Replies: 2 comments 1 reply
-
Gleam is a statically typed language, so all values have to belong to a type. Here you're saying the constructor |
Beta Was this translation helpful? Give feedback.
-
I would like to see records / structs in Gleam instead of having to use custom types all the time. Couple of reasons.
At the moment, when Gleam generates typescript types it translates custom types to classes. class State extends _.CustomType {
constructor(foo: number, bar: string);
foo: number;
bar: string;
} Which feels unnecessary for a thing that only has one variant (maybe there is a good reason for having this with one variant?). type State = { state: number, bar: string } |
Beta Was this translation helpful? Give feedback.
-
I'm just wondering why this is not valid:
Instead I have to wrap the record in a type:
Can someone help me understand this design choice?
Beta Was this translation helpful? Give feedback.
All reactions