Make type checking builtins also accept just a type argument

This commit is contained in:
dcodeIO
2018-04-07 23:31:36 +02:00
parent 8ffc7d463d
commit dcc0e284fb
12 changed files with 1113 additions and 888 deletions

10
std/assembly.d.ts vendored
View File

@ -236,15 +236,15 @@ declare function isNaN<T = f32 | f64>(value: T): bool;
/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */
declare function isFinite<T = f32 | f64>(value: T): bool;
/** Tests if the specified expression is of an integer type and not a reference. Compiles to a constant. */
declare function isInteger(value: any): value is number;
declare function isInteger<T>(value?: any): value is number;
/** Tests if the specified expression is of a float type. Compiles to a constant. */
declare function isFloat(value: any): value is number;
declare function isFloat<T>(value?: any): value is number;
/** Tests if the specified expression is of a reference type. Compiles to a constant. */
declare function isReference(value: any): value is object | string;
declare function isReference<T>(value?: any): value is object | string;
/** Tests if the specified expression can be used ass a string. Compiles to a constant. */
declare function isString(value: any): value is string | String;
declare function isString<T>(value?: any): value is string | String;
/** Tests if the specified expression can be used as an array. Compiles to a constant. */
declare function isArray(value: any): value is Array<any>;
declare function isArray<T>(value?: any): value is Array<any>;
/** Traps if the specified value is not true-ish, otherwise returns the (non-nullable) value. */
declare function assert<T>(isTrueish: T, message?: string): T & object; // any better way to model `: T != null`?
/** Parses an integer string to a 64-bit float. */

View File

@ -1,12 +1,12 @@
export declare function isInteger(value: void): bool;
export declare function isInteger<T>(value?: T): bool;
export declare function isFloat(value: void): bool;
export declare function isFloat<T>(value?: T): bool;
export declare function isReference(value: void): bool;
export declare function isReference<T>(value?: T): bool;
export declare function isString(value: void): bool;
export declare function isString<T>(value?: T): bool;
export declare function isArray(value: void): bool;
export declare function isArray<T>(value?: T): bool;
export declare const NaN: f64; // | f32