Skip to main content
Home Theme VS Code remix-vscode-theme Color themes used on Remix Run website and docs
remix-vscode-theme | Coding Theme
VS Code preview Full workbench mockup using this variant's colors and tokenColors.
colors Workbench UI color keys from the theme JSON colors map.
activityBar.activeBackground #3f3f3f activityBar.background #1e1e1e activityBar.dropBackground #eef2f8 activityBar.foreground #b7bcbe activityBar.inactiveForeground #6a726d activityBarBadge.background #59a8ff tokenColors TextMate scopes and font styles (syntax highlighting rules).
scope foreground fontStyle comment, punctuation.definition.comment #6a726d italic variable, string constant.other.placeholder, entity.name.variable.parameter, entity.name.variable.local, variable.parameter #f09eb7 — variable.other.object.property #59a8ff — constant.other.color #fecc1b — invalid, invalid.illegal
Shiki preview TypeScript sample highlighted with this variant's colors and tokenColors.
remix-vscode-theme — Remix Docs Dark
activityBarBadge.foreground #eef2f8
badge.background #1e1e1e
badge.foreground #b7bcbe
breadcrumb.activeSelectionForeground #eef2f8
breadcrumb.background #292929
breadcrumb.focusForeground #d0d0d0
breadcrumb.foreground #b7bcbe
breadcrumbPicker.background #292929
button.background #292929
button.foreground #eef2f8
button.hoverBackground #828282
button.secondaryBackground #e79fd7
button.secondaryForeground #eef2f8
button.secondaryHoverBackground #828282
charts.blue #59a8ff
charts.foreground #b7bcbe
charts.green #fecc1b
charts.lines #b7bcbe
charts.orange #d83bd2
charts.purple #e79fd7
charts.red #f09eb7
charts.yellow #59a8ff
checkbox.background #1e1e1e
checkbox.foreground #b7bcbe
debugConsole.errorForeground #f09eb7
debugConsole.infoForeground #b7bcbe
debugConsole.sourceForeground #b7bcbe
debugConsole.warningForeground #59a8ff
debugConsoleInputIcon.foreground #b7bcbe
debugExceptionWidget.background #292929
debugIcon.breakpointCurrentStackframeForeground #59a8ff
debugIcon.breakpointDisabledForeground #828282
debugIcon.breakpointForeground #f09eb7
debugIcon.breakpointStackframeForeground #b7bcbe
debugIcon.breakpointUnverifiedForeground #3f3f3f
debugIcon.continueForeground #fecc1b
debugIcon.disconnectForeground #f09eb7
debugIcon.pauseForeground #59a8ff
debugIcon.restartForeground #fecc1b
debugIcon.startForeground #fecc1b
debugIcon.stepBackForeground #b7bcbe
debugIcon.stepIntoForeground #54cfb7
debugIcon.stepOutForeground #e79fd7
debugIcon.stepOverForeground #59a8ff
debugIcon.stopForeground #f09eb7
debugTokenExpression.boolean #d83bd2
debugTokenExpression.error #f09eb7
debugTokenExpression.name #e79fd7
debugTokenExpression.number #d83bd2
debugTokenExpression.string #fecc1b
debugTokenExpression.value #b7bcbe
debugToolBar.background #292929
debugView.stateLabelBackground #59a8ff
debugView.stateLabelForeground #eef2f8
debugView.valueChangedHighlight #59a8ff
descriptionForeground #6a726d
diffEditor.diagonalFill #3f3f3f
diffEditor.insertedTextBackground #fecc1b20
diffEditor.removedTextBackground #f09eb720
dropdown.background #1e1e1e
dropdown.foreground #b7bcbe
dropdown.listBackground #1e1e1e
editor.background #1e1e1e
editor.findMatchBackground #59a8ff6f
editor.findMatchHighlightBackground #d83bd26f
editor.findRangeHighlightBackground #2929296f
editor.foreground #b7bcbe
editor.hoverHighlightBackground #3f3f3f6f
editor.inactiveSelectionBackground #3f3f3f
editor.lineHighlightBackground #292929
editor.rangeHighlightBackground #2929296f
editor.selectionBackground #3f3f3f
editor.selectionHighlightBackground #292929
editor.snippetFinalTabstopHighlightBackground #6a726d
editor.snippetTabstopHighlightBackground #3f3f3f
editor.wordHighlightBackground #3f3f3f6f
editor.wordHighlightStrongBackground #6a726d6f
editorBracketMatch.background #3f3f3f
editorCodeLens.foreground #3f3f3f
editorCursor.foreground #b7bcbe
editorError.foreground #f09eb7
editorGroup.background #1e1e1e
editorGroup.dropBackground #3f3f3f6f
editorGroup.emptyBackground #1e1e1e
editorGroupHeader.noTabsBackground #292929
editorGroupHeader.tabsBackground #292929
editorGutter.addedBackground #fecc1b
editorGutter.background #1e1e1e
editorGutter.commentRangeForeground #828282
editorGutter.deletedBackground #f09eb7
editorGutter.foldingControlForeground #b7bcbe
editorGutter.modifiedBackground #e79fd7
editorHint.foreground #59a8ff
editorHoverWidget.background #1e1e1e
editorHoverWidget.foreground #b7bcbe
editorIndentGuide.activeBackground #828282
editorIndentGuide.background #6a726d
editorInfo.foreground #54cfb7
editorLightBulb.foreground #59a8ff
editorLightBulbAutoFix.foreground #59a8ff
editorLineNumber.activeForeground #828282
editorLineNumber.foreground #6a726d
editorLink.activeForeground #59a8ff
editorMarkerNavigation.background #292929
editorMarkerNavigationError.background #f09eb7
editorMarkerNavigationInfo.background #59a8ff
editorMarkerNavigationWarning.background #59a8ff
editorOverviewRuler.addedForeground #fecc1b
editorOverviewRuler.bracketMatchForeground #d0d0d0
editorOverviewRuler.commonContentForeground #b7bcbe
editorOverviewRuler.currentContentForeground #59a8ff
editorOverviewRuler.deletedForeground #f09eb7
editorOverviewRuler.errorForeground #f09eb7
editorOverviewRuler.findMatchForeground #59a8ff6f
editorOverviewRuler.incomingContentForeground #fecc1b
editorOverviewRuler.infoForeground #54cfb7
editorOverviewRuler.modifiedForeground #e79fd7
editorOverviewRuler.rangeHighlightForeground #6a726d6f
editorOverviewRuler.selectionHighlightForeground #3f3f3f6f
editorOverviewRuler.warningForeground #59a8ff
editorOverviewRuler.wordHighlightForeground #eef2f86f
editorOverviewRuler.wordHighlightStrongForeground #59a8ff6f
editorPane.background #1e1e1e
editorRuler.foreground #6a726d
editorSuggestWidget.background #292929
editorSuggestWidget.foreground #b7bcbe
editorSuggestWidget.highlightForeground #59a8ff
editorSuggestWidget.selectedBackground #3f3f3f
editorWarning.foreground #59a8ff
editorWhitespace.foreground #6a726d
editorWidget.background #1e1e1e
editorWidget.foreground #b7bcbe
errorForeground #f09eb7
extensionBadge.remoteBackground #d83bd2
extensionBadge.remoteForeground #eef2f8
extensionButton.prominentBackground #fecc1b
extensionButton.prominentForeground #eef2f8
extensionButton.prominentHoverBackground #3f3f3f
foreground #b7bcbe
gitDecoration.addedResourceForeground #fecc1b
gitDecoration.conflictingResourceForeground #59a8ff
gitDecoration.deletedResourceForeground #f09eb7
gitDecoration.ignoredResourceForeground #6a726d
gitDecoration.modifiedResourceForeground #e79fd7
gitDecoration.stageDeletedResourceForeground #f09eb7
gitDecoration.stageModifiedResourceForeground #e79fd7
gitDecoration.submoduleResourceForeground #b7bcbe
gitDecoration.untrackedResourceForeground #d83bd2
icon.foreground #828282
input.background #1e1e1e
input.foreground #b7bcbe
input.placeholderForeground #6a726d
inputOption.activeBackground #3f3f3f
inputOption.activeBorder #d83bd2
inputOption.activeForeground #b7bcbe
inputValidation.errorBackground #f09eb7
inputValidation.errorBorder #f09eb7
inputValidation.errorForeground #b7bcbe
inputValidation.infoBackground #59a8ff
inputValidation.infoBorder #59a8ff
inputValidation.infoForeground #b7bcbe
inputValidation.warningBackground #59a8ff
inputValidation.warningBorder #59a8ff
inputValidation.warningForeground #b7bcbe
list.activeSelectionBackground #3f3f3f
list.activeSelectionForeground #b7bcbe
list.dropBackground #eef2f8
list.errorForeground #f09eb7
list.filterMatchBackground #3f3f3f
list.focusBackground #3f3f3f
list.focusForeground #b7bcbe
list.highlightForeground #eef2f8
list.hoverBackground #6a726d
list.hoverForeground #b7bcbe
list.inactiveFocusBackground #3f3f3f
list.inactiveSelectionBackground #3f3f3f
list.inactiveSelectionForeground #b7bcbe
list.invalidItemForeground #f09eb7
list.warningForeground #59a8ff
listFilterWidget.background #1e1e1e
listFilterWidget.noMatchesOutline #f09eb7
menu.background #292929
menu.foreground #b7bcbe
menu.selectionBackground #3f3f3f
menu.selectionForeground #b7bcbe
menu.separatorBackground #eef2f8
menubar.selectionBackground #292929
menubar.selectionForeground #b7bcbe
merge.currentContentBackground #59a8ff40
merge.currentHeaderBackground #59a8ff40
merge.incomingContentBackground #fecc1b60
merge.incomingHeaderBackground #fecc1b60
minimap.background #1e1e1e
minimap.errorHighlight #f09eb7
minimap.findMatchHighlight #59a8ff6f
minimap.selectionHighlight #3f3f3f6f
minimap.warningHighlight #59a8ff
minimapGutter.addedBackground #fecc1b
minimapGutter.deletedBackground #f09eb7
minimapGutter.modifiedBackground #e79fd7
notebook.rowHoverBackground #292929
notification.background #3f3f3f
notification.buttonBackground #59a8ff
notification.buttonForeground #eef2f8
notification.buttonHoverBackground #3f3f3f
notification.errorBackground #f09eb7
notification.errorForeground #eef2f8
notification.foreground #b7bcbe
notification.infoBackground #54cfb7
notification.infoForeground #eef2f8
notification.warningBackground #59a8ff
notification.warningForeground #eef2f8
notificationCenterHeader.background #292929
notificationCenterHeader.foreground #b7bcbe
notificationLink.foreground #59a8ff
notifications.background #3f3f3f
notifications.foreground #b7bcbe
notificationsErrorIcon.foreground #f09eb7
notificationsInfoIcon.foreground #59a8ff
notificationsWarningIcon.foreground #59a8ff
panel.background #1e1e1e
panel.dropBackground #2929296f
panelTitle.activeForeground #b7bcbe
panelTitle.inactiveForeground #6a726d
peekViewEditor.background #292929
peekViewEditor.matchHighlightBackground #d83bd26f
peekViewEditorGutter.background #292929
peekViewResult.background #1e1e1e
peekViewResult.fileForeground #b7bcbe
peekViewResult.lineForeground #6a726d
peekViewResult.matchHighlightBackground #d83bd26f
peekViewResult.selectionBackground #3f3f3f
peekViewResult.selectionForeground #b7bcbe
peekViewTitle.background #3f3f3f
peekViewTitleDescription.foreground #6a726d
peekViewTitleLabel.foreground #b7bcbe
pickerGroup.foreground #6a726d
problemsErrorIcon.foreground #f09eb7
problemsInfoIcon.foreground #54cfb7
problemsWarningIcon.foreground #59a8ff
progressBar.background #6a726d
quickInput.background #292929
quickInput.foreground #b7bcbe
scrollbar.shadow #292929
scrollbarSlider.activeBackground #8282826f
scrollbarSlider.background #3f3f3f6f
scrollbarSlider.hoverBackground #6a726d6f
selection.background #59a8ff
settings.checkboxBackground #292929
settings.checkboxForeground #b7bcbe
settings.dropdownBackground #292929
settings.dropdownForeground #b7bcbe
settings.focusedRowBackground #3f3f3f
settings.headerForeground #b7bcbe
settings.modifiedItemForeground #59a8ff
settings.modifiedItemIndicator #59a8ff
settings.numberInputBackground #292929
settings.numberInputForeground #b7bcbe
settings.textInputBackground #292929
settings.textInputForeground #b7bcbe
sideBar.background #292929
sideBar.dropBackground #3f3f3f6f
sideBar.foreground #b7bcbe
sideBarSectionHeader.background #6a726d
sideBarSectionHeader.foreground #b7bcbe
sideBarTitle.foreground #b7bcbe
statusBar.background #59a8ff
statusBar.debuggingBackground #d83bd2
statusBar.debuggingForeground #eef2f8
statusBar.foreground #eef2f8
statusBar.noFolderBackground #e79fd7
statusBar.noFolderForeground #eef2f8
statusBarItem.activeBackground #6a726d
statusBarItem.errorBackground #f09eb7
statusBarItem.errorForeground #eef2f8
statusBarItem.hoverBackground #3f3f3f
statusBarItem.prominentBackground #e79fd7
statusBarItem.prominentForeground #eef2f8
statusBarItem.prominentHoverBackground #f09eb7
statusBarItem.remoteBackground #fecc1b
statusBarItem.remoteForeground #eef2f8
symbolIcon.arrayForeground #b7bcbe
symbolIcon.booleanForeground #d83bd2
symbolIcon.classForeground #59a8ff
symbolIcon.colorForeground #f0f
symbolIcon.constantForeground #d83bd2
symbolIcon.constructorForeground #59a8ff
symbolIcon.enumeratorForeground #d83bd2
symbolIcon.enumeratorMemberForeground #59a8ff
symbolIcon.eventForeground #59a8ff
symbolIcon.fieldForeground #f09eb7
symbolIcon.fileForeground #b7bcbe
symbolIcon.folderForeground #b7bcbe
symbolIcon.functionForeground #59a8ff
symbolIcon.interfaceForeground #59a8ff
symbolIcon.keyForeground #f0f
symbolIcon.keywordForeground #e79fd7
symbolIcon.methodForeground #59a8ff
symbolIcon.moduleForeground #b7bcbe
symbolIcon.namespaceForeground #b7bcbe
symbolIcon.nullForeground #b7bcbe
symbolIcon.numberForeground #d83bd2
symbolIcon.objectForeground #f0f
symbolIcon.operatorForeground #f0f
symbolIcon.packageForeground #f0f
symbolIcon.propertyForeground #b7bcbe
symbolIcon.referenceForeground #f0f
symbolIcon.snippetForeground #b7bcbe
symbolIcon.stringForeground #fecc1b
symbolIcon.structForeground #59a8ff
symbolIcon.textForeground #b7bcbe
symbolIcon.typeParameterForeground #f0f
symbolIcon.unitForeground #f0f
symbolIcon.variableForeground #f09eb7
tab.activeBackground #1e1e1e
tab.activeForeground #b7bcbe
tab.activeModifiedBorder #59a8ff
tab.hoverBackground #3f3f3f
tab.inactiveBackground #292929
tab.inactiveForeground #6a726d
tab.inactiveModifiedBorder #59a8ff
tab.unfocusedActiveBackground #1e1e1e
tab.unfocusedActiveForeground #828282
tab.unfocusedActiveModifiedBorder #59a8ff
tab.unfocusedHoverBackground #3f3f3f
tab.unfocusedInactiveForeground #6a726d
tab.unfocusedInactiveModifiedBorder #59a8ff
terminal.ansiBlack #1e1e1e
terminal.ansiBlue #59a8ff
terminal.ansiBrightBlack #6a726d
terminal.ansiBrightBlue #59a8ff
terminal.ansiBrightCyan #54cfb7
terminal.ansiBrightGreen #fecc1b
terminal.ansiBrightMagenta #e79fd7
terminal.ansiBrightRed #f09eb7
terminal.ansiBrightWhite #eef2f8
terminal.ansiBrightYellow #59a8ff
terminal.ansiCyan #54cfb7
terminal.ansiGreen #fecc1b
terminal.ansiMagenta #e79fd7
terminal.ansiRed #f09eb7
terminal.ansiWhite #b7bcbe
terminal.ansiYellow #59a8ff
terminal.background #1e1e1e
terminal.foreground #b7bcbe
terminalCursor.foreground #b7bcbe
textBlockQuote.background #292929
textBlockQuote.border #59a8ff
textCodeBlock.background #1e1e1e
textLink.activeForeground #54cfb7
textLink.foreground #59a8ff
textPreformat.foreground #59a8ff
textSeparator.foreground #f0f
titleBar.activeBackground #1e1e1e
titleBar.activeForeground #b7bcbe
titleBar.inactiveBackground #292929
titleBar.inactiveForeground #6a726d
tree.indentGuidesStroke #b7bcbe
walkThrough.embeddedEditorBackground #1e1e1e
welcomePage.background #1e1e1e
welcomePage.buttonBackground #292929
welcomePage.buttonHoverBackground #3f3f3f
widget.shadow #1e1e1e invalid.deprecated #b7bcbe —
keyword, storage.modifier #e79fd7 —
keyword.control, keyword.control.flow, keyword.control.from, keyword.control.import, keyword.control.as #e79fd7 —
keyword.other.using, keyword.other.namespace, keyword.other.class, keyword.other.new, keyword.other.event, keyword.other.this, keyword.other.await, keyword.other.var, keyword.other.package, keyword.other.import, variable.language.this, storage.type.ts #e79fd7 —
keyword.type, storage.type.primitive #54cfb7 —
storage.type.function #59a8ff —
constant.other.color, punctuation, punctuation.section.class.end, meta.tag, punctuation.definition.tag, punctuation.separator.inheritance.php, punctuation.definition.tag.html, punctuation.definition.tag.begin.html, punctuation.definition.tag.end.html, keyword.other.template, keyword.other.substitution #b7bcbe —
punctuation.section.embedded, variable.interpolation #b7bcbe —
entity.name.tag, meta.tag.sgml, markup.deleted.git_gutter #f09eb7 —
entity.name.function, meta.function-call, variable.function, support.function, keyword.other.special-method #59a8ff —
meta.block variable.other #f09eb7 —
support.other.variable, string.other.link #f09eb7 —
constant.numeric, constant.language, support.constant, constant.character, constant.escape, keyword.other.unit, keyword.other #d83bd2 —
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 #fecc1b
entity.name, support.type, support.class, support.other.namespace.use.php, meta.use.php, support.other.namespace.php, markup.changed.git_gutter, support.type.sys-types #59a8ff —
storage.type, storage.modifier.package, storage.modifier.import #59a8ff —
entity.name.variable.field #59a8ff —
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 #54cfb7 —
entity.name.module.js, variable.import.parameter.js, variable.other.class.js #f09eb7 —
variable.language #f09eb7 italic
entity.name.method.js #59a8ff italic
meta.class-method.js entity.name.function.js, variable.function.constructor #59a8ff —
entity.other.attribute-name #59a8ff —
text.html.basic entity.other.attribute-name.html, text.html.basic entity.other.attribute-name #59a8ff italic
entity.other.attribute-name.class #59a8ff —
source.sass keyword.control #59a8ff —
constant.character.escape #54cfb7 —
*url*, *link*, *uri* — underline
tag.decorator.js entity.name.tag.js, tag.decorator.js punctuation.definition.tag.js #59a8ff italic
source.js constant.other.object.key.js string.unquoted.label.js #e79fd7 italic
source.json meta.structure.dictionary.json support.type.property-name.json #59a8ff —
source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json #59a8ff —
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 #59a8ff —
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 #59a8ff —
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 #59a8ff —
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 #59a8ff —
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 #59a8ff —
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 #59a8ff —
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 #59a8ff —
text.html.markdown, punctuation.definition.list_item.markdown #b7bcbe —
text.html.markdown markup.inline.raw.markdown #e79fd7 —
text.html.markdown markup.inline.raw.markdown punctuation.definition.raw.markdown #54cfb7 —
text.html.markdown meta.dummy.line-break #6a726d —
markdown.heading, markup.heading | markup.heading entity.name, markup.heading.markdown punctuation.definition.heading.markdown #59a8ff —
markup.italic #f09eb7 italic
markup.bold, markup.bold string #f09eb7 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 #f09eb7 bold
markup.underline #d83bd2 underline
markup.quote punctuation.definition.blockquote.markdown #54cfb7 —
string.other.link.title.markdown #59a8ff —
string.other.link.description.title.markdown #e79fd7 —
constant.other.reference.link.markdown #59a8ff —
markup.raw.block.fenced.markdown #00000050 —
punctuation.definition.fenced.markdown #00000050 —
markup.raw.block.fenced.markdown, variable.language.fenced.markdown #e79fd7 —
variable.language.fenced.markdown #f09eb7 —
meta.separator #54cfb7 bold
token.error-token #f09eb7 —
token.debug-token #e79fd7 —
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 } ! ` ;
}
Ln 5, Col 12
Spaces: 2
UTF-8
LF
TypeScript
Dark+
fetchUser.ts
index.ts
README.md
src
components
fetchUser.ts
Button.tsx
Modal.tsx
hooks
utils
index.ts
public
README.md
src
components
fetchUser.ts
fetchUser 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Problems1
Output
Debug Console
Terminal
Ports
~/my-project $ pnpm dev
▲ Next.js ready on http://localhost:3000
✓ compiled client and server successfully in 412ms
wait - compiling /theme/vscode...
~/my-project $
package.json
tsconfig.json
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 } ! ` ;
}