-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c66f8de
commit 9bd1a32
Showing
12 changed files
with
130 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/classImplementsMethodWIthTupleArgs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//// [classImplementsMethodWIthTupleArgs.ts] | ||
declare class MySettable implements Settable { | ||
set(option: Record<string, unknown>): void; | ||
set(name: string, value: unknown): void; | ||
} | ||
|
||
interface Settable { | ||
set(...args: [option: Record<string, unknown>] | [name: string, value: unknown] | [name: string]): void; | ||
} | ||
|
||
|
||
//// [classImplementsMethodWIthTupleArgs.js] | ||
"use strict"; |
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/classImplementsMethodWIthTupleArgs.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/classImplementsMethodWIthTupleArgs.ts === | ||
declare class MySettable implements Settable { | ||
>MySettable : Symbol(MySettable, Decl(classImplementsMethodWIthTupleArgs.ts, 0, 0)) | ||
>Settable : Symbol(Settable, Decl(classImplementsMethodWIthTupleArgs.ts, 3, 1)) | ||
|
||
set(option: Record<string, unknown>): void; | ||
>set : Symbol(MySettable.set, Decl(classImplementsMethodWIthTupleArgs.ts, 0, 46), Decl(classImplementsMethodWIthTupleArgs.ts, 1, 47)) | ||
>option : Symbol(option, Decl(classImplementsMethodWIthTupleArgs.ts, 1, 8)) | ||
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) | ||
|
||
set(name: string, value: unknown): void; | ||
>set : Symbol(MySettable.set, Decl(classImplementsMethodWIthTupleArgs.ts, 0, 46), Decl(classImplementsMethodWIthTupleArgs.ts, 1, 47)) | ||
>name : Symbol(name, Decl(classImplementsMethodWIthTupleArgs.ts, 2, 8)) | ||
>value : Symbol(value, Decl(classImplementsMethodWIthTupleArgs.ts, 2, 21)) | ||
} | ||
|
||
interface Settable { | ||
>Settable : Symbol(Settable, Decl(classImplementsMethodWIthTupleArgs.ts, 3, 1)) | ||
|
||
set(...args: [option: Record<string, unknown>] | [name: string, value: unknown] | [name: string]): void; | ||
>set : Symbol(Settable.set, Decl(classImplementsMethodWIthTupleArgs.ts, 5, 20)) | ||
>args : Symbol(args, Decl(classImplementsMethodWIthTupleArgs.ts, 6, 8)) | ||
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
tests/baselines/reference/classImplementsMethodWIthTupleArgs.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== tests/cases/compiler/classImplementsMethodWIthTupleArgs.ts === | ||
declare class MySettable implements Settable { | ||
>MySettable : MySettable | ||
|
||
set(option: Record<string, unknown>): void; | ||
>set : { (option: Record<string, unknown>): void; (name: string, value: unknown): void; } | ||
>option : Record<string, unknown> | ||
|
||
set(name: string, value: unknown): void; | ||
>set : { (option: Record<string, unknown>): void; (name: string, value: unknown): void; } | ||
>name : string | ||
>value : unknown | ||
} | ||
|
||
interface Settable { | ||
set(...args: [option: Record<string, unknown>] | [name: string, value: unknown] | [name: string]): void; | ||
>set : (...args: [option: Record<string, unknown>] | [name: string, value: unknown] | [name: string]) => void | ||
>args : [option: Record<string, unknown>] | [name: string, value: unknown] | [name: string] | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/contextualTupleTypeParameterReadonly.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
tests/cases/compiler/contextualTupleTypeParameterReadonly.ts(10,8): error TS2345: Argument of type '(a: 1 | 2, b: "1" | "2") => void' is not assignable to parameter of type '(...args: readonly [1, "1"] | readonly [2, "2"]) => any'. | ||
Types of parameters 'a' and 'args' are incompatible. | ||
Type 'readonly [1, "1"] | readonly [2, "2"]' is not assignable to type '[a: 1 | 2, b: "1" | "2"]'. | ||
The type 'readonly [1, "1"]' is 'readonly' and cannot be assigned to the mutable type '[a: 1 | 2, b: "1" | "2"]'. | ||
|
||
|
||
==== tests/cases/compiler/contextualTupleTypeParameterReadonly.ts (1 errors) ==== | ||
declare function each<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (fn: (...args: T) => any) => void; | ||
|
||
const cases = [ | ||
[1, '1'], | ||
[2, '2'], | ||
] as const; | ||
|
||
const eacher = each(cases); | ||
|
||
eacher((a, b) => { | ||
~~~~~~~~~~~ | ||
!!! error TS2345: Argument of type '(a: 1 | 2, b: "1" | "2") => void' is not assignable to parameter of type '(...args: readonly [1, "1"] | readonly [2, "2"]) => any'. | ||
!!! error TS2345: Types of parameters 'a' and 'args' are incompatible. | ||
!!! error TS2345: Type 'readonly [1, "1"] | readonly [2, "2"]' is not assignable to type '[a: 1 | 2, b: "1" | "2"]'. | ||
!!! error TS2345: The type 'readonly [1, "1"]' is 'readonly' and cannot be assigned to the mutable type '[a: 1 | 2, b: "1" | "2"]'. | ||
a; | ||
b; | ||
}); | ||
|
||
// TODO: https://github.com/microsoft/TypeScript/issues/53255 | ||
eacher((...args) => { | ||
const [a, b] = args; | ||
a; | ||
b; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/cases/compiler/classImplementsMethodWIthTupleArgs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @strict: true | ||
|
||
declare class MySettable implements Settable { | ||
set(option: Record<string, unknown>): void; | ||
set(name: string, value: unknown): void; | ||
} | ||
|
||
interface Settable { | ||
set(...args: [option: Record<string, unknown>] | [name: string, value: unknown] | [name: string]): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters