From 3daa7c4027a916edb65be3af1401a390c91fb16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=A9=20Cox?= Date: Fri, 15 Sep 2023 14:48:21 +0200 Subject: [PATCH 1/3] document typescript setup --- docs/getting-started.mdx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx index 0b4f9369..e4d1c002 100644 --- a/docs/getting-started.mdx +++ b/docs/getting-started.mdx @@ -127,6 +127,18 @@ Head to the [Version Policy page](/releases) to know which versions of TypeScrip and make sure that the [`@types/node`](https://www.npmjs.com/package/@types/node) package corresponding to your Node.js version is installed in your project. +:::info + +Sequelize makes use of the the [`exports`](https://nodejs.org/api/packages.html#exports) `package.json` field. +You may need to update your `tsconfig.json` configuration to make sure TypeScript's module resolution supports it. + +At time of writing (TS 5.2), this can be done in two ways: + +- Set [`moduleResolution`](https://www.typescriptlang.org/tsconfig#moduleResolution) to `node16`, `nodenext`, or `bundler`, +- or set [`resolvePackageJsonExports`](https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports) to `true`. + +::: + ## CommonJS or ESM? Our documentation makes heavy use of ECMAScript Modules (ESM), but CommonJS is fully supported by Sequelize. From a226a62583231212f09e80d74fde79c6769acc1a Mon Sep 17 00:00:00 2001 From: Alyx Date: Thu, 11 Apr 2024 22:35:21 +0200 Subject: [PATCH 2/3] point to getting started guide in decorator info box --- docs/_fragments/_decorator-info.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_fragments/_decorator-info.mdx b/docs/_fragments/_decorator-info.mdx index 7f47d8c4..238c40d3 100644 --- a/docs/_fragments/_decorator-info.mdx +++ b/docs/_fragments/_decorator-info.mdx @@ -13,4 +13,6 @@ Using legacy decorators requires to use a transpiler such as [TypeScript](https: [Babel](https://babeljs.io/docs/babel-plugin-proposal-decorators) or others to compile them to JavaScript. Alternatively, Sequelize also supports [a legacy approach](../other-topics/legacy-model-definitions.mdx) that does not require using decorators, but this is discouraged. +If you're using TypeScript, you will also need to configure it to be able to resolve this export, [see our Getting Started guide](../getting-started.mdx#typescript) for more information. + ::: From 3ab60efa793183e8e0dae9dd52b96a1abc03f82d Mon Sep 17 00:00:00 2001 From: Alyx Date: Thu, 11 Apr 2024 22:46:46 +0200 Subject: [PATCH 3/3] update TS version --- docs/getting-started.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx index c708926d..1493379b 100644 --- a/docs/getting-started.mdx +++ b/docs/getting-started.mdx @@ -104,7 +104,7 @@ in your project. Sequelize makes use of the the [`exports`](https://nodejs.org/api/packages.html#exports) `package.json` field. You may need to update your `tsconfig.json` configuration to make sure TypeScript's module resolution supports it. -At time of writing (TS 5.2), this can be done in two ways: +At time of writing (TS 5.4), this can be done in two ways: - Set [`moduleResolution`](https://www.typescriptlang.org/tsconfig#moduleResolution) to `node16`, `nodenext`, or `bundler`, - or set [`resolvePackageJsonExports`](https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports) to `true`.