This article follows on from the first three on the subject ANGULAR and deals with the TypeScript language:
Concept of "assertion type"
Type assertion is a way to tell the TypeScript compiler what type of variable is. Type assertion is similar to type conversion in other languages, but in TypeScript, it's just a compilation function.
let testComplete: any - "Test Assertion type"; let test -<string>(complete test). substring (0.4);</string> console.log(s);
and full test: any - "Test Assertion type"; let test - (testComplete as string).substring (0.4); console.log(s);
The use of function arrow removes the need to use the keyword "function." The settings are switched between brackets <> and the function expression is placed in brackets.
let addition - (a: number, b: number): number return a b; } addition (1, 2);
In line annotation:
In TypeScript, online type annotations allow you to declare an object for each of the object's properties.
let addition - (pairDeNombre - numberA: number,numberB: number' number: number return a b; }
Interfaces allow you to name these types and are a powerful way to define contracts in your code as well as contracts with code outside of your project.
Point interface x: number, y: number }
Link to TypeScript documentation: https://www.typescriptlang.org/docs/home.html