Skip to content

Latest commit

 

History

History

00191-medium-append-argument

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Append Argument medium #arguments

by Maciej Sikora @maciejsikora

Take the Challenge    简体中文 日本語

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


Back Share your Solutions Check out Solutions