From 6d60f699cac252ede8c0ab13f4b9b9cb213d8752 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 28 Apr 2019 13:59:05 -0700 Subject: [PATCH] Accept new baselines --- .../reference/keyofAndIndexedAccess2.errors.txt | 6 ++++++ .../reference/keyofAndIndexedAccess2.js | 10 ++++++++++ .../reference/keyofAndIndexedAccess2.symbols | 17 +++++++++++++++++ .../reference/keyofAndIndexedAccess2.types | 16 ++++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 9a937066374ab..0dceb11f57f26 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -204,4 +204,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 function fn2>(param: T, cb: (element: T[number]) => void) { cb(param[0]); } + + // Repro from #31149 + + function fn3>(param: T, cb: (element: T[number]) => void) { + cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.js b/tests/baselines/reference/keyofAndIndexedAccess2.js index 906bcd0eab3de..60409d65a38ff 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.js +++ b/tests/baselines/reference/keyofAndIndexedAccess2.js @@ -125,6 +125,12 @@ function fn} | {elements: Array}>(par function fn2>(param: T, cb: (element: T[number]) => void) { cb(param[0]); } + +// Repro from #31149 + +function fn3>(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]'. +} diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index 24e1a8b0674e7..c82129c4da128 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -471,3 +471,20 @@ function fn2>(param: T, cb: (element: T[number]) => void >param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 123, 38)) } +// Repro from #31149 + +function fn3>(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)) +} + diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index 6c0f3dff934d8..91c6d55a6f531 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -471,3 +471,19 @@ function fn2>(param: T, cb: (element: T[number]) => void >0 : 0 } +// Repro from #31149 + +function fn3>(param: T, cb: (element: T[number]) => void) { +>fn3 : (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 +} +