Merge of 2022-01-19 babel decorators. Disabling new-version-checklist as this is intended for a private publish for testing

This commit is contained in:
Miel Truyen 2022-01-19 01:52:05 +01:00
commit b2bb97f001
803 changed files with 4292 additions and 997 deletions

View File

@ -166,6 +166,14 @@ jobs:
at: /tmp/verdaccio-workspace at: /tmp/verdaccio-workspace
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-jest.sh - run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-jest.sh
e2e-breaking-prettier:
executor: node-executor
steps:
- checkout
- attach_workspace:
at: /tmp/verdaccio-workspace
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-prettier.sh
workflows: workflows:
version: 2 version: 2
build-standalone: build-standalone:
@ -245,3 +253,6 @@ workflows:
- e2e-breaking-jest: - e2e-breaking-jest:
requires: requires:
- publish-verdaccio-babel-8-breaking - publish-verdaccio-babel-8-breaking
- e2e-breaking-prettier:
requires:
- publish-verdaccio-babel-8-breaking

View File

@ -446,6 +446,7 @@ jobs:
- vue-cli - vue-cli
- jest - jest
- react-native - react-native
- prettier
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2

File diff suppressed because one or more lines are too long

View File

@ -35,4 +35,4 @@ releaseTool:
unsafeHttpWhitelist: unsafeHttpWhitelist:
- localhost - localhost
yarnPath: .yarn/releases/yarn-3.1.0.cjs yarnPath: .yarn/releases/yarn-3.1.1.cjs

View File

@ -20,6 +20,36 @@ See [`eslint-plugin-babel`'s releases](https://github.com/babel/eslint-plugin-ba
<!-- DO NOT CHANGE THESE COMMENTS - See .github/actions/trigger-github-release/update-changelog.js --> <!-- DO NOT CHANGE THESE COMMENTS - See .github/actions/trigger-github-release/update-changelog.js -->
<!-- insert-new-changelog-here --> <!-- insert-new-changelog-here -->
## v7.16.9 (2022-01-11)
#### :bug: Bug Fix
* `babel-register`
* [#14136](https://github.com/babel/babel/pull/14136) Restore `@babel/register` compat with `@babel/core@7.5.x` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
## v7.16.8 (2022-01-10)
#### :bug: Bug Fix
* `babel-generator`, `babel-plugin-syntax-typescript`, `babel-plugin-transform-parameters`
* [#14113](https://github.com/babel/babel/pull/14113) Print trailing comma after a single TS generic in arrow fns ([@ozanhonamlioglu](https://github.com/ozanhonamlioglu))
* `babel-traverse`
* [#14105](https://github.com/babel/babel/pull/14105) fix: forward stop signal to parent path ([@JLHwung](https://github.com/JLHwung))
* `babel-register`
* [#14107](https://github.com/babel/babel/pull/14107) Don't mutate `@babel/register` options ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-transform-modules-commonjs`
* [#14097](https://github.com/babel/babel/pull/14097) Register binding for newly created vars for commonjs transforms ([@The-x-Theorist](https://github.com/The-x-Theorist))
* `babel-plugin-transform-typescript`
* [#14093](https://github.com/babel/babel/pull/14093) Fix TypeScript Enum self-references ([@magic-akari](https://github.com/magic-akari))
#### :nail_care: Polish
* `babel-generator`
* [#14094](https://github.com/babel/babel/pull/14094) Always print directives with double quotes when minified ([@overlookmotel](https://github.com/overlookmotel))
#### :house: Internal
* `babel-helper-fixtures`, `babel-plugin-proposal-record-and-tuple`, `babel-preset-env`
* [#14118](https://github.com/babel/babel/pull/14118) Always use the plugin/preset name in fixtures options ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :microscope: Output optimization
* `babel-helper-remap-async-to-generator`, `babel-helper-wrap-function`, `babel-plugin-transform-async-to-generator`
* [#14122](https://github.com/babel/babel/pull/14122) Optimize `transform-async-to-generator` output ([@magic-akari](https://github.com/magic-akari))
## v7.16.7 (2021-12-31) ## v7.16.7 (2021-12-31)
#### :eyeglasses: Spec Compliance #### :eyeglasses: Spec Compliance

View File

@ -1,6 +1,6 @@
FLOW_COMMIT = 92bbb5e9dacb8185aa73ea343954d0434b42c40b FLOW_COMMIT = 92bbb5e9dacb8185aa73ea343954d0434b42c40b
TEST262_COMMIT = 46f165ae490de7f1343165ab8d228db81eaa02c5 TEST262_COMMIT = 46f165ae490de7f1343165ab8d228db81eaa02c5
TYPESCRIPT_COMMIT = bbd9ff51f5fa5208b223bbb75a94e5e8184e3ffd TYPESCRIPT_COMMIT = b53073bf66571b4c99f0a93b8f76fb06b36d8991
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967 # Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true export FORCE_COLOR = true
@ -187,15 +187,15 @@ prepublish:
IS_PUBLISH=true $(MAKE) test IS_PUBLISH=true $(MAKE) test
new-version-checklist: new-version-checklist:
@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" # @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" # @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@echo "!!!!!! !!!!!!" # @echo "!!!!!! !!!!!!"
@echo "!!!!!! Update the version of the "identity" !!!!!!" # @echo "!!!!!! Update the version of the "identity" !!!!!!"
@echo "!!!!!! and "applyDecs" helpers to 7.17.0 !!!!!!" # @echo "!!!!!! and "applyDecs" helpers to 7.17.0 !!!!!!"
@echo "!!!!!! !!!!!!" # @echo "!!!!!! !!!!!!"
@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" # @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" # @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@exit 1 # @exit 1
new-version: new-version:
$(MAKE) new-version-checklist $(MAKE) new-version-checklist

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-object-assign-to-object-spread"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-object-assign-to-object-spread"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-object-assign-to-object-spread"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-object-assign-to-object-spread"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,3 +1,3 @@
{ {
"plugins": ["../../../../lib"] "plugins": ["codemod-optional-catch-binding"]
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "babel", "name": "babel",
"version": "7.16.7", "version": "7.16.9",
"private": true, "private": true,
"type": "commonjs", "type": "commonjs",
"scripts": { "scripts": {
@ -17,7 +17,7 @@
"test:runtime:bundlers": "node test/runtime-integration/bundlers.cjs", "test:runtime:bundlers": "node test/runtime-integration/bundlers.cjs",
"test:runtime:node": "node test/runtime-integration/node.cjs" "test:runtime:node": "node test/runtime-integration/node.cjs"
}, },
"packageManager": "yarn@3.1.0", "packageManager": "yarn@3.1.1",
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.16.0", "@babel/cli": "^7.16.0",
"@babel/core": "^7.16.0", "@babel/core": "^7.16.0",
@ -88,7 +88,7 @@
"resolutions": { "resolutions": {
"browserslist": "npm:4.17.5", "browserslist": "npm:4.17.5",
"caniuse-lite": "npm:1.0.30001274", "caniuse-lite": "npm:1.0.30001274",
"core-js-compat": "npm:3.19.0", "core-js-compat": "npm:3.20.2",
"electron-to-chromium": "npm:1.3.749", "electron-to-chromium": "npm:1.3.749",
"glob-watcher/chokidar": "npm:^3.4.0", "glob-watcher/chokidar": "npm:^3.4.0",
"@types/babel__core": "link:./nope", "@types/babel__core": "link:./nope",

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/cli", "name": "@babel/cli",
"version": "7.16.7", "version": "7.16.8",
"description": "Babel command line.", "description": "Babel command line.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-cli", "homepage": "https://babel.dev/docs/en/next/babel-cli",

View File

@ -115,12 +115,12 @@ process.on("uncaughtException", function (err) {
}); });
export function requireChokidar(): any { export function requireChokidar(): any {
// $FlowIgnore - https://github.com/facebook/flow/issues/6913#issuecomment-662787504 const require = createRequire(import.meta.url);
const require = createRequire(import /*::("")*/.meta.url);
try { try {
// todo(babel 8): revert `@nicolo-ribaudo/chokidar-2` hack return process.env.BABEL_8_BREAKING
return parseInt(process.versions.node) >= 8 ? require("chokidar")
: parseInt(process.versions.node) >= 8
? require("chokidar") ? require("chokidar")
: require("@nicolo-ribaudo/chokidar-2"); : require("@nicolo-ribaudo/chokidar-2");
} catch (err) { } catch (err) {

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/compat-data", "name": "@babel/compat-data",
"version": "7.16.4", "version": "7.16.8",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"description": "", "description": "",
@ -30,7 +30,7 @@
], ],
"devDependencies": { "devDependencies": {
"@mdn/browser-compat-data": "^4.0.10", "@mdn/browser-compat-data": "^4.0.10",
"core-js-compat": "^3.19.1", "core-js-compat": "^3.20.2",
"electron-to-chromium": "^1.3.893" "electron-to-chromium": "^1.3.893"
}, },
"engines": { "engines": {

View File

@ -6,6 +6,7 @@ import buildDebug from "debug";
import path from "path"; import path from "path";
import type { Handler } from "gensync"; import type { Handler } from "gensync";
import loadCjsOrMjsDefault from "./module-types"; import loadCjsOrMjsDefault from "./module-types";
import { isAsync } from "../../gensync-utils/async";
import { createRequire } from "module"; import { createRequire } from "module";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
@ -149,18 +150,25 @@ function resolveStandardizedName(
} }
} }
const LOADING_MODULES = new Set(); if (!process.env.BABEL_8_BREAKING) {
// eslint-disable-next-line no-var
var LOADING_MODULES = new Set();
}
function* requireModule(type: string, name: string): Handler<unknown> { function* requireModule(type: string, name: string): Handler<unknown> {
if (LOADING_MODULES.has(name)) { if (!process.env.BABEL_8_BREAKING) {
throw new Error( if (!(yield* isAsync()) && LOADING_MODULES.has(name)) {
`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + throw new Error(
"and is trying to load itself while compiling itself, leading to a dependency cycle. " + `Reentrant ${type} detected trying to load "${name}". This module is not ignored ` +
'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.', "and is trying to load itself while compiling itself, leading to a dependency cycle. " +
); 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.',
);
}
} }
try { try {
LOADING_MODULES.add(name); if (!process.env.BABEL_8_BREAKING) {
LOADING_MODULES.add(name);
}
return yield* loadCjsOrMjsDefault( return yield* loadCjsOrMjsDefault(
name, name,
`You appear to be using a native ECMAScript module ${type}, ` + `You appear to be using a native ECMAScript module ${type}, ` +
@ -175,6 +183,8 @@ function* requireModule(type: string, name: string): Handler<unknown> {
err.message = `[BABEL]: ${err.message} (While processing: ${name})`; err.message = `[BABEL]: ${err.message} (While processing: ${name})`;
throw err; throw err;
} finally { } finally {
LOADING_MODULES.delete(name); if (!process.env.BABEL_8_BREAKING) {
LOADING_MODULES.delete(name);
}
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/generator", "name": "@babel/generator",
"version": "7.16.7", "version": "7.16.8",
"description": "Turns an AST into code.", "description": "Turns an AST into code.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",

View File

@ -12,9 +12,13 @@ export function TSTypeAnnotation(this: Printer, node: t.TSTypeAnnotation) {
export function TSTypeParameterInstantiation( export function TSTypeParameterInstantiation(
this: Printer, this: Printer,
node: t.TSTypeParameterInstantiation, node: t.TSTypeParameterInstantiation,
parent: t.Node,
): void { ): void {
this.token("<"); this.token("<");
this.printList(node.params, node, {}); this.printList(node.params, node, {});
if (parent.type === "ArrowFunctionExpression" && node.params.length === 1) {
this.token(",");
}
this.token(">"); this.token(">");
} }
@ -221,7 +225,10 @@ export function tsPrintFunctionOrConstructorType(
// todo: missing type FunctionOrConstructorType // todo: missing type FunctionOrConstructorType
node: any, node: any,
) { ) {
const { typeParameters, parameters } = node; const { typeParameters } = node;
const parameters = process.env.BABEL_8_BREAKING
? node.params
: node.parameters;
this.print(typeParameters, node); this.print(typeParameters, node);
this.token("("); this.token("(");
this._parameters(parameters, node); this._parameters(parameters, node);
@ -229,7 +236,10 @@ export function tsPrintFunctionOrConstructorType(
this.space(); this.space();
this.token("=>"); this.token("=>");
this.space(); this.space();
this.print(node.typeAnnotation.typeAnnotation, node); const returnType = process.env.BABEL_8_BREAKING
? node.returnType
: node.typeAnnotation;
this.print(returnType.typeAnnotation, node);
} }
export function TSTypeReference(this: Printer, node: t.TSTypeReference) { export function TSTypeReference(this: Printer, node: t.TSTypeReference) {
@ -644,12 +654,18 @@ export function TSNamespaceExportDeclaration(
} }
export function tsPrintSignatureDeclarationBase(this: Printer, node: any) { export function tsPrintSignatureDeclarationBase(this: Printer, node: any) {
const { typeParameters, parameters } = node; const { typeParameters } = node;
const parameters = process.env.BABEL_8_BREAKING
? node.params
: node.parameters;
this.print(typeParameters, node); this.print(typeParameters, node);
this.token("("); this.token("(");
this._parameters(parameters, node); this._parameters(parameters, node);
this.token(")"); this.token(")");
this.print(node.typeAnnotation, node); const returnType = process.env.BABEL_8_BREAKING
? node.returnType
: node.typeAnnotation;
this.print(returnType, node);
} }
export function tsPrintClassMemberModifiers(this: Printer, node: any, isField) { export function tsPrintClassMemberModifiers(this: Printer, node: any, isField) {

View File

@ -1 +1 @@
async <T>(a: T): T => a; async <T,>(a: T): T => a;

View File

@ -0,0 +1,2 @@
// Verify typescript doesn't change anything inside type parameter declaration
const foo = <T,>(a: T): T => a;

View File

@ -0,0 +1,3 @@
{
"plugins": ["jsx", "typescript"]
}

View File

@ -0,0 +1,2 @@
// Verify typescript doesn't change anything inside type parameter declaration
const foo = <T,>(a: T): T => a;

View File

@ -1,2 +1,2 @@
// Same as `generic`. Verify that JSX doesn't change things. // Same as `generic`. Verify that JSX doesn't change things.
<T>(a: T): T => a; <T,>(a: T): T => a;

View File

@ -1 +1 @@
<T>(a: T): T => a; <T,>(a: T): T => a;

View File

@ -38,6 +38,7 @@ interface Options {
name: string; name: string;
feature: number; feature: number;
loose?: boolean; loose?: boolean;
inherits?: (api: any, options: any) => any;
// same as PluginObject.manipulateOptions // same as PluginObject.manipulateOptions
manipulateOptions: (options: unknown, parserOpts: ParserOptions) => void; manipulateOptions: (options: unknown, parserOpts: ParserOptions) => void;
// TODO(flow->ts): change to babel api // TODO(flow->ts): change to babel api
@ -51,6 +52,7 @@ export function createClassFeaturePlugin({
manipulateOptions, manipulateOptions,
// TODO(Babel 8): Remove the default value // TODO(Babel 8): Remove the default value
api = { assumption: () => void 0 }, api = { assumption: () => void 0 },
inherits,
}: Options) { }: Options) {
const setPublicClassFields = api.assumption("setPublicClassFields"); const setPublicClassFields = api.assumption("setPublicClassFields");
const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties"); const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties");
@ -85,6 +87,7 @@ export function createClassFeaturePlugin({
return { return {
name, name,
manipulateOptions, manipulateOptions,
inherits,
pre() { pre() {
enableFeature(this.file, feature, loose); enableFeature(this.file, feature, loose);

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-fixtures", "name": "@babel/helper-fixtures",
"version": "7.16.7", "version": "7.16.8",
"description": "Helper function to support fixtures", "description": "Helper function to support fixtures",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",

View File

@ -298,7 +298,8 @@ function wrapPackagesArray(type, names, optionsDir) {
const monorepoPath = path.join( const monorepoPath = path.join(
path.dirname(fileURLToPath(import.meta.url)), path.dirname(fileURLToPath(import.meta.url)),
"../..", "../../..",
name.startsWith("codemod") ? "codemods" : "packages",
`babel-${type}-${name}`, `babel-${type}-${name}`,
); );

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-remap-async-to-generator", "name": "@babel/helper-remap-async-to-generator",
"version": "7.16.7", "version": "7.16.8",
"description": "Helper function to remap async functions to generators", "description": "Helper function to remap async functions to generators",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -36,6 +36,7 @@ export default function (
wrapAwait?: any; wrapAwait?: any;
}, },
noNewArrows?: boolean, noNewArrows?: boolean,
ignoreFunctionLength?: boolean,
) { ) {
path.traverse(awaitVisitor, { path.traverse(awaitVisitor, {
wrapAwait: helpers.wrapAwait, wrapAwait: helpers.wrapAwait,
@ -46,7 +47,12 @@ export default function (
path.node.async = false; path.node.async = false;
path.node.generator = true; path.node.generator = true;
wrapFunction(path, cloneNode(helpers.wrapAsync), noNewArrows); wrapFunction(
path,
cloneNode(helpers.wrapAsync),
noNewArrows,
ignoreFunctionLength,
);
const isProperty = const isProperty =
path.isObjectMethod() || path.isObjectMethod() ||

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-wrap-function", "name": "@babel/helper-wrap-function",
"version": "7.16.7", "version": "7.16.8",
"description": "Helper to wrap functions inside a function call.", "description": "Helper to wrap functions inside a function call.",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -66,7 +66,12 @@ function classOrObjectMethod(
).unwrapFunctionEnvironment(); ).unwrapFunctionEnvironment();
} }
function plainFunction(path: NodePath<any>, callId: any, noNewArrows: boolean) { function plainFunction(
path: NodePath<any>,
callId: any,
noNewArrows: boolean,
ignoreFunctionLength: boolean,
) {
const node = path.node; const node = path.node;
const isDeclaration = path.isFunctionDeclaration(); const isDeclaration = path.isFunctionDeclaration();
const functionId = node.id; const functionId = node.id;
@ -87,26 +92,20 @@ function plainFunction(path: NodePath<any>, callId: any, noNewArrows: boolean) {
} }
const built = callExpression(callId, [node]); const built = callExpression(callId, [node]);
const params: t.Identifier[] = [];
for (const param of node.params) {
if (isAssignmentPattern(param) || isRestElement(param)) {
break;
}
params.push(path.scope.generateUidIdentifier("x"));
}
const container = wrapper({ const container = wrapper({
NAME: functionId || null, NAME: functionId || null,
REF: path.scope.generateUidIdentifier(functionId ? functionId.name : "ref"), REF: path.scope.generateUidIdentifier(functionId ? functionId.name : "ref"),
FUNCTION: built, FUNCTION: built,
PARAMS: node.params.reduce( PARAMS: params,
(acc, param) => {
acc.done =
acc.done || isAssignmentPattern(param) || isRestElement(param);
if (!acc.done) {
acc.params.push(path.scope.generateUidIdentifier("x"));
}
return acc;
},
{
params: [],
done: false,
},
).params,
}); });
if (isDeclaration) { if (isDeclaration) {
@ -123,7 +122,11 @@ function plainFunction(path: NodePath<any>, callId: any, noNewArrows: boolean) {
}); });
} }
if (!retFunction || retFunction.id || node.params.length) { if (
!retFunction ||
retFunction.id ||
(!ignoreFunctionLength && params.length)
) {
// we have an inferred function id or params so we need this wrapper // we have an inferred function id or params so we need this wrapper
// @ts-expect-error todo(flow->ts) separate `wrapper` for `isDeclaration` and `else` branches // @ts-expect-error todo(flow->ts) separate `wrapper` for `isDeclaration` and `else` branches
path.replaceWith(container); path.replaceWith(container);
@ -139,10 +142,11 @@ export default function wrapFunction(
callId: any, callId: any,
// TODO(Babel 8): Consider defaulting to false for spec compliancy // TODO(Babel 8): Consider defaulting to false for spec compliancy
noNewArrows: boolean = true, noNewArrows: boolean = true,
ignoreFunctionLength: boolean = false,
) { ) {
if (path.isMethod()) { if (path.isMethod()) {
classOrObjectMethod(path, callId); classOrObjectMethod(path, callId);
} else { } else {
plainFunction(path, callId, noNewArrows); plainFunction(path, callId, noNewArrows, ignoreFunctionLength);
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -56,7 +56,7 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
var pub = metadataForKey.public; var pub = metadataForKey.public;
if (pub === void 0) { if (pub === void 0) {
pub = metadataForKey.public = Object.create(null); pub = metadataForKey.public = {};
} }
pub[property] = value; pub[property] = value;
@ -76,7 +76,7 @@ function createMetadataMethodsForProperty(metadataMap, kind, property) {
} }
function convertMetadataMapToFinal(obj, metadataMap) { function convertMetadataMapToFinal(obj, metadataMap) {
var parentMetadataMap = obj[Symbol.metadata]; var parentMetadataMap = obj[Symbol.metadata || Symbol.for("Symbol.metadata")];
var metadataKeys = Object.getOwnPropertySymbols(metadataMap); var metadataKeys = Object.getOwnPropertySymbols(metadataMap);
if (metadataKeys.length === 0) return; if (metadataKeys.length === 0) return;
@ -115,7 +115,7 @@ function convertMetadataMapToFinal(obj, metadataMap) {
Object.setPrototypeOf(metadataMap, parentMetadataMap); Object.setPrototypeOf(metadataMap, parentMetadataMap);
} }
obj[Symbol.metadata] = metadataMap; obj[Symbol.metadata || Symbol.for("Symbol.metadata")] = metadataMap;
} }
function createAddInitializerMethod(initializers) { function createAddInitializerMethod(initializers) {

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/node", "name": "@babel/node",
"version": "7.16.7", "version": "7.16.8",
"description": "Babel command line", "description": "Babel command line",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-node", "homepage": "https://babel.dev/docs/en/next/babel-node",
@ -25,7 +25,7 @@
"dependencies": { "dependencies": {
"@babel/register": "workspace:^", "@babel/register": "workspace:^",
"commander": "^4.0.1", "commander": "^4.0.1",
"core-js": "^3.19.0", "core-js": "^3.20.2",
"node-environment-flags": "^1.0.5", "node-environment-flags": "^1.0.5",
"regenerator-runtime": "^0.13.4", "regenerator-runtime": "^0.13.4",
"v8flags": "^3.1.1" "v8flags": "^3.1.1"

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/parser", "name": "@babel/parser",
"version": "7.16.7", "version": "7.16.8",
"description": "A JavaScript parser", "description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser", "homepage": "https://babel.dev/docs/en/next/babel-parser",

View File

@ -584,14 +584,21 @@ export default (superClass: Class<Parser>): Class<Parser> =>
): void { ): void {
// Arrow fns *must* have return token (`=>`). Normal functions can omit it. // Arrow fns *must* have return token (`=>`). Normal functions can omit it.
const returnTokenRequired = returnToken === tt.arrow; const returnTokenRequired = returnToken === tt.arrow;
// https://github.com/babel/babel/issues/9231
const paramsKey = process.env.BABEL_8_BREAKING ? "params" : "parameters";
const returnTypeKey = process.env.BABEL_8_BREAKING
? "returnType"
: "typeAnnotation";
signature.typeParameters = this.tsTryParseTypeParameters(); signature.typeParameters = this.tsTryParseTypeParameters();
this.expect(tt.parenL); this.expect(tt.parenL);
signature.parameters = this.tsParseBindingListForSignature(); signature[paramsKey] = this.tsParseBindingListForSignature();
if (returnTokenRequired) { if (returnTokenRequired) {
signature.typeAnnotation = signature[returnTypeKey] =
this.tsParseTypeOrTypePredicateAnnotation(returnToken); this.tsParseTypeOrTypePredicateAnnotation(returnToken);
} else if (this.match(returnToken)) { } else if (this.match(returnToken)) {
signature.typeAnnotation = signature[returnTypeKey] =
this.tsParseTypeOrTypePredicateAnnotation(returnToken); this.tsParseTypeOrTypePredicateAnnotation(returnToken);
} }
} }
@ -683,10 +690,16 @@ export default (superClass: Class<Parser>): Class<Parser> =>
} }
this.tsFillSignature(tt.colon, method); this.tsFillSignature(tt.colon, method);
this.tsParseTypeMemberSemicolon(); this.tsParseTypeMemberSemicolon();
const paramsKey = process.env.BABEL_8_BREAKING
? "params"
: "parameters";
const returnTypeKey = process.env.BABEL_8_BREAKING
? "returnType"
: "typeAnnotation";
if (method.kind === "get") { if (method.kind === "get") {
if (method.parameters.length > 0) { if (method[paramsKey].length > 0) {
this.raise(this.state.pos, Errors.BadGetterArity); this.raise(this.state.pos, Errors.BadGetterArity);
if (this.isThisParam(method.parameters[0])) { if (this.isThisParam(method[paramsKey][0])) {
this.raise( this.raise(
this.state.pos, this.state.pos,
TSErrors.AccesorCannotDeclareThisParameter, TSErrors.AccesorCannotDeclareThisParameter,
@ -694,10 +707,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
} }
} }
} else if (method.kind === "set") { } else if (method.kind === "set") {
if (method.parameters.length !== 1) { if (method[paramsKey].length !== 1) {
this.raise(this.state.pos, Errors.BadSetterArity); this.raise(this.state.pos, Errors.BadSetterArity);
} else { } else {
const firstParameter = method.parameters[0]; const firstParameter = method[paramsKey][0];
if (this.isThisParam(firstParameter)) { if (this.isThisParam(firstParameter)) {
this.raise( this.raise(
this.state.pos, this.state.pos,
@ -720,9 +733,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
); );
} }
} }
if (method.typeAnnotation) { if (method[returnTypeKey]) {
this.raise( this.raise(
method.typeAnnotation.start, method[returnTypeKey].start,
TSErrors.SetAccesorCannotHaveReturnType, TSErrors.SetAccesorCannotHaveReturnType,
); );
} }

View File

@ -1270,6 +1270,11 @@ export type TsSignatureDeclaration =
export type TsSignatureDeclarationOrIndexSignatureBase = NodeBase & { export type TsSignatureDeclarationOrIndexSignatureBase = NodeBase & {
// Not using TypeScript's "ParameterDeclaration" here, since it's inconsistent with regular functions. // Not using TypeScript's "ParameterDeclaration" here, since it's inconsistent with regular functions.
params: $ReadOnlyArray<
Identifier | RestElement | ObjectPattern | ArrayPattern,
>,
returnType: ?TsTypeAnnotation,
// TODO(Babel-8): Remove
parameters: $ReadOnlyArray< parameters: $ReadOnlyArray<
Identifier | RestElement | ObjectPattern | ArrayPattern, Identifier | RestElement | ObjectPattern | ArrayPattern,
>, >,

View File

@ -0,0 +1,5 @@
declare interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,141 @@
{
"type": "File",
"start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}},
"program": {
"type": "Program",
"start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":102,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}},
"id": {
"type": "Identifier",
"start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"B"},
"name": "B"
},
"body": {
"type": "TSInterfaceBody",
"start":20,"end":102,"loc":{"start":{"line":1,"column":20},"end":{"line":5,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":24,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}},
"key": {
"type": "Identifier",
"start":24,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"parameters": [
{
"type": "ArrayPattern",
"start":28,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}},
"elements": [],
"optional": true
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":32,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":34,"end":38,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":16}}
}
},
"kind": "method"
},
{
"type": "TSMethodSignature",
"start":42,"end":60,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":20}},
"key": {
"type": "Identifier",
"start":42,"end":45,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"bar"},
"name": "bar"
},
"computed": false,
"parameters": [
{
"type": "ObjectPattern",
"start":46,"end":48,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}},
"properties": []
},
{
"type": "ArrayPattern",
"start":50,"end":53,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13}},
"elements": [],
"optional": true
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":54,"end":59,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":19}},
"typeAnnotation": {
"type": "TSAnyKeyword",
"start":56,"end":59,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":19}}
}
},
"kind": "method"
},
{
"type": "TSMethodSignature",
"start":63,"end":100,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":39}},
"key": {
"type": "Identifier",
"start":63,"end":66,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"baz"},
"name": "baz"
},
"computed": false,
"parameters": [
{
"type": "Identifier",
"start":67,"end":76,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":15},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":68,"end":76,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":15}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":70,"end":76,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":15}}
}
}
},
{
"type": "Identifier",
"start":78,"end":87,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":26},"identifierName":"b"},
"name": "b",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":79,"end":87,"loc":{"start":{"line":4,"column":18},"end":{"line":4,"column":26}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":81,"end":87,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":26}}
}
}
},
{
"type": "ArrayPattern",
"start":89,"end":92,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":31}},
"elements": [],
"optional": true
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":93,"end":99,"loc":{"start":{"line":4,"column":32},"end":{"line":4,"column":38}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":95,"end":99,"loc":{"start":{"line":4,"column":34},"end":{"line":4,"column":38}}
}
},
"kind": "method"
}
]
},
"declare": true
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -28,7 +28,7 @@
"name": "foo" "name": "foo"
}, },
"computed": false, "computed": false,
"parameters": [ "params": [
{ {
"type": "ArrayPattern", "type": "ArrayPattern",
"start":28,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}}, "start":28,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9}},
@ -36,7 +36,7 @@
"optional": true "optional": true
} }
], ],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":32,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}}, "start":32,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16}},
"typeAnnotation": { "typeAnnotation": {
@ -55,7 +55,7 @@
"name": "bar" "name": "bar"
}, },
"computed": false, "computed": false,
"parameters": [ "params": [
{ {
"type": "ObjectPattern", "type": "ObjectPattern",
"start":46,"end":48,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}}, "start":46,"end":48,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":8}},
@ -68,7 +68,7 @@
"optional": true "optional": true
} }
], ],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":54,"end":59,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":19}}, "start":54,"end":59,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":19}},
"typeAnnotation": { "typeAnnotation": {
@ -87,7 +87,7 @@
"name": "baz" "name": "baz"
}, },
"computed": false, "computed": false,
"parameters": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start":67,"end":76,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":15},"identifierName":"a"}, "start":67,"end":76,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":15},"identifierName":"a"},
@ -121,7 +121,7 @@
"optional": true "optional": true
} }
], ],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":93,"end":99,"loc":{"start":{"line":4,"column":32},"end":{"line":4,"column":38}}, "start":93,"end":99,"loc":{"start":{"line":4,"column":32},"end":{"line":4,"column":38}},
"typeAnnotation": { "typeAnnotation": {

View File

@ -0,0 +1,3 @@
interface I {
(x: number): void;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,55 @@
{
"type": "File",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"},
"name": "I"
},
"body": {
"type": "TSInterfaceBody",
"start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSCallSignatureDeclaration",
"start":18,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}},
"parameters": [
{
"type": "Identifier",
"start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"x"},
"name": "x",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":20,"end":28,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":14}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":22,"end":28,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":14}}
}
}
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":29,"end":35,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":31,"end":35,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":21}}
}
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -22,7 +22,7 @@
{ {
"type": "TSCallSignatureDeclaration", "type": "TSCallSignatureDeclaration",
"start":18,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}}, "start":18,"end":36,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":22}},
"parameters": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"x"}, "start":19,"end":28,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":14},"identifierName":"x"},
@ -37,7 +37,7 @@
} }
} }
], ],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":29,"end":35,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}}, "start":29,"end":35,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}},
"typeAnnotation": { "typeAnnotation": {

View File

@ -0,0 +1,3 @@
interface I {
new (x: number): void;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,55 @@
{
"type": "File",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"},
"name": "I"
},
"body": {
"type": "TSInterfaceBody",
"start":12,"end":42,"loc":{"start":{"line":1,"column":12},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSConstructSignatureDeclaration",
"start":18,"end":40,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":26}},
"parameters": [
{
"type": "Identifier",
"start":23,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"x"},
"name": "x",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":24,"end":32,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":18}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":26,"end":32,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}
}
}
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":33,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":35,"end":39,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25}}
}
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -22,7 +22,7 @@
{ {
"type": "TSConstructSignatureDeclaration", "type": "TSConstructSignatureDeclaration",
"start":18,"end":40,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":26}}, "start":18,"end":40,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":26}},
"parameters": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start":23,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"x"}, "start":23,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"x"},
@ -37,7 +37,7 @@
} }
} }
], ],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":33,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}}, "start":33,"end":39,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}},
"typeAnnotation": { "typeAnnotation": {

View File

@ -0,0 +1,3 @@
interface Foo {
<T>(a: string): string;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -0,0 +1,70 @@
{
"type": "File",
"start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":43,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSCallSignatureDeclaration",
"start":18,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}},
"params": [
{
"type": "TSTypeParameter",
"start":19,"end":20,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4}},
"name": {
"type": "Identifier",
"start":19,"end":20,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"T"},
"name": "T"
}
}
]
},
"params": [
{
"type": "Identifier",
"start":22,"end":31,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":15},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":23,"end":31,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":15}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":25,"end":31,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":15}}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":32,"end":40,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":34,"end":40,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":24}}
}
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
type Foo = <T>() => number;

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -0,0 +1,50 @@
{
"type": "File",
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
"program": {
"type": "Program",
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSTypeAliasDeclaration",
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
"id": {
"type": "Identifier",
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"},
"name": "Foo"
},
"typeAnnotation": {
"type": "TSFunctionType",
"start":11,"end":26,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":26}},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}},
"params": [
{
"type": "TSTypeParameter",
"start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}},
"name": {
"type": "Identifier",
"start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"},
"name": "T"
}
}
]
},
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":17,"end":26,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":26}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}}
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
type Foo = new <T>() => void;

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -0,0 +1,51 @@
{
"type": "File",
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
"program": {
"type": "Program",
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSTypeAliasDeclaration",
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
"id": {
"type": "Identifier",
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"},
"name": "Foo"
},
"typeAnnotation": {
"type": "TSConstructorType",
"start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}},
"abstract": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}},
"params": [
{
"type": "TSTypeParameter",
"start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}},
"name": {
"type": "Identifier",
"start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"T"},
"name": "T"
}
}
]
},
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":24,"end":28,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":28}}
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
interface Foo {
new<T>(a: string): string;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -0,0 +1,70 @@
{
"type": "File",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":46,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSConstructSignatureDeclaration",
"start":18,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":28}},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":21,"end":24,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}},
"params": [
{
"type": "TSTypeParameter",
"start":22,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}},
"name": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"},
"name": "T"
}
}
]
},
"params": [
{
"type": "Identifier",
"start":25,"end":34,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":26,"end":34,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":18}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":28,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":35,"end":43,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":37,"end":43,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}}
}
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
interface Foo {
foo<T>(x: number): void;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -0,0 +1,77 @@
{
"type": "File",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":44,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":18,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":26}},
"key": {
"type": "Identifier",
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":21,"end":24,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}},
"params": [
{
"type": "TSTypeParameter",
"start":22,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}},
"name": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"},
"name": "T"
}
}
]
},
"params": [
{
"type": "Identifier",
"start":25,"end":34,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":18},"identifierName":"x"},
"name": "x",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":26,"end":34,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":18}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":28,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":35,"end":41,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":37,"end":41,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":25}}
}
},
"kind": "method"
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,6 @@
interface Foo {
get
foo(): string;
set
bar(v);
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,86 @@
{
"type": "File",
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
"program": {
"type": "Program",
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":56,"loc":{"start":{"line":1,"column":14},"end":{"line":6,"column":1}},
"body": [
{
"type": "TSPropertySignature",
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}},
"key": {
"type": "Identifier",
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"get"},
"name": "get"
},
"computed": false
},
{
"type": "TSMethodSignature",
"start":24,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}},
"key": {
"type": "Identifier",
"start":24,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"parameters": [],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":29,"end":37,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":15}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":31,"end":37,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15}}
}
},
"kind": "method"
},
{
"type": "TSPropertySignature",
"start":41,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5}},
"key": {
"type": "Identifier",
"start":41,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"set"},
"name": "set"
},
"computed": false
},
{
"type": "TSMethodSignature",
"start":47,"end":54,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":9}},
"key": {
"type": "Identifier",
"start":47,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"bar"},
"name": "bar"
},
"computed": false,
"parameters": [
{
"type": "Identifier",
"start":51,"end":52,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"v"},
"name": "v"
}
],
"kind": "method"
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -38,8 +38,8 @@
"name": "foo" "name": "foo"
}, },
"computed": false, "computed": false,
"parameters": [], "params": [],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":29,"end":37,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":15}}, "start":29,"end":37,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":15}},
"typeAnnotation": { "typeAnnotation": {
@ -68,7 +68,7 @@
"name": "bar" "name": "bar"
}, },
"computed": false, "computed": false,
"parameters": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start":51,"end":52,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"v"}, "start":51,"end":52,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"v"},

View File

@ -0,0 +1,4 @@
interface Foo {
get foo(): string;
set bar(v);
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,66 @@
{
"type": "File",
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"program": {
"type": "Program",
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":52,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":18,"end":36,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":20}},
"kind": "get",
"key": {
"type": "Identifier",
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"parameters": [],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":27,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":19}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":29,"end":35,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":19}}
}
}
},
{
"type": "TSMethodSignature",
"start":39,"end":50,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":13}},
"kind": "set",
"key": {
"type": "Identifier",
"start":43,"end":46,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
"name": "bar"
},
"computed": false,
"parameters": [
{
"type": "Identifier",
"start":47,"end":48,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"v"},
"name": "v"
}
]
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
interface Foo {
set bar(foo?: string);
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,58 @@
{
"type": "File",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: A 'set' accessor cannot have an optional parameter. (3:1)"
],
"program": {
"type": "Program",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":42,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":18,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}},
"key": {
"type": "Identifier",
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"},
"name": "bar"
},
"computed": false,
"kind": "set",
"parameters": [
{
"type": "Identifier",
"start":26,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22},"identifierName":"foo"},
"name": "foo",
"optional": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":30,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":32,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}}
}
}
}
]
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -32,7 +32,7 @@
}, },
"computed": false, "computed": false,
"kind": "set", "kind": "set",
"parameters": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start":26,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22},"identifierName":"foo"}, "start":26,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22},"identifierName":"foo"},

View File

@ -0,0 +1,4 @@
interface Foo {
get foo(param): string;
set foo();
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,70 @@
{
"type": "File",
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"errors": [
"SyntaxError: A 'get' accesor must not have any formal parameters. (3:5)",
"SyntaxError: A 'set' accesor must have exactly one formal parameter. (4:1)"
],
"program": {
"type": "Program",
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":56,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":18,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}},
"key": {
"type": "Identifier",
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"kind": "get",
"parameters": [
{
"type": "Identifier",
"start":26,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"param"},
"name": "param"
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":32,"end":40,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":34,"end":40,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":24}}
}
}
},
{
"type": "TSMethodSignature",
"start":44,"end":54,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":12}},
"key": {
"type": "Identifier",
"start":48,"end":51,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"kind": "set",
"parameters": []
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -33,14 +33,14 @@
}, },
"computed": false, "computed": false,
"kind": "get", "kind": "get",
"parameters": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start":26,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"param"}, "start":26,"end":31,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":15},"identifierName":"param"},
"name": "param" "name": "param"
} }
], ],
"typeAnnotation": { "returnType": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start":32,"end":40,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24}}, "start":32,"end":40,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":24}},
"typeAnnotation": { "typeAnnotation": {
@ -59,7 +59,7 @@
}, },
"computed": false, "computed": false,
"kind": "set", "kind": "set",
"parameters": [] "params": []
} }
] ]
} }

View File

@ -0,0 +1,3 @@
interface Foo {
set bar(...v);
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -0,0 +1,53 @@
{
"type": "File",
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: A 'set' accessor cannot have rest parameter. (3:1)"
],
"program": {
"type": "Program",
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":18,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}},
"key": {
"type": "Identifier",
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"},
"name": "bar"
},
"computed": false,
"kind": "set",
"params": [
{
"type": "RestElement",
"start":26,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}},
"argument": {
"type": "Identifier",
"start":29,"end":30,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"v"},
"name": "v"
}
}
]
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -32,7 +32,7 @@
}, },
"computed": false, "computed": false,
"kind": "set", "kind": "set",
"parameters": [ "params": [
{ {
"type": "RestElement", "type": "RestElement",
"start":26,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}}, "start":26,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":14}},

View File

@ -0,0 +1,3 @@
interface Foo {
set foo(param): string;
}

Some files were not shown because too many files have changed in this diff Show More