Skip to content

Commit

Permalink
Accept new baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Apr 28, 2019
1 parent 3050c62 commit 6d60f69
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/baselines/reference/keyofAndIndexedAccess2.errors.txt
Expand Up @@ -204,4 +204,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23
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]'.
}

10 changes: 10 additions & 0 deletions tests/baselines/reference/keyofAndIndexedAccess2.js
Expand Up @@ -125,6 +125,12 @@ 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]'.
}


//// [keyofAndIndexedAccess2.js]
Expand Down Expand Up @@ -207,3 +213,7 @@ function fn(param, cb) {
function fn2(param, cb) {
cb(param[0]);
}
// Repro from #31149
function fn3(param, cb) {
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
}
17 changes: 17 additions & 0 deletions tests/baselines/reference/keyofAndIndexedAccess2.symbols
Expand Up @@ -471,3 +471,20 @@ function fn2<T extends Array<string>>(param: T, cb: (element: T[number]) => void
>param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 123, 38))
}

// Repro from #31149

function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number]) => void) {
>fn3 : Symbol(fn3, Decl(keyofAndIndexedAccess2.ts, 125, 1))
>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13))
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --))
>param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46))
>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13))
>cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55))
>element : Symbol(element, Decl(keyofAndIndexedAccess2.ts, 129, 61))
>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13))

cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
>cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55))
>param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46))
}

16 changes: 16 additions & 0 deletions tests/baselines/reference/keyofAndIndexedAccess2.types
Expand Up @@ -471,3 +471,19 @@ function fn2<T extends Array<string>>(param: T, cb: (element: T[number]) => void
>0 : 0
}

// Repro from #31149

function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number]) => void) {
>fn3 : <T extends readonly string[]>(param: T, cb: (element: T[number]) => void) => void
>param : T
>cb : (element: T[number]) => void
>element : T[number]

cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
>cb(param[0]) : void
>cb : (element: T[number]) => void
>param[0] : string
>param : T
>0 : 0
}

0 comments on commit 6d60f69

Please sign in to comment.