Rob's garden / notes / note

Note

I've been playing around with a little #JavaScript validation tool for a very specific use-case. I'm starting to feel proud of the result and syntax and especially that there is no #TypeScript! So it is pure JS but it can still generates types for the structure-validated values, purely through JSDoc!

Also! you can get it to generate a JSON-schema from your structures. Not sure what to do with that but it seems pretty cool / powerful

const struct = Structure.array(Structure.object({
  name: Structure.string(),
  age: Structure.number(),
  pets: Structure.array(Structure.string())
}))
With a code hover showing it has generated the type from the structure as:
const value: {
    name: string;
    age: number;
    pets: string[];
}[]

A JavaScript code sample