Skip to content

Commit

Permalink
Add docs for dts new parser option for typescript plugin (#2487)
Browse files Browse the repository at this point in the history
* 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 <bng412@gmail.com>

Co-authored-by: Brian Ng <bng412@gmail.com>
  • Loading branch information
sosukesuzuki and existentialism committed Apr 29, 2021
1 parent 13ccb20 commit f4ed4b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/parser.md
Expand Up @@ -238,6 +238,13 @@ You should enable these features only if you are using an older version.

#### Plugins options

<details>
<summary>History</summary>
| Version | Changes |
| --- | --- |
| `7.14.0` | Added `dts` for `typescript` plugin |
</details>

> NOTE: When a plugin is specified multiple times, only the first options are considered.
- `decorators`:
Expand Down Expand Up @@ -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<T>(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?
Expand Down

0 comments on commit f4ed4b3

Please sign in to comment.