js

    This package is deprecated. https://mooncakes.io/docs/moonbit-community/js-ffi should be preferred.

    javascript
    interoperation
    Download zip
    Author
    Version
    0.1.2
    License
    Apache-2.0
    Last updated
    7 months ago
    Downloads
    17

    #sennenki/js

    Yet another JavaScript binding library for mbt test.

    This library provides a set of types and functions to interact with JavaScript values from mbt test, focusing on type safety and idiomatic mbt test usage where possible.

    #Features

    • Core JS Types: bindings for Any, Undefined, Null, Symbol, Object.
    • Promises: Full Promise support including creating, chaining (then, catch_, finally_), and combinators (all, race, any).
    • Traits: Implementation of standard traits (Show, Eq, Compare, Default, Hash) for JS types.
    • Safety: Helper wrapper types Nullable[T] and Nullish[T] to handle JS nullability safely.

    #Usage

    #Basic Types

    let a = Any::new(42)
    println(a.is_number()) // true

    let obj = Object::new()
    obj.set("key", 100)
    let val : Int = obj.get("key")
    println(val) // 100

    #Promises

    let p = Promise::new(fn(resolve, _reject) {
    // Simulate async work
    resolve(42)
    })

    let _ = p.map(fn(val) { val + 1 })
    .map(fn(val) { println(val) }) // Prints 43

    #Async/Await

    You can convert async functions to Promises:

    let p = Promise::from_async(async fn() {
    let val = 100
    val
    })

    #Handling Null and Undefined

    let x : Nullable[Int] = Nullable::new(10)
    let y : Nullable[Int] = Nullable::null()

    match x.to_option() {
    Some(v) => println(v)
    None => println("null")
    }

    let z : Nullish[Int] = Nullish::undefined()
    // ...

    #Comparisons and Equality

    JS strict equality (===) is used for Eq implementation. Abstract comparison is used for Compare.

    let a = Any::new(1)
    let b = Any::new(1)
    println(a == b) // true

    StringOrSymbol

    pub trait StringOrSymbol {
    }

    Trait for types that can be used as object keys (String or Symbol).

    Any

    #external
    pub type Any

    Represents TypeScript type any.
    impl Compare for Any
    impl Eq for Any
    impl Show for Any

    Any::is_bigint

    fn Any::is_bigint(self : Any) -> Bool

    Checks if the any is a bigint.

    Any::is_boolean

    fn Any::is_boolean(self : Any) -> Bool

    Checks if the any is a boolean.

    Any::is_function

    fn Any::is_function(self : Any) -> Bool

    Checks if the any is a function.

    Any::is_null

    fn Any::is_null(self : Any) -> Bool

    Checks if the any is null.

    Any::is_number

    fn Any::is_number(self : Any) -> Bool

    Checks if the any is a number.

    Any::is_object

    fn Any::is_object(self : Any) -> Bool

    Checks if the any is an object (excluding null).

    Any::is_object_or_null

    fn Any::is_object_or_null(self : Any) -> Bool

    Checks if the any is an object or null.

    Any::is_string

    fn Any::is_string(self : Any) -> Bool

    Checks if the any is a string.

    Any::is_symbol

    fn Any::is_symbol(self : Any) -> Bool

    Checks if the any is a symbol.

    Any::is_undefined

    fn Any::is_undefined(self : Any) -> Bool

    Checks if the any is undefined.

    Any::new

    fn[T] Any::new(obj : T) -> Any

    Creates an any from arbitrary object.

    Any::unsafe_as

    fn[T] Any::unsafe_as(obj : Any) -> T

    Casts an any to arbitrary type without runtime check.

    Null

    #external
    pub type Null

    Represents the null value in JavaScript.
    impl Compare for Null
    impl Default for Null
    impl Eq for Null
    impl Hash for Null
    impl Show for Null

    Null::new

    fn Null::new() -> Null

    Creates a null value.

    Nullable

    #external
    pub type Nullable[T]

    Represents a value that can be null.
    impl Compare for Nullable[T]
    impl Eq for Nullable[T]
    impl Hash for Nullable[T]
    impl Show for Nullable[T]

    Nullable::from_nullish

    fn[T] Nullable::from_nullish(nullish : Nullish[T]) -> Nullable[T]

    Creates a Nullable from a Nullish.

    Nullable::from_option

    fn[T] Nullable::from_option(opt : T?) -> Nullable[T]

    Creates a Nullable from an Option.

    Nullable::is_null

    fn[T] Nullable::is_null(self : Nullable[T]) -> Bool

    Checks if the value is null.

    Nullable::new

    fn[T] Nullable::new(value : T) -> Nullable[T]

    Creates a Nullable from a value.

    Nullable::null

    fn[T] Nullable::null() -> Nullable[T]

    Creates a null Nullable.

    Nullable::to_option

    fn[T] Nullable::to_option(self : Nullable[T]) -> T?

    Converts to an Option.

    Nullable::unwrap

    fn[T] Nullable::unwrap(self : Nullable[T]) -> T

    Unwraps the value. Unsafe if null.

    Nullish

    #external
    pub type Nullish[T]

    Represents a value that can be null or undefined.
    impl Compare for Nullish[T]
    impl Eq for Nullish[T]
    impl Hash for Nullish[T]
    impl Show for Nullish[T]

    Nullish::from_nullable

    fn[T] Nullish::from_nullable(nullable : Nullable[T]) -> Nullish[T]

    Creates a Nullish from a Nullable.

    Nullish::from_option

    fn[T] Nullish::from_option(opt : T?) -> Nullish[T]

    Creates a Nullish from an Option.

    Nullish::is_defined

    fn[T] Nullish::is_defined(self : Nullish[T]) -> Bool

    Checks if the value is defined (not null or undefined).

    Nullish::is_null

    fn[T] Nullish::is_null(self : Nullish[T]) -> Bool

    Checks if the value is null.

    Nullish::is_null_or_undefined

    fn[T] Nullish::is_null_or_undefined(self : Nullish[T]) -> Bool

    Checks if the value is null or undefined.

    Nullish::is_undefined

    fn[T] Nullish::is_undefined(self : Nullish[T]) -> Bool

    Checks if the value is undefined.

    Nullish::new

    fn[T] Nullish::new(value : T) -> Nullish[T]

    Creates a Nullish from a value.

    Nullish::null

    fn[T] Nullish::null() -> Nullish[T]

    Creates a null Nullish.

    Nullish::to_nullable

    fn[T] Nullish::to_nullable(self : Nullish[T]) -> Nullable[T]

    Converts to a Nullable.

    Nullish::to_option

    fn[T] Nullish::to_option(self : Nullish[T]) -> T?

    Converts to an Option.

    Nullish::undefined

    fn[T] Nullish::undefined() -> Nullish[T]

    Creates an undefined Nullish.

    Nullish::unwrap

    fn[T] Nullish::unwrap(self : Nullish[T]) -> T

    Unwraps the value. Unsafe if null or undefined.

    Object

    #external
    pub type Object

    Represents a JavaScript Object.
    impl Compare for Object
    impl Default for Object
    impl Eq for Object
    impl Show for Object

    Object::from_pair

    fn[K : StringOrSymbol, T] Object::from_pair(key : K, val : T) -> Object

    Creates an Object with a single key-value pair.

    Object::get

    #alias("_[_]")
    fn[K : StringOrSymbol, T] Object::get(self : Object, key : K) -> T

    Gets a property from the object.

    Object::new

    fn Object::new() -> Object

    Creates a new empty Object.

    Object::set

    #alias("_[_]=_")
    fn[K : StringOrSymbol, T] Object::set(self : Object, key : K, val : T) -> Unit

    Sets a property on the object.

    Object::unsafe_as

    fn[T] Object::unsafe_as(self : Object) -> T

    Casts the object to an arbitrary type.

    Promise

    #external
    pub type Promise[T]

    Represents a JavaScript Promise.

    Promise::all

    fn[T] Promise::all(iterable : Array[Promise[T]]) -> Promise[Array[T]]

    Returns a single Promise that resolves when all of the promises in the iterable argument have resolved or when the iterable argument contains no promises. It rejects with the reason of the first promise that rejects.

    Promise::any

    fn[T] Promise::any(iterable : Array[Promise[T]]) -> Promise[T]

    Returns a single Promise that resolves as soon as any of the promises in the iterable fulfills, with the value of the fulfilled promise. If no promises in the iterable fulfill (if all of the given promises are rejected), then the returned promise is rejected with an AggregateError.

    Promise::catch_

    fn[T, U] Promise::catch_(self : Promise[T], f : (Any) -> U) -> Promise[U]

    Catches a rejection with a function that returns a value.

    Promise::finally_

    fn[T] Promise::finally_(self : Promise[T], onfinally : () -> Unit) -> Promise[T]

    Adds a handler to be called when the Promise is settled (either fulfilled or rejected).

    Promise::flat_except

    fn[T, U] Promise::flat_except(self : Promise[T], f : (Any) -> Promise[U]) -> Promise[U]

    Catches a rejection with a function that returns another Promise.

    Promise::flat_map

    fn[T, U] Promise::flat_map(self : Promise[T], f : (T) -> Promise[U]) -> Promise[U]

    Chains a Promise with a function that returns another Promise.

    Promise::flatten

    fn[T] Promise::flatten(self : Promise[Promise[T]]) -> Promise[T]

    Flattens a Promise of a Promise.

    Promise::from_async

    fn[T] Promise::from_async(f : async () -> T) -> Promise[T]

    Converts an async function which may raise error to a Promise.

    Promise::map

    fn[T, U] Promise::map(self : Promise[T], f : (T) -> U) -> Promise[U]

    Chains a Promise with a function that returns a value.

    Promise::new

    fn[T] Promise::new(executor : ((T) -> Unit, (Any) -> Unit) -> Unit) -> Promise[T]

    Creates a new Promise.

    Promise::race

    fn[T] Promise::race(iterable : Array[Promise[T]]) -> Promise[T]

    Returns a promise that fulfills or rejects as soon as one of the promises in an iterable fulfills or rejects, with the value or reason from that promise.

    Promise::reject

    fn[T] Promise::reject(reason : Any) -> Promise[T]

    Creates a Promise that is rejected with the given reason.

    Promise::resolve

    fn[T] Promise::resolve(value : T) -> Promise[T]

    Creates a Promise that is resolved with the given value.

    Promise::with_resolvers

    fn[T] Promise::with_resolvers() -> Resolvers[T]

    Creates a new Promise and returns the resolve and reject functions along with the promise.

    Resolvers

    pub struct Resolvers[T] {
    promise : Promise[T]
    resolve : (T) -> Unit
    reject : (Any) -> Unit
    }

    Represents a set of functions to resolve or reject a Promise.

    Symbol

    #external
    pub type Symbol

    Represents a JavaScript Symbol.
    impl Compare for Symbol
    impl Eq for Symbol
    impl Show for Symbol

    Symbol::from_string_existing

    fn Symbol::from_string_existing(name : String) -> Symbol

    Returns a Symbol for the given key from the global symbol registry.

    Symbol::from_string_fresh

    fn Symbol::from_string_fresh(name : String) -> Symbol

    Creates a new unique Symbol with a description.

    Symbol::key

    fn Symbol::key(self : Symbol) -> String?

    Returns the key for the given Symbol from the global symbol registry.

    Symbol::new

    fn Symbol::new() -> Symbol

    Creates a new unique Symbol.
    type U2[T1, T2]

    Represents TypeScript union T1 | T2.

    U2::from_t1

    fn[T1, T2] U2::from_t1(obj : T1) -> U2[T1, T2]

    Creates a U2 from T1.

    U2::from_t2

    fn[T1, T2] U2::from_t2(obj : T2) -> U2[T1, T2]

    Creates a U2 from T2.

    U2::unsafe_as_t1

    fn[T1, T2] U2::unsafe_as_t1(self : U2[T1, T2]) -> T1

    Casts a U2 to T1 without runtime check.

    U2::unsafe_as_t2

    fn[T1, T2] U2::unsafe_as_t2(self : U2[T1, T2]) -> T2

    Casts a U2 to T2 without runtime check.
    type U3[T1, T2, T3]

    Represents TypeScript union T1 | T2 | T3.

    U3::from_t1

    fn[T1, T2, T3] U3::from_t1(obj : T1) -> U3[T1, T2, T3]

    Creates a U3 from T1.

    U3::from_t2

    fn[T1, T2, T3] U3::from_t2(obj : T2) -> U3[T1, T2, T3]

    Creates a U3 from T2.

    U3::from_t3

    fn[T1, T2, T3] U3::from_t3(obj : T3) -> U3[T1, T2, T3]

    Creates a U3 from T3.

    U3::unsafe_as_t1

    fn[T1, T2, T3] U3::unsafe_as_t1(self : U3[T1, T2, T3]) -> T1

    Casts a U3 to T1 without runtime check.

    U3::unsafe_as_t2

    fn[T1, T2, T3] U3::unsafe_as_t2(self : U3[T1, T2, T3]) -> T2

    Casts a U3 to T2 without runtime check.

    U3::unsafe_as_t3

    fn[T1, T2, T3] U3::unsafe_as_t3(self : U3[T1, T2, T3]) -> T3

    Casts a U3 to T3 without runtime check.
    type U4[T1, T2, T3, T4]

    Represents TypeScript union T1 | T2 | T3 | T4.

    U4::from_t1

    fn[T1, T2, T3, T4] U4::from_t1(obj : T1) -> U4[T1, T2, T3, T4]

    Creates a U4 from T1.

    U4::from_t2

    fn[T1, T2, T3, T4] U4::from_t2(obj : T2) -> U4[T1, T2, T3, T4]

    Creates a U4 from T2.

    U4::from_t3

    fn[T1, T2, T3, T4] U4::from_t3(obj : T3) -> U4[T1, T2, T3, T4]

    Creates a U4 from T3.

    U4::from_t4

    fn[T1, T2, T3, T4] U4::from_t4(obj : T4) -> U4[T1, T2, T3, T4]

    Creates a U4 from T4.

    U4::unsafe_as_t1

    fn[T1, T2, T3, T4] U4::unsafe_as_t1(self : U4[T1, T2, T3, T4]) -> T1

    Casts a U4 to T1 without runtime check.

    U4::unsafe_as_t2

    fn[T1, T2, T3, T4] U4::unsafe_as_t2(self : U4[T1, T2, T3, T4]) -> T2

    Casts a U4 to T2 without runtime check.

    U4::unsafe_as_t3

    fn[T1, T2, T3, T4] U4::unsafe_as_t3(self : U4[T1, T2, T3, T4]) -> T3

    Casts a U4 to T3 without runtime check.

    U4::unsafe_as_t4

    fn[T1, T2, T3, T4] U4::unsafe_as_t4(self : U4[T1, T2, T3, T4]) -> T4

    Casts a U4 to T4 without runtime check.
    type U5[T1, T2, T3, T4, T5]

    Represents TypeScript union T1 | T2 | T3 | T4 | T5.

    U5::from_t1

    fn[T1, T2, T3, T4, T5] U5::from_t1(obj : T1) -> U5[T1, T2, T3, T4, T5]

    Creates a U5 from T1.

    U5::from_t2

    fn[T1, T2, T3, T4, T5] U5::from_t2(obj : T2) -> U5[T1, T2, T3, T4, T5]

    Creates a U5 from T2.

    U5::from_t3

    fn[T1, T2, T3, T4, T5] U5::from_t3(obj : T3) -> U5[T1, T2, T3, T4, T5]

    Creates a U5 from T3.

    U5::from_t4

    fn[T1, T2, T3, T4, T5] U5::from_t4(obj : T4) -> U5[T1, T2, T3, T4, T5]

    Creates a U5 from T4.

    U5::from_t5

    fn[T1, T2, T3, T4, T5] U5::from_t5(obj : T5) -> U5[T1, T2, T3, T4, T5]

    Creates a U5 from T5.

    U5::unsafe_as_t1

    fn[T1, T2, T3, T4, T5] U5::unsafe_as_t1(self : U5[T1, T2, T3, T4, T5]) -> T1

    Casts a U5 to T1 without runtime check.

    U5::unsafe_as_t2

    fn[T1, T2, T3, T4, T5] U5::unsafe_as_t2(self : U5[T1, T2, T3, T4, T5]) -> T2

    Casts a U5 to T2 without runtime check.

    U5::unsafe_as_t3

    fn[T1, T2, T3, T4, T5] U5::unsafe_as_t3(self : U5[T1, T2, T3, T4, T5]) -> T3

    Casts a U5 to T3 without runtime check.

    U5::unsafe_as_t4

    fn[T1, T2, T3, T4, T5] U5::unsafe_as_t4(self : U5[T1, T2, T3, T4, T5]) -> T4

    Casts a U5 to T4 without runtime check.

    U5::unsafe_as_t5

    fn[T1, T2, T3, T4, T5] U5::unsafe_as_t5(self : U5[T1, T2, T3, T4, T5]) -> T5

    Casts a U5 to T5 without runtime check.
    type U6[T1, T2, T3, T4, T5, T6]

    Represents TypeScript union T1 | T2 | T3 | T4 | T5 | T6.

    U6::from_t1

    fn[T1, T2, T3, T4, T5, T6] U6::from_t1(obj : T1) -> U6[T1, T2, T3, T4, T5, T6]

    Creates a U6 from T1.

    U6::from_t2

    fn[T1, T2, T3, T4, T5, T6] U6::from_t2(obj : T2) -> U6[T1, T2, T3, T4, T5, T6]

    Creates a U6 from T2.

    U6::from_t3

    fn[T1, T2, T3, T4, T5, T6] U6::from_t3(obj : T3) -> U6[T1, T2, T3, T4, T5, T6]

    Creates a U6 from T3.

    U6::from_t4

    fn[T1, T2, T3, T4, T5, T6] U6::from_t4(obj : T4) -> U6[T1, T2, T3, T4, T5, T6]

    Creates a U6 from T4.

    U6::from_t5

    fn[T1, T2, T3, T4, T5, T6] U6::from_t5(obj : T5) -> U6[T1, T2, T3, T4, T5, T6]

    Creates a U6 from T5.

    U6::from_t6

    fn[T1, T2, T3, T4, T5, T6] U6::from_t6(obj : T6) -> U6[T1, T2, T3, T4, T5, T6]

    Creates a U6 from T6.

    U6::unsafe_as_t1

    fn[T1, T2, T3, T4, T5, T6] U6::unsafe_as_t1(self : U6[T1, T2, T3, T4, T5, T6]) -> T1

    Casts a U6 to T1 without runtime check.

    U6::unsafe_as_t2

    fn[T1, T2, T3, T4, T5, T6] U6::unsafe_as_t2(self : U6[T1, T2, T3, T4, T5, T6]) -> T2

    Casts a U6 to T2 without runtime check.

    U6::unsafe_as_t3

    fn[T1, T2, T3, T4, T5, T6] U6::unsafe_as_t3(self : U6[T1, T2, T3, T4, T5, T6]) -> T3

    Casts a U6 to T3 without runtime check.

    U6::unsafe_as_t4

    fn[T1, T2, T3, T4, T5, T6] U6::unsafe_as_t4(self : U6[T1, T2, T3, T4, T5, T6]) -> T4

    Casts a U6 to T4 without runtime check.

    U6::unsafe_as_t5

    fn[T1, T2, T3, T4, T5, T6] U6::unsafe_as_t5(self : U6[T1, T2, T3, T4, T5, T6]) -> T5

    Casts a U6 to T5 without runtime check.

    U6::unsafe_as_t6

    fn[T1, T2, T3, T4, T5, T6] U6::unsafe_as_t6(self : U6[T1, T2, T3, T4, T5, T6]) -> T6

    Casts a U6 to T6 without runtime check.
    type U7[T1, T2, T3, T4, T5, T6, T7]

    Represents TypeScript union T1 | T2 | T3 | T4 | T5 | T6 | T7.

    U7::from_t1

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t1(obj : T1) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T1.

    U7::from_t2

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t2(obj : T2) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T2.

    U7::from_t3

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t3(obj : T3) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T3.

    U7::from_t4

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t4(obj : T4) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T4.

    U7::from_t5

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t5(obj : T5) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T5.

    U7::from_t6

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t6(obj : T6) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T6.

    U7::from_t7

    fn[T1, T2, T3, T4, T5, T6, T7] U7::from_t7(obj : T7) -> U7[T1, T2, T3, T4, T5, T6, T7]

    Creates a U7 from T7.

    U7::unsafe_as_t1

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t1(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T1

    Casts a U7 to T1 without runtime check.

    U7::unsafe_as_t2

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t2(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T2

    Casts a U7 to T2 without runtime check.

    U7::unsafe_as_t3

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t3(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T3

    Casts a U7 to T3 without runtime check.

    U7::unsafe_as_t4

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t4(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T4

    Casts a U7 to T4 without runtime check.

    U7::unsafe_as_t5

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t5(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T5

    Casts a U7 to T5 without runtime check.

    U7::unsafe_as_t6

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t6(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T6

    Casts a U7 to T6 without runtime check.

    U7::unsafe_as_t7

    fn[T1, T2, T3, T4, T5, T6, T7] U7::unsafe_as_t7(self : U7[T1, T2, T3, T4, T5, T6, T7]) -> T7

    Casts a U7 to T7 without runtime check.
    type U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Represents TypeScript union T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8.

    U8::from_t1

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t1(obj : T1) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T1.

    U8::from_t2

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t2(obj : T2) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T2.

    U8::from_t3

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t3(obj : T3) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T3.

    U8::from_t4

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t4(obj : T4) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T4.

    U8::from_t5

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t5(obj : T5) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T5.

    U8::from_t6

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t6(obj : T6) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T6.

    U8::from_t7

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t7(obj : T7) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T7.

    U8::from_t8

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::from_t8(obj : T8) -> U8[T1, T2, T3, T4, T5, T6, T7, T8]

    Creates a U8 from T8.

    U8::unsafe_as_t1

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t1(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T1

    Casts a U8 to T1 without runtime check.

    U8::unsafe_as_t2

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t2(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T2

    Casts a U8 to T2 without runtime check.

    U8::unsafe_as_t3

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t3(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T3

    Casts a U8 to T3 without runtime check.

    U8::unsafe_as_t4

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t4(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T4

    Casts a U8 to T4 without runtime check.

    U8::unsafe_as_t5

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t5(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T5

    Casts a U8 to T5 without runtime check.

    U8::unsafe_as_t6

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t6(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T6

    Casts a U8 to T6 without runtime check.

    U8::unsafe_as_t7

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t7(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T7

    Casts a U8 to T7 without runtime check.

    U8::unsafe_as_t8

    fn[T1, T2, T3, T4, T5, T6, T7, T8] U8::unsafe_as_t8(self : U8[T1, T2, T3, T4, T5, T6, T7, T8]) -> T8

    Casts a U8 to T8 without runtime check.
    type U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Represents TypeScript union T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9.

    U9::from_t1

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t1(obj : T1) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T1.

    U9::from_t2

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t2(obj : T2) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T2.

    U9::from_t3

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t3(obj : T3) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T3.

    U9::from_t4

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t4(obj : T4) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T4.

    U9::from_t5

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t5(obj : T5) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T5.

    U9::from_t6

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t6(obj : T6) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T6.

    U9::from_t7

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t7(obj : T7) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T7.

    U9::from_t8

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t8(obj : T8) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T8.

    U9::from_t9

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::from_t9(obj : T9) -> U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]

    Creates a U9 from T9.

    U9::unsafe_as_t1

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t1(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T1

    Casts a U9 to T1 without runtime check.

    U9::unsafe_as_t2

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t2(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T2

    Casts a U9 to T2 without runtime check.

    U9::unsafe_as_t3

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t3(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T3

    Casts a U9 to T3 without runtime check.

    U9::unsafe_as_t4

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t4(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T4

    Casts a U9 to T4 without runtime check.

    U9::unsafe_as_t5

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t5(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T5

    Casts a U9 to T5 without runtime check.

    U9::unsafe_as_t6

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t6(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T6

    Casts a U9 to T6 without runtime check.

    U9::unsafe_as_t7

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t7(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T7

    Casts a U9 to T7 without runtime check.

    U9::unsafe_as_t8

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t8(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T8

    Casts a U9 to T8 without runtime check.

    U9::unsafe_as_t9

    fn[T1, T2, T3, T4, T5, T6, T7, T8, T9] U9::unsafe_as_t9(self : U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) -> T9

    Casts a U9 to T9 without runtime check.

    Undefined

    #external
    pub type Undefined

    Represents the undefined value in JavaScript.
    impl Eq for Undefined
    impl Hash for Undefined
    impl Show for Undefined

    Undefined::new

    fn Undefined::new() -> Undefined

    Creates an undefined value.

    run_async

    fn run_async(f : async () -> Unit noraise) -> Unit

    Runs an async function.

    unsafe_as

    fn[T, U] unsafe_as(obj : T) -> U

    Cast Between any two types without runtime check.