From f4ed4b3391da5089fa736ce34a01e337f158126e Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Fri, 30 Apr 2021 04:45:05 +0900 Subject: [PATCH] Add docs for `dts` new parser option for typescript plugin (#2487) * Add docs for new parser option for typescript plugin * Add history table * Add link for ambient context * Update docs/parser.md Co-authored-by: Brian Ng Co-authored-by: Brian Ng --- docs/parser.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/parser.md b/docs/parser.md index b0e217e2b9..b6b626fc8e 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -238,6 +238,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`: @@ -275,6 +282,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`) + 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 #### Will the Babel parser support a plugin system?