passes the jsxPragma options from preset-typescript to plugin-transform-typescript (#7990)

This commit is contained in:
Miguel Albernaz
2018-05-21 15:33:43 -03:00
committed by Henry Zhu
parent c558dedd7b
commit bc757c8b75
2 changed files with 12 additions and 2 deletions

View File

@@ -53,3 +53,13 @@ require("@babel/core").transform("code", {
presets: ["@babel/preset-typescript"]
});
```
## Options
### `jsxPragma`
`string`
Replace the function used when compiling JSX expressions.
This is so that we know that the import is not a type import, and should not be removed

View File

@@ -1,10 +1,10 @@
import { declare } from "@babel/helper-plugin-utils";
import transformTypeScript from "@babel/plugin-transform-typescript";
export default declare(api => {
export default declare((api, { jsxPragma }) => {
api.assertVersion(7);
return {
plugins: [transformTypeScript],
plugins: [[transformTypeScript, { jsxPragma }]],
};
});