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 | #A5F3FC | italic |
| string.quoted.docstring.multi.python | #A5F3FC | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #E0F2FE | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #E0F2FE | — |
| variable.other.constant, variable.other.readonly | #A5F3FC | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #38BDF8 | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #06B6D4 | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #334155 | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #A5F3FC | — |
| entity.name.function, entity.name.function.constructor | #38BDF8 | bold |
| meta.function-call, variable.function | #7DD3FC | — |
| support.function, support.function.builtin, support.function.console | #818CF8 | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #38BDF8 | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #FBBF24 | italic |
| entity.name.type.class, support.class | #0891B2 | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #60A5FA | italic |
| entity.name.type.enum, entity.name.type.struct | #22D3EE | bold |
| entity.name.type, support.type | #0891B2 | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #67E8F9 | — |
| string.template | #BAE6FD | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #334155 | — |
| 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 | #06B6D4 | — |
| string.quoted.double.json, string.quoted.single.json | #67E8F9 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #2DD4BF | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #FBBF24 | — |
| string.quoted.double.html, string.quoted.single.html | #67E8F9 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #2DD4BF | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #0891B2 | 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 | #38BDF8 | italic |
| support.type.property-name.css, support.type.property-name.scss, support.type.property-name.less | #06B6D4 | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #67E8F9 | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #F43F5E | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #A5F3FC | — |
| 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 | #60A5FA | italic |
| variable.css, variable.argument.css, custom-property | #38BDF8 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #38BDF8 | bold |
| entity.other.attribute-name.class.css.tailwindcss | #67E8F9 | — |
| entity.other.attribute-name.variant.tailwindcss | #38BDF8 | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #2DD4BF | bold |
| entity.other.attribute-name.directive.vue | #2DD4BF | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #FBBF24 | italic |
| markup.heading, entity.name.section.markdown | #E0F2FE | bold |
| markup.inline.raw, markup.fenced_code.block | #67E8F9 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #38BDF8 | italic |
| support.function.magic.python | #38BDF8 | 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 | #60A5FA | italic |
| keyword.channel.go, keyword.goroutine.go | #38BDF8 | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #06B6D4 | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #38BDF8 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #06B6D4 | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #06B6D4 | — |
| variable.other.normal.shell, variable.other.special.shell | #E0F2FE | — |
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 | #64748B | italic |
| string.quoted.docstring.multi.python | #64748B | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #E2E8F0 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #CBD5E1 | — |
| variable.other.constant, variable.other.readonly | #FB7185 | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #FB7185 | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #E11D48 | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #E11D48 | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #CBD5E1 | — |
| entity.name.function, entity.name.function.constructor | #F59E0B | bold |
| meta.function-call, variable.function | #FBBF24 | — |
| support.function, support.function.builtin, support.function.console | #F43F5E | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #F59E0B | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #FBBF24 | italic |
| entity.name.type.class, support.class | #BE123C | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #38BDF8 | italic |
| entity.name.type.enum, entity.name.type.struct | #F59E0B | bold |
| entity.name.type, support.type | #BE123C | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #94A3B8 | — |
| string.template | #CBD5E1 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #E11D48 | — |
| string.regexp, string.regexp.character-class, punctuation.definition.string.regexp | #2DD4BF | — |
| constant.numeric | #E2E8F0 | — |
| 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 | #E11D48 | — |
| string.quoted.double.json, string.quoted.single.json | #94A3B8 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #FB7185 | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #F59E0B | — |
| string.quoted.double.html, string.quoted.single.html | #94A3B8 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #FB7185 | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #BE123C | 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 | #E11D48 | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #94A3B8 | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #F43F5E | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #CBD5E1 | — |
| 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 | #38BDF8 | italic |
| variable.css, variable.argument.css, custom-property | #FB7185 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #FB7185 | bold |
| entity.other.attribute-name.class.css.tailwindcss | #94A3B8 | — |
| entity.other.attribute-name.variant.tailwindcss | #FB7185 | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #FB7185 | 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 | #E2E8F0 | bold |
| markup.inline.raw, markup.fenced_code.block | #94A3B8 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #FB7185 | italic |
| support.function.magic.python | #F59E0B | bold |
| storage.modifier.lifetime.rust, entity.name.type.lifetime.rust | #F59E0B | italic |
| support.macro.rust, entity.name.function.macro.rust | #E11D48 | bold |
| entity.name.type.trait.rust | #38BDF8 | italic |
| keyword.channel.go, keyword.goroutine.go | #FB7185 | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #E11D48 | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #F59E0B | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #E11D48 | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #E11D48 | — |
| variable.other.normal.shell, variable.other.special.shell | #E2E8F0 | — |
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 | #059669 | italic |
| string.quoted.docstring.multi.python | #059669 | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #2E1065 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #4C1D95 | — |
| variable.other.constant, variable.other.readonly | #4C1D95 | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #6D28D9 | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #7C3AED | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #4F46E5 | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #6D28D9 | — |
| entity.name.function, entity.name.function.constructor | #D97706 | bold |
| meta.function-call, variable.function | #B45309 | — |
| 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 | #5B21B6 | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #0284C7 | italic |
| entity.name.type.enum, entity.name.type.struct | #4F46E5 | bold |
| entity.name.type, support.type | #5B21B6 | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #0369A1 | — |
| string.template | #0284C7 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #4F46E5 | — |
| 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 | #E11D48 | bold |
| support.type.property-name.json, meta.object-key.json, meta.structure.dictionary.key.json | #7C3AED | — |
| string.quoted.double.json, string.quoted.single.json | #0369A1 | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #6D28D9 | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #D97706 | — |
| string.quoted.double.html, string.quoted.single.html | #0369A1 | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #6D28D9 | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #5B21B6 | 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 | #B45309 | italic |
| support.type.property-name.css, support.type.property-name.scss, support.type.property-name.less | #7C3AED | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #0369A1 | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #DC2626 | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #5B21B6 | — |
| 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 | #0369A1 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #6D28D9 | bold |
| entity.other.attribute-name.class.css.tailwindcss | #0369A1 | — |
| entity.other.attribute-name.variant.tailwindcss | #6D28D9 | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #6D28D9 | bold |
| entity.other.attribute-name.directive.vue | #059669 | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #D97706 | italic |
| markup.heading, entity.name.section.markdown | #2E1065 | bold |
| markup.inline.raw, markup.fenced_code.block | #0369A1 | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #6D28D9 | 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 | #6D28D9 | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #7C3AED | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #D97706 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #7C3AED | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #7C3AED | — |
| variable.other.normal.shell, variable.other.special.shell | #2E1065 | — |
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 | #047857 | italic |
| string.quoted.docstring.multi.python | #047857 | italic |
| variable, variable.other, variable.other.readwrite, meta.block | #2E1065 | — |
| variable.parameter, meta.parameter.type.variable, variable.parameter.function | #4C1D95 | — |
| variable.other.constant, variable.other.readonly | #4C1D95 | bold |
| keyword.control, keyword.control.conditional, keyword.control.repeat, keyword.control.flow, keyword.control.trycatch, keyword.control.import, keyword.control.export | #5B21B6 | bold |
| keyword, storage.type, storage.modifier, keyword.operator.new, keyword.operator.expression | #6D28D9 | bold |
| keyword.operator, keyword.operator.comparison, keyword.operator.arithmetic, keyword.operator.logical | #4338CA | — |
| punctuation, punctuation.separator, punctuation.terminator, meta.delimiter, punctuation.section, punctuation.definition.parameters, punctuation.definition.block | #6D28D9 | — |
| entity.name.function, entity.name.function.constructor | #B45309 | bold |
| meta.function-call, variable.function | #92400E | — |
| support.function, support.function.builtin, support.function.console | #0369A1 | — |
| support.function.react, support.function.builtin.react, entity.name.function.react | #B45309 | italic |
| meta.decorator, entity.name.function.decorator, punctuation.decorator | #B45309 | italic |
| entity.name.type.class, support.class | #5B21B6 | bold |
| entity.name.type.interface, entity.name.type.type-parameter | #0284C7 | italic |
| entity.name.type.enum, entity.name.type.struct | #4338CA | bold |
| entity.name.type, support.type | #5B21B6 | — |
| string, string.quoted, string.quoted.double, string.quoted.single | #1E3A8A | — |
| string.template | #0284C7 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #4338CA | — |
| string.regexp, string.regexp.character-class, punctuation.definition.string.regexp | #0F766E | — |
| constant.numeric | #B91C1C | — |
| constant.language, constant.language.boolean, constant.language.null, constant.language.undefined | #DC2626 | bold |
| support.type.property-name.json, meta.object-key.json, meta.structure.dictionary.key.json | #6D28D9 | — |
| string.quoted.double.json, string.quoted.single.json | #1E3A8A | — |
| entity.name.tag, entity.name.tag.html, entity.name.tag.xml, punctuation.definition.tag | #6D28D9 | — |
| entity.other.attribute-name, entity.other.attribute-name.html | #B45309 | — |
| string.quoted.double.html, string.quoted.single.html | #1E3A8A | — |
| entity.name.tag.jsx, entity.name.tag.tsx | #6D28D9 | — |
| support.class.component.jsx, support.class.component.tsx, entity.name.tag.custom.jsx, entity.name.tag.custom.tsx | #5B21B6 | bold |
| entity.other.attribute-name.jsx, entity.other.attribute-name.tsx, entity.other.attribute-name.js, entity.other.attribute-name.ts | #B45309 | — |
| 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 | #6D28D9 | — |
| support.constant.property-value.css, meta.property-value.css, support.constant.color.w3c-standard-color-name.css | #1E3A8A | — |
| keyword.other.unit.css, keyword.other.unit.scss, constant.numeric.css | #B91C1C | — |
| entity.other.attribute-name.class.css, entity.other.attribute-name.class.scss | #5B21B6 | — |
| entity.other.attribute-name.id.css, entity.other.attribute-name.id.scss | #B45309 | bold |
| entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css | #0369A1 | italic |
| variable.css, variable.argument.css, custom-property | #0369A1 | — |
| keyword.control.at-rule.media, keyword.control.at-rule.keyframes, keyword.control.at-rule.import | #5B21B6 | bold |
| entity.other.attribute-name.class.css.tailwindcss | #1E3A8A | — |
| entity.other.attribute-name.variant.tailwindcss | #6D28D9 | italic |
| entity.name.tag.template.html.vue, entity.name.tag.script.html.vue, entity.name.tag.style.html.vue | #6D28D9 | bold |
| entity.other.attribute-name.directive.vue | #047857 | italic |
| entity.other.attribute-name.directive.svelte, punctuation.definition.reactive.svelte | #B45309 | italic |
| markup.heading, entity.name.section.markdown | #2E1065 | bold |
| markup.inline.raw, markup.fenced_code.block | #1E3A8A | — |
| variable.parameter.function.language.special.self.python, variable.parameter.function.language.special.cls.python | #5B21B6 | italic |
| support.function.magic.python | #B45309 | bold |
| storage.modifier.lifetime.rust, entity.name.type.lifetime.rust | #B45309 | italic |
| support.macro.rust, entity.name.function.macro.rust | #C2410C | bold |
| entity.name.type.trait.rust | #0284C7 | italic |
| keyword.channel.go, keyword.goroutine.go | #5B21B6 | bold |
| keyword.other.DML.sql, keyword.other.DDL.create.sql | #6D28D9 | bold |
| support.function.scalar.sql, support.function.aggregate.sql | #B45309 | — |
| keyword.other.special-method.dockerfile, entity.name.instruction.dockerfile | #6D28D9 | bold |
| entity.name.tag.yaml, support.type.property-name.yaml | #6D28D9 | — |
| variable.other.normal.shell, variable.other.special.shell | #2E1065 | — |
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}!`;
}