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
| declare const opaque: unique symbol; | |
| type Opaque<T, OpaqueType> = T & { readonly [opaque]: OpaqueType }; | |
| // examples | |
| type Timestamp = Opaque<number, 'Timestamp'>; | |
| const timestamp: Timestamp = Math.random() // Type 'number' is not assignable to type 'Timestamp' |
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
| const createQueue = () => { | |
| let queue = Promise.resolve(); | |
| return <T extends () => any>(task: T) => { | |
| queue = queue.then(() => task()); | |
| }; | |
| }; | |
| const queue = createQueue(); | |
| // example |
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
| #!/bin/bash | |
| ssh-keygen -t ed25519 -f ~/.ssh/id_faustienf | |
| touch ~/.ssh/config | |
| echo " | |
| Host faustienf.github.com | |
| HostName github.com | |
| User faustienf | |
| IdentityFile ~/.ssh/id_faustienf |
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
| // Unility types begin | |
| type Split< | |
| S extends string, | |
| Delimiter extends string | |
| > = S extends `${infer Head}${Delimiter}${infer Tail}` | |
| ? [Head, ...Split<Tail, Delimiter>] | |
| : S extends Delimiter | |
| ? [] | |
| : [S]; |
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
| module.exports = { | |
| create: function (context) { | |
| const checkSpreadStatement = (node) => { | |
| if (!['ObjectExpression', 'ArrayExpression'].includes(node.type)) { | |
| return; | |
| } | |
| const properties = node.properties || node.elements; | |
| properties.forEach((property) => { |
OlderNewer