Shadow Monarch Abyss
A premium VS Code theme family inspired by Sung Jin-woo from Solo Leveling. Includes Void, Abyss, Ember, Igris, Frost, Light, Twilight, and Dawn variants.
A premium VS Code theme family inspired by Sung Jin-woo from Solo Leveling. Includes Void, Abyss, Ember, Igris, Frost, Light, Twilight, and Dawn variants.
Full workbench mockup using this variant's colors and tokenColors.
Loading...
Workbench UI color keys from the theme JSON colors map.
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| comment, comment.line, comment.block, punctuation.definition.comment | #10B981 | italic |
| string.quoted.docstring.multi.python | #10B981 | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #E2D9F3 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #CBD5E1 | — |
| variable.other.constant, variable.other.readonly | #C4B5FD | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #C084FC | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #A78BFA | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #818CF8 | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #C4B5FD | — |
| entity.name.function, entity.name.function.constructor | #FBBF24 | bold |
| meta.function-call, variable.function | #F59E0B | — |
| support.function, support.function.builtin, support.function.console | #06B6D4 | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #FBBF24 | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #FBBF24 | italic |
| entity.name.type.class, support.class | #8B5CF6 | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #22D3EE | italic |
| entity.name.type.enum, entity.name.type.struct | #818CF8 | bold |
| entity.name.type, support.type | #8B5CF6 | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #38BDF8 | — |
| string.template | #60A5FA | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #818CF8 | — |
| string.regexp, string.regexp.character-class, punctuation.definition.string.regexp | #2DD4BF | — |
| constant.numeric | #F43F5E | — |
| constant.language, constant.language.boolean, constant.language.null, constant.language.undefined | #FB7185 | bold |
| support.type.property-name.json, meta.object-key.json, meta.structure.dictionary.key.json | #A78BFA | — |
| string.quoted.double.json, string.quoted.single.json | #38BDF8 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #C084FC | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #FBBF24 | — |
| string.quoted.double.html, string.quoted.single.html | #38BDF8 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #C084FC | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #A855F7 | bold |
| entity.other.attribute-name.jsx, entity.other.attribute-name.tsx, entity.other.attribute-name.js, entity.other.attribute-name.ts | #FBBF24 | — |
| entity.other.attribute-name.event.jsx, entity.other.attribute-name.event.tsx | #F59E0B | italic |
| support.type.property-name.css, support.type.property-name.scss, support.type.property-name.less | #A78BFA | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #38BDF8 | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #F43F5E | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #C4B5FD | — |
| entity.other.attribute-name.id.css, entity.other.attribute-name.id.scss | #FBBF24 | bold |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #22D3EE | italic |
| variable.css, variable.argument.css, custom-property | #06B6D4 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #C084FC | bold |
| entity.other.attribute-name.class.css.tailwindcss | #38BDF8 | — |
| entity.other.attribute-name.variant.tailwindcss | #C084FC | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #C084FC | bold |
| entity.other.attribute-name.directive.vue | #10B981 | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #F59E0B | italic |
| markup.heading, entity.name.section.markdown | #E2D9F3 | bold |
| markup.inline.raw, markup.fenced_code.block | #38BDF8 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #C084FC | italic |
| support.function.magic.python | #FBBF24 | bold |
| storage.modifier.lifetime.rust, entity.name.type.lifetime.rust | #FBBF24 | italic |
| support.macro.rust, entity.name.function.macro.rust | #F97316 | bold |
| entity.name.type.trait.rust | #22D3EE | italic |
| keyword.channel.go, keyword.goroutine.go | #C084FC | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #A78BFA | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #FBBF24 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #A78BFA | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #A78BFA | — |
| variable.other.normal.shell, variable.other.special.shell | #E2D9F3 | — |
Full workbench mockup using this variant's colors and tokenColors.
Loading...
Workbench UI color keys from the theme JSON colors map.
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| comment, comment.line, comment.block, punctuation.definition.comment | #10B981 | italic |
| string.quoted.docstring.multi.python | #10B981 | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #E2D9F3 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #CBD5E1 | — |
| variable.other.constant, variable.other.readonly | #C4B5FD | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #F472B6 | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #E081F9 | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #818CF8 | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #C4B5FD | — |
| entity.name.function, entity.name.function.constructor | #06B6D4 | bold |
| meta.function-call, variable.function | #22D3EE | — |
| support.function, support.function.builtin, support.function.console | #C084FC | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #06B6D4 | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #F59E0B | italic |
| entity.name.type.class, support.class | #A855F7 | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #A5B4FC | italic |
| entity.name.type.enum, entity.name.type.struct | #C084FC | bold |
| entity.name.type, support.type | #A855F7 | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #38BDF8 | — |
| string.template | #60A5FA | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #818CF8 | — |
| string.regexp, string.regexp.character-class, punctuation.definition.string.regexp | #2DD4BF | — |
| constant.numeric | #FB7185 | — |
| constant.language, constant.language.boolean, constant.language.null, constant.language.undefined | #F43F5E | bold |
| support.type.property-name.json, meta.object-key.json, meta.structure.dictionary.key.json | #E081F9 | — |
| string.quoted.double.json, string.quoted.single.json | #38BDF8 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #C084FC | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #F59E0B | — |
| string.quoted.double.html, string.quoted.single.html | #38BDF8 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #C084FC | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #C084FC | bold |
| entity.other.attribute-name.jsx, entity.other.attribute-name.tsx, entity.other.attribute-name.js, entity.other.attribute-name.ts | #F59E0B | — |
| entity.other.attribute-name.event.jsx, entity.other.attribute-name.event.tsx | #FB7185 | italic |
| support.type.property-name.css, support.type.property-name.scss, support.type.property-name.less | #E081F9 | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #22D3EE | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #FB7185 | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #A5B4FC | — |
| entity.other.attribute-name.id.css, entity.other.attribute-name.id.scss | #F59E0B | bold |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #06B6D4 | italic |
| variable.css, variable.argument.css, custom-property | #22D3EE | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #F472B6 | bold |
| entity.other.attribute-name.class.css.tailwindcss | #38BDF8 | — |
| entity.other.attribute-name.variant.tailwindcss | #E081F9 | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #C084FC | bold |
| entity.other.attribute-name.directive.vue | #10B981 | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #F59E0B | italic |
| markup.heading, entity.name.section.markdown | #E2D9F3 | bold |
| markup.inline.raw, markup.fenced_code.block | #38BDF8 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #F472B6 | italic |
| support.function.magic.python | #06B6D4 | bold |
| storage.modifier.lifetime.rust, entity.name.type.lifetime.rust | #F59E0B | italic |
| support.macro.rust, entity.name.function.macro.rust | #FB923C | bold |
| entity.name.type.trait.rust | #A5B4FC | italic |
| keyword.channel.go, keyword.goroutine.go | #F472B6 | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #E081F9 | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #06B6D4 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #E081F9 | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #E081F9 | — |
| variable.other.normal.shell, variable.other.special.shell | #E2D9F3 | — |
Full workbench mockup using this variant's colors and tokenColors.
Loading...
Workbench UI color keys from the theme JSON colors map.
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| comment, comment.line, comment.block, punctuation.definition.comment | #854D0E | italic |
| string.quoted.docstring.multi.python | #854D0E | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #1C1917 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #78350F | — |
| variable.other.constant, variable.other.readonly | #78350F | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #92400E | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #B45309 | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #A08060 | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #78350F | — |
| entity.name.function, entity.name.function.constructor | #D97706 | bold |
| meta.function-call, variable.function | #92400E | — |
| support.function, support.function.builtin, support.function.console | #0284C7 | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #D97706 | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #D97706 | italic |
| entity.name.type.class, support.class | #92400E | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #0284C7 | italic |
| entity.name.type.enum, entity.name.type.struct | #B45309 | bold |
| entity.name.type, support.type | #92400E | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #047857 | — |
| string.template | #059669 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #A08060 | — |
| string.regexp, string.regexp.character-class, punctuation.definition.string.regexp | #0D9488 | — |
| constant.numeric | #DC2626 | — |
| constant.language, constant.language.boolean, constant.language.null, constant.language.undefined | #B91C1C | bold |
| support.type.property-name.json, meta.object-key.json, meta.structure.dictionary.key.json | #B45309 | — |
| string.quoted.double.json, string.quoted.single.json | #047857 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #B45309 | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #D97706 | — |
| string.quoted.double.html, string.quoted.single.html | #047857 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #B45309 | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #92400E | bold |
| entity.other.attribute-name.jsx, entity.other.attribute-name.tsx, entity.other.attribute-name.js, entity.other.attribute-name.ts | #D97706 | — |
| entity.other.attribute-name.event.jsx, entity.other.attribute-name.event.tsx | #92400E | italic |
| support.type.property-name.css, support.type.property-name.scss, support.type.property-name.less | #B45309 | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #047857 | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #DC2626 | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #92400E | — |
| entity.other.attribute-name.id.css, entity.other.attribute-name.id.scss | #D97706 | bold |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #0284C7 | italic |
| variable.css, variable.argument.css, custom-property | #0284C7 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #92400E | bold |
| entity.other.attribute-name.class.css.tailwindcss | #047857 | — |
| entity.other.attribute-name.variant.tailwindcss | #B45309 | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #B45309 | bold |
| entity.other.attribute-name.directive.vue | #047857 | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #D97706 | italic |
| markup.heading, entity.name.section.markdown | #1C1917 | bold |
| markup.inline.raw, markup.fenced_code.block | #047857 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #92400E | italic |
| support.function.magic.python | #D97706 | bold |
| storage.modifier.lifetime.rust, entity.name.type.lifetime.rust | #D97706 | italic |
| support.macro.rust, entity.name.function.macro.rust | #EA580C | bold |
| entity.name.type.trait.rust | #0284C7 | italic |
| keyword.channel.go, keyword.goroutine.go | #92400E | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #B45309 | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #D97706 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #B45309 | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #B45309 | — |
| variable.other.normal.shell, variable.other.special.shell | #1C1917 | — |
Full workbench mockup using this variant's colors and tokenColors.
Loading...
Workbench UI color keys from the theme JSON colors map.
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| comment, comment.line, comment.block, punctuation.definition.comment | #10B981 | italic |
| string.quoted.docstring.multi.python | #10B981 | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #F3E2D9 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #FED7AA | — |
| variable.other.constant, variable.other.readonly | #FDBA74 | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #FB923C | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #F97316 | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #7A4A3A | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #FDBA74 | — |
| entity.name.function, entity.name.function.constructor | #FBBF24 | bold |
| meta.function-call, variable.function | #F59E0B | — |
| support.function, support.function.builtin, support.function.console | #EF4444 | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #FBBF24 | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #FBBF24 | italic |
| entity.name.type.class, support.class | #EA580C | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #38BDF8 | italic |
| entity.name.type.enum, entity.name.type.struct | #F97316 | bold |
| entity.name.type, support.type | #EA580C | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #FDBA74 | — |
| string.template | #FFEDD5 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #7A4A3A | — |
| string.regexp, string.regexp.character-class, punctuation.definition.string.regexp | #FB923C | — |
| constant.numeric | #DC2626 | — |
| constant.language, constant.language.boolean, constant.language.null, constant.language.undefined | #EF4444 | bold |
| support.type.property-name.json, meta.object-key.json, meta.structure.dictionary.key.json | #F97316 | — |
| string.quoted.double.json, string.quoted.single.json | #FDBA74 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #F87171 | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #FBBF24 | — |
| string.quoted.double.html, string.quoted.single.html | #FDBA74 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #F87171 | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #EA580C | bold |
| entity.other.attribute-name.jsx, entity.other.attribute-name.tsx, entity.other.attribute-name.js, entity.other.attribute-name.ts | #FBBF24 | — |
| entity.other.attribute-name.event.jsx, entity.other.attribute-name.event.tsx | #F97316 | italic |
| support.type.property-name.css, support.type.property-name.scss, support.type.property-name.less | #F97316 | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #FDBA74 | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #DC2626 | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #FB923C | — |
| entity.other.attribute-name.id.css, entity.other.attribute-name.id.scss | #FBBF24 | bold |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #38BDF8 | italic |
| variable.css, variable.argument.css, custom-property | #F97316 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #FB923C | bold |
| entity.other.attribute-name.class.css.tailwindcss | #FDBA74 | — |
| entity.other.attribute-name.variant.tailwindcss | #FB923C | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #F87171 | bold |
| entity.other.attribute-name.directive.vue | #10B981 | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #F59E0B | italic |
| markup.heading, entity.name.section.markdown | #F3E2D9 | bold |
| markup.inline.raw, markup.fenced_code.block | #FDBA74 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #FB923C | italic |
| support.function.magic.python | #FBBF24 | bold |
| storage.modifier.lifetime.rust, entity.name.type.lifetime.rust | #FBBF24 | italic |
| support.macro.rust, entity.name.function.macro.rust | #F97316 | bold |
| entity.name.type.trait.rust | #38BDF8 | italic |
| keyword.channel.go, keyword.goroutine.go | #FB923C | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #F97316 | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #FBBF24 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #F97316 | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #F97316 | — |
| variable.other.normal.shell, variable.other.special.shell | #F3E2D9 | — |
export interface User {
id: string;
name: string;
role: "admin" | "member";
tags: string[];
}
/**
* Fetch user data by ID
* @param id
* @returns User object or null if ID is invalid
*/
export async function fetchUser(id: string): Promise<User | null> {
if (!id) {
return null;
}
const response = await fetch(`/api/users/${id}`, {
method: "GET",
headers: { Accept: "application/json" },
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return (await response.json()) as User;
}
function greet(user: User): string {
// Simple greeting function that uses the user's name
return `Hello, ${user.name}!`;
}
export interface User {
id: string;
name: string;
role: "admin" | "member";
tags: string[];
}
/**
* Fetch user data by ID
* @param id
* @returns User object or null if ID is invalid
*/
export async function fetchUser(id: string): Promise<User | null> {
if (!id) {
return null;
}
const response = await fetch(`/api/users/${id}`, {
method: "GET",
headers: { Accept: "application/json" },
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return (await response.json()) as User;
}
function greet(user: User): string {
// Simple greeting function that uses the user's name
return `Hello, ${user.name}!`;
}
export interface User {
id: string;
name: string;
role: "admin" | "member";
tags: string[];
}
/**
* Fetch user data by ID
* @param id
* @returns User object or null if ID is invalid
*/
export async function fetchUser(id: string): Promise<User | null> {
if (!id) {
return null;
}
const response = await fetch(`/api/users/${id}`, {
method: "GET",
headers: { Accept: "application/json" },
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return (await response.json()) as User;
}
function greet(user: User): string {
// Simple greeting function that uses the user's name
return `Hello, ${user.name}!`;
}
export interface User {
id: string;
name: string;
role: "admin" | "member";
tags: string[];
}
/**
* Fetch user data by ID
* @param id
* @returns User object or null if ID is invalid
*/
export async function fetchUser(id: string): Promise<User | null> {
if (!id) {
return null;
}
const response = await fetch(`/api/users/${id}`, {
method: "GET",
headers: { Accept: "application/json" },
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return (await response.json()) as User;
}
function greet(user: User): string {
// Simple greeting function that uses the user's name
return `Hello, ${user.name}!`;
}