TypeScript Tutorial #4 - Type Inference

Publicado em: 17 Junho 2021
no canal de: 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.


Nesta página do site você pode assistir ao vídeo on-line TypeScript Tutorial #4 - Type Inference duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Free Tutorial Wale 17 Junho 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 7 vezes e gostou 0 espectadores. Boa visualização!