Hallucination
Publisher: matheusdearaujoThemes in package: 3
A dark theme for Visual Studio Code.
A dark theme for Visual Studio Code.
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 |
|---|---|---|
| punctuation.definition.delayed.unison,punctuation.definition.list.begin.unison,punctuation.definition.list.end.unison,punctuation.definition.ability.begin.unison,punctuation.definition.ability.end.unison,punctuation.operator.assignment.as.unison,punctuation.separator.pipe.unison,punctuation.separator.delimiter.unison,punctuation.definition.hash.unison | #f8f8f2 | — |
| variable.other.generic-type.haskell | #ff79c6 | — |
| storage.type.haskell | #d694f5 | — |
| support.variable.magic.python | #f8f8f2 | — |
| punctuation.separator.period.python,punctuation.separator.element.python,punctuation.parenthesis.begin.python,punctuation.parenthesis.end.python | #fefefe | — |
| variable.parameter.function.language.special.self.python | #d694f5 | — |
| storage.modifier.lifetime.rust | #fefefe | — |
| support.function.std.rust | #50fa7b | — |
| entity.name.lifetime.rust | #d694f5 | — |
| variable.language.rust | #f8f8f2 | — |
| support.constant.edge | #ff79c6 | — |
| constant.other.character-class.regexp | #f8f8f2 | — |
| keyword.operator.quantifier.regexp | #d694f5 | — |
| punctuation.definition.string.begin,punctuation.definition.string.end | #f1fa8c | — |
| variable.parameter.function | #fefefe | — |
| comment markup.link | #5f5076 | — |
| markup.changed.diff | #d694f5 | — |
| meta.diff.header.from-file,meta.diff.header.to-file,punctuation.definition.from-file.diff,punctuation.definition.to-file.diff | #50fa7b | — |
| markup.inserted.diff | #f1fa8c | — |
| markup.deleted.diff | #f8f8f2 | — |
| meta.function.c,meta.function.cpp | #f8f8f2 | — |
| punctuation.section.block.begin.bracket.curly.cpp,punctuation.section.block.end.bracket.curly.cpp,punctuation.terminator.statement.c,punctuation.section.block.begin.bracket.curly.c,punctuation.section.block.end.bracket.curly.c,punctuation.section.parens.begin.bracket.round.c,punctuation.section.parens.end.bracket.round.c,punctuation.section.parameters.begin.bracket.round.c,punctuation.section.parameters.end.bracket.round.c | #fefefe | — |
| punctuation.separator.key-value | #fefefe | — |
| keyword.operator.expression.import | #50fa7b | — |
| support.constant.math | #d694f5 | — |
| support.constant.property.math | #d694f5 | — |
| variable.other.constant | #d694f5 | — |
| storage.type.annotation.java, storage.type.object.array.java | #d694f5 | — |
| source.java | #f8f8f2 | — |
| punctuation.section.block.begin.java,punctuation.section.block.end.java,punctuation.definition.method-parameters.begin.java,punctuation.definition.method-parameters.end.java,meta.method.identifier.java,punctuation.section.method.begin.java,punctuation.section.method.end.java,punctuation.terminator.java,punctuation.section.class.begin.java,punctuation.section.class.end.java,punctuation.section.inner-class.begin.java,punctuation.section.inner-class.end.java,meta.method-call.java,punctuation.section.class.begin.bracket.curly.java,punctuation.section.class.end.bracket.curly.java,punctuation.section.method.begin.bracket.curly.java,punctuation.section.method.end.bracket.curly.java,punctuation.separator.period.java,punctuation.bracket.angle.java,punctuation.definition.annotation.java,meta.method.body.java | #fefefe | — |
| meta.method.java | #50fa7b | — |
| storage.modifier.import.java,storage.type.java,storage.type.generic.java | #d694f5 | — |
| keyword.operator.instanceof.java | #ff79c6 | — |
| meta.definition.variable.name.java | #f8f8f2 | — |
| keyword.operator.logical | #ff79c6 | — |
| keyword.operator.bitwise | #ff79c6 | — |
| keyword.operator.channel | #ff79c6 | — |
| support.constant.property-value.scss,support.constant.property-value.css | #d694f5 | — |
| keyword.operator.css,keyword.operator.scss,keyword.operator.less | #ff79c6 | — |
| support.constant.color.w3c-standard-color-name.css,support.constant.color.w3c-standard-color-name.scss | #50FA7B | — |
| punctuation.separator.list.comma.css | #fefefe | — |
| support.constant.color.w3c-standard-color-name.css | #50FA7B | — |
| support.type.vendored.property-name.css | #ff79c6 | — |
| support.module.node,support.type.object.module,support.module.node | #d694f5 | — |
| entity.name.type.module | #d694f5 | — |
| variable.other.readwrite,meta.object-literal.key,support.variable.property,support.variable.object.process,support.variable.object.node | #f8f8f2 | — |
| support.constant.json | #d694f5 | — |
| keyword.operator.expression.instanceof, keyword.operator.new, keyword.operator.ternary, keyword.operator.optional, keyword.operator.expression.keyof | #ff79c6 | — |
| support.type.object.console | #f8f8f2 | — |
| support.variable.property.process | #d694f5 | — |
| entity.name.function,support.function.console | #50fa7b | — |
| keyword.operator.misc.rust | #fefefe | — |
| keyword.operator.sigil.rust | #ff79c6 | — |
| keyword.operator.delete | #ff79c6 | — |
| support.type.object.dom | #ff79c6 | — |
| support.variable.dom,support.variable.property.dom | #f8f8f2 | — |
| keyword.operator.arithmetic,keyword.operator.comparison,keyword.operator.decrement,keyword.operator.increment,keyword.operator.relational | #ff79c6 | — |
| keyword.operator.assignment.c,keyword.operator.comparison.c,keyword.operator.c,keyword.operator.increment.c,keyword.operator.decrement.c,keyword.operator.bitwise.shift.c,keyword.operator.assignment.cpp,keyword.operator.comparison.cpp,keyword.operator.cpp,keyword.operator.increment.cpp,keyword.operator.decrement.cpp,keyword.operator.bitwise.shift.cpp | #ff79c6 | — |
| punctuation.separator.delimiter | #fefefe | — |
| punctuation.separator.c,punctuation.separator.cpp | #ff79c6 | — |
| support.type.posix-reserved.c,support.type.posix-reserved.cpp | #ff79c6 | — |
| keyword.operator.sizeof.c,keyword.operator.sizeof.cpp | #ff79c6 | — |
| variable.parameter.function.language.python | #d694f5 | — |
| support.type.python | #ff79c6 | — |
| keyword.operator.logical.python | #ff79c6 | — |
| variable.parameter.function.python | #d694f5 | — |
| punctuation.definition.arguments.begin.python,punctuation.definition.arguments.end.python,punctuation.separator.arguments.python,punctuation.definition.list.begin.python,punctuation.definition.list.end.python | #fefefe | — |
| meta.function-call.generic.python | #50fa7b | — |
| constant.character.format.placeholder.other.python | #d694f5 | — |
| keyword.operator | #fefefe | — |
| keyword.operator.assignment.compound | #ff79c6 | — |
| keyword.operator.assignment.compound.js,keyword.operator.assignment.compound.ts | #ff79c6 | — |
| keyword | #ff79c6 | — |
| entity.name.namespace | #d694f5 | — |
| variable | #f8f8f2 | — |
| variable.c | #fefefe | — |
| variable.language | #d694f5 | — |
| token.variable.parameter.java | #fefefe | — |
| import.storage.java | #d694f5 | — |
| token.package.keyword | #ff79c6 | — |
| token.package | #fefefe | — |
| entity.name.function, meta.function-call.generic, meta.function-call.object, meta.function-call.php, meta.function-call.static, meta.method-call.java meta.method, meta.method.groovy, support.function.any-method.lua, keyword.operator.function.infix | #50FA7B | — |
| entity.name.type.namespace | #8BE9FD | — |
| support.class, entity.name.type.class | #8BE9FD | — |
| entity.name.class.identifier.namespace.type | #8BE9FD | — |
| entity.name.class, variable.other.class.js, variable.other.class.ts | #8BE9FD | — |
| variable.other.class.php | #f8f8f2 | — |
| entity.name.type | #8BE9FD | — |
| keyword.control | #ff79c6 | — |
| control.elements, keyword.operator.less | #d694f5 | — |
| keyword.other.special-method | #50fa7b | — |
| storage | #ff79c6 | — |
| token.storage | #ff79c6 | — |
| keyword.operator.expression.delete,keyword.operator.expression.in,keyword.operator.expression.of,keyword.operator.expression.instanceof,keyword.operator.new,keyword.operator.expression.typeof,keyword.operator.expression.void | #ff79c6 | — |
| token.storage.type.java | #d694f5 | — |
| support.function | #ff79c6 | — |
| support.type.property-name | #fefefe | — |
| support.constant.property-value | #fefefe | — |
| support.constant.font-name | #d694f5 | — |
| meta.tag | #fefefe | — |
| string | #f1fa8c | — |
| entity.other.inherited-class | #8BE9FD | — |
| constant.other.symbol | #ff79c6 | — |
| constant.numeric | #d694f5 | — |
| constant, variable.other.constant | #D694F5 | — |
| punctuation.definition.constant | #d694f5 | — |
| entity.name.tag | #ff79c6 | — |
| entity.other.attribute-name | #50FA7B | — |
| entity.other.attribute-name.id | #50fa7b | normal |
| entity.other.attribute-name.class.css | #50FA7B | normal |
| meta.selector | #ff79c6 | — |
| markup.heading | #f8f8f2 | — |
| markup.heading punctuation.definition.heading, entity.name.section | #50fa7b | — |
| keyword.other.unit | #f8f8f2 | — |
| markup.bold,todo.bold | #d694f5 | — |
| punctuation.definition.bold | #d694f5 | — |
| markup.italic, punctuation.definition.italic,todo.emphasis | #ff79c6 | — |
| emphasis md | #ff79c6 | — |
| entity.name.section.markdown | #f8f8f2 | — |
| punctuation.definition.heading.markdown | #f8f8f2 | — |
| punctuation.definition.list.begin.markdown | #f8f8f2 | — |
| markup.heading.setext | #fefefe | — |
| punctuation.definition.bold.markdown | #d694f5 | — |
| markup.inline.raw.markdown | #f1fa8c | — |
| markup.inline.raw.string.markdown | #f1fa8c | — |
| punctuation.definition.list.markdown | #f8f8f2 | — |
| punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown, punctuation.definition.metadata.markdown | #f8f8f2 | — |
| beginning.punctuation.definition.list.markdown | #f8f8f2 | — |
| punctuation.definition.metadata.markdown | #f8f8f2 | — |
| markup.underline.link.markdown,markup.underline.link.image.markdown | #ff79c6 | — |
| string.other.link.title.markdown,string.other.link.description.markdown | #50fa7b | — |
| string.regexp | #ff79c6 | — |
| constant.character.escape | #ff79c6 | — |
| punctuation.section.embedded, variable.interpolation | #f8f8f2 | — |
| punctuation.section.embedded.begin,punctuation.section.embedded.end | #ff79c6 | — |
| invalid.illegal | #ffffff | — |
| invalid.illegal.bad-ampersand.html | #fefefe | — |
| invalid.broken | #ffffff | — |
| invalid.deprecated | #ffffff | — |
| invalid.unimplemented | #ffffff | — |
| source.json meta.structure.dictionary.json > string.quoted.json | #f8f8f2 | — |
| source.json meta.structure.dictionary.json > string.quoted.json > punctuation.string | #f8f8f2 | — |
| source.json meta.structure.dictionary.json > value.json > string.quoted.json,source.json meta.structure.array.json > value.json > string.quoted.json,source.json meta.structure.dictionary.json > value.json > string.quoted.json > punctuation,source.json meta.structure.array.json > value.json > string.quoted.json > punctuation | #f1fa8c | — |
| source.json meta.structure.dictionary.json > constant.language.json,source.json meta.structure.array.json > constant.language.json | #ff79c6 | — |
| support.type.property-name.json | #f8f8f2 | — |
| support.type.property-name.json punctuation | #f8f8f2 | — |
| text.html.laravel-blade source.php.embedded.line.html entity.name.tag.laravel-blade | #ff79c6 | — |
| text.html.laravel-blade source.php.embedded.line.html support.constant.laravel-blade | #ff79c6 | — |
| support.other.namespace.use.php,support.other.namespace.use-as.php,support.other.namespace.php,entity.other.alias.php,meta.interface.php | #d694f5 | — |
| keyword.operator.error-control.php | #ff79c6 | — |
| keyword.operator.type.php | #ff79c6 | — |
| punctuation.section.array.begin.php | #fefefe | — |
| punctuation.section.array.end.php | #fefefe | — |
| invalid.illegal.non-null-typehinted.php | #f44747 | — |
| storage.type.php,meta.other.type.phpdoc.php,keyword.other.type.php,keyword.other.array.phpdoc.php | #d694f5 | — |
| meta.function-call.php,meta.function-call.object.php,meta.function-call.static.php | #50fa7b | — |
| punctuation.definition.parameters.begin.bracket.round.php,punctuation.definition.parameters.end.bracket.round.php,punctuation.separator.delimiter.php,punctuation.section.scope.begin.php,punctuation.section.scope.end.php,punctuation.terminator.expression.php,punctuation.definition.arguments.begin.bracket.round.php,punctuation.definition.arguments.end.bracket.round.php,punctuation.definition.storage-type.begin.bracket.round.php,punctuation.definition.storage-type.end.bracket.round.php,punctuation.definition.array.begin.bracket.round.php,punctuation.definition.array.end.bracket.round.php,punctuation.definition.begin.bracket.round.php,punctuation.definition.end.bracket.round.php,punctuation.definition.begin.bracket.curly.php,punctuation.definition.end.bracket.curly.php,punctuation.definition.section.switch-block.end.bracket.curly.php,punctuation.definition.section.switch-block.start.bracket.curly.php,punctuation.definition.section.switch-block.begin.bracket.curly.php,punctuation.definition.section.switch-block.end.bracket.curly.php | #fefefe | — |
| support.constant.core.rust | #d694f5 | — |
| support.constant.ext.php,support.constant.std.php,support.constant.core.php,support.constant.parser-token.php | #d694f5 | — |
| entity.name.goto-label.php,support.other.php | #50fa7b | — |
| keyword.operator.logical.php,keyword.operator.bitwise.php,keyword.operator.arithmetic.php | #ff79c6 | — |
| keyword.operator.regexp.php | #ff79c6 | — |
| keyword.operator.comparison.php | #ff79c6 | — |
| keyword.operator.heredoc.php,keyword.operator.nowdoc.php | #ff79c6 | — |
| meta.function.decorator.python | #50fa7b | — |
| support.token.decorator.python,meta.function.decorator.identifier.python | #ff79c6 | — |
| function.parameter | #fefefe | — |
| function.brace | #fefefe | — |
| function.parameter.ruby, function.parameter.cs | #fefefe | — |
| constant.language.symbol.ruby | #ff79c6 | — |
| rgb-value | #ff79c6 | — |
| inline-color-decoration rgb-value | #d694f5 | — |
| less rgb-value | #d694f5 | — |
| selector.sass | #f8f8f2 | — |
| support.type.primitive.ts,support.type.builtin.ts,support.type.primitive.tsx,support.type.builtin.tsx | #8BE9FD | — |
| block.scope.end,block.scope.begin | #fefefe | — |
| storage.type.cs | #d694f5 | — |
| entity.name.variable.local.cs | #f8f8f2 | — |
| token.info-token | #50fa7b | — |
| token.warn-token | #d694f5 | — |
| token.error-token | #f44747 | — |
| token.debug-token | #ff79c6 | — |
| punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end, punctuation.section.embedded | #ff79c6 | — |
| meta.template.expression | #fefefe | — |
| keyword.operator.module | #ff79c6 | — |
| support.type.type.flowtype | #50fa7b | — |
| support.type.primitive | #8BE9FD | — |
| meta.property.object | #f8f8f2 | — |
| variable.parameter.function.js | #f8f8f2 | — |
| keyword.other.template.begin | #f1fa8c | — |
| keyword.other.template.end | #f1fa8c | — |
| keyword.other.substitution.begin | #f1fa8c | — |
| keyword.other.substitution.end | #f1fa8c | — |
| keyword.operator.assignment | #ff79c6 | — |
| keyword.operator.assignment.go | #d694f5 | — |
| keyword.operator.arithmetic.go, keyword.operator.address.go | #ff79c6 | — |
| entity.name.package.go | #d694f5 | — |
| support.type.prelude.elm | #ff79c6 | — |
| support.constant.elm | #d694f5 | — |
| punctuation.quasi.element | #ff79c6 | — |
| constant.character.entity | #f8f8f2 | — |
| entity.other.attribute-name.pseudo-element, entity.other.attribute-name.pseudo-class | #ff79c6 | — |
| entity.global.clojure | #d694f5 | — |
| meta.symbol.clojure | #f8f8f2 | — |
| constant.keyword.clojure | #ff79c6 | — |
| meta.arguments.coffee, variable.parameter.function.coffee | #f8f8f2 | — |
| source.ini | #f1fa8c | — |
| meta.scope.prerequisites.makefile | #f8f8f2 | — |
| source.makefile | #d694f5 | — |
| storage.modifier.import.groovy | #d694f5 | — |
| meta.method.groovy | #50fa7b | — |
| meta.definition.variable.name.groovy | #f8f8f2 | — |
| meta.definition.class.inherited.classes.groovy | #f1fa8c | — |
| support.variable.semantic.hlsl | #d694f5 | — |
| support.type.texture.hlsl, support.type.sampler.hlsl, support.type.object.hlsl, support.type.object.rw.hlsl, support.type.fx.hlsl, support.type.object.hlsl | #ff79c6 | — |
| text.variable, text.bracketed | #f8f8f2 | — |
| support.type.swift, support.type.vb.asp | #d694f5 | — |
| entity.name.function.xi | #d694f5 | — |
| entity.name.class.xi | #ff79c6 | — |
| constant.character.character-class.regexp.xi | #f8f8f2 | — |
| constant.regexp.xi | #ff79c6 | — |
| keyword.control.xi | #ff79c6 | — |
| invalid.xi | #fefefe | — |
| beginning.punctuation.definition.quote.markdown.xi | #f1fa8c | — |
| beginning.punctuation.definition.list.markdown.xi | #5f5076 | — |
| constant.character.xi | #50fa7b | — |
| accent.xi | #50fa7b | — |
| wikiword.xi | #d694f5 | — |
| constant.other.color.rgb-value.xi | #ffffff | — |
| punctuation.definition.tag.xi | #5f5076 | — |
| entity.name.label.cs, entity.name.scope-resolution.function.call, entity.name.scope-resolution.function.definition | #d694f5 | — |
| entity.name.label.cs, markup.heading.setext.1.markdown, markup.heading.setext.2.markdown | #f8f8f2 | — |
| meta.brace.square | #fefefe | — |
| comment, punctuation.definition.comment | #5f5076 | italic |
| markup.quote.markdown | #5f5076 | — |
| punctuation.definition.block.sequence.item.yaml | #fefefe | — |
| constant.language.symbol.elixir | #ff79c6 | — |
| entity.other.attribute-name.js,entity.other.attribute-name.ts,entity.other.attribute-name.jsx,entity.other.attribute-name.tsx,variable.parameter,variable.language.super | — | italic |
| comment.line.double-slash,comment.block.documentation | — | italic |
| keyword.control.import.python,keyword.control.flow.python | — | italic |
| markup.italic.markdown | — | italic |
| punctuation.definition.character-class.regexp | #8BE9FD | — |
| entity.name.type.class, entity.name.class | #8BE9FD | normal |
| keyword.expressions-and-types.swift, keyword.other.this, variable.language, variable.language punctuation.definition.variable.php, variable.other.readwrite.instance.ruby, variable.parameter.function.language.special | #BD93F9 | italic |
| entity.other.inherited-class | #8BE9FD | italic |
| comment.block.documentation variable | #FFB86C | italic |
| entity.name.variable.parameter, meta.at-rule.function variable, meta.at-rule.mixin variable, meta.function.arguments variable.other.php, meta.selectionset.graphql meta.arguments.graphql variable.arguments.graphql, variable.parameter | #FFB86C | italic |
| constant.other.date, constant.other.timestamp | #FFB86C | — |
| entity.name.type.type-parameter, meta.indexer.mappedtype.declaration entity.name.type, meta.type.parameters entity.name.type | #FFB86C | — |
| meta.import variable.other.readwrite, meta.object-binding-pattern-variable variable.object.property, meta.variable.assignment.destructured.object.coffee variable | #FFB86C | italic |
| meta.import variable.other.readwrite.alias, meta.export variable.other.readwrite.alias, meta.variable.assignment.destructured.object.coffee variable variable | #F8F8F2 | normal |
| punctuation.definition.group.regexp | #FFB86C | — |
| entity.name.fragment.graphql, variable.fragment.graphql | #8BE9FD | — |
| beginning.punctuation.definition.list.markdown, beginning.punctuation.definition.quote.markdown, punctuation.definition.link.restructuredtext | #8BE9FD | — |
| markup.underline.link, markup.underline.link.image | #8BE9FD | — |
| comment.block.documentation entity.name.type | #8BE9FD | italic |
| comment.block.documentation entity.name.type punctuation.definition.bracket | #8BE9FD | — |
| support | #8BE9FD | italic |
| support.variable | #8BE9FD | — |
| entity.name.function.target.makefile, entity.name.section.toml, entity.name.tag.yaml, variable.other.key.toml | #8BE9FD | — |
| entity.name.type, keyword.primitive-datatypes.swift, keyword.type.cs, meta.protocol-list.objc, meta.return-type.objc, source.go storage.type, source.groovy storage.type, source.java storage.type, source.powershell entity.other.attribute-name, storage.class.std.rust, storage.type.attribute.swift, storage.type.c, storage.type.core.rust, storage.type.cs, storage.type.groovy, storage.type.objc, storage.type.php, storage.type.haskell, storage.type.ocaml | #8BE9FD | italic |
| constant.other.symbol.hashkey punctuation.definition.constant.ruby, entity.other.attribute-name.placeholder punctuation, entity.other.attribute-name.pseudo-class punctuation, entity.other.attribute-name.pseudo-element punctuation, meta.group.double.toml, meta.group.toml, meta.object-binding-pattern-variable punctuation.destructuring, punctuation.colon.graphql, punctuation.definition.block.scalar.folded.yaml, punctuation.definition.block.scalar.literal.yaml, punctuation.definition.block.sequence.item.yaml, punctuation.definition.entity.other.inherited-class, punctuation.function.swift, punctuation.separator.dictionary.key-value, punctuation.separator.hash, punctuation.separator.inheritance, punctuation.separator.key-value, punctuation.separator.key-value.mapping.yaml, punctuation.separator.namespace, punctuation.separator.pointer-access, punctuation.separator.slice, string.unquoted.heredoc punctuation.definition.string, support.other.chomping-indicator.yaml, punctuation.separator.annotation | #FF79C6 | — |
| keyword.operator.other.powershell, keyword.other.statement-separator.powershell, meta.brace.round, meta.function-call punctuation, punctuation.definition.arguments.begin, punctuation.definition.arguments.end, punctuation.definition.entity.begin, punctuation.definition.entity.end, punctuation.definition.tag.cs, punctuation.definition.type.begin, punctuation.definition.type.end, punctuation.section.scope.begin, punctuation.section.scope.end, storage.type.generic.java, string.template meta.brace, string.template punctuation.accessor | #F8F8F2 | — |
| entity.other.attribute-name | #50FA7B | italic |
| meta.decorator variable.other.readwrite, meta.decorator variable.other.property | #50FA7B | italic |
| meta.decorator variable.other.object | #50FA7B | — |
| support.function.magic, support.variable, variable.other.predefined | #BD93F9 | regular |
| support.function, support.type.property-name | — | regular |
| entity.name.function | #5AEE95 | — |
TypeScript sample highlighted with this variant's colors and tokenColors.
Loading...
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}!`;
}