replace.TypeAlias.Replace - GyldendalDigital/kobber GitHub Wiki

@gyldendal/kobber-components / replace / Replace

Replace<T, S, D, A>: T extends `${infer L}${S}${infer R}` ? Replace<R, S, D, `${A}${L}${D}`> : `${A}${T}`

Defined in: packages/kobber-components/src/utils/replace.ts:5

Type Parameters

T extends string

S extends string

D extends string

A extends string = ""

Example

type MyType = Replace<"foo bar", " ", "_">; // "foo_bar"

https://stackoverflow.com/a/71353081