@rwk/physics-math
Version:
Math for physics homework problems
70 lines • 2.3 kB
TypeScript
/**
* Predicate/Type Guard for any function.
* @param f
*/
export declare const isFunction: <A extends Function>(f: any) => f is A;
/**
* Generate a unique ID based on a prefix. A different numerical series is produced
* for each prefix.
* @param prefix
* @param sep
*/
export declare function idGen(prefix?: string, sep?: string): string;
/**
* We extend our returned HTML element with Observable's 'viewof' support.
*/
export interface ViewOf<T = any> {
value: T;
}
/**
* A functional version of the throw statement.
* @param msg
*/
export declare const Throw: (msg?: string | Error) => never;
/**
* Convenience function for marking places not yet implemented.
* @param name Optional name for what is not implemented yet.
* @constructor
*/
export declare const NYI: (name?: string | undefined) => never;
/**
* A constructor
*/
export interface Constructor<R, A extends [...any[]] = []> {
new (...args: A): R;
}
/**
* Removes the readonly property from the fields of an object type.
* @typeParam the object type to remove readonly from.
*/
export declare type Writeable<T> = {
-readonly [P in keyof T]: T[P];
};
/**
* Coerce a string into a form suitable for passing to a string interpolator.
*
* @param s
*/
export declare const callSite: (s: string | string[]) => any;
/**
* String template for producing tex. Produces a raw string containing the LaTeX code, unparsed.
* If the katex module is available, it will be used to parse the LaTeX for error-checking
* purposes, but the string will be returned (suitable for later parsing in the end environment).
* @param s
* @param substitutions
*/
export declare const tex: (s: TemplateStringsArray, ...substitutions: any[]) => string;
/**
* Define a @toStringTag for a given class's prototype so that objects show in inspectors with that
* tag even if minified. Can accept either a prototype or a class constructor.
*
* @param proto
* @param tag
*/
export declare const defineTag: (proto: Constructor<any, any> | any, tag: string) => void;
/**
* Return the negation of a predicate.
* @param pred
*/
export declare const not: <T extends any[]>(pred: (...a: T) => boolean) => (...a: T) => boolean;
//# sourceMappingURL=utils.d.ts.map