valentinkononov / ts-runtime-checker

Runtime Checks for Typescript projects
MIT License
8 stars 1 forks source link

Incorrect work with type union #3

Open Semigradsky opened 4 years ago

Semigradsky commented 4 years ago

The correct call throws an error:

Argument: 3 has type: number different from expected type: object.
    @Typed()
    public x(foo: string | number): void {
valentinkononov commented 4 years ago

Thanks! this is similar to interface or array member issue, TS doesn't have corresponding metadata in runtime. for such case we have just 'object', which doesn't bring enough information for correct check

wSedlacek commented 4 years ago

Would a Parameter Decorator help resolve this type of information?