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
sequelize types import files outside of 'dist' dir, causing downstream tsc issues #14038
Comments
I'm assigning @ephys to this since they have been working on this. About the setup for testing, I think running Either way, thanks for reporting this and the extensive description. I think that together we can provide a good solution to this |
Okay cool. I'm definitely happy to help out in any way that I can. I can reliably reproduce it in my local environment, which is great for testing. I just don't want to step on anyone's toes because it does look like there's some work being done to prevent type duplication across the project. I'll see if I can clone the repo and get those test-typing tests running in the mean time. |
This is more issues arrising due to workaround to repair issues with the initial TS migrations :/ I think we could solve this by merging the But if we do that we cause issues for users that import directly from /types (they should not do that but I'm sure some do). But that's less important than having the "proper" usage be broken. |
Other, more radical, option; if this is causing all these issues maybe we should revert the initial TS things for v6? With the changes we've done after it would cause quite some conflicts but it would solve this |
We could transpiles .ts files in /lib to js & copy the emitted typings to /types in the v6 branch. With some manual fixing |
We'll have a fix soon, I'm merging our existing TS PRs first before changing our build process. Only one left. |
Thanks!:) |
soon === undefined in typescript 😎 you have a rough timeline for it :) |
🎉 This issue has been resolved in version 6.16.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Issue Creation Checklist
Bug Description
Typescript builds are failing on projects using sequelize when the typescript project has certain strict typechecking options enabled in its
tsconfig.json
file.The root cause is the changes to the
types/index.d.ts
file introduced in PR #14002 (though there are other similar errors in the index.d.ts file that likely need to be addressed as well).Additional info:
3f75880
5e93243
This change uses
../
imports to reference files for their types, but since the index.d.ts file ends up top-level in thedist
folder during a build, this effectively causes the build output to refer to<module root>/dist/../lib/errors
(for example), which resolves to<module root>/lib/errors
. This causes unbuiltts
files to be referenced, ultimately resulting in downstream projects failing theirtsc
builds when settings such as the following are set in theirtsconfig.json
:When all type checking guards available in the tsconfig.json file are turned on, here is the exhaustive list of errors that occur after importing the module into a downstream project:
I suspect the type definitions need to be updated to not refer to any files outside of the
types
source folder.I can confirm locally that by adjusting these
../
entries to instead be./
in the dist folder resolves the issues, but I am not knowledgable to know if this translates well to the source files themselves. It looks like it wouldn't work without some additional type files in thetypes
directory.To recreate yourself:
npx tsc --init
npx tsc && node src/index.js
Environment
Bug Report Checklist
How does this problem relate to dialects?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: