TypeScript 2.4 Flashcards
dynamic import()
Promise-returning; can be await’ed
enum members can contain
string initializers
enums can be used in discriminated union types
type Shape = Circle | Square;
better inferring types, esp. with . . .
generics
TypeScript has always compared parameters in a . . .
bivariant way
a “weak type” is an interface with . . .
all optional params
what is an index signature
index signature to the weak type (i.e. [propName: string]: any) - can be anything as long as it’s not already defined as a property name
even assigning the entire ReadonlyArray back to a ___ is illegal
normal array
values that won’t change: ___ use const whereas ___ use readonly
variables / properties
values that won’t change: ___ use const whereas ___ use readonly
variables / properties
___ get special treatment and undergo ___ when assigning them to other variables, or passing them as arguments
Object literals / excess property checking
type assertion
(i.e. opts as Options)
function type
interface SearchFunc {
(source: string, subString: string): boolean;
}
This index signature states that when a StringArray is indexed with a number, it will return a string.
tagged union type
a union type whose member types all define a discriminant property of a literal type (TS2.0)