T
ClearPlaceholder
testedRemoves the placeholder syntax from a template string.
Example
ts
type Base = ClearPlaceholder<'{user.name}'>; // 'user.name'
type Unbalanced = ClearPlaceholder<'{user.name'>; // 'user.name'
type Spaces = ClearPlaceholder<'{ user.name }'>; // 'user.name'Signature
ts
export type ClearPlaceholder<In extends string>
= In extends `${string}{${infer Template}`
? ClearPlaceholder<Template>
: In extends `${infer Template}}${string}`
? ClearPlaceholder<Template>
: Trim<In>;Type Parameters
Inextends string