For given function type `Fn`, and any type `A` (any in this context means we don't restrict the type, and I don't have in mind any type π) create a generic type which will take `Fn` as the first argument, `A` as the second, and will produce function type `G` which will be the same as `Fn` but with appended argument `A` as a last one. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
For given function type Fn
, and any type A
(any in this context means we don't restrict the type, and I don't have in mind any type π) create a generic type which will take Fn
as the first argument, A
as the second, and will produce function type G
which will be the same as Fn
but with appended argument A
as a last one. π―
In this medium-level challenge, you'll for given function type fn
, and any type a
(any in this context means we don't restrict the type, and i don't have in mind any type π) create a generic type which will take fn
as the first argument, a
as the second, and will produce function type g
which will be the same as fn
but with appended argument a
as a last one.. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
This challenge will teach you essential skills for advanced TypeScript development and type-level programming.
For this challenge, you will need to change the following code to make the tests pass (no type check errors).
For given function type Fn
, and any type A
(any in this context means we don't restrict the type, and I don't have in mind any type π) create a generic type which will take Fn
as the first argument, A
as the second, and will produce function type G
which will be the same as Fn
but with appended argument A
as a last one.
For example,
type Fn = (a: number, b: string) => number
type Result = AppendArgument<Fn, boolean>
// expected be (a: number, b: string, x: boolean) => number
This question is ported from the original article by @maciejsikora
This challenge requires understanding of TypeScript's type system.
The solution involves carefully constructing types that satisfy all test cases while handling edge cases properly.
This challenge helps you understand TypeScript's advanced type system and how to apply this concept in real-world scenarios.
Be the first to access the course, unlock exclusive launch bonuses, and get special early-bird pricing before anyone else.
Only 27 Spots left
Get 1 month early access
Pre-Launch discount
This challenge is originally from here.