We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d140b9c commit 02f4accCopy full SHA for 02f4acc
website/src/pages/index.mdx
@@ -310,6 +310,16 @@ Adopting template literal types brings several advantages:
310
311
Template literal types are useful in various practical scenarios, such as:
312
313
+- String Patterns - Use template literal types to enforce valid string patterns.
314
+
315
+ ```ts
316
+ // ❌ Avoid
317
+ const appVersion = '2.6';
318
+ // ✅ Use
319
+ type Version = `v${number}.${number}.${number}`;
320
+ const appVersion: Version = 'v2.6.1';
321
+ ```
322
323
- API Endpoints - Use template literal types to restrict values to valid API routes.
324
325
```ts
0 commit comments