Chinubhai67
Publisher: chinubhai67Themes in package: 7
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 |
|---|---|---|
| source, punctuation.definition.dictionary, punctuation.separator.dictionary.pair, variable.other, variable.assignment, entity.name.type.instance, punctuation.section.property-list.begin.bracket.curly.css, punctuation.section.property-list.end.bracket.curly.css, punctuation.definition.constant.css, constant.other.color, support.constant.color, meta.property-name.css, meta.property-value.css, punctuation.section.function.begin.bracket.round.css, punctuation.section.function.end.bracket.round.css, punctuation.section.media.begin.bracket.curly.css, punctuation.section.media.end.bracket.curly.css, punctuation.separator.list.comma.css, meta.paragraph.markdown, text.html.markdown, text.html.basic, punctuation.definition.variable.less, variable.other.object, text.jade, punctuation.section.property-list.begin.bracket.curly.scss, punctuation.section.property-list.end.bracket.curly.scss, variable.interpolation.scss, punctuation.definition.bracket.curly.begin.jsdoc, punctuation.definition.bracket.curly.end.jsdoc, string.other.link.description.title.markdown, constant.language.import-export-all.js, constant.language.import-export-all.ts, constant.language.import-export-all.tsx, meta.parameters.js, punctuation.separator.comma.js | #EEFFFF | — |
| punctuation, keyword.operator, meta.brace, support.constant, support.type.object.module.js, meta.group.regexp, string.regexp.js, source.js-ignored-vscode | #89DDF3 | — |
| support.type.property-name, string.quoted, meta.object-literal.key, source.coffee.embedded.source, entity.name.section.markdown, punctuation.definition.heading.markdown, string.unquoted.plain.out.yaml, string.template.js, string.interpolated.jade, support.type.builtin.graphql | #C3E88D | — |
| constant.numeric, variable.parameter.function, keyword.other.unit | #F78C6A | — |
| constant.language, entity.name.tag.html, entity.name.tag.structure.any.html, entity.name.tag.inline.any.html, entity.name.tag.block.any.html, constant.other.table-name.sql, constant.other.database-name.sql, entity.name.tag.xml, entity.name.tag.localname.xml, entity.name.tag.yaml, entity.name.tag.style.html, entity.name.tag.other.html, support.variable.property.js, entity.name.tag.jade, constant.name.attribute.tag.jade, entity.name.tag.js, entity.name.tag.ts, entity.name.tag.tsx, support.class.component.js, support.class.component.ts, support.class.component.tsx, support.class.component.html | #F07178 | — |
| comment, punctuation.definition.comment | #4f6875 | italic |
| storage.type, keyword.control, keyword.other.important.css, punctuation.definition.keyword, punctuation.definition.directive, storage.modifier.cs, keyword.other.class.cs, keyword.type.cs, markup.italic.markdown, punctuation.definition.italic.markdown, keyword.package.go, keyword.import.go, keyword.function.go, keyword.var.go, keyword.const.go, meta.tag.sgml.doctype.html, storage.modifier.java, punctuation.definition.storage.type.objc, storage.modifier.perl, keyword.other.DML.sql, keyword.other.alias.sql, storage.modifier.async.js, support.type.property-name.json, punctuation.support.type.property-name.begin.json, punctuation.support.type.property-name.end.json, keyword.other.definition.ini, punctuation.definition.block.tag.jsdoc, storage.modifier.js, storage.modifier.ts, storage.modifier.tsx, keyword.type.graphql, keyword.other.default | #C792EA | — |
| markup.italic.markdown, punctuation.definition.italic.markdown | #C792EA | italic |
| entity.name.function, support.function, variable.other.property, punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown, markup.quote.markdown, meta.function-call.generic.python, keyword.other.special-method.ruby, entity.name.type.js, variable.other.object.property.js, entity.name.section.group-title.ini, support.variable.property.dom.js, support.variable.property.dom.ts, entity.name.type.ts, entity.name.type.tsx, variable.graphql | #82AAFF | — |
| markup.quote.markdown | #82AAFF | italic |
| support.class, entity.name.type.class, constant.numeric.css, entity.other.attribute-name, support.variable.object.node.js, support.variable.object.process.js, support.variable.property.process.js, support.variable.dom.js, support.constant.json.js, entity.other.inherited-class, support.variable.dom.ts, support.type.primitive.ts, entity.name.type.interface.ts, entity.name.type.module.js, entity.name.type.module.ts, entity.name.type.module.tsx, support.variable.dom.tsx, support.type.graphql | #FFCB6B | — |
| markup.bold.markdown, punctuation.definition.bold.markdown | #FFCB6B | bold |
| variable.language.super, punctuation.definition.metadata.markdown, variable.language.special.self.python, punctuation.definition.interpolation.begin.bracket.curly.scss, punctuation.definition.interpolation.end.bracket.curly.scss, variable.language.this.js, variable.language.this.ts | #FF5370 | — |
| entity.name.tag | #B2CCD6 | — |
| support.type.property-name.css, support.type.property-name.media.css, support.constant.parity.css, meta.object-literal.key.js, meta.object-literal.key.ts | #73d1c8 | — |
| markup.underline.link.image.markdown, markup.underline.link.markdown | #ff869a | — |
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, punctuation.definition.comment | #838383 | italic |
| variable, string constant.other.placeholder | #EEFFFF | — |
| string constant.other.placeholder | #fa71ff | — |
| constant.other.color | #ffffff | — |
| invalid, invalid.illegal | #FF5370 | — |
| keyword, storage.type, storage.modifier | #ff0062 | — |
| keyword.control, constant.other.color, punctuation, meta.tag, punctuation.definition.tag, punctuation.separator.inheritance.php, punctuation.definition.tag.html, punctuation.definition.tag.begin.html, punctuation.definition.tag.end.html, punctuation.section.embedded, keyword.other.template, keyword.other.substitution | #ffffff | — |
| keyword.control | #ff006a | — |
| entity.name.tag, meta.tag.sgml, markup.deleted.git_gutter | #ff0077 | — |
| entity.name.function, variable.function, support.function, keyword.other.special-method | #00ffff | — |
| meta.function-call | #20dd20 | — |
| meta.block variable.other | #f07178 | — |
| support.other.variable, string.other.link | #f07178 | — |
| constant.numeric, constant.language, support.constant, constant.character, constant.escape, variable.parameter, keyword.other.unit, keyword.other | #ff7e34 | — |
| keyword.other.unit, keyword.other | #82fbff | — |
| constant.other.symbol, constant.other.key, entity.other.inherited-class, markup.heading, markup.inserted.git_gutter, meta.group.braces.curly constant.other.object.key.js string.unquoted.label.js | #ff0077 | — |
| string | #eeff00 | — |
| entity.name, support.type, support.class, support.orther.namespace.use.php, meta.use.php, support.other.namespace.php, markup.changed.git_gutter, support.type.sys-types | #FFCB6B | — |
| support.type | #F0B565 | — |
| source.css support.type.property-name, source.sass support.type.property-name, source.scss support.type.property-name, source.less support.type.property-name, source.stylus support.type.property-name, source.postcss support.type.property-name | #ffffff | — |
| entity.name.module.js, variable.import.parameter.js, variable.other.class.js | #fd0076 | — |
| variable.language | #FF5370 | italic |
| entity.name.method.js | #fdff82 | italic |
| meta.class-method.js entity.name.function.js, variable.function.constructor | #829fff | — |
| entity.other.attribute-name | #00fff2 | — |
| text.html.basic entity.other.attribute-name.html, text.html.basic entity.other.attribute-name | #FFCB6B | italic |
| entity.other.attribute-name.class | #FFCB6B | — |
| source.sass keyword.control | #82AAFF | — |
| markup.inserted | #C3E88D | — |
| markup.deleted | #FF5370 | — |
| markup.changed | #C792EA | — |
| string.regexp | #89DDFF | — |
| constant.character.escape | #89DDFF | — |
| *url*, *link*, *uri* | — | underline |
| tag.decorator.js entity.name.tag.js, tag.decorator.js punctuation.definition.tag.js | #82AAFF | italic |
| source.js constant.other.object.key.js string.unquoted.label.js | #FF5370 | italic |
| source.json meta.structure.dictionary.json support.type.property-name.json | #C792EA | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #FFCB6B | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #F78C6C | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #FF5370 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #da8878 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #ff0062 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #f07178 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #ff0062 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #C3E88D | — |
| text.html.markdown, punctuation.definition.list_item.markdown | #EEFFFF | — |
| text.html.markdown markup.inline.raw.markdown | #ff0062 | — |
| text.html.markdown markup.inline.raw.markdown punctuation.definition.raw.markdown | #65737E | — |
| markdown.heading, markup.heading | markup.heading entity.name, markup.heading.markdown punctuation.definition.heading.markdown | #C3E88D | — |
| markup.italic | #f07178 | italic |
| markup.bold, markup.bold string | #f49eff | bold |
| markup.bold markup.italic, markup.italic markup.bold, markup.quote markup.bold, markup.bold markup.italic string, markup.italic markup.bold string, markup.quote markup.bold string | #f07178 | bold |
| markup.underline | #F78C6C | underline |
| markup.quote punctuation.definition.blockquote.markdown | #65737E | — |
| markup.quote | — | italic |
| string.other.link.title.markdown | #ff0062 | — |
| string.other.link.description.title.markdown | #ff0062 | — |
| constant.other.reference.link.markdown | #FFCB6B | — |
| markup.raw.block | #ff0062 | — |
| markup.raw.block.fenced.markdown | #00000050 | — |
| punctuation.definition.fenced.markdown | #00000050 | — |
| markup.raw.block.fenced.markdown, variable.language.fenced.markdown, punctuation.section.class.end | #EEFFFF | — |
| variable.language.fenced.markdown | #65737E | — |
| meta.separator | #65737E | bold |
| markup.table | #EEFFFF | — |
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 |
|---|---|---|
| keyword.other.using.cs, keyword.other.namespace.cs, keyword.preprocessor.pragma.cs, meta.preprocessor.cs | #cc75f5 | — |
| entity.name.type.namespace.cs, entity.name.function.python | #f0608d | — |
| keyword.type.cs, keyword.other.class.cs, keyword.other.new.cs, keyword.other.var.cs, keyword.other.await.cs | #fd4c87 | — |
| storage.modifier.cs, storage.modifier.ts | #00faa7 | — |
| entity.name.type.class.cs, storage.type, variable.other.object.cs, keyword.control.flow.return.cs, support.type.exception.python, support.type.primitive.ts | #f8aa35 | — |
| entity.name.function.cs, entity.name.variable.local.cs, variable.other.object.property.cs, variable.other.readwrite.cs, keyword.control.import.ts, keyword.control.from.ts, keyword.control.from.js | #55acf3 | — |
| entity.name.variable.field.cs, entity.name.variable.parameter.cs, entity.name.variable.property.cs | #d350cc | — |
| constant.language.boolean.true.cs, constant.language.boolean.false.cs | #5653ff | — |
| comment.line.double-slash.cs, comment.block.cs, punctuation.definition.comment.json.comments, comment.line.double-slash.js, meta.structure.array.json.comments, meta.structure.dictionary.value.json.comments, meta.structure.dictionary.json.comments, source.json.comments, comment.block.css, comment.block.html, meta.property-list.css, comment.line.number-sign.python, punctuation.definition.comment.cs, comment.block.documentation.cs, punctuation.definition.comment.ts, comment.line.double-slash.ts, comment.line.scss, comment.block.ts, comment.block.scss, comment.block.documentation.ts, comment.line.double-slash.tsx, comment.block.tsx | #48515e | — |
| variable.other.constant.js, meta.definition.variable.js, meta.var-single-variable.expr.js, meta.var.expr.js, support.variable.magic.python, meta.attribute.python | #ff91de | — |
| variable.other.readwrite.js | #4979fc | — |
| entity.name.function.js | #2ff76b | — |
| meta.object-literal.key.js, meta.object.member.js, meta.objectliteral.js | #00faa7 | — |
| constant.language.boolean.true.js, constant.language.boolean.false.js | #5653ff | — |
| variable.parameter.js, meta.parameters.js, meta.arrow.js, constant.other.caps.python, variable.other.readwrite.ts, variable.other.readwrite.alias.ts, variable.other.constant.ts, variable.other.readwrite.alias.js | #faa84b | — |
| entity.other.njk.delimiter.tag, variable.other.njk | #faa84b | — |
| entity.other.attribute-name.id.css, entity.other.attribute-name.pseudo-class.css, meta.selector.css, entity.other.attribute-name.class.css, meta.selector.css | #5fe953 | — |
| entity.name.tag.css, meta.selector.css | #faa84b | — |
| support.type.property-name.css, meta.property-name.css, meta.property-list.css, support.type.vendored.property-name.css | #7d8eac | — |
| constant.numeric.css, support.constant.property-value.css, support.constant.color.w3c-standard-color-name.css | #00d9ff | — |
| variable.argument.css, meta.function.variable.css | #f5d2a5 | — |
| keyword.other.unit.px.css, keyword.other.unit.percentage.css, keyword.other.unit.vh.css, keyword.other.unit.rem.css, keyword.other.unit.em.css, keyword.other.unit.ms.css, keyword.control.export.ts | #ff67f2 | — |
| invalid, invalid.illegal | #FF5370 | — |
| keyword.control, constant.other.color, punctuation, meta.tag, punctuation.definition.tag, punctuation.separator.inheritance.php, punctuation.definition.tag.html, punctuation.definition.tag.begin.html, punctuation.definition.tag.end.html, punctuation.section.embedded, keyword.other.template, keyword.other.substitution, keyword.operator.new.ts, meta.object-literal.key.ts | #89DDFF | — |
| entity.name.tag, meta.tag.sgml, markup.deleted.git_gutter | #f07178 | — |
| entity.name.function, meta.function-call, variable.function, support.function, keyword.other.special-method | #95b1ec | — |
| entity.name.function.ts | #709eff | — |
| meta.block variable.other | #fd5a62 | — |
| support.other.variable, string.other.link, constant.numeric.dec.python, meta.function-call.arguments.python, meta.indexed-name.python | #fc626a | — |
| constant.numeric, constant.language, support.constant, constant.character, constant.escape, variable.parameter, keyword.other.unit, keyword.other, meta.item-access.arguments.python, | #F78C6C | — |
| string, constant.other.symbol, constant.other.key, entity.other.inherited-class, markup.heading, markup.inserted.git_gutter, meta.group.braces.curly constant.other.object.key.js string.unquoted.label.js | #C3E88D | — |
| entity.name, support.type, support.class, support.orther.namespace.use.php, meta.use.php, support.other.namespace.php, markup.changed.git_gutter, support.type.sys-types, meta.function-call.generic.python, variable.object.property.ts | #00b7ff | — |
| support.type | #92a0df | — |
| source.css support.type.property-name, source.sass support.type.property-name, source.scss support.type.property-name, source.less support.type.property-name, source.stylus support.type.property-name, source.postcss support.type.property-name | #B2CCD6 | — |
| entity.name.module.js, variable.import.parameter.js, variable.other.class.js, keyword.control.import.python | #FF5370 | — |
| variable.language | #FF5370 | italic |
| entity.name.method.js | #82AAFF | italic |
| meta.class-method.js entity.name.function.js, variable.function.constructor | #82AAFF | — |
| entity.other.attribute-name | #C792EA | — |
| text.html.basic entity.other.attribute-name.html, text.html.basic entity.other.attribute-name | #FFCB6B | italic |
| entity.other.attribute-name.class | #FFCB6B | — |
| source.sass keyword.control | #82AAFF | — |
| markup.inserted | #C3E88D | — |
| markup.deleted | #FF5370 | — |
| markup.changed | #C792EA | — |
| string.regexp | #89DDFF | — |
| constant.character.escape | #89DDFF | — |
| *url*, *link*, *uri* | — | underline |
| tag.decorator.js entity.name.tag.js, tag.decorator.js punctuation.definition.tag.js | #82AAFF | italic |
| source.js constant.other.object.key.js string.unquoted.label.js | #FF5370 | italic |
| source.json meta.structure.dictionary.json support.type.property-name.json | #C792EA | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #FFCB6B | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #F78C6C | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #FF5370 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #C17E70 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #82AAFF | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #f07178 | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #C792EA | — |
| source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json | #C3E88D | — |
| text.html.markdown, punctuation.definition.list_item.markdown, meta.paragraph.markdown | #5d90ff | — |
| text.html.markdown markup.inline.raw.markdown | #C792EA | — |
| text.html.markdown markup.inline.raw.markdown punctuation.definition.raw.markdown | #65737E | — |
| markdown.heading, markup.heading | markup.heading entity.name, markup.heading.markdown punctuation.definition.heading.markdown | #ff8800 | — |
| markup.italic | #f07178 | italic |
| markup.bold, markup.bold string | #f07178 | bold |
| markup.bold markup.italic, markup.italic markup.bold, markup.quote markup.bold, markup.bold markup.italic string, markup.italic markup.bold string, markup.quote markup.bold string | #f07178 | bold |
| markup.underline | #fa7f5a | underline |
| markup.quote punctuation.definition.blockquote.markdown | #65737E | — |
| markup.quote | — | italic |
| string.other.link.title.markdown | #fffc35 | — |
| string.other.link.description.title.markdown | #C792EA | — |
| constant.other.reference.link.markdown | #FFCB6B | — |
| markup.raw.block | #C792EA | — |
| markup.raw.block.fenced.markdown | #00000050 | — |
| punctuation.definition.fenced.markdown | #00000050 | — |
| markup.raw.block.fenced.markdown, variable.language.fenced.markdown, punctuation.section.class.end | #EEFFFF | — |
| variable.language.fenced.markdown | #65737E | — |
| meta.separator | #65737E | bold |
| markup.table | #EEFFFF | — |
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}!`;
}