gleam
gleam copied to clipboard
Typescript generation: Cannot reproduce example from blog post
On nightly and latest stable.
Given this input:
import gleam/io
pub const answer = 42
pub fn map(result, fun) {
case result {
Ok(a) -> Ok(fun(a))
Error(e) -> Error(e)
}
}
pub fn main() {
map(Ok(456), io.debug)
}
I get
import * as io from "../../gleam_stdlib/dist/gleam/io.d.ts";
import * as _ from "./gleam.d.ts";
export const answer: number;
export function map(result: _.Result<any, any>, fun: (x0: any) => any): _.Result<
any,
any
>;
export function main(): _.Result<number, any>;
map is not generic.
What is the current approach used to test this feature? Are there snapshots for it?
Thank you
What is the current approach used to test this feature? Are there snapshots for it?
Yup, in with the JS tests there is a TS snapshot macro