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

Syntax Lookup

Enter some language construct you want to know more about.
This is a type parameter.

Types may be declared with type parameters (also known as generics in other languages) to create generalized versions of those types.

Example with one type parameter

ReScriptJS Output
type point2D<'a> = ('a, 'a)

let intPoint: point2D<int> = (1, 2)
let floatPoint: point2D<float> = (1.0, 2.0)

Example with multiple type parameters

ReScriptJS Output
type either<'a, 'b> = This('a) | That('b)

let value1: either<int, string> = This(123)
let value2: either<int, string> = That("Hello")

References

  • Type parameters

© 2025 The ReScript Project

About
  • Community
  • ReScript Association
Find us on