assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

support for type guards parsing

Open npenin opened this issue 3 years ago • 0 comments

Hey there,

Type guards is now an old feature in typescript and an assemblyscript would be really beneficial:

    const trait = Symbol();

    interface MyTrait
    {
        [trait]:string
    }

    export function isBuffer(x: any): x is MyTrait
    {
        return trait in x;
    }

The above piece of code is fully typescript compliant, but assembly script fails at parsing the typeguard, while the return type is clearly a boolean,

npenin avatar Jun 11 '22 09:06 npenin