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:
Nicolò Ribaudo 2020-04-05 23:43:20 +02:00 committed by GitHub
parent aeebc08234
commit 65d09e46a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 0 deletions

View File

@ -36,6 +36,9 @@ const iifeVisitor = {
path.stop();
}
},
// type annotations don't use or introduce "real" bindings
"TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration": path =>
path.skip(),
};
export default function convertFunctionParams(path, loose) {

View File

@ -0,0 +1,7 @@
function a(b: (c) => void = {}) {
let c;
}
function d(e = <T>() => {}) {
let T;
}

View File

@ -0,0 +1,6 @@
{
"plugins": [
"transform-parameters",
"syntax-flow"
]
}

View 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;
}

View File

@ -0,0 +1,7 @@
function a(b: (c) => void = {}) {
let c;
}
function d(e = <T>() => {}) {
let T;
}

View File

@ -0,0 +1,6 @@
{
"plugins": [
"transform-parameters",
"syntax-typescript"
]
}

View 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;
}