Skip to content

TypeScript does a great job at compile time type safety, but we still need to do runtime checks just like in JavaScript. There are many packages and tools to help with this, we focused on AJV Standalone that outputs JS validation functions at compile time to be used at runtime. Going from TS Types to JSON Schema to JS functions allows us to vali…

Notifications You must be signed in to change notification settings

rehanvdm/ajv-standalone-type-saftey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Type Safety with AJV Standalone

This is the code base for a blog post: https://www.rehanvdm.com/blog/typescript-type-safety-with-ajv-standalone

Have a read through the blog post to understand what is happening, you can use the commands in the package.json to run the app-basic and app-abstracted examples.

Intro:

In this blog we start of by exploring what Type means in TypeScript and how to achieve type safety at runtime. Then a quick comparison of the current tools to achieve this and deep dive into the implementation using the AJV Standalone method.

TL;DR TypeScript does a great job at compile time type safety, but we still need to do runtime checks just like in JavaScript. There are many packages and tools to help with this, we focused on AJV Standalone that outputs JS validation functions at compile time to be used at runtime. Going from TS Types to JSON Schema to JS functions allows us to validate TS Types where the other packages all work with classes and reflection.

... Read more here: https://www.rehanvdm.com/blog/typescript-type-safety-with-ajv-standalone

About

TypeScript does a great job at compile time type safety, but we still need to do runtime checks just like in JavaScript. There are many packages and tools to help with this, we focused on AJV Standalone that outputs JS validation functions at compile time to be used at runtime. Going from TS Types to JSON Schema to JS functions allows us to vali…

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages