Update README for Babel TypeScript Plugin (#7443)

This commit is contained in:
Orta 2018-03-01 09:46:54 -05:00 committed by Brian Ng
parent 007f8d19b3
commit fdfbd9a6f7

View File

@ -4,8 +4,17 @@
Does not type-check its input. For that, you will need to install and set up TypeScript. Does not type-check its input. For that, you will need to install and set up TypeScript.
Does not support `namespace`s or `const enum`s because those require type information to transpile. ## Caveats
Also does not support `export =` and `import =`, because those cannot be transpiled to ES.next.
* Does not support [`namespace`][namespace]s.
* Does not support [`const enum`][const_enum]s because those require type information to transpile.
* Does not support [`export =`][exin] and [`import =`][exin], because those cannot be transpiled to ES.next.
## Workarounds
* `namespace`: Migrate to using the `module { }` syntax instead.
* `const enum`: Remove the `const`, which makes it available at runtime.
* `export =` \ `import =`: Convert to using `export default` and `export const`.
## Example ## Example
@ -52,3 +61,7 @@ require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-typescript"] plugins: ["@babel/plugin-transform-typescript"]
}); });
``` ```
[const_enum]: https://www.typescriptlang.org/docs/handbook/enums.html#const-enums
[namespace]: https://www.typescriptlang.org/docs/handbook/namespaces.html
[exin]: https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require