Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Hack to fix `syntax.constructor` causing TS error
Nate Butlerad4201f76813
diff --git a/styles/src/themes/common/syntax.ts b/styles/src/themes/common/syntax.tsindex 763141cea88..57710b365fa 100644--- a/styles/src/themes/common/syntax.ts+++ b/styles/src/themes/common/syntax.ts@@ -56,7 +56,8 @@ export interface Syntax {"string.regex": SyntaxHighlightStyle// == Types ====== /- constructor: SyntaxHighlightStyle+ // We allow Function here because all JS objects literals have this property+ constructor: SyntaxHighlightStyle | Functionvariant: SyntaxHighlightStyletype: SyntaxHighlightStyle// js: predefined_type@@ -120,6 +121,7 @@ export interface Syntax {// HACK: "constructor" as a key in the syntax interface returns an error when a theme tries to use it.// For now hack around it by omiting constructor as a valid key for overrides.+// export type ThemeSyntax = Partial<Omit<Syntax, "constructor">>export type ThemeSyntax = Partial<Syntax>const defaultSyntaxHighlightStyle: Omit<SyntaxHighlightStyle, "color"> = {diff --git a/styles/src/themes/one-dark.ts b/styles/src/themes/one-dark.tsindex 48305e5bd92..2b2e87fa127 100644--- a/styles/src/themes/one-dark.ts+++ b/styles/src/themes/one-dark.ts@@ -41,6 +41,8 @@ const ramps = {magenta: colorRamp(chroma("#be5046")),}++const syntax: ThemeSyntax = {boolean: { color: color.orange },comment: { color: color.grey },@@ -63,6 +65,7 @@ const syntax: ThemeSyntax = {type: { color: color.teal },"variable.special": { color: color.orange },variant: { color: color.blue },+ constructor: { color: color.blue }}export const dark = createColorScheme(name, false, ramps, syntax)