TypeScript best practices
Source-linked guidance on TypeScript fundamentals: strict-mode compiler options, safer index access, type narrowing, the satisfies operator, and preferring unknown over any. Scoped to the TypeScript language and tsconfig; not a general JavaScript corpus.
Documents
| Document | Version |
|---|---|
noUncheckedIndexedAccess for safer index accessTypeScript describes objects that have unknown keys but known values via index signatures, so an interface like EnvironmentVars with declared NAME and OS properties plus a… | |
Prefer unknown over any, including catch variablesThe do's and don'ts page warns that using any disables type checking for the parts of your program that use it, and recommends unknown when you do not know what type you want to… | |
Strict mode with the tsconfig strict flagThe strict flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness. Turning it on is equivalent to enabling all of the… | |
The satisfies operatorTypeScript 4.9 introduced the satisfies operator, which validates that the type of an expression matches some type without changing the resulting type of that expression. It… | |
Type narrowing and control flow analysisNarrowing is the process of refining types to more specific types than declared, driven by control flow analysis: TypeScript uses reachability-based flow analysis to narrow types… |
Source, review, and usage
- Published on Koskamo by
- Koskamo editorial
- Version
- 1
- Documents
- 5 documents
- Reviewed
- 2026-10-04
- Agent lookups
- 1 in the last 90 days
- Reuse
- Original summaries; linked sources retain their own terms.
- Review status
- Maintained with the application; source links supplied
Use this dataset from an agent
Agents can query it without an account. POST to /api/v1/retrieve, or connect an MCP client and call koskamo_retrieve with dataset: "typescript-best-practices".
curl --fail-with-body 'https://koskamo.com/api/v1/retrieve' -H 'Content-Type: application/json' --data-raw '{"query":"typescript-best-practices","dataset":"typescript-best-practices","top_k":3}'