This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "show_edit_predictions": false, | |
| "collaboration_panel": { | |
| "dock": "left" | |
| }, | |
| "git_panel": { | |
| "dock": "left" | |
| }, | |
| "lsp": { | |
| "vtsls": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // -------------------------------------> 1. Reversing a list | |
| namespace Reverse { | |
| // How does it work? | |
| // 1. check if it`s possible to destructure a param into a tuple where we select first element and spread the rest | |
| // 2.1 if it`s possible, then recursively repeat the first step by putting the first item as a second part of the tuple | |
| // 2.2 if it`s not possible, then return an empty array | |
| type Reverse<A extends unknown[]> = A extends [infer Item, ...infer Rest] ? [...Reverse<Rest>, Item] : []; | |
| type initString = ["doing", "you", "are", "how"]; | |
| type initNumber = [9, 7, 5, 3, 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //==================================================== | |
| // Type-level Typescript | |
| // build-in language in the compiler level | |
| //==================================================== | |
| // 1. Functions ------------------------- | |
| const makeTuple = (a: number, b: string) => [a, b]; | |
| type MakeTuple<T extends number, U extends string> = [T, U]; | |
| // 2. Conditionals ---------------------- |