diff --git a/tests/baselines/reference/typeParameterConstModifiers.errors.txt b/tests/baselines/reference/typeParameterConstModifiers.errors.txt index c46be5e6f26e6..2c2599889367a 100644 --- a/tests/baselines/reference/typeParameterConstModifiers.errors.txt +++ b/tests/baselines/reference/typeParameterConstModifiers.errors.txt @@ -176,6 +176,14 @@ typeParameterConstModifiers.ts(55,9): error TS1277: 'const' modifier can only ap fc1((a: string, b: number) => {}, "hello", 42); fc2((a: string, b: number) => {}, "hello", 42); + declare function fd1(args: T): T; + declare function fd2(args: T): T; + + fd1(["hello", "world"]); + fd1([1, 2, 3]); + fd2(["hello", "world"]); + fd2([1, 2, 3]); + declare function fn1(...args: T): T; fn1({ foo: ["hello", 123] }, { foo: [true]}); diff --git a/tests/baselines/reference/typeParameterConstModifiers.js b/tests/baselines/reference/typeParameterConstModifiers.js index 367f176c7274a..5f6ab4ff0e710 100644 --- a/tests/baselines/reference/typeParameterConstModifiers.js +++ b/tests/baselines/reference/typeParameterConstModifiers.js @@ -170,6 +170,14 @@ declare function fc2(f: (...args: T) => void fc1((a: string, b: number) => {}, "hello", 42); fc2((a: string, b: number) => {}, "hello", 42); +declare function fd1(args: T): T; +declare function fd2(args: T): T; + +fd1(["hello", "world"]); +fd1([1, 2, 3]); +fd2(["hello", "world"]); +fd2([1, 2, 3]); + declare function fn1(...args: T): T; fn1({ foo: ["hello", 123] }, { foo: [true]}); @@ -261,4 +269,8 @@ fb1("hello", 42); fb2("hello", 42); fc1(function (a, b) { }, "hello", 42); fc2(function (a, b) { }, "hello", 42); +fd1(["hello", "world"]); +fd1([1, 2, 3]); +fd2(["hello", "world"]); +fd2([1, 2, 3]); fn1({ foo: ["hello", 123] }, { foo: [true] }); diff --git a/tests/baselines/reference/typeParameterConstModifiers.symbols b/tests/baselines/reference/typeParameterConstModifiers.symbols index 160a354a105e5..12c94fc85fb77 100644 --- a/tests/baselines/reference/typeParameterConstModifiers.symbols +++ b/tests/baselines/reference/typeParameterConstModifiers.symbols @@ -562,16 +562,42 @@ fc2((a: string, b: number) => {}, "hello", 42); >a : Symbol(a, Decl(typeParameterConstModifiers.ts, 167, 5)) >b : Symbol(b, Decl(typeParameterConstModifiers.ts, 167, 15)) -declare function fn1(...args: T): T; ->fn1 : Symbol(fn1, Decl(typeParameterConstModifiers.ts, 167, 47)) +declare function fd1(args: T): T; +>fd1 : Symbol(fd1, Decl(typeParameterConstModifiers.ts, 167, 47)) >T : Symbol(T, Decl(typeParameterConstModifiers.ts, 169, 21)) ->foo : Symbol(foo, Decl(typeParameterConstModifiers.ts, 169, 38)) ->args : Symbol(args, Decl(typeParameterConstModifiers.ts, 169, 59)) +>args : Symbol(args, Decl(typeParameterConstModifiers.ts, 169, 58)) >T : Symbol(T, Decl(typeParameterConstModifiers.ts, 169, 21)) >T : Symbol(T, Decl(typeParameterConstModifiers.ts, 169, 21)) +declare function fd2(args: T): T; +>fd2 : Symbol(fd2, Decl(typeParameterConstModifiers.ts, 169, 70)) +>T : Symbol(T, Decl(typeParameterConstModifiers.ts, 170, 21)) +>args : Symbol(args, Decl(typeParameterConstModifiers.ts, 170, 76)) +>T : Symbol(T, Decl(typeParameterConstModifiers.ts, 170, 21)) +>T : Symbol(T, Decl(typeParameterConstModifiers.ts, 170, 21)) + +fd1(["hello", "world"]); +>fd1 : Symbol(fd1, Decl(typeParameterConstModifiers.ts, 167, 47)) + +fd1([1, 2, 3]); +>fd1 : Symbol(fd1, Decl(typeParameterConstModifiers.ts, 167, 47)) + +fd2(["hello", "world"]); +>fd2 : Symbol(fd2, Decl(typeParameterConstModifiers.ts, 169, 70)) + +fd2([1, 2, 3]); +>fd2 : Symbol(fd2, Decl(typeParameterConstModifiers.ts, 169, 70)) + +declare function fn1(...args: T): T; +>fn1 : Symbol(fn1, Decl(typeParameterConstModifiers.ts, 175, 15)) +>T : Symbol(T, Decl(typeParameterConstModifiers.ts, 177, 21)) +>foo : Symbol(foo, Decl(typeParameterConstModifiers.ts, 177, 38)) +>args : Symbol(args, Decl(typeParameterConstModifiers.ts, 177, 59)) +>T : Symbol(T, Decl(typeParameterConstModifiers.ts, 177, 21)) +>T : Symbol(T, Decl(typeParameterConstModifiers.ts, 177, 21)) + fn1({ foo: ["hello", 123] }, { foo: [true]}); ->fn1 : Symbol(fn1, Decl(typeParameterConstModifiers.ts, 167, 47)) ->foo : Symbol(foo, Decl(typeParameterConstModifiers.ts, 171, 5)) ->foo : Symbol(foo, Decl(typeParameterConstModifiers.ts, 171, 30)) +>fn1 : Symbol(fn1, Decl(typeParameterConstModifiers.ts, 175, 15)) +>foo : Symbol(foo, Decl(typeParameterConstModifiers.ts, 179, 5)) +>foo : Symbol(foo, Decl(typeParameterConstModifiers.ts, 179, 30)) diff --git a/tests/baselines/reference/typeParameterConstModifiers.types b/tests/baselines/reference/typeParameterConstModifiers.types index 37dd7c23df911..79ddb8f8b2476 100644 --- a/tests/baselines/reference/typeParameterConstModifiers.types +++ b/tests/baselines/reference/typeParameterConstModifiers.types @@ -633,6 +633,44 @@ fc2((a: string, b: number) => {}, "hello", 42); >"hello" : "hello" >42 : 42 +declare function fd1(args: T): T; +>fd1 : (args: T) => T +>args : T + +declare function fd2(args: T): T; +>fd2 : (args: T) => T +>args : T + +fd1(["hello", "world"]); +>fd1(["hello", "world"]) : ["hello", "world"] +>fd1 : (args: T) => T +>["hello", "world"] : ["hello", "world"] +>"hello" : "hello" +>"world" : "world" + +fd1([1, 2, 3]); +>fd1([1, 2, 3]) : [1, 2, 3] +>fd1 : (args: T) => T +>[1, 2, 3] : [1, 2, 3] +>1 : 1 +>2 : 2 +>3 : 3 + +fd2(["hello", "world"]); +>fd2(["hello", "world"]) : readonly ["hello", "world"] +>fd2 : (args: T) => T +>["hello", "world"] : ["hello", "world"] +>"hello" : "hello" +>"world" : "world" + +fd2([1, 2, 3]); +>fd2([1, 2, 3]) : readonly [1, 2, 3] +>fd2 : (args: T) => T +>[1, 2, 3] : [1, 2, 3] +>1 : 1 +>2 : 2 +>3 : 3 + declare function fn1(...args: T): T; >fn1 : (...args: T) => T >foo : unknown[] diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterConstModifiers.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterConstModifiers.ts index 6a9e78ff7afad..16a571232004c 100644 --- a/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterConstModifiers.ts +++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterConstModifiers.ts @@ -169,6 +169,14 @@ declare function fc2(f: (...args: T) => void fc1((a: string, b: number) => {}, "hello", 42); fc2((a: string, b: number) => {}, "hello", 42); +declare function fd1(args: T): T; +declare function fd2(args: T): T; + +fd1(["hello", "world"]); +fd1([1, 2, 3]); +fd2(["hello", "world"]); +fd2([1, 2, 3]); + declare function fn1(...args: T): T; fn1({ foo: ["hello", 123] }, { foo: [true]});