News for hackers. Stuff that matters.
Re:TypeScript 4.1 by resynth1943 on Friday November 20, 2020 @02:39PM (#25164044)
I use runtypes:

     import { Record, Number, Static } from 'runtypes';

     export const Thing = Record({
       thing: Number
     });

     export type Thing = Static<Thing>;
Then you can import it like this:

     import { Thing } from './thing';

     function (thing: Thing) {
       if (Thing.guard(thing)) { console.log('we have a thing!'); }
     }

There are no comments on this comment yet.