Question on Proper Usage of Matcher

Hi, I wonder if I am using the matcher properly. In the following situation:
const tryIt = pipe(
        Match.type<{readonly a : number|string}>(),
        Match.when({a:Match.number},(obj)=>obj.a.toString()),
        // (parameter) obj: {readonly a: number | string;}
        Match.orElse((obj)=>obj.a)
    )

I was stupidly hoping obj in the second match would have type (parameter) obj: {readonly a: string;} but it has type (parameter) obj: {readonly a: number | string;}. How could I get it to have the type I expected?
Was this page helpful?