You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library aims to provide types and type classes for typechecking interop with Typescript code without the need for conversion.
In conjuction with purescript-readts, purescript bindings for JS libraries which are written in Typescript or have type definitions can be created with little effort.
Types and Typeclasses
IsTSEq a b - Given a standard purescript type a does it match b where b can contain the following types:
Type
TS type
Matches
Any
any
Anything
OneOf (typed :: A, typed :: B, typed :: C)
(A|B|C)
Either one of A,B or C
StringConst "text"
"text"
An exact string
OptionRecord (optional :: A, mandatory :: B) (mandatory :: B)
{optional? : A; mandatory: B }
A record which optionally contains fields from the first row but must contain all the fields specified in the second. All fields are checked with IsTSEq.
In addition to these equivalences the following additional rules apply:
Int will match Number
Effect b matches EffectFn1 a b - very useful for event handlers when you don't need the event.
Nullable a matches a if it's one of the optional properties in OptionRecord.