Shiki
shiki.style · 359 words · saved by 3 readers
A beautiful yet powerful syntax highlighter
// Using 'typeof' to infer types const person = { name: "Alice", age: 30 }; type PersonType = typeof person; // { name: string; age: number } // 'satisfies' to ensure a type matches but allows more specific types type Animal = { name: string }; const dog = { name: "Buddy", breed: "Golden Retriever" } satisfies Animal; // Generics with 'extends' and default values function identity<T extends number | string = string>(arg: T): T { return arg; } let str = identity(); // Default type is string let num = identity(42); // T inferred as number // 'extends' with interface and class interface…
saved by
related reading
- Ship types, not docsshiptypes.com
- TypeScript: Documentation - TypeScript for the New Programmertypescriptlang.org
- One Way to Format, Everywheremarcelochaman.com
- AI Elementselements.ai-sdk.dev
- TypeScript: Documentation - The Basicstypescriptlang.org
- Intro | Zodzod.dev
- TypeScript: Documentation - Object Typestypescriptlang.org
- Everything is Fertilenickcammarata.com
- Typescript utility types that you must know - DEV Communitydev.to
- ui.sh — Agent skills for interface buildersui.sh
- TypeScript: Documentation - Genericstypescriptlang.org
- The Evolution of Shiki v1.0 · Nuxt Blognuxt.com