TypeScript Type Assertion
Introduction
If you're a Mr(s). Know It All and want to tell the compiler what to do
you can use Type Assertions
.
Syntax
interface Foo {
bar: number
bas: string
}
var foo = {} as Foo
foo.bar = 123
foo.bas = "hello"
If you're a Mr(s). Know It All and want to tell the compiler what to do
you can use Type Assertions
.
interface Foo {
bar: number
bas: string
}
var foo = {} as Foo
foo.bar = 123
foo.bas = "hello"