From e21048485c54eb57ac2386bdcb4f94954b6572de Mon Sep 17 00:00:00 2001 From: uhyo Date: Wed, 8 Jun 2022 23:56:44 +0900 Subject: [PATCH] add declaration emit test --- ...amingDestructuredPropertyInFunctionType.js | 56 +++++++++++++++++++ ...amingDestructuredPropertyInFunctionType.ts | 1 + 2 files changed, 57 insertions(+) diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js index 634f2fd3512..445ca0d8c1a 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js @@ -32,3 +32,59 @@ interface I { } //// [renamingDestructuredPropertyInFunctionType.js] + + +//// [renamingDestructuredPropertyInFunctionType.d.ts] +declare type O = { + a: string; + b: number; + c: number; +}; +declare type F1 = (arg: number) => any; +declare type F2 = ({ a }: O) => any; +declare type F3 = ({ a, b, c }: O) => any; +declare type F4 = ({ a }: O) => any; +declare type F5 = ({ a, b, c }: O) => any; +declare type F6 = ({ a }: { + a: any; +}) => typeof string; +declare type F7 = ({ a, b }: { + a: any; + b: any; +}) => typeof number; +declare type F8 = ({ a, b }: { + a: any; + b: any; +}) => typeof number; +declare type F9 = ([a, b, c]: [any, any, any]) => void; +declare type G1 = (arg: number) => any; +declare type G2 = ({ a }: O) => any; +declare type G3 = ({ a, b, c }: O) => any; +declare type G4 = ({ a }: O) => any; +declare type G5 = ({ a, b, c }: O) => any; +declare type G6 = ({ a }: { + a: any; +}) => typeof string; +declare type G7 = ({ a, b }: { + a: any; + b: any; +}) => typeof number; +declare type G8 = ({ a, b }: { + a: any; + b: any; +}) => typeof number; +declare type G9 = ([a, b, c]: [any, any, any]) => void; +interface I { + method1(arg: number): any; + method2({ a }: { + a: any; + }): any; + (arg: number): any; + ({ a }: { + a: any; + }): any; + new (arg: number): any; + new ({ a }: { + a: any; + }): any; +} diff --git a/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts b/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts index b1aeabb429a..1fe6b480c3c 100644 --- a/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts +++ b/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts @@ -1,3 +1,4 @@ +// @declaration: true type O = { a: string; b: number; c: number; }; type F1 = (arg: number) => any; // OK type F2 = ({ a: string }: O) => any; // Error