From 39e90ce1e18b511ff8fe1cf1a0921a32d235a144 Mon Sep 17 00:00:00 2001 From: uhyo Date: Wed, 8 Jun 2022 21:36:18 +0900 Subject: [PATCH] renew tests (not very right now) --- ...tructuredPropertyInFunctionType.errors.txt | 93 ++++++++++- ...amingDestructuredPropertyInFunctionType.js | 37 ++++- ...DestructuredPropertyInFunctionType.symbols | 157 +++++++++++++++++- ...ngDestructuredPropertyInFunctionType.types | 142 +++++++++++++++- ...ructuredPropertyInFunctionType2.errors.txt | 95 ++++++++++- ...estructuredPropertyInFunctionType2.symbols | 156 ++++++++++++++++- ...gDestructuredPropertyInFunctionType2.types | 145 +++++++++++++++- ...amingDestructuredPropertyInFunctionType.ts | 32 +++- ...mingDestructuredPropertyInFunctionType2.ts | 34 +++- 9 files changed, 833 insertions(+), 58 deletions(-) diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.errors.txt b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.errors.txt index d7bcfc4950c..0a04f6fbeeb 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.errors.txt +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.errors.txt @@ -1,10 +1,91 @@ -tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(1,15): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(3,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(4,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(5,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(6,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(7,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(8,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(8,28): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(9,20): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(13,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(14,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(15,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(16,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(17,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(18,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(18,28): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(19,20): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(24,16): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(27,9): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(30,13): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. -==== tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts (1 errors) ==== - type F = ({a: string}) => void; - ~~~~~~ +==== tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts (19 errors) ==== + type O = { a: string; b: number; c: number; }; + type F1 = (arg: number) => any; // OK + type F2 = ({ a: string }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F3 = ({ a: string, b, c }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F4 = ({ a: string }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F5 = ({ a: string, b, c }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F6 = ({ a: string }) => typeof string; // OK + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F7 = ({ a: string, b: number }) => typeof number; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F8 = ({ a, b: number }) => typeof number; // OK + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F9 = ([a, b, c]) => void; // Error + + type G1 = (arg: number) => any; // OK + type G2 = ({ a: string }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G3 = ({ a: string, b, c }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G4 = ({ a: string }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G5 = ({ a: string, b, c }: O) => any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G6 = ({ a: string }) => typeof string; // OK + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G7 = ({ a: string, b: number }) => typeof number; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G8 = ({ a, b: number }) => typeof number; // OK + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G9 = ([a, b, c]) => void; // Error + + interface I { + method1(arg: number): any; // OK + method2({ a: string }): any; // Error + ~~~~~~ !!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. - const f = ({a: string}) => string; - \ No newline at end of file + (arg: number): any; // OK + ({ a: string }): any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + + new (arg: number): any; // OK + new ({ a: string }): any; // Error + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + } \ No newline at end of file diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js index 3d3a24d9a28..634f2fd3512 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js @@ -1,11 +1,34 @@ //// [renamingDestructuredPropertyInFunctionType.ts] -type F = ({a: string}) => void; +type O = { a: string; b: number; c: number; }; +type F1 = (arg: number) => any; // OK +type F2 = ({ a: string }: O) => any; // Error +type F3 = ({ a: string, b, c }: O) => any; // Error +type F4 = ({ a: string }: O) => any; // Error +type F5 = ({ a: string, b, c }: O) => any; // Error +type F6 = ({ a: string }) => typeof string; // OK +type F7 = ({ a: string, b: number }) => typeof number; // Error +type F8 = ({ a, b: number }) => typeof number; // OK +type F9 = ([a, b, c]) => void; // Error -const f = ({a: string}) => string; - +type G1 = (arg: number) => any; // OK +type G2 = ({ a: string }: O) => any; // Error +type G3 = ({ a: string, b, c }: O) => any; // Error +type G4 = ({ a: string }: O) => any; // Error +type G5 = ({ a: string, b, c }: O) => any; // Error +type G6 = ({ a: string }) => typeof string; // OK +type G7 = ({ a: string, b: number }) => typeof number; // Error +type G8 = ({ a, b: number }) => typeof number; // OK +type G9 = ([a, b, c]) => void; // Error + +interface I { + method1(arg: number): any; // OK + method2({ a: string }): any; // Error + + (arg: number): any; // OK + ({ a: string }): any; // Error + + new (arg: number): any; // OK + new ({ a: string }): any; // Error +} //// [renamingDestructuredPropertyInFunctionType.js] -var f = function (_a) { - var string = _a.a; - return string; -}; diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.symbols b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.symbols index c0fc1701b12..0d70bfa20b7 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.symbols +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.symbols @@ -1,12 +1,151 @@ === tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts === -type F = ({a: string}) => void; ->F : Symbol(F, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) ->a : Symbol(a) ->string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 11)) +type O = { a: string; b: number; c: number; }; +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 21)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 32)) -const f = ({a: string}) => string; ->f : Symbol(f, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 5)) ->a : Symbol(a) ->string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 12)) ->string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 12)) +type F1 = (arg: number) => any; // OK +>F1 : Symbol(F1, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 46)) +>arg : Symbol(arg, Decl(renamingDestructuredPropertyInFunctionType.ts, 1, 11)) +type F2 = ({ a: string }: O) => any; // Error +>F2 : Symbol(F2, Decl(renamingDestructuredPropertyInFunctionType.ts, 1, 31)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 12)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type F3 = ({ a: string, b, c }: O) => any; // Error +>F3 : Symbol(F3, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 36)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 3, 12)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 3, 23)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 3, 26)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type F4 = ({ a: string }: O) => any; // Error +>F4 : Symbol(F4, Decl(renamingDestructuredPropertyInFunctionType.ts, 3, 42)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 4, 12)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type F5 = ({ a: string, b, c }: O) => any; // Error +>F5 : Symbol(F5, Decl(renamingDestructuredPropertyInFunctionType.ts, 4, 36)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 5, 12)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 5, 23)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 5, 26)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type F6 = ({ a: string }) => typeof string; // OK +>F6 : Symbol(F6, Decl(renamingDestructuredPropertyInFunctionType.ts, 5, 42)) +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 6, 12)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 6, 12)) + +type F7 = ({ a: string, b: number }) => typeof number; // Error +>F7 : Symbol(F7, Decl(renamingDestructuredPropertyInFunctionType.ts, 6, 43)) +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 7, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 7, 23)) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 7, 23)) + +type F8 = ({ a, b: number }) => typeof number; // OK +>F8 : Symbol(F8, Decl(renamingDestructuredPropertyInFunctionType.ts, 7, 54)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 8, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 8, 15)) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 8, 15)) + +type F9 = ([a, b, c]) => void; // Error +>F9 : Symbol(F9, Decl(renamingDestructuredPropertyInFunctionType.ts, 8, 46)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 9, 12)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 9, 14)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 9, 17)) + +type G1 = (arg: number) => any; // OK +>G1 : Symbol(G1, Decl(renamingDestructuredPropertyInFunctionType.ts, 9, 30)) +>arg : Symbol(arg, Decl(renamingDestructuredPropertyInFunctionType.ts, 11, 11)) + +type G2 = ({ a: string }: O) => any; // Error +>G2 : Symbol(G2, Decl(renamingDestructuredPropertyInFunctionType.ts, 11, 31)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 12, 12)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type G3 = ({ a: string, b, c }: O) => any; // Error +>G3 : Symbol(G3, Decl(renamingDestructuredPropertyInFunctionType.ts, 12, 36)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 13, 12)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 13, 23)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 13, 26)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type G4 = ({ a: string }: O) => any; // Error +>G4 : Symbol(G4, Decl(renamingDestructuredPropertyInFunctionType.ts, 13, 42)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 14, 12)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type G5 = ({ a: string, b, c }: O) => any; // Error +>G5 : Symbol(G5, Decl(renamingDestructuredPropertyInFunctionType.ts, 14, 36)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 10)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 15, 12)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 15, 23)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 15, 26)) +>O : Symbol(O, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0)) + +type G6 = ({ a: string }) => typeof string; // OK +>G6 : Symbol(G6, Decl(renamingDestructuredPropertyInFunctionType.ts, 15, 42)) +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 16, 12)) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 16, 12)) + +type G7 = ({ a: string, b: number }) => typeof number; // Error +>G7 : Symbol(G7, Decl(renamingDestructuredPropertyInFunctionType.ts, 16, 43)) +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 17, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 17, 23)) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 17, 23)) + +type G8 = ({ a, b: number }) => typeof number; // OK +>G8 : Symbol(G8, Decl(renamingDestructuredPropertyInFunctionType.ts, 17, 54)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 18, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 18, 15)) +>number : Symbol(number, Decl(renamingDestructuredPropertyInFunctionType.ts, 18, 15)) + +type G9 = ([a, b, c]) => void; // Error +>G9 : Symbol(G9, Decl(renamingDestructuredPropertyInFunctionType.ts, 18, 46)) +>a : Symbol(a, Decl(renamingDestructuredPropertyInFunctionType.ts, 19, 12)) +>b : Symbol(b, Decl(renamingDestructuredPropertyInFunctionType.ts, 19, 14)) +>c : Symbol(c, Decl(renamingDestructuredPropertyInFunctionType.ts, 19, 17)) + +interface I { +>I : Symbol(I, Decl(renamingDestructuredPropertyInFunctionType.ts, 19, 30)) + + method1(arg: number): any; // OK +>method1 : Symbol(I.method1, Decl(renamingDestructuredPropertyInFunctionType.ts, 21, 13)) +>arg : Symbol(arg, Decl(renamingDestructuredPropertyInFunctionType.ts, 22, 10)) + + method2({ a: string }): any; // Error +>method2 : Symbol(I.method2, Decl(renamingDestructuredPropertyInFunctionType.ts, 22, 28)) +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 23, 11)) + + (arg: number): any; // OK +>arg : Symbol(arg, Decl(renamingDestructuredPropertyInFunctionType.ts, 25, 3)) + + ({ a: string }): any; // Error +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 26, 4)) + + new (arg: number): any; // OK +>arg : Symbol(arg, Decl(renamingDestructuredPropertyInFunctionType.ts, 28, 7)) + + new ({ a: string }): any; // Error +>a : Symbol(a) +>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 29, 8)) +} diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types index 013797280e3..4a4795377a6 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types @@ -1,13 +1,141 @@ === tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts === -type F = ({a: string}) => void; ->F : ({ a }: { a: any; }) => void ->a : any ->string : any +type O = { a: string; b: number; c: number; }; +>O : { a: string; b: number; c: number; } +>a : string +>b : number +>c : number -const f = ({a: string}) => string; ->f : ({ a }: { a: any; }) => any ->({a: string}) => string : ({ a }: { a: any; }) => any +type F1 = (arg: number) => any; // OK +>F1 : (arg: number) => any +>arg : number + +type F2 = ({ a: string }: O) => any; // Error +>F2 : ({ a }: O) => any +>a : any +>string : string + +type F3 = ({ a: string, b, c }: O) => any; // Error +>F3 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type F4 = ({ a: string }: O) => any; // Error +>F4 : ({ a }: O) => any +>a : any +>string : string + +type F5 = ({ a: string, b, c }: O) => any; // Error +>F5 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type F6 = ({ a: string }) => typeof string; // OK +>F6 : ({ a }: { a: any; }) => any >a : any >string : any >string : any +type F7 = ({ a: string, b: number }) => typeof number; // Error +>F7 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>string : any +>b : any +>number : any +>number : any + +type F8 = ({ a, b: number }) => typeof number; // OK +>F8 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>b : any +>number : any +>number : any + +type F9 = ([a, b, c]) => void; // Error +>F9 : ([a, b, c]: [any, any, any]) => void +>a : any +>b : any +>c : any + +type G1 = (arg: number) => any; // OK +>G1 : (arg: number) => any +>arg : number + +type G2 = ({ a: string }: O) => any; // Error +>G2 : ({ a }: O) => any +>a : any +>string : string + +type G3 = ({ a: string, b, c }: O) => any; // Error +>G3 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type G4 = ({ a: string }: O) => any; // Error +>G4 : ({ a }: O) => any +>a : any +>string : string + +type G5 = ({ a: string, b, c }: O) => any; // Error +>G5 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type G6 = ({ a: string }) => typeof string; // OK +>G6 : ({ a }: { a: any; }) => any +>a : any +>string : any +>string : any + +type G7 = ({ a: string, b: number }) => typeof number; // Error +>G7 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>string : any +>b : any +>number : any +>number : any + +type G8 = ({ a, b: number }) => typeof number; // OK +>G8 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>b : any +>number : any +>number : any + +type G9 = ([a, b, c]) => void; // Error +>G9 : ([a, b, c]: [any, any, any]) => void +>a : any +>b : any +>c : any + +interface I { + method1(arg: number): any; // OK +>method1 : (arg: number) => any +>arg : number + + method2({ a: string }): any; // Error +>method2 : ({ a }: { a: any; }) => any +>a : any +>string : any + + (arg: number): any; // OK +>arg : number + + ({ a: string }): any; // Error +>a : any +>string : any + + new (arg: number): any; // OK +>arg : number + + new ({ a: string }): any; // Error +>a : any +>string : any +} diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.errors.txt b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.errors.txt index a99d3c29542..c274d106b1a 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.errors.txt +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.errors.txt @@ -1,14 +1,93 @@ -tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts(1,15): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. -tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts(3,16): error TS7031: Binding element 'string' implicitly has an 'any' type. +tests/cases/compiler/a.d.ts(3,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(4,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(5,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(6,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(7,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(8,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(8,28): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(9,20): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(13,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(14,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(15,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(16,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(17,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(18,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(18,28): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(19,20): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(24,16): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(27,9): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. +tests/cases/compiler/a.d.ts(30,13): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. -==== tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts (2 errors) ==== - type F = ({a: string}) => void; - ~~~~~~ +==== tests/cases/compiler/a.d.ts (19 errors) ==== + type O = { a: string; b: number; c: number; }; + type F1 = (arg: number) => any; + type F2 = ({ a: string }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F3 = ({ a: string, b, c }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F4 = ({ a: string }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F5 = ({ a: string, b, c }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F6 = ({ a: string }) => typeof string; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F7 = ({ a: string, b: number }) => typeof number; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F8 = ({ a, b: number }) => typeof number; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type F9 = ([a, b, c]) => void; + + type G1 = (arg: number) => any; + type G2 = ({ a: string }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G3 = ({ a: string, b, c }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G4 = ({ a: string }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G5 = ({ a: string, b, c }: O) => any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G6 = ({ a: string }) => typeof string; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G7 = ({ a: string, b: number }) => typeof number; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G8 = ({ a, b: number }) => typeof number; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + type G9 = ([a, b, c]) => void; + + interface I { + method1(arg: number): any; + method2({ a: string }): any; + ~~~~~~ !!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. - const f = ({a: string}) => string; - ~~~~~~ -!!! error TS7031: Binding element 'string' implicitly has an 'any' type. + (arg: number): any; + ({ a: string }): any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + + new (arg: number): any; + new ({ a: string }): any; + ~~~~~~ +!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation. + } \ No newline at end of file diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.symbols b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.symbols index 0e5dac47a36..567f4fad622 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.symbols +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.symbols @@ -1,13 +1,153 @@ -=== tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts === -type F = ({a: string}) => void; ->F : Symbol(F, Decl(renamingDestructuredPropertyInFunctionType2.ts, 0, 0)) +=== tests/cases/compiler/a.d.ts === +type O = { a: string; b: number; c: number; }; +>O : Symbol(O, Decl(a.d.ts, 0, 0)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>b : Symbol(b, Decl(a.d.ts, 0, 21)) +>c : Symbol(c, Decl(a.d.ts, 0, 32)) + +type F1 = (arg: number) => any; +>F1 : Symbol(F1, Decl(a.d.ts, 0, 46)) +>arg : Symbol(arg, Decl(a.d.ts, 1, 11)) + +type F2 = ({ a: string }: O) => any; +>F2 : Symbol(F2, Decl(a.d.ts, 1, 31)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 2, 12)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type F3 = ({ a: string, b, c }: O) => any; +>F3 : Symbol(F3, Decl(a.d.ts, 2, 36)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 3, 12)) +>b : Symbol(b, Decl(a.d.ts, 3, 23)) +>c : Symbol(c, Decl(a.d.ts, 3, 26)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type F4 = ({ a: string }: O) => any; +>F4 : Symbol(F4, Decl(a.d.ts, 3, 42)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 4, 12)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type F5 = ({ a: string, b, c }: O) => any; +>F5 : Symbol(F5, Decl(a.d.ts, 4, 36)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 5, 12)) +>b : Symbol(b, Decl(a.d.ts, 5, 23)) +>c : Symbol(c, Decl(a.d.ts, 5, 26)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type F6 = ({ a: string }) => typeof string; +>F6 : Symbol(F6, Decl(a.d.ts, 5, 42)) >a : Symbol(a) ->string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType2.ts, 0, 11)) +>string : Symbol(string, Decl(a.d.ts, 6, 12)) +>string : Symbol(string, Decl(a.d.ts, 6, 12)) -const f = ({a: string}) => string; ->f : Symbol(f, Decl(renamingDestructuredPropertyInFunctionType2.ts, 2, 5)) +type F7 = ({ a: string, b: number }) => typeof number; +>F7 : Symbol(F7, Decl(a.d.ts, 6, 43)) >a : Symbol(a) ->string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType2.ts, 2, 12)) ->string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType2.ts, 2, 12)) +>string : Symbol(string, Decl(a.d.ts, 7, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(a.d.ts, 7, 23)) +>number : Symbol(number, Decl(a.d.ts, 7, 23)) + +type F8 = ({ a, b: number }) => typeof number; +>F8 : Symbol(F8, Decl(a.d.ts, 7, 54)) +>a : Symbol(a, Decl(a.d.ts, 8, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(a.d.ts, 8, 15)) +>number : Symbol(number, Decl(a.d.ts, 8, 15)) + +type F9 = ([a, b, c]) => void; +>F9 : Symbol(F9, Decl(a.d.ts, 8, 46)) +>a : Symbol(a, Decl(a.d.ts, 9, 12)) +>b : Symbol(b, Decl(a.d.ts, 9, 14)) +>c : Symbol(c, Decl(a.d.ts, 9, 17)) + +type G1 = (arg: number) => any; +>G1 : Symbol(G1, Decl(a.d.ts, 9, 30)) +>arg : Symbol(arg, Decl(a.d.ts, 11, 11)) + +type G2 = ({ a: string }: O) => any; +>G2 : Symbol(G2, Decl(a.d.ts, 11, 31)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 12, 12)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type G3 = ({ a: string, b, c }: O) => any; +>G3 : Symbol(G3, Decl(a.d.ts, 12, 36)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 13, 12)) +>b : Symbol(b, Decl(a.d.ts, 13, 23)) +>c : Symbol(c, Decl(a.d.ts, 13, 26)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type G4 = ({ a: string }: O) => any; +>G4 : Symbol(G4, Decl(a.d.ts, 13, 42)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 14, 12)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type G5 = ({ a: string, b, c }: O) => any; +>G5 : Symbol(G5, Decl(a.d.ts, 14, 36)) +>a : Symbol(a, Decl(a.d.ts, 0, 10)) +>string : Symbol(string, Decl(a.d.ts, 15, 12)) +>b : Symbol(b, Decl(a.d.ts, 15, 23)) +>c : Symbol(c, Decl(a.d.ts, 15, 26)) +>O : Symbol(O, Decl(a.d.ts, 0, 0)) + +type G6 = ({ a: string }) => typeof string; +>G6 : Symbol(G6, Decl(a.d.ts, 15, 42)) +>a : Symbol(a) +>string : Symbol(string, Decl(a.d.ts, 16, 12)) +>string : Symbol(string, Decl(a.d.ts, 16, 12)) + +type G7 = ({ a: string, b: number }) => typeof number; +>G7 : Symbol(G7, Decl(a.d.ts, 16, 43)) +>a : Symbol(a) +>string : Symbol(string, Decl(a.d.ts, 17, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(a.d.ts, 17, 23)) +>number : Symbol(number, Decl(a.d.ts, 17, 23)) + +type G8 = ({ a, b: number }) => typeof number; +>G8 : Symbol(G8, Decl(a.d.ts, 17, 54)) +>a : Symbol(a, Decl(a.d.ts, 18, 12)) +>b : Symbol(b) +>number : Symbol(number, Decl(a.d.ts, 18, 15)) +>number : Symbol(number, Decl(a.d.ts, 18, 15)) + +type G9 = ([a, b, c]) => void; +>G9 : Symbol(G9, Decl(a.d.ts, 18, 46)) +>a : Symbol(a, Decl(a.d.ts, 19, 12)) +>b : Symbol(b, Decl(a.d.ts, 19, 14)) +>c : Symbol(c, Decl(a.d.ts, 19, 17)) + +interface I { +>I : Symbol(I, Decl(a.d.ts, 19, 30)) + + method1(arg: number): any; +>method1 : Symbol(I.method1, Decl(a.d.ts, 21, 13)) +>arg : Symbol(arg, Decl(a.d.ts, 22, 10)) + + method2({ a: string }): any; +>method2 : Symbol(I.method2, Decl(a.d.ts, 22, 28)) +>a : Symbol(a) +>string : Symbol(string, Decl(a.d.ts, 23, 11)) + + (arg: number): any; +>arg : Symbol(arg, Decl(a.d.ts, 25, 3)) + + ({ a: string }): any; +>a : Symbol(a) +>string : Symbol(string, Decl(a.d.ts, 26, 4)) + + new (arg: number): any; +>arg : Symbol(arg, Decl(a.d.ts, 28, 7)) + + new ({ a: string }): any; +>a : Symbol(a) +>string : Symbol(string, Decl(a.d.ts, 29, 8)) +} diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.types b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.types index 46bae2330b1..237a2ac3641 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.types +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType2.types @@ -1,14 +1,143 @@ -=== tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts === -type F = ({a: string}) => void; ->F : ({ a }: { a: any; }) => void ->a : any ->string : any +=== tests/cases/compiler/a.d.ts === +type O = { a: string; b: number; c: number; }; +>O : { a: string; b: number; c: number; } +>a : string +>b : number +>c : number -const f = ({a: string}) => string; ->f : ({ a }: { a: any; }) => any ->({a: string}) => string : ({ a }: { a: any; }) => any +type F1 = (arg: number) => any; +>F1 : (arg: number) => any +>arg : number + +type F2 = ({ a: string }: O) => any; +>F2 : ({ a }: O) => any +>a : any +>string : string + +type F3 = ({ a: string, b, c }: O) => any; +>F3 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type F4 = ({ a: string }: O) => any; +>F4 : ({ a }: O) => any +>a : any +>string : string + +type F5 = ({ a: string, b, c }: O) => any; +>F5 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type F6 = ({ a: string }) => typeof string; +>F6 : ({ a }: { a: any; }) => any >a : any >string : any >string : any +type F7 = ({ a: string, b: number }) => typeof number; +>F7 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>string : any +>b : any +>number : any +>number : any + +type F8 = ({ a, b: number }) => typeof number; +>F8 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>b : any +>number : any +>number : any + +type F9 = ([a, b, c]) => void; +>F9 : ([a, b, c]: [any, any, any]) => void +>a : any +>b : any +>c : any + +type G1 = (arg: number) => any; +>G1 : (arg: number) => any +>arg : number + +type G2 = ({ a: string }: O) => any; +>G2 : ({ a }: O) => any +>a : any +>string : string + +type G3 = ({ a: string, b, c }: O) => any; +>G3 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type G4 = ({ a: string }: O) => any; +>G4 : ({ a }: O) => any +>a : any +>string : string + +type G5 = ({ a: string, b, c }: O) => any; +>G5 : ({ a, b, c }: O) => any +>a : any +>string : string +>b : number +>c : number + +type G6 = ({ a: string }) => typeof string; +>G6 : ({ a }: { a: any; }) => any +>a : any +>string : any +>string : any + +type G7 = ({ a: string, b: number }) => typeof number; +>G7 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>string : any +>b : any +>number : any +>number : any + +type G8 = ({ a, b: number }) => typeof number; +>G8 : ({ a, b }: { a: any; b: any; }) => any +>a : any +>b : any +>number : any +>number : any + +type G9 = ([a, b, c]) => void; +>G9 : ([a, b, c]: [any, any, any]) => void +>a : any +>b : any +>c : any + +interface I { + method1(arg: number): any; +>method1 : (arg: number) => any +>arg : number + + method2({ a: string }): any; +>method2 : ({ a }: { a: any; }) => any +>a : any +>string : any + + (arg: number): any; +>arg : number + + ({ a: string }): any; +>a : any +>string : any + + new (arg: number): any; +>arg : number + + new ({ a: string }): any; +>a : any +>string : any +} + diff --git a/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts b/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts index c61bbe96700..b1aeabb429a 100644 --- a/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts +++ b/tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts @@ -1,3 +1,31 @@ -type F = ({a: string}) => void; +type O = { a: string; b: number; c: number; }; +type F1 = (arg: number) => any; // OK +type F2 = ({ a: string }: O) => any; // Error +type F3 = ({ a: string, b, c }: O) => any; // Error +type F4 = ({ a: string }: O) => any; // Error +type F5 = ({ a: string, b, c }: O) => any; // Error +type F6 = ({ a: string }) => typeof string; // OK +type F7 = ({ a: string, b: number }) => typeof number; // Error +type F8 = ({ a, b: number }) => typeof number; // OK +type F9 = ([a, b, c]) => void; // Error -const f = ({a: string}) => string; +type G1 = (arg: number) => any; // OK +type G2 = ({ a: string }: O) => any; // Error +type G3 = ({ a: string, b, c }: O) => any; // Error +type G4 = ({ a: string }: O) => any; // Error +type G5 = ({ a: string, b, c }: O) => any; // Error +type G6 = ({ a: string }) => typeof string; // OK +type G7 = ({ a: string, b: number }) => typeof number; // Error +type G8 = ({ a, b: number }) => typeof number; // OK +type G9 = ([a, b, c]) => void; // Error + +interface I { + method1(arg: number): any; // OK + method2({ a: string }): any; // Error + + (arg: number): any; // OK + ({ a: string }): any; // Error + + new (arg: number): any; // OK + new ({ a: string }): any; // Error +} \ No newline at end of file diff --git a/tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts b/tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts index 9f56fe8a119..3653d833b43 100644 --- a/tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts +++ b/tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts @@ -1,5 +1,33 @@ -// @noImplicitAny: true -type F = ({a: string}) => void; +// @filename: a.d.ts +type O = { a: string; b: number; c: number; }; +type F1 = (arg: number) => any; +type F2 = ({ a: string }: O) => any; +type F3 = ({ a: string, b, c }: O) => any; +type F4 = ({ a: string }: O) => any; +type F5 = ({ a: string, b, c }: O) => any; +type F6 = ({ a: string }) => typeof string; +type F7 = ({ a: string, b: number }) => typeof number; +type F8 = ({ a, b: number }) => typeof number; +type F9 = ([a, b, c]) => void; -const f = ({a: string}) => string; +type G1 = (arg: number) => any; +type G2 = ({ a: string }: O) => any; +type G3 = ({ a: string, b, c }: O) => any; +type G4 = ({ a: string }: O) => any; +type G5 = ({ a: string, b, c }: O) => any; +type G6 = ({ a: string }) => typeof string; +type G7 = ({ a: string, b: number }) => typeof number; +type G8 = ({ a, b: number }) => typeof number; +type G9 = ([a, b, c]) => void; + +interface I { + method1(arg: number): any; + method2({ a: string }): any; + + (arg: number): any; + ({ a: string }): any; + + new (arg: number): any; + new ({ a: string }): any; +}