This file contains 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
/** | |
* Wether the property is optional in the object or not. | |
* | |
* @example ``` | |
* type Foo = PropertyRequirement<{ a: number }, 'a'>; // 'required' | |
* type Bar = PropertyRequirement<{ b?: number }, 'b'>; // 'optional' | |
* ``` | |
*/ | |
type PropertyRequirement<T, K extends keyof T> = Pick<T, K> extends Required< | |
Pick<T, K> |
This file contains 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
// Function overload arguments (max 50) as unions. | |
// Note that the size of this file is 32kb! | |
type ParametersOfOverloads<T>=T extends{(..._:infer A):unknown;(..._:infer B):unknown;(..._:infer C):unknown;(..._:infer D):unknown;(..._:infer E):unknown;(..._:infer F):unknown;(..._:infer G):unknown;(..._:infer H):unknown;(..._:infer I):unknown;(..._:infer J):unknown;(..._:infer K):unknown;(..._:infer L):unknown;(..._:infer M):unknown;(..._:infer N):unknown;(..._:infer O):unknown;(..._:infer P):unknown;(..._:infer Q):unknown;(..._:infer R):unknown;(..._:infer S):unknown;(..._:infer T):unknown;(..._:infer U):unknown;(..._:infer V):unknown;(..._:infer W):unknown;(..._:infer Q):unknown;(..._:infer Y):unknown;(..._:infer Z):unknown;(..._:infer a):unknown;(..._:infer b):unknown;(..._:infer c):unknown;(..._:infer d):unknown;(..._:infer e):unknown;(..._:infer f):unknown;(..._:infer g):unknown;(..._:infer h):unknown;(..._:infer i):unknown;(..._:infer j):unknown;(..._:infer k):unknown;(..._:infer l):unknown;(..._:infer m) |
This file contains 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
Find: (^|\n)\s*(?:let|const|var)\s+(.+?)\s*=\s*require\s*\(\s*(?:'|")(.+?)(?:'|")\s*\)\s*(;(?:$|\n)|(?:$|\n)) | |
Replace: $1import * as $2 from '$3'$4 |
This file contains 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
import NSwag from 'nswagjs' | |
import * as path from 'path' | |
import * as protoc_swagger_gen from '@accility/protoc-swagger-plugin' | |
import * as protoc_tools from '@accility/protoc-tools' | |
import * as protoc_apis from 'google-proto-files' | |
import * as fs from 'fs' | |
const PATH2GENERATED = path.join(__dirname, 'generated') | |
const PATH2PROTO = path.join(__dirname, 'protos') | |
const PATH2NSWAG = path.join(__dirname, 'node_modules/nswag') |