From 39a3ccdd77647fdcdb26954362fbb95c611ae4be Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Tue, 13 Apr 2021 08:02:55 +0900 Subject: [PATCH 1/4] Add docs for new parser option for typescript plugin --- docs/parser.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/parser.md b/docs/parser.md index 8493c5f216..30c12bdf3a 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -273,6 +273,10 @@ You should enable these features only if you are using an older version. Some code has different meaning in Flow and in vanilla JavaScript. For example, `foo(x)` is parsed as a call expression with a type argument in Flow, but as a comparison (`foo < T > x`) accordingly to the ECMAScript specification. By default, `babel-parser` parses those ambiguous constructs as Flow types only if the file starts with a `// @flow` pragma. Set this option to `true` to always parse files as if `// @flow` was specified. +- `typescript` + - `dts` (`boolean`, default `false`) + In TypeScript, some syntaxes in Ambient Context such as `.d.ts` files and in `declare module` are different from normal TypeScript. If this option is enabled, syntax errors will be handled as Ambient Context. + ### FAQ #### Will the Babel parser support a plugin system? From 1f99220636d673f3c049c50db4760ac85529868a Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Wed, 14 Apr 2021 06:21:18 +0900 Subject: [PATCH 2/4] Add history table --- docs/parser.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/parser.md b/docs/parser.md index 30c12bdf3a..f87223609f 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -236,6 +236,13 @@ You should enable these features only if you are using an older version. #### Plugins options +
+ History +| Version | Changes | +| --- | --- | +| `7.14.0` | Added `dts` for `typescript` plugin | +
+ > NOTE: When a plugin is specified multiple times, only the first options are considered. - `decorators`: From 416f05f4beb1bdc76f903012481af0c132cff039 Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Wed, 14 Apr 2021 06:27:18 +0900 Subject: [PATCH 3/4] Add link for ambient context --- docs/parser.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/parser.md b/docs/parser.md index f87223609f..0693e0a859 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -282,7 +282,7 @@ You should enable these features only if you are using an older version. - `typescript` - `dts` (`boolean`, default `false`) - In TypeScript, some syntaxes in Ambient Context such as `.d.ts` files and in `declare module` are different from normal TypeScript. If this option is enabled, syntax errors will be handled as Ambient Context. + In TypeScript, some syntaxes in Ambient Context such as `.d.ts` files and in `declare module` are different from normal TypeScript. If this option is enabled, syntax errors will be handled as Ambient Context. Please see https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html and https://basarat.gitbook.io/typescript/type-system/intro for detail of Ambient Context. ### FAQ From bba529acdb95e8e4e128a1348d03346c67a9b3a7 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Tue, 27 Apr 2021 13:30:12 +0900 Subject: [PATCH 4/4] Update docs/parser.md Co-authored-by: Brian Ng --- docs/parser.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/parser.md b/docs/parser.md index 0693e0a859..b0b9a2ff47 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -282,7 +282,7 @@ You should enable these features only if you are using an older version. - `typescript` - `dts` (`boolean`, default `false`) - In TypeScript, some syntaxes in Ambient Context such as `.d.ts` files and in `declare module` are different from normal TypeScript. If this option is enabled, syntax errors will be handled as Ambient Context. Please see https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html and https://basarat.gitbook.io/typescript/type-system/intro for detail of Ambient Context. + This option will enable parsing within a TypeScript ambient context, where certain syntax have different rules (like `.d.ts` files and inside `declare module` blocks). Please see https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html and https://basarat.gitbook.io/typescript/type-system/intro for more information about ambient contexts. ### FAQ