ts-interface-checker | Runtime library to validate data | Runtime Evironment library
kandi X-RAY | ts-interface-checker Summary
kandi X-RAY | ts-interface-checker Summary
Runtime library to validate data against TypeScript interfaces.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ts-interface-checker
ts-interface-checker Key Features
ts-interface-checker Examples and Code Snippets
Community Discussions
Trending Discussions on ts-interface-checker
QUESTION
I want to generate some joi schema object from Typescript types or interfaces. In my initial searching I found some things that do the opposite (generate Typescript types/interfaces from joi schemas), and ts-interface-builder
+ ts-interface-checker
that offer some ability to create runtime checkers based on Typescript types/interfaces but were still lacking in feature support, and a whole bunch of gnarly things using classes and decorators around props/methods to accomplish this.
Is there something out there to generate such joi schemas? Or a more mature alternative for runtime checking of interfaces/types? (Useful when pulling from a database and ensuring that the response from a DB is in the correct structure)
EDIT: I guess there's a pretty good thread about this kind of problem on this io-ts github issue.
...ANSWER
Answered 2020-Mar-24 at 03:28I found something that works to my satisfaction for this: typescript-is.
- Swap out what typescript compiler you're using to ttypescript. Instead of calling
tsc
, callttsc
. - Add the following to
tsconfig.json
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ts-interface-checker
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page