mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-26 19:25:41 -05:00
Add regression test
This commit is contained in:
@@ -127,3 +127,9 @@ function fn<T extends {elements: Array<string>} | {elements: Array<number>}>(par
|
||||
function fn2<T extends Array<string>>(param: T, cb: (element: T[number]) => void) {
|
||||
cb(param[0]);
|
||||
}
|
||||
|
||||
// Repro from #31149
|
||||
|
||||
function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number]) => void) {
|
||||
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user