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
Also, could enable lots of super nice helper functions
typeFirst<T>=Textends[infer U, ...any[]] ? U : never;typeDropFirst<T>=Textends[any, ...infer U] ? U : never;typeLast<T>=Textends[...any[], infer U] ? U : never;
What about things in the "middle"?
Could beef up inference a bit
Do labels slice and dice correctly?
The intent is that they should, some technicalities that make it not work right.
One of the use-cases was curry - take a function of a parameter list of some length, return a function that takes the first and returns a function that takes the rest.
As for pedantic mode, I like the idea! As already mentioned, some of this can be easily done with linter config. Some time ago I create TypeSTRICT which is ESlint/Tslint config focused on finding bugs code. so there might be some good candidates for pedantic rules.
I would love to see something like no-floating-promises as a built warning into tsc (as pedantic or strict flag).
Variadic Types and Variadic Tuples
#5453
[FixedTypes, OptionalTypes?, ...OneRestType[]]
[number, ...string[], boolean
[number, ...[string, boolean], number]
Yes!
And if you feed in a union, it distributes
Example: what do you infer to
[...T, ...U]
?If you can do it "right", you can type
Function.prototype.bind
more simply.Also, could enable lots of super nice helper functions
What about things in the "middle"?
curry
- take a function of a parameter list of some length, return a function that takes the first and returns a function that takes the rest.Zip
@weswigham shows me it's possible
Node Factory
#35282
#38604
NodeFactory
s between different versions?await
can't be done with ambiguous parsing contexts (i.e. script .js vs module .mjs).Pedantic Modes
https://gist.github.com/RyanCavanaugh/f80f9ddc50d45c4d76e7c4101efada28
undefined
in indexed access types (currently too annoying)override
keyword in classes (useless withoutnoImplicitOverride
or something)--pedantic
?my-super-kewl-typscript-pedantic
?pedanticYaddaYadda
?strict
and which is not.The text was updated successfully, but these errors were encountered: