-
Notifications
You must be signed in to change notification settings - Fork 460
Run TypeScript scripts directly #2322
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
base: main
Are you sure you want to change the base?
Conversation
Also removes enums. There's `--experimental-transform-types` for that but that's still experimental and TS team regretted adding enums after all.
This isn't really true 😄 |
jakebailey
left a comment
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.
I can't properly review this at the moment but should be able to do so in a few days
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.
We should really just move these to src tbh
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.
I can't properly review this at the moment but should be able to do so in a few days
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.
That's not strictly needed here and can happen separately IMO
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.
Fair enough
That's what I'm told in some decades old issue, are things changed? |
| InstanceOnly, | ||
| All, | ||
| } | ||
| type EmitScope = "StaticOnly" | "InstanceOnly" | "All"; |
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.
I'd just use an as const object and the keyof typeof trick
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.
Hmmmmmmmmmmmmmmmm..................... I kinda prefer this way as it's simpler and it's what we do in web APIs 🤔
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.
Sure, but this was a TS enum before, so IMO this is easier:
const EmitScope = {
StaticOnly: "StaticOnly",
InstanceOnly: "InstanceOnly",
All: "All",
} as const;
type EmitScope = typeof EmitScope[keyof typeof EmitScope];Then no other code has to change.
But, the strings aren't the worst either
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| "resolveJsonModule": true, | ||
| "allowImportingTsExtensions": true, |
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.
We should set these to match https://nodejs.org/api/typescript.html#type-stripping
| "strict": true, | ||
| "resolveJsonModule": true | ||
| "resolveJsonModule": true, | ||
| "allowImportingTsExtensions": true |
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.
We'll probably want to set the options listed in https://nodejs.org/api/typescript.html#type-stripping
jakebailey
left a comment
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.
This PR seems fine to me, just has conflicts with main
Also removes enums. There's
--experimental-transform-typesfor that but that's still experimental and TS team regretted adding enums after all.Fixes #2321
Closes #2125