You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tsc
lib/eclint.ts(112,38): error TS2345: Argument of type'string | Error' is not assignable to parameter of type'Options & { message: string; }'.
Type 'string' is not assignable to type'Options & { message: string; }'.
Type 'string' is not assignable to type'{ message: string; }'.
Or you could do a disjunction on the type of err, but this looks a bit silly (it's better to use any than get some convoluted code just to appease the type checker):
I thought that TS would automatically resolve the correct result but the fact that one of the variants has a generic parameter type or that there are different return values may have confused it. Adding the corresponding signature manually is the best solution for the moment.
Activity
gucong3000 commentedon Jan 22, 2018
I don't know how to modify my code to compile
Closes gulpjs#10
[-]TypeScript Compile error [/-][+]TypeScript compile error [/+]demurgos commentedon Jan 22, 2018
Thanks for PR, it was needed indeed. I proposed a change to better support custom errors, could you update your branch?
If you want to move on with the current types, just use an
anycast:Or you could do a disjunction on the type of err, but this looks a bit silly (it's better to use
anythan get some convoluted code just to appease the type checker):I thought that TS would automatically resolve the correct result but the fact that one of the variants has a generic parameter type or that there are different return values may have confused it. Adding the corresponding signature manually is the best solution for the moment.
Closes gulpjs#10
Closes gulpjs#10
Closes gulpjs#10
Update types to support union-type arguments
Update types to support union-type arguments
Update types to support union-type arguments
Update types to support union-type arguments
Fix: Update types to support union-type arguments (Fixes #10)