1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
=== tests/cases/compiler/incrementOnNullAssertion.ts ===
interface Dictionary<T> {
>Dictionary : Symbol(Dictionary, Decl(incrementOnNullAssertion.ts, 0, 0))
>T : Symbol(T, Decl(incrementOnNullAssertion.ts, 0, 21))
[myFavouriteType: string]: T | undefined
>myFavouriteType : Symbol(myFavouriteType, Decl(incrementOnNullAssertion.ts, 1, 5))
>T : Symbol(T, Decl(incrementOnNullAssertion.ts, 0, 21))
}
const x = 'bar'
>x : Symbol(x, Decl(incrementOnNullAssertion.ts, 3, 5))
let foo: Dictionary<number> = {}
>foo : Symbol(foo, Decl(incrementOnNullAssertion.ts, 4, 3))
>Dictionary : Symbol(Dictionary, Decl(incrementOnNullAssertion.ts, 0, 0))
if (foo[x] === undefined) {
>foo : Symbol(foo, Decl(incrementOnNullAssertion.ts, 4, 3))
>x : Symbol(x, Decl(incrementOnNullAssertion.ts, 3, 5))
>undefined : Symbol(undefined)
foo[x] = 1
>foo : Symbol(foo, Decl(incrementOnNullAssertion.ts, 4, 3))
>x : Symbol(x, Decl(incrementOnNullAssertion.ts, 3, 5))
}
else {
let nu = foo[x]
>nu : Symbol(nu, Decl(incrementOnNullAssertion.ts, 9, 7))
>foo : Symbol(foo, Decl(incrementOnNullAssertion.ts, 4, 3))
>x : Symbol(x, Decl(incrementOnNullAssertion.ts, 3, 5))
let n = foo[x]
>n : Symbol(n, Decl(incrementOnNullAssertion.ts, 10, 7))
>foo : Symbol(foo, Decl(incrementOnNullAssertion.ts, 4, 3))
>x : Symbol(x, Decl(incrementOnNullAssertion.ts, 3, 5))
foo[x]!++
>foo : Symbol(foo, Decl(incrementOnNullAssertion.ts, 4, 3))
>x : Symbol(x, Decl(incrementOnNullAssertion.ts, 3, 5))
}
|