id | keywords | name | summary | category | ||
---|---|---|---|---|---|---|
as-decorator |
|
@as |
This is the `@as` decorator. |
decorators |
The @as
decorator is commonly used on record types to alias record field names to a different JavaScript attribute name.
This is useful to map to JavaScript attribute names that cannot be expressed in ReScript (such as keywords).
<CodeTab labels={["ReScript", "JS Output"]}>
type action = {
@as("type") type_: string
}
let action = {type_: "ADD_USER"}
var action = {
type: "ADD_USER"
};