mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 14:31:28 +00:00
Implement isDefined and isConstant builtins
This commit is contained in:
@ -10,6 +10,10 @@ export declare function isString<T>(value?: T): bool;
|
||||
|
||||
export declare function isArray<T>(value?: T): bool;
|
||||
|
||||
export declare function isDefined(expression: void): bool;
|
||||
|
||||
export declare function isConstant(expression: void): bool;
|
||||
|
||||
export const NaN: f64 = 0 / 0;
|
||||
|
||||
export const Infinity: f64 = 1 / 0;
|
||||
|
4
std/assembly/index.d.ts
vendored
4
std/assembly/index.d.ts
vendored
@ -304,6 +304,10 @@ declare function isReference<T>(value?: any): value is object | string;
|
||||
declare function isString<T>(value?: any): value is string | String;
|
||||
/** Tests if the specified type *or* expression can be used as an array. Compiles to a constant. */
|
||||
declare function isArray<T>(value?: any): value is Array<any>;
|
||||
/** Tests if the specified expression resolves to a defined element. */
|
||||
declare function isDefined(expression: any): bool;
|
||||
/** Tests if the specified expression evaluates to a constant value. */
|
||||
declare function isConstant(expression: any): bool;
|
||||
/** 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. */
|
||||
|
Reference in New Issue
Block a user