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/src/pages/docs/workflows/typescript.mdx
+43-1
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,49 @@ declare module 'next-intl' {
122
122
123
123
You can freely define the interface, but if you have your messages available locally, it can be helpful to automatically create the type based on the messages from your default locale.
124
124
125
-
### Strict arguments [#messages-arguments]
125
+
<Detailsid="messages-performance-tsc">
126
+
<summary>Does this affect the performance of type checking?</summary>
127
+
128
+
While the size of your messages file can have an effect on the time it takes to run the TypeScript compiler on your project, the overhead of augmenting `Messages` should be reasonably fast.
129
+
130
+
Here's a benchmark from a sample project with 340 messages:
131
+
132
+
- No type augmentation for messages: ~2.20s
133
+
- Type-safe keys: ~2.82s
134
+
- Type-safe arguments: ~2.85s
135
+
136
+
This was observed on a MacBook Pro 2019 (Intel).
137
+
138
+
---
139
+
140
+
If you experience performance issues on larger projects, you can consider:
141
+
142
+
1. Using type augmentation of messages only on your continuous integration pipeline as a safety net
143
+
2. Splitting your project into multiple packages in a monorepo, allowing you to work with separate messages per package
144
+
145
+
</Details>
146
+
147
+
<Detailsid="messages-performance-editor">
148
+
<summary>Does this affect the performance of my editor?</summary>
149
+
150
+
Generally, type augmentation for `Messages` should be [reasonably fast](#messages-performance-tsc).
151
+
152
+
In case you notice your editor performance related to saving files to be impacted, it might be caused by running ESLint on save when using [type-aware](https://typescript-eslint.io/troubleshooting/typed-linting/performance/) rules from `@typescript-eslint`.
153
+
154
+
To ensure your editor performance is optimal, you can consider running expensive, type-aware rules only on your continuous integration pipeline:
0 commit comments