Feat: Validate typescript types for modifier data #685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This uses https://github.com/samchon/typia's runtime type validators to confirm that the modifier data files match the types specified for them in
src/assets/modifierdata/metadata.ts
.Typia applies a build-time code transformation to convert Typescript's types (which don't exist at runtime) into code. It's possible to integrate this into the Vite build process, but as we don't currently do any runtime validation in the actual application and that involves making sure Vite uses
tsc
, this instead does a one-time code generation when you run a standalone script. (There is a potential use case for runtime verification—we could validate the user-entered content in the "Extra Modifiers" box—but that could be a potential future thing.)This is a first step to typing the modifier data as it flows through the codebase; right now it's all
any
.