-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Cannot import decorators-legacy in V7 #552
Comments
You need to set your tsconfig |
Our own tsconfig should not be used as an example, it's overly complicated because we try to support multiple versions of TypeScript I've converted this to a documentation issue |
It would be handy to have an example |
This is pretty awful, I can't lie.
The |
You can have path aliasing in your own project by configuring The explanation for the different type of moduleResolutions is described here: https://www.typescriptlang.org/tsconfig#moduleResolution You don't technically have to use Node16/NodeNext/Bundler (though I don't see why you wouldn't use the ts module resolution that accurately replicates how node resolves modules if you're using node). You can configure |
yeah, sorry. Was very frustrated last night. Turned out my path aliasing was working just fine but needed the |
We have opened #583 to document this. Are we missing anything? |
As mentioned in sequelize/sequelize#16866, we also need to update the SSCCE repo's tsconfig |
FWIW, you can set I have Sequelize v7 with decorators working in a Next.js 14 project, and I'm basically using the default create-t3-app {
"compilerOptions": {
/* Base Options */
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ES2022",
"allowJs": true,
"resolveJsonModule": true,
"moduleDetection": "force",
"isolatedModules": true,
/* Sequelize */
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowImportingTsExtensions": true,
/* Strictness */
"strict": true,
"noUncheckedIndexedAccess": true,
"forceConsistentCasingInFileNames": true,
"checkJs": true,
/* Bundled projects */
"lib": ["dom", "dom.iterable", "ES2022"],
"noEmit": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "preserve",
"plugins": [{ "name": "next" }],
"incremental": true,
/* Path aliases */
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
},
/* Needed for ts-node */
"typeRoots": ["**/*.d.ts"]
},
"include": [
".eslintrc.cjs",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.cjs",
"**/*.js",
".next/types/**/*.ts"
],
"exclude": ["node_modules"],
"ts-node": {
"esm": true
}
} |
Issue Creation Checklist
Bug Description
The documentation explicitly indicates to use decorators to define all aspects related to a model.
From types, to relationships, and more.
However, I personally cannot get it to work, due to this issue in my VSCode editor
Reproducible Example
node_modules
seems to have all the requested dataHowever, and as per a standard example on this page, the usual flow to use decorators
has the second line, no matter what else I have in my file, always throw this error:
Cannot find module '@sequelize/core/decorators-legacy' or its corresponding type declarations.ts(2307)
What do you expect to happen?
Find the module and not throw that error
What is actually happening?
Environment
tsconfig.json
MySQL 8
[email protected]
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: