Skip to content

Instantly share code, notes, and snippets.

View Josh-Cena's full-sized avatar
💭
Working hard to keep depressive thoughts away

Joshua Chen Josh-Cena

💭
Working hard to keep depressive thoughts away
View GitHub Profile
declare global {
interface StringConstructor {
dedent<A extends unknown[], R>(tag: (template: TemplateStringsArray, ...substitutions: A) => R): (template: TemplateStringsArray, ...substitutions: A) => string;
dedent(template: TemplateStringsArray, ...substitutions: unknown[]): string;
}
}
// @ts-expect-error: deliberate narrow
String.dedent = (() => {
const GlobalDedentRegistry = new WeakMap<object, TemplateStringsArray>();