microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
packages/html-program-viewer/src/utils.ts
11lines · modecode
| 1 | import type { Type, Union } from "@typespec/compiler"; |
| 2 | |
| 3 | export type NamedType = Type & { name: string }; |
| 4 | |
| 5 | export function isNamedUnion(union: Union): union is Union & { name: string } { |
| 6 | return union.name !== undefined; |
| 7 | } |
| 8 | |
| 9 | export function isMapLike(value: any): value is Map<string, any> { |
| 10 | return "entries" in value && typeof value.entries === "function"; |
| 11 | } |
| 12 | |