Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for dts new parser option for typescript plugin #2487

Merged
merged 4 commits into from Apr 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/parser.md
Expand Up @@ -236,6 +236,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 @@ -273,6 +280,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`)
existentialism marked this conversation as resolved.
Show resolved Hide resolved
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