Custom Types
Last updated
Was this helpful?
Last updated
Was this helpful?
FlowScript is a structurally typed language, but it is possible to create named types. Using a named type allows you to deserialize , or write groups of functions operating on the same type of data without a lot of repetition.
Note that all values in this program are still structurally typed. In other words, the following permutation is perfectly valid:
Like functions, types can be generic. Type variables are written in angle brackets after the type name.
In other words, the getEmail function accepts all records which have at least the members defined in the User type. There is no requirement that they be created using the new User construct, and they are allowed to have additional members not listed in the type. (For in-depth information, refer to the .)