-
Notifications
You must be signed in to change notification settings - Fork 1
Validate types against the cjs (shows that its failing) #2
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
Conversation
|
Well done! One of the most significant missing features of this repo was that it didn't show how More context here: https://twitter.com/maksimsinik/status/1316001906746064898Well done! Not showing the |
|
@fox1t Core thing this shows though is that the types of Fastify isn't compatible with Typescript checked cjs 🙂 |
I am sure that we can make the old and beloved CJS work somehow. I am not sure about the new and fresh ESM, though. XD |
|
@fox1t Updated, removed all of the things I did that touched esm and refocused on cjs with a new Can squash later if that's wanted |
fox1t
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.
LGTM
It's not enough that the JS-code itself executes and runs. As Typescript supports validation of JS-files the types needs to work for anyone who uses that (like I do).
I've in this PR added type validation of the cjs and esm code as well, and it shows that the types aren't valid in the cjs scenario, which is what was brought up by me in fastify/env-schema#16 and which @mcollina pointed towards this repo to explain.
Reason why I added the
esm/package.jsonis that TypeScript yet doesn't like the.mjsfile ending, microsoft/TypeScript#27957, so specifying that it's an esm file in the package.json is a way around that.