Handle typescript function overloading in a default export (#13605)

* feat(ransform-typescript): add test case

* feat(transform-typescript): avoid calling registerGlobalType if node.id is not defined
This commit is contained in:
Tony Gorez 2021-08-04 00:37:53 +02:00 committed by GitHub
parent 13af87cd3b
commit 70c66b3799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -291,7 +291,7 @@ export default declare((api, opts) => {
}
} else if (
stmt.isTSTypeAliasDeclaration() ||
stmt.isTSDeclareFunction() ||
(stmt.isTSDeclareFunction() && stmt.get("id").isIdentifier()) ||
stmt.isTSInterfaceDeclaration() ||
stmt.isClassDeclaration({ declare: true }) ||
stmt.isTSEnumDeclaration({ declare: true }) ||

View File

@ -0,0 +1,3 @@
export default function(choiceField: any, selectedIndex: number): void;
export default function(choiceField: any, selectedValue: string): void;
export default function(choiceField: any, selection: number | string) {}

View File

@ -0,0 +1 @@
export default function (choiceField, selection) {}