We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defaultProps
propTypes
#23812
LibraryManagedAttributes
prop
defaultTypes
static defaultTypes: Partial<MyProps>
One of the primary ideas is "can I please capture an argument list as a tuple?"
Built-ins are untyped like call, bind, apply are untyped.
call
bind
apply
Someone asked "can't we just capture rest parameter generics as tuples?"
function baz<T extends unknown[]>(...args: T): T { throw "nope"; } baz("foo", 100); // [string, number]
Action item:
baz<"foo">("bar"); // infers as 'string' - why?
Can now type things like curry.
curry
declare function curry<T, U extends unknown[], R>(f: (x: T, ...rest: U) => R, x: T): (...args: U) => R;
To make this work, we need tuples to be able to encode anything in a parameter list.
?
...
Have added optionality: `[Foo, Bar?, Baz]
Can finally write a Parameters helper type.
Parameters
type Parameters<T extends (...args: any[]) => any> = T extends (...args: infer U) => any ? U : never;
How does this work with Promises?
promisify
Overall this is a big improvement with little added complexity.
But hey, we're already pretty powerful with this feature!
type TupleTail<T extends any[]> = ((...args: T) => void) extends ((head: any, ...tail: infer U) => void) ? U : never;
Is this a breaking change to func.call?
func.call
Run it on RWC and DefinitelyTyped.
What do errors look like?
The text was updated successfully, but these errors were encountered:
The syntax looks complicated and there are too many symbols
Sorry, something went wrong.
No branches or pull requests
defaultProps
andpropTypes
#23812
LibraryManagedAttributes
prop
defaultProps
andpropTypes
defaultProps
propTypes
anddefaultTypes
LibraryManagedAttributes
says "anything in the types ofdefaultTypes
makes things optional"static defaultTypes: Partial<MyProps>
...propTypes
.Parameter list capture and variadic functions
One of the primary ideas is "can I please capture an argument list as a tuple?"
Built-ins are untyped like
call
,bind
,apply
are untyped.Someone asked "can't we just capture rest parameter generics as tuples?"
Action item:
Can now type things like
curry
.To make this work, we need tuples to be able to encode anything in a parameter list.
?
...
Have added optionality: `[Foo, Bar?, Baz]
?
as a postfix type syntax.Can finally write a
Parameters
helper type.How does this work with Promises?
promisify
?Overall this is a big improvement with little added complexity.
But hey, we're already pretty powerful with this feature!
Is this a breaking change to
func.call
?Run it on RWC and DefinitelyTyped.
What do errors look like?
The text was updated successfully, but these errors were encountered: