-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
fix: emit cts types #3093
fix: emit cts types #3093
Conversation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@faker-js/maintainers how should we handle following?
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3093 +/- ##
==========================================
- Coverage 99.96% 99.96% -0.01%
==========================================
Files 2776 2776
Lines 226260 226260
Branches 945 942 -3
==========================================
- Hits 226183 226182 -1
- Misses 77 78 +1 |
The only difference between the old types, is that the |
It looks like that with this change the moduleResolution Node/Node10 is not usable anymore and the build fails with: index.ts:2:34 - error TS2307: Cannot find module '@faker-js/faker/locale/de' or its corresponding type declarations.
There are types at 'D:/shinigami/OpenSource/faker-playground/node_modules/@faker-js/faker/dist/locale/de.d.ts',
but this result could not be resolved under your current 'moduleResolution' setting.
Consider updating to 'node16', 'nodenext', or 'bundler'. For whatever reason, this only affects |
It's gone, if you build the project first. |
But previously we only build the types and not the whole project. Do we really want now to build the whole project just to check the types? Or do we want to add a |
No, we don't have to build it.
We can do that, but I would like to understand why it doesn't work anymore. |
If you keep the type stuff, it works: "types": "index.d.ts",
"typesVersions": {
">=5.0": {
"*": [
"dist/*"
]
}
}, |
We have to add tests/playgrounds for all of this, so that it doesn't silently break. |
I played with this branch against #3095 and the missing step is to add typesVersions field again. |
Should we merge #3097 before we make such bigger changes to |
dcaf620
to
ecf9ff2
Compare
Thanks @xDivisionByZerox for the review, I will have a look into this probably this evening |
Oh my god I think I got it now 💡 Line 86 in 18ab2c7
previously we had |
This PR now runs green against faker-js/playground#7 on my local machine |
I just tested it against my issue repro repo and worked properly 😃 |
Co-authored-by: ST-DDT <[email protected]>
Team Decision If all works well, we will merge and release this soon. |
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.
An additional recommendation is to use .d.cts types in root types
and typesVersions
. They are only used in node10 resolutions and probably will be used in commonjs projects.
But I haven’t tried that against playground.
Thanks for the information. Do you have a source for that recommendation? |
https://www.typescriptlang.org/tsconfig/#moduleResolution
According to this, node10 will be used in legacy code that only supports CommonJS. |
closes #3087