If i was in the TS team, i'd stop anything I am working on right now and work on error messages, it's so frustrating.
But they're already so great
Argument of type X is not assignable to type Y
Except this is more descriptive
i'd be very happy with this
That's what it is now
this is repeating the same error message in many lines.
It's not the same
Notice how it removes | undefined in the latter lines
if they had removed the last two lines, how would that make the error message less informative?
You would just see ICurrentUser | undefined vs IGraphQLCurrencyTypes | undefined And you'd say "what the fuck? ICurrentUser is for sure compatible with IGraphCurrencyTypes, I'm sure they are, silly TypeScript"
But at the bottom you can see that IGraphQLCurrencyTypes is actually some kind of Enum, and ICurrentUser is an interface
i can see clearly that IcurrentUser isn't IGQLcurrency
they have different names, and they caused error, this means they don't match.
TS has structural typing
Обсуждают сегодня