Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Apr 28, 2019
1 parent 9c401b4 commit 3050c62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts
Expand Up @@ -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]'.
}

0 comments on commit 3050c62

Please sign in to comment.