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
A fix implies having a leading or mid-span rest in a tuple type (e.g. [number, ...string, number])
Can we just fix this? ("fix" being allow these calls, not capture 'a' as a 1-tuple)
This example "works" because the types of the parameters match, but that's a bit of a special case - this call can only succeed if they match (or are related)
The second arg here gets "lost" into a's variable-lengthness
At a minimum we should make the error not be nonsense
How would you efficiently reason about a call like
Hello, with regards to destructuring type annotations. Do you have a link to the "guards" proposal? I looked around on TC 39 but couldn't find it. If the double colon is a no go can we come up with another usable token? Almost anything would be better than having to double type all destructured parameters to functions. I'm partial to :> but I don't know enough about the TS compiler to know if that would cause issues. Thanks for looking into this.
[number, ...string, number]
)a
's variable-lengthnessfoo(a: number, b: number, c: number, ...more: number[])
foo(...arr, 1, 2, 3)
::
is part of a proposal called "guards"; avoid thisas
?function fn(%{ a: string, b: number })
excludeTypes
forceExclude
, not a simple filter@types/node
,excludeTypes
will not fix thistypes: []
is a good default in modern TStypes: []
in your tsconfig because if that didn't fix your problem, then this wouldn't eithertypes:
those that wouldn't get into your program via an import anywayNaN
typingNaN
exists, is it a subtype ofnumber
?number | NaN
is an evaporating union tonumber
, and this never does anything usefulNaN
, but very few of them do under reasonable arguments except in cases where people are already on guardextends
is the wrong syntax since it doesn't create a subtype;...
is betterAdvEvents.Start
andBasicEvents.Start
are identical; both refer to the same typeThe text was updated successfully, but these errors were encountered: