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: readme.md
+36-29
Original file line number
Diff line number
Diff line change
@@ -83,9 +83,9 @@ License MIT
83
83
- [Recursive](#types-recursive)
84
84
- [Conditional](#types-conditional)
85
85
- [Template Literal](#types-template-literal)
86
-
- [Intrinsic String](#types-intrinsic-string)
87
86
- [Indexed](#types-indexed)
88
87
- [Negated](#types-negated)
88
+
- [Intrinsic](#types-intrinsic)
89
89
- [Rest](#types-rest)
90
90
- [Guards](#types-guards)
91
91
- [Unsafe](#types-unsafe)
@@ -875,34 +875,6 @@ const R = Type.Record(T, Type.String()) // const R = {
875
875
// }
876
876
```
877
877
878
-
<a name='types-intrinsic-string'></a>
879
-
880
-
### Intrinsic String Types
881
-
882
-
TypeBox supports a set of intrinsic string mapping functions which can be used on string literals. These functions match the TypeScript string intrinsic types `Uppercase`, `Lowercase`, `Capitalize` and `Uncapitalize`. These functions are supported for literal strings, template literals and union types. The following shows the literal string usage.
TypeBox supports TypeScript intrinsic string manipulation types `Uppercase`, `Lowercase`, `Capitalize` and `Uncapitalize`. These can be applied to string literals, template literals and unions. The following shows general usage.
966
+
967
+
```typescript
968
+
// TypeScript
969
+
970
+
typeA=Capitalize<'hello'>// type A = 'Hello'
971
+
972
+
typeB=Capitalize<'hello'|'world'>// type C = 'Hello' | 'World'
973
+
974
+
typeC=Capitalize<`hello${1|2|3}`>// type B = 'Hello1' | 'Hello2' | 'Hello3'
0 commit comments