upcast
upcast copied to clipboard
feat request: typescript
These would be sweet as type guard functions in TypeScript.
As an example,
const blah: unknown = undefined
let s: string = ''
if (upcast.is(blah, 'string')) {
s = blah // ok
}
else {
s = blah // type error
}
working sample implementation on TypeScript playground. Hover on blah within both branches of the conditional.
I’ll get to this soon. I’ve already got a typescript fork I’m using at work.
@OmgImAlexis hello, I know is old thread...but any chance you might share the types for upcast.js file? 🙏