Enable allowNamespaces in transform-typescript by default (#12765)

This commit is contained in:
Huáng Jùnliàng 2021-02-21 11:46:06 -05:00 committed by GitHub
parent 16e9f1c8e5
commit a93bbce867
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -51,9 +51,9 @@ export default declare((api, opts) => {
const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/; const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;
const { const {
allowNamespaces = true,
jsxPragma = "React.createElement", jsxPragma = "React.createElement",
jsxPragmaFrag = "React.Fragment", jsxPragmaFrag = "React.Fragment",
allowNamespaces = false,
onlyRemoveTypeImports = false, onlyRemoveTypeImports = false,
} = opts; } = opts;

View File

@ -2,7 +2,7 @@ import { OptionValidator } from "@babel/helper-validator-option";
const v = new OptionValidator("@babel/preset-typescript"); const v = new OptionValidator("@babel/preset-typescript");
export default function normalizeOptions(options = {}) { export default function normalizeOptions(options = {}) {
let { allowNamespaces, jsxPragma, onlyRemoveTypeImports } = options; let { allowNamespaces = true, jsxPragma, onlyRemoveTypeImports } = options;
if (process.env.BABEL_8_BREAKING) { if (process.env.BABEL_8_BREAKING) {
const TopLevelOptions = { const TopLevelOptions = {

View File

@ -78,7 +78,7 @@ describe("normalize options", () => {
expect(normalizeOptions({})).toMatchInlineSnapshot(` expect(normalizeOptions({})).toMatchInlineSnapshot(`
Object { Object {
"allExtensions": false, "allExtensions": false,
"allowNamespaces": undefined, "allowNamespaces": true,
"isTSX": false, "isTSX": false,
"jsxPragma": undefined, "jsxPragma": undefined,
"jsxPragmaFrag": "React.Fragment", "jsxPragmaFrag": "React.Fragment",