Don't check type annotations when deciding params scope (#11349)
* Don't check type annotations when deciding params scope * Also type params
This commit is contained in:
parent
aeebc08234
commit
65d09e46a0
@ -36,6 +36,9 @@ const iifeVisitor = {
|
|||||||
path.stop();
|
path.stop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// type annotations don't use or introduce "real" bindings
|
||||||
|
"TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration": path =>
|
||||||
|
path.skip(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function convertFunctionParams(path, loose) {
|
export default function convertFunctionParams(path, loose) {
|
||||||
|
|||||||
7
packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/input.js
vendored
Normal file
7
packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/input.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
function a(b: (c) => void = {}) {
|
||||||
|
let c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(e = <T>() => {}) {
|
||||||
|
let T;
|
||||||
|
}
|
||||||
6
packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/options.json
vendored
Normal file
6
packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/options.json
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"transform-parameters",
|
||||||
|
"syntax-flow"
|
||||||
|
]
|
||||||
|
}
|
||||||
9
packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/output.js
vendored
Normal file
9
packages/babel-plugin-transform-parameters/test/fixtures/regression/11344-flow/output.js
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
function a() {
|
||||||
|
let b: (c) => void = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
|
let c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function d() {
|
||||||
|
let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : <T>() => {};
|
||||||
|
let T;
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
function a(b: (c) => void = {}) {
|
||||||
|
let c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function d(e = <T>() => {}) {
|
||||||
|
let T;
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"transform-parameters",
|
||||||
|
"syntax-typescript"
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
function a() {
|
||||||
|
let b: (c) => void = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
|
let c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function d() {
|
||||||
|
let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : <T>() => {};
|
||||||
|
let T;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user