mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
assignmentToAnyArrayRestParameters.ts(15,25): error TS2339: Property '0.0' does not exist on type 'string[]'.
|
|
assignmentToAnyArrayRestParameters.ts(18,16): error TS2536: Type '"0.0"' cannot be used to index type 'T'.
|
|
|
|
|
|
==== assignmentToAnyArrayRestParameters.ts (2 errors) ====
|
|
// Repros from #57122
|
|
|
|
function foo<T extends string[]>(
|
|
fa: (s: string, ...args: string[]) => string,
|
|
fb: (s: string, ...args: T) => string
|
|
) {
|
|
const f1: (...args: any) => string = fa;
|
|
const f2: (...args: any[]) => string = fa;
|
|
const f3: (...args: any) => string = fb;
|
|
const f4: (...args: any[]) => string = fb;
|
|
}
|
|
|
|
function bar<T extends string[], K extends number>() {
|
|
type T00 = string[]["0"];
|
|
type T01 = string[]["0.0"]; // Error
|
|
~~~~~
|
|
!!! error TS2339: Property '0.0' does not exist on type 'string[]'.
|
|
type T02 = string[][K | "0"];
|
|
type T10 = T["0"];
|
|
type T11 = T["0.0"]; // Error
|
|
~~~~~~~~
|
|
!!! error TS2536: Type '"0.0"' cannot be used to index type 'T'.
|
|
type T12 = T[K | "0"];
|
|
}
|
|
|