OpenTest language support
Publisher: Viktor KoraiThemes in package: 2
Extension for OpenTest
Extension for OpenTest
Full workbench mockup using this variant's colors and tokenColors.
Loading...
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| — | #D2D7D3 | — |
| comment | #608B4E | — |
| string | #CE9178 | — |
| constant.numeric | #EB739D | — |
| constant.language | #387AFF | — |
| constant.character, constant.other | #387AFF | — |
| variable | #00D1C7 | |
| keyword | #FF9100 | bold |
| storage | #E87E04 | — |
| storage.type | #FF6600 | — |
| entity.name.class | #00FF77 | — |
| entity.other.inherited-class | #00FF77 | bold |
| entity.name.function | #45C1FF | — |
| variable.parameter | #FF3126 | — |
| entity.name.tag | #569CD6 | |
| entity.other.attribute-name | #F2784B | |
| support.function | #69BFF0 | bold |
| support.constant | #69BFF0 | — |
| support.type, support.class | #69BFF0 | — |
| support.other.variable | #FF3126 | |
| invalid | #FFFFFF | |
| invalid.deprecated | #FFFFFF | — |
| entity.name.type | #FFD103 | — |
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}!`;
}