Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and provide a type validator #21

Open
scarletcs opened this issue Jan 20, 2024 · 0 comments
Open

Create and provide a type validator #21

scarletcs opened this issue Jan 20, 2024 · 0 comments
Assignees
Milestone

Comments

@scarletcs
Copy link
Collaborator

Currently test cases for the library are based on compile-time checks from static files. This will simply not work or scale well as the library and API grow. For example, tests already fail because the files don't reflect timeless legality (implemented in #8, which is good, this is a test problem not a problem with that PR).

Testing needs to be able to be done at runtime.

TypeScript can't really be assessed at runtime; types and interfaces do not exist at runtime and are exclusively a compile-time feature. The closest-match community project, ts-runtime, is 4 years old and never left the experimental v0.x stage.

Instead, I need to build a validator inside the library that (essentially) re-implements and tests the types against runtime data. That's a big ask but not necessarily unreasonable to do on reflection: it's reasonable for a type library to provide a validator, and I would be essentially dogfooding it in our libraries.

I want to maintain this library at having minimal dependencies. Right now we're at zero, which is pretty good. I could install yup for validation however, which itself has 4 dependencies, each of which has zero dependencies.

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

No branches or pull requests

1 participant