3 ms·
I was thinking about this the other day i would love for TS flag that would turn an interface into an assert const shout = (message: string) => console.log(mes
by vorticalbox 6y ago
I was thinking about this the other day i would love for TS flag that would turn an interface into an assert
const shout = (message: string) => console.log(message)
into something like
const assert = require('assert');
const shout = (message) => {
assert(typeof message === "string");
console.log(message);
}
of course this doesn't work for more complicated types
- IggleSniggle 6y agoYou should checkout myzod, which is very close to this experience.
- colinmcd 6y agoOr just plain zod
- IggleSniggle 6y agoGenuinely curious, why would you pick zod over myzod?
- vorticalbox 6y agoThanks for this