Fork of daniellemaywood.uk/gleam — Wasm codegen work
Something went wrong. Try again.
923 B · 59 lines
Rust
at wasm
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: 2022 The Gleam contributors
use crate::assert_ts_def;
#[test]fn fn_generics_typescript() { assert_ts_def!( r#"pub fn identity(a) -> a { a}"#, );}
#[test]fn record_generics_typescript() { assert_ts_def!( r#"pub type Animal(t) { Cat(type_: t) Dog(type_: t)}
pub fn main() { Cat(type_: 6)}"#, );}
#[test]fn tuple_generics_typescript() { assert_ts_def!( r#"pub fn make_tuple(x: t) -> #(Int, t, Int) { #(0, x, 1)}"#, );}
#[test]fn result_typescript() { assert_ts_def!( r#"pub fn map(result, fun) { case result { Ok(a) -> Ok(fun(a)) Error(e) -> Error(e) } }"#, );}
#[test]fn task_typescript() { assert_ts_def!( r#"pub type Promise(value) pub type Task(a) = fn() -> Promise(a)"#, );}