This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
Type Checking API #227
Labels
feature: planned
A feature that's been accepted into the project's roadmap.
It'd be useful to have a method to determine the type of objects created by Roact in order to validate them more rigorously.
We can expose this through a feature we already have internally,
Type
. The public API would be:Roact.typeOf(object) -> RoactType | nil
Roact.Type
, an enum with these variants, taken from Type.lua:We should be careful not to expose the actual
Type
symbol that we use as a key for these types, which would allow users to impersonate Roact instances.Alternatively, we could have this function return strings instead of enum variants. This would let us keep the set of types we expose open (potentially aiding modularity), but introduce the potential for typos from our users. This has precedent in Lua's
type
and Roblox'stypeof
functions.The text was updated successfully, but these errors were encountered: