Initial compile time type check builtins

This commit is contained in:
dcodeIO
2018-03-17 12:54:37 +01:00
parent faac3c31eb
commit 2ed9fac171
15 changed files with 1158 additions and 657 deletions

14
std/portable.d.ts vendored
View File

@ -136,6 +136,20 @@ declare function bswap16<T = i16 | u16 | i32 | u32>(value: T): T;
/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/
declare function changetype<T>(value: any): T;
/** Tests if a 32-bit or 64-bit float is `NaN`. */
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 value is a valid integer. Can't distinguish an integer from an integral float. */
declare function isInteger(value: any): bool;
/** Tests if the specified value is a valid float. Can't distinguish a float from an integer. */
declare function isFloat(value: any): bool;
/** Tests if the specified value is of a reference type. */
declare function isReference(value: any): bool;
/** Tests if the specified value can be used as a string. */
declare function isString(value: any): bool;
/** Tests if the specified value can be used as an array. */
declare function isArray(value: any): bool;
/** Traps if the specified value is not true-ish, otherwise returns the value. */
declare function assert<T>(isTrueish: T | null, message?: string): T;
/** Parses an integer string to a 64-bit float. */