TypeScript Tutorial #4 - Type Inference

Veröffentlicht am: 17 Juni 2021
auf dem Kanal: Free Tutorial Wale
7
0

#Type #Inference

TypeScript is a typed language. However, it is not mandatory to specify the type of a variable. TypeScript infers types of variables when there is no explicit information available in the form of type annotations.

Types are inferred by TypeScript compiler when:

Variables are initialized

Default values are set for parameters

Function return types are determined

For example,

var a = "some text"

Here, since we are not explicitly defining a: string with a type annotation, TypeScript infers the type of the variable based on the value assigned to the variable. The value of a is a string and hence the type of a is inferred as a string.


Auf dieser Seite können Sie das Online-Video TypeScript Tutorial #4 - Type Inference mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Free Tutorial Wale 17 Juni 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 7 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!