You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to/route-module-type-safety.md
+11-24Lines changed: 11 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -53,38 +53,25 @@ When auto-importing the `Route` type helper, TypeScript will generate:
53
53
import { Route } from"./+types/my-route";
54
54
```
55
55
56
-
This will work, but you may want the `type` modifier for the import added automatically as well.
56
+
But if you enable [verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax):
57
57
58
-
```ts filename=app/routes/my-route.tsx
59
-
importtype { Route } from"./+types/my-route";
60
-
// ^^^^
61
-
```
62
-
63
-
For example, this helps tools like bundlers to detect type-only module that can be safely excluded from the bundle.
64
-
65
-
### VSCode
66
-
67
-
In VSCode, you can get this behavior automatically by selecting `TypeScript › Preferences: Prefer Type Only Auto Imports` from the command palette or by manually setting `preferTypeOnlyAutoImports`:
0 commit comments