From 826234b5ff24a90e771d10b1029d1adabd8de6fb Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Wed, 11 Dec 2019 10:54:18 +0100 Subject: [PATCH] docs: use es2018 target over esnext --- docs/es/guide/setup.md | 37 +---------------- docs/guide/setup.md | 41 +++---------------- docs/ja/guide/setup.md | 37 +---------------- docs/pt/guide/setup.md | 37 +---------------- docs/shared/nuxt.config.js | 0 docs/shared/tsconfig.json | 34 +++++++++++++++ examples/class-api/minimal/tsconfig.json | 2 +- .../composition-api/minimal/tsconfig.json | 2 +- examples/options-api/minimal/tsconfig.json | 2 +- .../test/fixture/tsconfig.json | 2 +- 10 files changed, 46 insertions(+), 148 deletions(-) create mode 100644 docs/shared/nuxt.config.js create mode 100644 docs/shared/tsconfig.json diff --git a/docs/es/guide/setup.md b/docs/es/guide/setup.md index f6f21682..c3b124d7 100644 --- a/docs/es/guide/setup.md +++ b/docs/es/guide/setup.md @@ -25,42 +25,7 @@ export default { y crear un archivo **`tsconfig.json`** : -```json -// tsconfig.json -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "lib": [ - "esnext", - "esnext.asynciterable", - "dom" - ], - "esModuleInterop": true, - "allowJs": true, - "sourceMap": true, - "strict": true, - "noEmit": true, - "baseUrl": ".", - "paths": { - "~/*": [ - "./*" - ], - "@/*": [ - "./*" - ] - }, - "types": [ - "@types/node", - "@nuxt/types" - ] - }, - "exclude": [ - "node_modules" - ] -} -``` +<<< @/shared/tsconfig.json ::: tip `@nuxt/typescript-build` incluye `@nuxt/types`, asi que no necesitas instalarlo de forma independiente. diff --git a/docs/guide/setup.md b/docs/guide/setup.md index 9050b611..30d774aa 100644 --- a/docs/guide/setup.md +++ b/docs/guide/setup.md @@ -25,42 +25,11 @@ export default { and create a **`tsconfig.json`** file : -```json -// tsconfig.json -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "lib": [ - "esnext", - "esnext.asynciterable", - "dom" - ], - "esModuleInterop": true, - "allowJs": true, - "sourceMap": true, - "strict": true, - "noEmit": true, - "baseUrl": ".", - "paths": { - "~/*": [ - "./*" - ], - "@/*": [ - "./*" - ] - }, - "types": [ - "@types/node", - "@nuxt/types" - ] - }, - "exclude": [ - "node_modules" - ] -} -``` +<<< @/shared/tsconfig.json + +::: tip +Notice that **es2018** target is needed to be able to use [**Optional chaining**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining) and [**Nullish Coalescing**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing), as **esnext** target doesn't seem to support these features for now. +::: You will also need to provide types for Vue files by adding the following type declaration: diff --git a/docs/ja/guide/setup.md b/docs/ja/guide/setup.md index 063feafc..085ee8cb 100644 --- a/docs/ja/guide/setup.md +++ b/docs/ja/guide/setup.md @@ -25,42 +25,7 @@ export default { そして、**`tsconfig.json`** ファイルを作成します: -```json -// tsconfig.json -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "lib": [ - "esnext", - "esnext.asynciterable", - "dom" - ], - "esModuleInterop": true, - "allowJs": true, - "sourceMap": true, - "strict": true, - "noEmit": true, - "baseUrl": ".", - "paths": { - "~/*": [ - "./*" - ], - "@/*": [ - "./*" - ] - }, - "types": [ - "@types/node", - "@nuxt/types" - ] - }, - "exclude": [ - "node_modules" - ] -} -``` +<<< @/shared/tsconfig.json また、以下の型宣言を追加し Vue ファイルの型を提供する必要があります: diff --git a/docs/pt/guide/setup.md b/docs/pt/guide/setup.md index 56a1f544..b6f9c32f 100644 --- a/docs/pt/guide/setup.md +++ b/docs/pt/guide/setup.md @@ -25,42 +25,7 @@ export default { e criar um arquivo **`tsconfig.json`** : -```json -// tsconfig.json -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "lib": [ - "esnext", - "esnext.asynciterable", - "dom" - ], - "esModuleInterop": true, - "allowJs": true, - "sourceMap": true, - "strict": true, - "noEmit": true, - "baseUrl": ".", - "paths": { - "~/*": [ - "./*" - ], - "@/*": [ - "./*" - ] - }, - "types": [ - "@types/node", - "@nuxt/types" - ] - }, - "exclude": [ - "node_modules" - ] -} -``` +<<< @/shared/tsconfig.json ::: tip `@nuxt/typescript-build` entrega `@nuxt/types`, então não há necessidade de instalá-lo de forma independente. diff --git a/docs/shared/nuxt.config.js b/docs/shared/nuxt.config.js new file mode 100644 index 00000000..e69de29b diff --git a/docs/shared/tsconfig.json b/docs/shared/tsconfig.json new file mode 100644 index 00000000..77648aaa --- /dev/null +++ b/docs/shared/tsconfig.json @@ -0,0 +1,34 @@ +// tsconfig.json +{ + "compilerOptions": { + "target": "es2018", + "module": "esnext", + "moduleResolution": "node", + "lib": [ + "esnext", + "esnext.asynciterable", + "dom" + ], + "esModuleInterop": true, + "allowJs": true, + "sourceMap": true, + "strict": true, + "noEmit": true, + "baseUrl": ".", + "paths": { + "~/*": [ + "./*" + ], + "@/*": [ + "./*" + ] + }, + "types": [ + "@types/node", + "@nuxt/types" + ] + }, + "exclude": [ + "node_modules" + ] +} diff --git a/examples/class-api/minimal/tsconfig.json b/examples/class-api/minimal/tsconfig.json index a650abdf..ec2578ad 100644 --- a/examples/class-api/minimal/tsconfig.json +++ b/examples/class-api/minimal/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "esnext", + "target": "es2018", "module": "esnext", "moduleResolution": "node", "lib": [ diff --git a/examples/composition-api/minimal/tsconfig.json b/examples/composition-api/minimal/tsconfig.json index 0451cc04..88bebb69 100644 --- a/examples/composition-api/minimal/tsconfig.json +++ b/examples/composition-api/minimal/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "esnext", + "target": "es2018", "module": "esnext", "moduleResolution": "node", "lib": [ diff --git a/examples/options-api/minimal/tsconfig.json b/examples/options-api/minimal/tsconfig.json index 0451cc04..88bebb69 100644 --- a/examples/options-api/minimal/tsconfig.json +++ b/examples/options-api/minimal/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "esnext", + "target": "es2018", "module": "esnext", "moduleResolution": "node", "lib": [ diff --git a/packages/typescript-build/test/fixture/tsconfig.json b/packages/typescript-build/test/fixture/tsconfig.json index 281d153f..caa0cba5 100644 --- a/packages/typescript-build/test/fixture/tsconfig.json +++ b/packages/typescript-build/test/fixture/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "esnext", + "target": "es2018", "module": "esnext", "moduleResolution": "node", "lib": [