glutinum-org / cli

https://glutinum.net/
59 stars 6 forks source link

Add support for `MappedType` #119

Closed MangelMaxime closed 2 months ago

MangelMaxime commented 2 months ago

TypeScript documentation:

declare const NODES: readonly ["a", "button"];
type Primitives = {
    [E in (typeof NODES)[number]]: boolean;
};

translates into

[<AllowNullLiteral>]
[<Interface>]
type Primitives =
    abstract member a: bool with get, set
    abstract member button: bool with get, set

Example of npm package using this features:

React or similar packages will use this kind of features.

roboz0r commented 2 months ago

An example of this kind of syntax is being used in @radix-ui/react-primitive