feat request: typescript
trusktr opened this issue · 2 comments
trusktr commented
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.
OmgImAlexis commented
I’ll get to this soon. I’ve already got a typescript fork I’m using at work.
nicobees commented
@OmgImAlexis hello, I know is old thread...but any chance you might share the types for upcast.js
file? 🙏