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 stable] Fix model arg to a Route serialize #20490

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

chriskrycho
Copy link
Contributor

Previously, the internal type here always explicitly added | undefined to the type of the model param. This was likely reasonable when the conversion first happened, since the type here was simply a minimal IModel | undefined. Since the param is now driven by the type param for the Route, though, and defaults to unknown, we can just use the Model type param directly, and the implementation handles it correctly since the was actually already, albeit invisibly, just unknown, since unknown | undefined === unknown.

Fixes #20487.

Previously, the internal type here always explicitly added `| undefined`
to the type of the `model` param. This was likely reasonable when the
conversion first happened, since the type here was simply a minimal
`IModel | undefined`. Since the param is now driven by the type param
for the `Route`, though, and defaults to `unknown`, we can just use the
`Model` type param directly, and the implementation handles it correctly
since the was actually already, albeit invisibly, just `unknown`, since
`unknown | undefined` === `unknown`.
@chriskrycho chriskrycho merged commit d2b746b into main Jun 29, 2023
18 checks passed
@chriskrycho chriskrycho deleted the types/route-serialize-fix branch June 29, 2023 19:00
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.

[Bug] undefined is required in a route's serialize method in the stable types
3 participants