Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Add Type Checking API #230

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

MisterUncloaked
Copy link
Contributor

Closes #227

Added a public API for type checking in Roact

  • Added nameOf function to Type to lookup the string name for any Type
  • Added TypeMirror module which exposes a subset of types in Type without exposing the internal Roact symbols
  • Added Roact.Type and Roact.typeOf to expose a type checking API for external use

Checklist before submitting:

  • Added entry to CHANGELOG.md
  • Added/updated relevant tests
  • Added/updated documentation

Added a public API for type checking in Roact

- Added nameOf function to Type to lookup the string name for any Type
- Added TypeMirror module which exposes a subset of types in Type without exposing the internal Roact symbols
- Added Roact.Type and Roact.typeOf to expose a type checking API for external use
@coveralls
Copy link

coveralls commented Aug 9, 2019

Coverage Status

Coverage increased (+0.4%) to 93.683% when pulling 666d7a9 on MisterUncloaked:type-checking-api into 9493406 on Roblox:master.

src/TypeMirror.lua Outdated Show resolved Hide resolved
src/TypeMirror.lua Outdated Show resolved Hide resolved
src/Type.lua Show resolved Hide resolved
src/TypeMirror.lua Show resolved Hide resolved
src/TypeMirror.spec.lua Outdated Show resolved Hide resolved
- removed userdata dance in TypeMirror.lua
- removed redundant checks in TypeMirror.lua
- removed redundant declaration of allowed Roact types
@MisterUncloaked
Copy link
Contributor Author

This PR is ready for another pass - tests and docs are updated with Roact.isComponent (formerly Roact.isValidElementType)

@MisterUncloaked
Copy link
Contributor Author

This PR should be ready to go at this point.

docs/advanced/type-validation.md Outdated Show resolved Hide resolved
docs/advanced/type-validation.md Outdated Show resolved Hide resolved
docs/advanced/type-validation.md Outdated Show resolved Hide resolved
docs/api-reference.md Outdated Show resolved Hide resolved
src/TypeMirror.lua Outdated Show resolved Hide resolved
src/TypeMirror.spec.lua Show resolved Hide resolved
- removed Without Type Checking example that used undocumented internals
- removed info blurb about only accepting component classes for additional safety
@jeparlefrancais jeparlefrancais mentioned this pull request Aug 21, 2019
4 tasks
@MisterUncloaked
Copy link
Contributor Author

@LPGhatguy anything else you'd like to see here before we get this merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type Checking API
5 participants