ReScript HomeReScript Home
DocsPlaygroundBlogCommunityPackages
  • Playground
  • Blog
  • Community
  • Packages
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact

Syntax Lookup

Enter some language construct you want to know more about.
type rec defines recursive and mutually recursive types.

Use type rec to define recursive types. Combine it with and for mutually recursive types.

Example

ReScriptJS Output
type rec expr =
  | Int(int)
  | Add(expr, expr)
and node = {
  value: expr,
  next: option<node>,
}

References

  • Type

© 2026 The ReScript Project

About
  • Community
  • ReScript Association
Find us on