Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Use type-only imports for types
Mark compile-time-only imports explicitly while preserving required runtime metadata and side effects.
Bad example
| 1 | import { User } from './models'; |
| 2 | import { formatUser } from './format'; |
| 3 |
|
| 4 | function render(user: User) { return formatUser(user); } |
Explanation (EN)
An ordinary import obscures whether the symbol must exist at runtime.
Objašnjenje (HR)
Good example
| 1 | import type { User } from './models'; |
| 2 | import { formatUser } from './format'; |
| 3 |
|
| 4 | function render(user: User) { return formatUser(user); } |
Explanation (EN)
`import type` is fully erased at compile time and makes the type-only intent explicit.
Objašnjenje (HR)
Notes (EN)
Use type-only imports for symbols needed solely at compile time, following the installed compiler and transpiler settings.
Exceptions / Tradeoffs (EN)
isolatedModules alone does not mean every ordinary type import survives runtime emission. verbatimModuleSyntax requires explicit type intent. Decorator metadata or intentional side effects may require a runtime import.