Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] fix for TS 5.1 nightly narrowing change #20441

Merged
merged 1 commit into from
Apr 17, 2023
Merged

Conversation

chriskrycho
Copy link
Contributor

The type here was any and sort of narrowing before; now it checks explicitly whether it is string. TS 5.1 seems to have a change (maybe a regression?) in how it narrows between the two branches, but previous versions simply fell back to any anyway rather than narrowing to the inferred types. This unblocks us for TS 5.1, but we should also rewrite this function handler entirely: if it were just two functions instead of using variadic function args, it would dramatically simplify all of this implementation (and almost certainly perform better, too!).

The type here was `any` and *sort of* narrowing before; now it checks
explicitly whether it is `string`. TS 5.1 seems to have a change (maybe
a regression?) in how it narrows between the two branches, but previous
versions simply fell back to `any` anyway rather than narrowing to the
inferred types. This unblocks us for TS 5.1, but we should also rewrite
this function handler entirely: if it were just two functions instead
of using variadic function args, it would dramatically simplify *all*
of this implementation (and almost certainly perform better, too!).
@chriskrycho chriskrycho added Bug TypeScript Work on Ember’s types labels Apr 17, 2023
@chriskrycho chriskrycho merged commit 2a8e063 into main Apr 17, 2023
@chriskrycho chriskrycho deleted the fix-ts-nightly branch April 17, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug TypeScript Work on Ember’s types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant