-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRi: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: types
Description
Bug Report
When I upgrade @babel/types to 7.8.0, the following TypeScript source files had some compilation errors:
import {
arrowFunctionExpression,
identifier,
blockStatement,
returnStatement,
program,
variableDeclaration,
variableDeclarator,
stringLiteral,
} from '@babel/types';
// error TS2554: Expected 4-7 arguments, but got 2.
arrowFunctionExpression(
[identifier('arg')],
blockStatement([returnStatement(identifier('arg'))]),
);
// error TS2554: Expected 5 arguments, but got 1.
program([
variableDeclaration('const', [
variableDeclarator(identifier('foo'), stringLiteral('bar')),
]),
]);I followed the error message and fixed it like this:
arrowFunctionExpression(
[identifier('arg')],
blockStatement([returnStatement(identifier('arg'))]),
false,
false,
);
program(
[
variableDeclaration('const', [
variableDeclarator(identifier('foo'), stringLiteral('bar')),
]),
],
undefined,
undefined,
undefined,
'',
);Typescript compilation was successful,But when I use node to execute the compiled JS file,@babel/types threw errors:
Error: ArrowFunctionExpression: Too many arguments passed. Received 4 but can receive no more than 3
Error: Program: Too many arguments passed. Received 5 but can receive no more than 4
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true
},
}Environment
System:
OS: macOS Mojave 10.14.6
Binaries:
Node: 12.14.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
npmPackages:
@babel/types: ^7.8.0 => 7.8.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRi: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: types