Accept new baselines

This commit is contained in:
Anders Hejlsberg 2019-04-28 13:59:05 -07:00
parent 3050c62251
commit 6d60f699ca
4 changed files with 49 additions and 0 deletions

View file

@ -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]'.
}

View file

@ -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]
@ -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]'.
}

View file

@ -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))
}

View file

@ -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
}