-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve emitted type declarations for TS 5.5+ #116
Conversation
✅ Deploy Preview for astro-integration-kit ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
7789e3f
to
227f1dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat. so much cleaner....
@@ -28,4 +28,6 @@ export type Prettify<T> = { | |||
[K in keyof T]: T[K]; | |||
} & {}; | |||
|
|||
export type ExtendedPrettify<T> = T extends infer U ? Prettify<U> : never; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a TS trick to force a generic to expand to its component types.
Some changes in TS 5.5 caused the declarations emitted from our inferred types to include internal types, both ours and from Astro. This causes
Example
Take this simplified example from Inox Tools as a base:
With the new TS version, the following type declaration is emitted:
With the optimization the following declaration is emitted: