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 bbce336 commit 64174b9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
7 changes: 6 additions & 1 deletion tests/baselines/reference/keyofAndIndexedAccess2.errors.txt
Expand Up @@ -208,6 +208,11 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23
// 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]'.
cb(param[0]);
}

function fn4<K extends number>() {
let x: Array<string>[K] = 'abc';
let y: ReadonlyArray<string>[K] = 'abc';
}

13 changes: 11 additions & 2 deletions tests/baselines/reference/keyofAndIndexedAccess2.js
Expand Up @@ -129,7 +129,12 @@ function fn2<T extends Array<string>>(param: T, cb: (element: T[number]) => void
// 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]'.
cb(param[0]);
}

function fn4<K extends number>() {
let x: Array<string>[K] = 'abc';
let y: ReadonlyArray<string>[K] = 'abc';
}


Expand Down Expand Up @@ -215,5 +220,9 @@ function fn2(param, cb) {
}
// Repro from #31149
function fn3(param, cb) {
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
cb(param[0]);
}
function fn4() {
let x = 'abc';
let y = 'abc';
}
17 changes: 16 additions & 1 deletion tests/baselines/reference/keyofAndIndexedAccess2.symbols
Expand Up @@ -483,8 +483,23 @@ function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number])
>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(param[0]);
>cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55))
>param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46))
}

function fn4<K extends number>() {
>fn4 : Symbol(fn4, Decl(keyofAndIndexedAccess2.ts, 131, 1))
>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13))

let x: Array<string>[K] = 'abc';
>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 134, 7))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more)
>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13))

let y: ReadonlyArray<string>[K] = 'abc';
>y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 135, 7))
>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, --, --))
>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13))
}

14 changes: 13 additions & 1 deletion tests/baselines/reference/keyofAndIndexedAccess2.types
Expand Up @@ -479,11 +479,23 @@ function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number])
>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]);
>cb(param[0]) : void
>cb : (element: T[number]) => void
>param[0] : string
>param : T
>0 : 0
}

function fn4<K extends number>() {
>fn4 : <K extends number>() => void

let x: Array<string>[K] = 'abc';
>x : string[][K]
>'abc' : "abc"

let y: ReadonlyArray<string>[K] = 'abc';
>y : readonly string[][K]
>'abc' : "abc"
}

0 comments on commit 64174b9

Please sign in to comment.