diff --git a/constraints.pro b/constraints.pro index 9a5b3650a0ab..36b864b27eca 100644 --- a/constraints.pro +++ b/constraints.pro @@ -85,6 +85,7 @@ gen_enforced_field(WorkspaceCwd, 'exports', '{ ".": "./lib/index.js", "./package WorkspaceIdent \= '@babel/parser', WorkspaceIdent \= '@babel/plugin-transform-react-jsx', % TODO: Remove in Babel 8 WorkspaceIdent \= '@babel/standalone', + WorkspaceIdent \= '@babel/types', % @babel/types has types exports \+ atom_concat('@babel/eslint-', _, WorkspaceIdent), \+ atom_concat('@babel/runtime', _, WorkspaceIdent). diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 5e8720afb711..f436a1929fde 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -27,7 +27,7 @@ "files": [ "bin", "lib", - "typings", + "typings/babel-parser.d.ts", "index.cjs" ], "engines": { @@ -54,6 +54,7 @@ "type": "module", "exports": { ".": { + "types": "./typings/babel-parser.d.ts", "require": "./lib/index.cjs", "default": "./lib/index.js" }, @@ -65,6 +66,7 @@ }, "exports": { ".": { + "types": "./typings/babel-parser.d.ts", "require": "./index.cjs", "default": "./lib/index.js" }, diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 164d1a57e8ac..8266e86c551d 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -52,7 +52,11 @@ ] }, "exports": { - ".": "./lib/index.js", + ".": { + "types@>=3.7": "./lib/index.d.ts", + "types": "./lib/index-legacy.d.ts", + "default": "./lib/index.js" + }, "./package.json": "./package.json" }, "type": "commonjs" diff --git a/scripts/integration-tests/e2e-prettier.sh b/scripts/integration-tests/e2e-prettier.sh index e9df53316a89..a150a697fc7c 100755 --- a/scripts/integration-tests/e2e-prettier.sh +++ b/scripts/integration-tests/e2e-prettier.sh @@ -36,6 +36,9 @@ startLocalRegistry "$root"/verdaccio-config.yml yarn install --no-immutable yarn info +# Test typings for @babel/parser +yarn lint:typecheck + # https://github.com/babel/babel/pull/14892#issuecomment-1233180626 echo "export default () => () => {}" > src/main/create-print-pre-check-function.js