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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
=== tests/cases/compiler/strictNullNotNullIndexTypeNoLib.ts ===
type Readonly<T> = {readonly [K in keyof T]: T[K]}
>Readonly : Symbol(Readonly, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 0))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 14))
>K : Symbol(K, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 30))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 14))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 14))
>K : Symbol(K, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 30))
interface A {
>A : Symbol(A, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 50))
params?: { name: string; };
>params : Symbol(A.params, Decl(strictNullNotNullIndexTypeNoLib.ts, 1, 13))
>name : Symbol(name, Decl(strictNullNotNullIndexTypeNoLib.ts, 2, 14))
}
class Test<T extends A> {
>Test : Symbol(Test, Decl(strictNullNotNullIndexTypeNoLib.ts, 3, 1))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 5, 11))
>A : Symbol(A, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 50))
attrs: Readonly<T>;
>attrs : Symbol(Test.attrs, Decl(strictNullNotNullIndexTypeNoLib.ts, 5, 25))
>Readonly : Symbol(Readonly, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 0))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 5, 11))
m() {
>m : Symbol(Test.m, Decl(strictNullNotNullIndexTypeNoLib.ts, 6, 23))
this.attrs.params!.name;
>this.attrs.params!.name : Symbol(name, Decl(strictNullNotNullIndexTypeNoLib.ts, 2, 14))
>this.attrs.params : Symbol(params, Decl(strictNullNotNullIndexTypeNoLib.ts, 1, 13))
>this.attrs : Symbol(Test.attrs, Decl(strictNullNotNullIndexTypeNoLib.ts, 5, 25))
>this : Symbol(Test, Decl(strictNullNotNullIndexTypeNoLib.ts, 3, 1))
>attrs : Symbol(Test.attrs, Decl(strictNullNotNullIndexTypeNoLib.ts, 5, 25))
>params : Symbol(params, Decl(strictNullNotNullIndexTypeNoLib.ts, 1, 13))
>name : Symbol(name, Decl(strictNullNotNullIndexTypeNoLib.ts, 2, 14))
}
}
interface Foo {
>Foo : Symbol(Foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 11, 1))
foo?: number;
>foo : Symbol(Foo.foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 13, 15))
}
class FooClass<P extends Foo = Foo> {
>FooClass : Symbol(FooClass, Decl(strictNullNotNullIndexTypeNoLib.ts, 15, 1))
>P : Symbol(P, Decl(strictNullNotNullIndexTypeNoLib.ts, 17, 15))
>Foo : Symbol(Foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 11, 1))
>Foo : Symbol(Foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 11, 1))
properties: Readonly<P>;
>properties : Symbol(FooClass.properties, Decl(strictNullNotNullIndexTypeNoLib.ts, 17, 37))
>Readonly : Symbol(Readonly, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 0))
>P : Symbol(P, Decl(strictNullNotNullIndexTypeNoLib.ts, 17, 15))
foo(): number {
>foo : Symbol(FooClass.foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 18, 28))
const { foo = 42 } = this.properties;
>foo : Symbol(foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 21, 15))
>this.properties : Symbol(FooClass.properties, Decl(strictNullNotNullIndexTypeNoLib.ts, 17, 37))
>this : Symbol(FooClass, Decl(strictNullNotNullIndexTypeNoLib.ts, 15, 1))
>properties : Symbol(FooClass.properties, Decl(strictNullNotNullIndexTypeNoLib.ts, 17, 37))
return foo;
>foo : Symbol(foo, Decl(strictNullNotNullIndexTypeNoLib.ts, 21, 15))
}
}
class Test2<T extends A> {
>Test2 : Symbol(Test2, Decl(strictNullNotNullIndexTypeNoLib.ts, 24, 1))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 26, 12))
>A : Symbol(A, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 50))
attrs: Readonly<T>;
>attrs : Symbol(Test2.attrs, Decl(strictNullNotNullIndexTypeNoLib.ts, 26, 26))
>Readonly : Symbol(Readonly, Decl(strictNullNotNullIndexTypeNoLib.ts, 0, 0))
>T : Symbol(T, Decl(strictNullNotNullIndexTypeNoLib.ts, 26, 12))
m() {
>m : Symbol(Test2.m, Decl(strictNullNotNullIndexTypeNoLib.ts, 27, 23))
return this.attrs.params!; // Return type should maintain relationship with `T` after being not-null-asserted, ideally
>this.attrs.params : Symbol(params, Decl(strictNullNotNullIndexTypeNoLib.ts, 1, 13))
>this.attrs : Symbol(Test2.attrs, Decl(strictNullNotNullIndexTypeNoLib.ts, 26, 26))
>this : Symbol(Test2, Decl(strictNullNotNullIndexTypeNoLib.ts, 24, 1))
>attrs : Symbol(Test2.attrs, Decl(strictNullNotNullIndexTypeNoLib.ts, 26, 26))
>params : Symbol(params, Decl(strictNullNotNullIndexTypeNoLib.ts, 1, 13))
}
}
|