Restore @babel/types support for old TS versions (#12521)

This commit is contained in:
Nicolò Ribaudo 2020-12-17 18:34:23 +01:00 committed by GitHub
parent bfb51362c7
commit b9deeb458b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -42,8 +42,9 @@ generate-type-helpers:
build-flow-typings: build-flow-typings:
$(NODE) packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow $(NODE) packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
build-typescript-3.7-typings: # For TypeScript older than 3.7
$(NODE) packages/babel-types/scripts/generators/typescript-3.7.js > packages/babel-types/lib/index-ts3.7.d.ts build-typescript-legacy-typings:
$(NODE) packages/babel-types/scripts/generators/typescript-legacy.js > packages/babel-types/lib/index-legacy.d.ts
build-standalone: build-babel-standalone build-standalone: build-babel-standalone
@ -194,7 +195,7 @@ prepublish-prepare-dts:
$(MAKE) tscheck $(MAKE) tscheck
$(YARN) gulp bundle-dts $(YARN) gulp bundle-dts
$(YARN) gulp clean-dts $(YARN) gulp clean-dts
$(MAKE) build-typescript-3.7-typings $(MAKE) build-typescript-legacy-typings
$(MAKE) clean-tsconfig $(MAKE) clean-tsconfig
prepublish: prepublish:

View File

@ -14,10 +14,11 @@
"directory": "packages/babel-types" "directory": "packages/babel-types"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index-legacy.d.ts",
"typesVersions": { "typesVersions": {
"<3.7": { ">=3.7": {
"lib/index.d.ts": [ "lib/index-legacy.d.ts": [
"lib/index-ts3.7.d.ts" "lib/index.d.ts"
] ]
} }
}, },

View File

@ -5,7 +5,7 @@ const stringifyValidator = require("../utils/stringifyValidator");
const toFunctionName = require("../utils/toFunctionName"); const toFunctionName = require("../utils/toFunctionName");
let code = `// NOTE: This file is autogenerated. Do not modify. let code = `// NOTE: This file is autogenerated. Do not modify.
// See packages/babel-types/scripts/generators/typescript-3.7.js for script used. // See packages/babel-types/scripts/generators/typescript-legacy.js for script used.
interface BaseComment { interface BaseComment {
value: string; value: string;