Typescript Standards.instructions
# TypeScript Best Practices
Apply strict TypeScript standards for type-safe, maintainable code.
You should always follow these TypeScript guidelines:
## Type Safety
- Enable `strict: true` in tsconfig.json
- Avoid `any` type - use `unknown` if truly dynamic
- Define explicit return types for functions
- Use union types instead of enums when appropriate
- Leverage type guards and narrowing
## Interfaces vs Types
- Use `interface` for object shapes
- Use `type` for unions, intersections, primitives
- Prefer composition over complex inheritance
## Best Practiceswhen to use it
Community prompt sourced from the open-source GitHub repo AmadeusITGroup/ai-primitives-hub (Apache-2.0). A "Typescript Standards.instructions" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
AmadeusITGroup/ai-primitives-hub · Apache-2.0
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions