Please enable JavaScript.
Coggle requires JavaScript to display documents.
Angular (Material (CDK), Component (ViewEncapsulation (None, Emulated,…
-
TypeScript
Types
-
Conditional types
function setMeta<T extends TestLAyer | ImageLayer>(layer: T, meta: T extends TextLayer ? TextMeta : ImageMeta) {}
-
-
-
Tuple
type Element = [number, string, "px" | "pt"];
-
-
-
-
-
-
Functions
-
Arrow notation =>
capture this, no need to use self
Rest parameter
function X(name: string, ...ids: number[])
Overload
Multiple signatures, one body
-
-
-
-
-
interface
0 calories, only design time, disappear after transpilation
-
-
-
Modules
Export
-
at the end of the file export {Item1, Item2 as Item}
-
-
Destructuring
Arrays
let medals: string[] = ['gold', 'silver', 'bronze'];
let [first, second, third] = medals;
function fun([book1, book2, ...others]: Book[]) {}
Objects
let person = {name: 'Klara', age: 7};
let { name, age } = person;
let { title: booktitle, author: bookauthor } = book1;
let function fun({ title: booktitle, author: bookauthor }: Book) {}
Tuple
let myTuple: [number, string] = [10, 'Mach'];
-
-
-