String: Replace

Medium
conditional types
template literal
infer

Description:

Implement Replace<S, From, To> which replace the string From with To once in the given string S

For example

type replaced = Replace<'hello, {name}!', '{name}', 'Vlad'> // expected: 'hello, Vlad!'

Code

Loading...