mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 05:58:32 -06:00
Add regression test
This commit is contained in:
parent
68585f2a1e
commit
07d259593a
@ -110,3 +110,13 @@ interface Type {
|
||||
function get123<K extends keyof Type>(): Type[K] {
|
||||
return 123; // Error
|
||||
}
|
||||
|
||||
// Repros from #30938
|
||||
|
||||
function fn<T extends {elements: Array<string>} | {elements: Array<number>}>(param: T, cb: (element: T['elements'][number]) => void) {
|
||||
cb(param.elements[0]);
|
||||
}
|
||||
|
||||
function fn2<T extends Array<string>>(param: T, cb: (element: T[number]) => void) {
|
||||
cb(param[0]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user