#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.
On this page of the site you can watch the video online TypeScript Tutorial #4 - Type Inference with a duration of hours minute second in good quality, which was uploaded by the user Free Tutorial Wale 17 June 2021, share the link with friends and acquaintances, this video has already been watched 7 times on youtube and it was liked by 0 viewers. Enjoy your viewing!