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 #b7bcbe activityBar.background #f8fbfc activityBar.dropBackground #1e1e1e activityBar.foreground #3f3f3f activityBar.inactiveForeground #828282 activityBarBadge.background #0f4f8c tokenColors TextMate scopes and font styles (syntax highlighting rules).
scope foreground fontStyle comment, punctuation.definition.comment #828282 italic variable, string constant.other.placeholder, entity.name.variable.parameter, entity.name.variable.local, variable.parameter #aa253a — variable.other.object.property #0f4f8c — constant.other.color #22942c — invalid, invalid.illegal
Shiki preview TypeScript sample highlighted with this variant's colors and tokenColors.
remix-vscode-theme — Remix Docs Light
activityBarBadge.foreground #1e1e1e
badge.background #f8fbfc
badge.foreground #3f3f3f
breadcrumb.activeSelectionForeground #1e1e1e
breadcrumb.background #d0d0d0
breadcrumb.focusForeground #292929
breadcrumb.foreground #3f3f3f
breadcrumbPicker.background #d0d0d0
button.background #d0d0d0
button.foreground #1e1e1e
button.hoverBackground #6a726d
button.secondaryBackground #d83bd2
button.secondaryForeground #1e1e1e
button.secondaryHoverBackground #6a726d
charts.blue #0f4f8c
charts.foreground #3f3f3f
charts.green #22942c
charts.lines #3f3f3f
charts.orange #d83bd2
charts.purple #d83bd2
charts.red #aa253a
charts.yellow #287bd9
checkbox.background #f8fbfc
checkbox.foreground #3f3f3f
debugConsole.errorForeground #aa253a
debugConsole.infoForeground #3f3f3f
debugConsole.sourceForeground #3f3f3f
debugConsole.warningForeground #287bd9
debugConsoleInputIcon.foreground #3f3f3f
debugExceptionWidget.background #d0d0d0
debugIcon.breakpointCurrentStackframeForeground #287bd9
debugIcon.breakpointDisabledForeground #6a726d
debugIcon.breakpointForeground #aa253a
debugIcon.breakpointStackframeForeground #292929
debugIcon.breakpointUnverifiedForeground #b7bcbe
debugIcon.continueForeground #22942c
debugIcon.disconnectForeground #aa253a
debugIcon.pauseForeground #0f4f8c
debugIcon.restartForeground #22942c
debugIcon.startForeground #22942c
debugIcon.stepBackForeground #292929
debugIcon.stepIntoForeground #1db28b
debugIcon.stepOutForeground #d83bd2
debugIcon.stepOverForeground #0f4f8c
debugIcon.stopForeground #aa253a
debugTokenExpression.boolean #d83bd2
debugTokenExpression.error #aa253a
debugTokenExpression.name #d83bd2
debugTokenExpression.number #d83bd2
debugTokenExpression.string #22942c
debugTokenExpression.value #3f3f3f
debugToolBar.background #d0d0d0
debugView.stateLabelBackground #0f4f8c
debugView.stateLabelForeground #1e1e1e
debugView.valueChangedHighlight #0f4f8c
descriptionForeground #828282
diffEditor.diagonalFill #b7bcbe
diffEditor.insertedTextBackground #22942c20
diffEditor.removedTextBackground #aa253a20
dropdown.background #f8fbfc
dropdown.foreground #3f3f3f
dropdown.listBackground #f8fbfc
editor.background #f8fbfc
editor.findMatchBackground #287bd96f
editor.findMatchHighlightBackground #d83bd26f
editor.findRangeHighlightBackground #d0d0d06f
editor.foreground #3f3f3f
editor.hoverHighlightBackground #b7bcbe6f
editor.inactiveSelectionBackground #b7bcbe
editor.lineHighlightBackground #d0d0d0
editor.rangeHighlightBackground #d0d0d06f
editor.selectionBackground #b7bcbe
editor.selectionHighlightBackground #d0d0d0
editor.snippetFinalTabstopHighlightBackground #828282
editor.snippetTabstopHighlightBackground #b7bcbe
editor.wordHighlightBackground #b7bcbe6f
editor.wordHighlightStrongBackground #8282826f
editorBracketMatch.background #b7bcbe
editorCodeLens.foreground #b7bcbe
editorCursor.foreground #3f3f3f
editorError.foreground #aa253a
editorGroup.background #f8fbfc
editorGroup.dropBackground #b7bcbe6f
editorGroup.emptyBackground #f8fbfc
editorGroupHeader.noTabsBackground #d0d0d0
editorGroupHeader.tabsBackground #d0d0d0
editorGutter.addedBackground #22942c
editorGutter.background #f8fbfc
editorGutter.commentRangeForeground #6a726d
editorGutter.deletedBackground #aa253a
editorGutter.foldingControlForeground #3f3f3f
editorGutter.modifiedBackground #d83bd2
editorHint.foreground #0f4f8c
editorHoverWidget.background #f8fbfc
editorHoverWidget.foreground #3f3f3f
editorIndentGuide.activeBackground #6a726d
editorIndentGuide.background #828282
editorInfo.foreground #1db28b
editorLightBulb.foreground #287bd9
editorLightBulbAutoFix.foreground #0f4f8c
editorLineNumber.activeForeground #6a726d
editorLineNumber.foreground #828282
editorLink.activeForeground #0f4f8c
editorMarkerNavigation.background #d0d0d0
editorMarkerNavigationError.background #aa253a
editorMarkerNavigationInfo.background #0f4f8c
editorMarkerNavigationWarning.background #287bd9
editorOverviewRuler.addedForeground #22942c
editorOverviewRuler.bracketMatchForeground #292929
editorOverviewRuler.commonContentForeground #292929
editorOverviewRuler.currentContentForeground #0f4f8c
editorOverviewRuler.deletedForeground #aa253a
editorOverviewRuler.errorForeground #aa253a
editorOverviewRuler.findMatchForeground #287bd96f
editorOverviewRuler.incomingContentForeground #22942c
editorOverviewRuler.infoForeground #1db28b
editorOverviewRuler.modifiedForeground #d83bd2
editorOverviewRuler.rangeHighlightForeground #8282826f
editorOverviewRuler.selectionHighlightForeground #b7bcbe6f
editorOverviewRuler.warningForeground #287bd9
editorOverviewRuler.wordHighlightForeground #1e1e1e6f
editorOverviewRuler.wordHighlightStrongForeground #0f4f8c6f
editorPane.background #f8fbfc
editorRuler.foreground #828282
editorSuggestWidget.background #d0d0d0
editorSuggestWidget.foreground #3f3f3f
editorSuggestWidget.highlightForeground #0f4f8c
editorSuggestWidget.selectedBackground #b7bcbe
editorWarning.foreground #287bd9
editorWhitespace.foreground #828282
editorWidget.background #f8fbfc
editorWidget.foreground #3f3f3f
errorForeground #aa253a
extensionBadge.remoteBackground #d83bd2
extensionBadge.remoteForeground #1e1e1e
extensionButton.prominentBackground #22942c
extensionButton.prominentForeground #1e1e1e
extensionButton.prominentHoverBackground #b7bcbe
foreground #3f3f3f
gitDecoration.addedResourceForeground #22942c
gitDecoration.conflictingResourceForeground #287bd9
gitDecoration.deletedResourceForeground #aa253a
gitDecoration.ignoredResourceForeground #828282
gitDecoration.modifiedResourceForeground #d83bd2
gitDecoration.stageDeletedResourceForeground #aa253a
gitDecoration.stageModifiedResourceForeground #d83bd2
gitDecoration.submoduleResourceForeground #292929
gitDecoration.untrackedResourceForeground #d83bd2
icon.foreground #6a726d
input.background #f8fbfc
input.foreground #3f3f3f
input.placeholderForeground #828282
inputOption.activeBackground #b7bcbe
inputOption.activeBorder #d83bd2
inputOption.activeForeground #3f3f3f
inputValidation.errorBackground #aa253a
inputValidation.errorBorder #aa253a
inputValidation.errorForeground #3f3f3f
inputValidation.infoBackground #0f4f8c
inputValidation.infoBorder #0f4f8c
inputValidation.infoForeground #3f3f3f
inputValidation.warningBackground #287bd9
inputValidation.warningBorder #287bd9
inputValidation.warningForeground #3f3f3f
list.activeSelectionBackground #b7bcbe
list.activeSelectionForeground #3f3f3f
list.dropBackground #1e1e1e
list.errorForeground #aa253a
list.filterMatchBackground #b7bcbe
list.focusBackground #b7bcbe
list.focusForeground #3f3f3f
list.highlightForeground #1e1e1e
list.hoverBackground #828282
list.hoverForeground #3f3f3f
list.inactiveFocusBackground #b7bcbe
list.inactiveSelectionBackground #b7bcbe
list.inactiveSelectionForeground #3f3f3f
list.invalidItemForeground #aa253a
list.warningForeground #287bd9
listFilterWidget.background #f8fbfc
listFilterWidget.noMatchesOutline #aa253a
menu.background #d0d0d0
menu.foreground #3f3f3f
menu.selectionBackground #b7bcbe
menu.selectionForeground #3f3f3f
menu.separatorBackground #1e1e1e
menubar.selectionBackground #d0d0d0
menubar.selectionForeground #3f3f3f
merge.currentContentBackground #0f4f8c40
merge.currentHeaderBackground #0f4f8c40
merge.incomingContentBackground #22942c60
merge.incomingHeaderBackground #22942c60
minimap.background #f8fbfc
minimap.errorHighlight #aa253a
minimap.findMatchHighlight #287bd96f
minimap.selectionHighlight #b7bcbe6f
minimap.warningHighlight #287bd9
minimapGutter.addedBackground #22942c
minimapGutter.deletedBackground #aa253a
minimapGutter.modifiedBackground #d83bd2
notebook.rowHoverBackground #d0d0d0
notification.background #b7bcbe
notification.buttonBackground #0f4f8c
notification.buttonForeground #1e1e1e
notification.buttonHoverBackground #b7bcbe
notification.errorBackground #aa253a
notification.errorForeground #1e1e1e
notification.foreground #3f3f3f
notification.infoBackground #1db28b
notification.infoForeground #1e1e1e
notification.warningBackground #287bd9
notification.warningForeground #1e1e1e
notificationCenterHeader.background #d0d0d0
notificationCenterHeader.foreground #3f3f3f
notificationLink.foreground #0f4f8c
notifications.background #b7bcbe
notifications.foreground #3f3f3f
notificationsErrorIcon.foreground #aa253a
notificationsInfoIcon.foreground #0f4f8c
notificationsWarningIcon.foreground #287bd9
panel.background #f8fbfc
panel.dropBackground #d0d0d06f
panelTitle.activeForeground #3f3f3f
panelTitle.inactiveForeground #828282
peekViewEditor.background #d0d0d0
peekViewEditor.matchHighlightBackground #d83bd26f
peekViewEditorGutter.background #d0d0d0
peekViewResult.background #f8fbfc
peekViewResult.fileForeground #3f3f3f
peekViewResult.lineForeground #828282
peekViewResult.matchHighlightBackground #d83bd26f
peekViewResult.selectionBackground #b7bcbe
peekViewResult.selectionForeground #3f3f3f
peekViewTitle.background #b7bcbe
peekViewTitleDescription.foreground #828282
peekViewTitleLabel.foreground #3f3f3f
pickerGroup.foreground #828282
problemsErrorIcon.foreground #aa253a
problemsInfoIcon.foreground #1db28b
problemsWarningIcon.foreground #287bd9
progressBar.background #828282
quickInput.background #d0d0d0
quickInput.foreground #3f3f3f
scrollbar.shadow #d0d0d0
scrollbarSlider.activeBackground #6a726d6f
scrollbarSlider.background #b7bcbe6f
scrollbarSlider.hoverBackground #8282826f
selection.background #0f4f8c
settings.checkboxBackground #d0d0d0
settings.checkboxForeground #3f3f3f
settings.dropdownBackground #d0d0d0
settings.dropdownForeground #3f3f3f
settings.focusedRowBackground #b7bcbe
settings.headerForeground #3f3f3f
settings.modifiedItemForeground #0f4f8c
settings.modifiedItemIndicator #0f4f8c
settings.numberInputBackground #d0d0d0
settings.numberInputForeground #3f3f3f
settings.textInputBackground #d0d0d0
settings.textInputForeground #3f3f3f
sideBar.background #d0d0d0
sideBar.dropBackground #b7bcbe6f
sideBar.foreground #3f3f3f
sideBarSectionHeader.background #828282
sideBarSectionHeader.foreground #3f3f3f
sideBarTitle.foreground #3f3f3f
statusBar.background #0f4f8c
statusBar.debuggingBackground #d83bd2
statusBar.debuggingForeground #1e1e1e
statusBar.foreground #1e1e1e
statusBar.noFolderBackground #d83bd2
statusBar.noFolderForeground #1e1e1e
statusBarItem.activeBackground #828282
statusBarItem.errorBackground #aa253a
statusBarItem.errorForeground #1e1e1e
statusBarItem.hoverBackground #b7bcbe
statusBarItem.prominentBackground #d83bd2
statusBarItem.prominentForeground #1e1e1e
statusBarItem.prominentHoverBackground #aa253a
statusBarItem.remoteBackground #22942c
statusBarItem.remoteForeground #1e1e1e
symbolIcon.arrayForeground #3f3f3f
symbolIcon.booleanForeground #d83bd2
symbolIcon.classForeground #287bd9
symbolIcon.colorForeground #f0f
symbolIcon.constantForeground #d83bd2
symbolIcon.constructorForeground #0f4f8c
symbolIcon.enumeratorForeground #d83bd2
symbolIcon.enumeratorMemberForeground #0f4f8c
symbolIcon.eventForeground #287bd9
symbolIcon.fieldForeground #aa253a
symbolIcon.fileForeground #3f3f3f
symbolIcon.folderForeground #3f3f3f
symbolIcon.functionForeground #0f4f8c
symbolIcon.interfaceForeground #0f4f8c
symbolIcon.keyForeground #f0f
symbolIcon.keywordForeground #d83bd2
symbolIcon.methodForeground #0f4f8c
symbolIcon.moduleForeground #3f3f3f
symbolIcon.namespaceForeground #3f3f3f
symbolIcon.nullForeground #292929
symbolIcon.numberForeground #d83bd2
symbolIcon.objectForeground #f0f
symbolIcon.operatorForeground #f0f
symbolIcon.packageForeground #f0f
symbolIcon.propertyForeground #3f3f3f
symbolIcon.referenceForeground #f0f
symbolIcon.snippetForeground #3f3f3f
symbolIcon.stringForeground #22942c
symbolIcon.structForeground #287bd9
symbolIcon.textForeground #3f3f3f
symbolIcon.typeParameterForeground #f0f
symbolIcon.unitForeground #f0f
symbolIcon.variableForeground #aa253a
tab.activeBackground #f8fbfc
tab.activeForeground #3f3f3f
tab.activeModifiedBorder #0f4f8c
tab.hoverBackground #b7bcbe
tab.inactiveBackground #d0d0d0
tab.inactiveForeground #828282
tab.inactiveModifiedBorder #0f4f8c
tab.unfocusedActiveBackground #f8fbfc
tab.unfocusedActiveForeground #6a726d
tab.unfocusedActiveModifiedBorder #0f4f8c
tab.unfocusedHoverBackground #b7bcbe
tab.unfocusedInactiveForeground #828282
tab.unfocusedInactiveModifiedBorder #0f4f8c
terminal.ansiBlack #f8fbfc
terminal.ansiBlue #0f4f8c
terminal.ansiBrightBlack #828282
terminal.ansiBrightBlue #0f4f8c
terminal.ansiBrightCyan #1db28b
terminal.ansiBrightGreen #22942c
terminal.ansiBrightMagenta #d83bd2
terminal.ansiBrightRed #aa253a
terminal.ansiBrightWhite #1e1e1e
terminal.ansiBrightYellow #287bd9
terminal.ansiCyan #1db28b
terminal.ansiGreen #22942c
terminal.ansiMagenta #d83bd2
terminal.ansiRed #aa253a
terminal.ansiWhite #3f3f3f
terminal.ansiYellow #287bd9
terminal.background #f8fbfc
terminal.foreground #3f3f3f
terminalCursor.foreground #3f3f3f
textBlockQuote.background #d0d0d0
textBlockQuote.border #0f4f8c
textCodeBlock.background #f8fbfc
textLink.activeForeground #1db28b
textLink.foreground #0f4f8c
textPreformat.foreground #0f4f8c
textSeparator.foreground #f0f
titleBar.activeBackground #f8fbfc
titleBar.activeForeground #3f3f3f
titleBar.inactiveBackground #d0d0d0
titleBar.inactiveForeground #828282
tree.indentGuidesStroke #3f3f3f
walkThrough.embeddedEditorBackground #f8fbfc
welcomePage.background #f8fbfc
welcomePage.buttonBackground #d0d0d0
welcomePage.buttonHoverBackground #b7bcbe
widget.shadow #f8fbfc invalid.deprecated #292929 —
keyword, storage.modifier #d83bd2 —
keyword.control, keyword.control.flow, keyword.control.from, keyword.control.import, keyword.control.as #d83bd2 —
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 #d83bd2 —
keyword.type, storage.type.primitive #1db28b —
storage.type.function #0f4f8c —
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 #3f3f3f —
punctuation.section.embedded, variable.interpolation #292929 —
entity.name.tag, meta.tag.sgml, markup.deleted.git_gutter #aa253a —
entity.name.function, meta.function-call, variable.function, support.function, keyword.other.special-method #0f4f8c —
meta.block variable.other #aa253a —
support.other.variable, string.other.link #aa253a —
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 #22942c
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 #287bd9 —
storage.type, storage.modifier.package, storage.modifier.import #287bd9 —
entity.name.variable.field #0f4f8c —
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 #1db28b —
entity.name.module.js, variable.import.parameter.js, variable.other.class.js #aa253a —
variable.language #aa253a italic
entity.name.method.js #0f4f8c italic
meta.class-method.js entity.name.function.js, variable.function.constructor #0f4f8c —
entity.other.attribute-name #0f4f8c —
text.html.basic entity.other.attribute-name.html, text.html.basic entity.other.attribute-name #287bd9 italic
entity.other.attribute-name.class #287bd9 —
source.sass keyword.control #0f4f8c —
constant.character.escape #1db28b —
*url*, *link*, *uri* — underline
tag.decorator.js entity.name.tag.js, tag.decorator.js punctuation.definition.tag.js #0f4f8c italic
source.js constant.other.object.key.js string.unquoted.label.js #d83bd2 italic
source.json meta.structure.dictionary.json support.type.property-name.json #0f4f8c —
source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json #0f4f8c —
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 #0f4f8c —
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 #0f4f8c —
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 #0f4f8c —
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 #0f4f8c —
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 #0f4f8c —
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 #0f4f8c —
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 #0f4f8c —
text.html.markdown, punctuation.definition.list_item.markdown #3f3f3f —
text.html.markdown markup.inline.raw.markdown #d83bd2 —
text.html.markdown markup.inline.raw.markdown punctuation.definition.raw.markdown #1db28b —
text.html.markdown meta.dummy.line-break #828282 —
markdown.heading, markup.heading | markup.heading entity.name, markup.heading.markdown punctuation.definition.heading.markdown #0f4f8c —
markup.italic #aa253a italic
markup.bold, markup.bold string #aa253a 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 #aa253a bold
markup.underline #d83bd2 underline
markup.quote punctuation.definition.blockquote.markdown #1db28b —
string.other.link.title.markdown #0f4f8c —
string.other.link.description.title.markdown #d83bd2 —
constant.other.reference.link.markdown #287bd9 —
markup.raw.block.fenced.markdown #00000050 —
punctuation.definition.fenced.markdown #00000050 —
markup.raw.block.fenced.markdown, variable.language.fenced.markdown #d83bd2 —
variable.language.fenced.markdown #aa253a —
meta.separator #1db28b bold
token.error-token #aa253a —
token.debug-token #d83bd2 —
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
Light+
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 } ! ` ;
}