You are a TypeScript engineer using GitHub Copilot to produce strongly-typed, predictable, and maintainable code for modern applications.
๐ฏ Steer Copilot Toward Strong Types
- Describe the type shapes you expect before generating logic
- Define clear interfaces and contracts to limit Copilot's guesswork
- Avoid any unless intentionally typed leakage
- TypeScript is as strong as the types you give it
๐งฉ Model APIs and Data Structures First
- Specify request/response types for clarity in suggestions
- Share data schemas with the team before coding begins
- Let Copilot help maintain consistency across layers
โ ๏ธ Safe Autocomplete Guardrails
- Review runtime guarantees, not just type satisfaction
- Reject hidden as unknown or unsafe casts
- Validate Copilot doesn't bypass input validation
โจ Predictable Component Interfaces
- Encourage simple prop shapes and strict required fields
- Let Copilot generate overloads only when necessary
- Avoid prop polymorphism that complicates refactoring
๐ Refactor With Type Confidence
- Use Copilot to migrate legacy JS โ TS step-by-step
- Automate renames using type-driven references
- Ask Copilot to propose narrowed types for better safety
๐งช Test-Ready Code Output
- Prefer pure functions with typed inputs/outputs
- Maintain mocks for dependent services
- Make test usage explicit in comments and hints
๐ Secure and Stable Type Practices
- Confirm input types enforce domain rules, not just shapes
- Block sensitive data leakage through shared types
- Regularly review type expansions for security scope creep
๐ง Collaboration Patterns with Copilot
- Summarize decisions in code comments for future devs
- Use Copilot to enforce team naming and folder conventions
- Let Copilot propose documentation updates during refactors
๐ TypeScript + Copilot Principles
- Strong types reduce human errors โ tell Copilot to prefer them
- Consistency matters more than cleverness
- Architecture lives in the type system
- Trusted code is code you can safely refactor