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

Enable allowNamespaces in transform-typescript by default #12765

Merged
merged 2 commits into from Feb 21, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-typescript/src/index.js
Expand Up @@ -51,9 +51,9 @@ export default declare((api, opts) => {
const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;

const {
allowNamespaces = true,
jsxPragma = "React.createElement",
jsxPragmaFrag = "React.Fragment",
allowNamespaces = false,
nicolo-ribaudo marked this conversation as resolved.
Show resolved Hide resolved
onlyRemoveTypeImports = false,
} = opts;

Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-typescript/src/normalize-options.js
Expand Up @@ -2,7 +2,7 @@ import { OptionValidator } from "@babel/helper-validator-option";
const v = new OptionValidator("@babel/preset-typescript");

export default function normalizeOptions(options = {}) {
let { allowNamespaces, jsxPragma, onlyRemoveTypeImports } = options;
let { allowNamespaces = true, jsxPragma, onlyRemoveTypeImports } = options;

if (process.env.BABEL_8_BREAKING) {
const TopLevelOptions = {
Expand Down
Expand Up @@ -78,7 +78,7 @@ describe("normalize options", () => {
expect(normalizeOptions({})).toMatchInlineSnapshot(`
Object {
"allExtensions": false,
"allowNamespaces": undefined,
"allowNamespaces": true,
"isTSX": false,
"jsxPragma": undefined,
"jsxPragmaFrag": "React.Fragment",
Expand Down