← Back to Blog
TypeScriptJavaScript
TypeScript Tips I Wish I Knew Earlier
March 2, 2026·6 min read·by Nishara Ramasinghe
TypeScript is so much more than just types. Here are the patterns I use daily.
1. Use `satisfies` for type checking without widening
const config = {
port: 3000,
host: "localhost",
} satisfies Record<string, string | number>;2. Discriminated Unions
type Result<T> =
| { success: true; data: T }
| { success: false; error: string };3. Template Literal Types
type Route = `/${string}`;These patterns will level up your TypeScript game dramatically.