Closed
Description
TypeScript Version: 2.2.1
Code
interface Foo {
bar: {
baz: number;
} | null;
}
type Baz = Foo["bar"]["baz"]; // This doesn't compile with the error: "Property 'baz' does not exist on type '{ baz: number; } | null'."
let x: Baz = 0;
Expected behavior:
I would expect there to be a way to specify bar
is non-null, such as Foo["bar!"]
.
Actual behavior:
The code doesn't compile with the following error message:
"Property 'baz' does not exist on type '{ baz: number; } | null'."