delphirtl
Version:
RTL functions from Delphi
52 lines (51 loc) • 1.55 kB
TypeScript
/**
* Declares a type that extracts common properties or methods of two classes.
* Usage: "type CommonType = CommonMethodsOrProperties<ClassA, ClassB>;"
* To use on multiple classes, nest the definitions: "CommonMethodsOrProperties<ClassA, CommonMethodsOrProperties<ClassB, ClassC>>;"
*
* @type {CommonMethodsOrProperties}
* @template A extends {}
* @template B extends {}
* @category RTL
*/
type CommonMethodsOrProperties<A extends {}, B extends {}> = {
[P in keyof A & keyof B]: A[P] | B[P];
};
/**
* Returns the number of parameters passed to the app
*
* @returns {number}
* @category RTL
*/
declare function ParamCount(): number;
/**
* Returns the index'th argument passed to the app
*
* @param {number} index
* @returns {string}
* @category RTL
*/
declare function ParamStr(index: number): string;
/**
*
* @returns the launcher, ie, node.exe or something that can run Javascript...
* @category RTL
*/
declare function getLauncher(): string;
/**
* Sleeps for the specified number of millisecs.
*
* @async
* @param {number} ms number of ms to sleep
* @returns {unknown}
* @category RTL
*/
declare function sleep(ms: number): Promise<unknown>;
/**
* Used for ignoring any unused types, variables, so that the compiler doesn't complain.
*
* @param {...*} x any number of parameters to ignore
* @category RTL
*/
declare function UNUSED(...x: any): void;
export { ParamCount, ParamCount as getParamCount, ParamStr, ParamStr as getParamStr, sleep, sleep as Sleep, CommonMethodsOrProperties, UNUSED, getLauncher };