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

[CLEANUP] Make intern utility type safe #20268

Merged
merged 1 commit into from
Nov 16, 2022
Merged

Conversation

chriskrycho
Copy link
Contributor

Experimenting with removing/improving some other types while implementing RFC 0821. revealed that this function needed to preserve its input type when that type was narrower than just string, so introduce a type parameter to keep that information around. Then, switch to using Object.create(null) so it can be used in the Record type safely.

Pulling this out into its own commit makes it easier to land, and it also allows us to guarantee that we are making changes only to the types and module layout for the PR implementing RFC 0821.

Experimenting with removing/improving some *other* types while
implementing RFC 0821. revealed that this function needed to preserve
its input type when that type was narrower than just `string`, so
introduce a type parameter to keep that information around. Then,
switch to using `Object.create(null)` so it can be used in the `Record`
type safely.

Pulling this out into its own commit makes it easier to land, and it
also allows us to guarantee that we are making changes *only* to the
types and module layout for the PR implementing RFC 0821.
@chriskrycho chriskrycho added the TypeScript Work on Ember’s types label Nov 16, 2022
@chriskrycho chriskrycho merged commit 8497a5b into master Nov 16, 2022
@chriskrycho chriskrycho deleted the type-safe-intern branch November 16, 2022 15:01
@chriskrycho chriskrycho changed the title [CLEANUP] Make intern utility type safe [CLEANUP] Make intern utility type safe Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TypeScript Work on Ember’s types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants