ts-fortress 6.2.2 → 6.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/array/array-at-least-length.d.mts +2 -2
  3. package/dist/array/array-at-least-length.d.mts.map +1 -1
  4. package/dist/array/array-at-least-length.mjs.map +1 -1
  5. package/dist/array/array-of-length.d.mts +2 -2
  6. package/dist/array/array-of-length.d.mts.map +1 -1
  7. package/dist/array/array-of-length.mjs.map +1 -1
  8. package/dist/array/array.d.mts +2 -2
  9. package/dist/array/array.d.mts.map +1 -1
  10. package/dist/array/array.mjs.map +1 -1
  11. package/dist/array/non-empty-array.d.mts +2 -2
  12. package/dist/array/non-empty-array.d.mts.map +1 -1
  13. package/dist/array/non-empty-array.mjs.map +1 -1
  14. package/dist/array/tuple.d.mts +5 -5
  15. package/dist/array/tuple.d.mts.map +1 -1
  16. package/dist/array/tuple.mjs.map +1 -1
  17. package/dist/brand/brand.d.mts +1 -1
  18. package/dist/brand/brand.d.mts.map +1 -1
  19. package/dist/compose/intersection.d.mts +4 -4
  20. package/dist/compose/intersection.d.mts.map +1 -1
  21. package/dist/compose/intersection.mjs.map +1 -1
  22. package/dist/compose/merge-records.d.mts +3 -3
  23. package/dist/compose/merge-records.d.mts.map +1 -1
  24. package/dist/compose/merge-records.mjs.map +1 -1
  25. package/dist/compose/union.d.mts +2 -2
  26. package/dist/compose/union.d.mts.map +1 -1
  27. package/dist/compose/union.mjs.map +1 -1
  28. package/dist/enum/enum.d.mts +2 -2
  29. package/dist/enum/enum.d.mts.map +1 -1
  30. package/dist/enum/enum.mjs.map +1 -1
  31. package/dist/globals.d.mts +0 -2
  32. package/dist/other-types/map.d.mts +2 -2
  33. package/dist/other-types/map.d.mts.map +1 -1
  34. package/dist/other-types/map.mjs.map +1 -1
  35. package/dist/other-types/recursion.d.mts +2 -2
  36. package/dist/other-types/recursion.d.mts.map +1 -1
  37. package/dist/other-types/recursion.mjs +5 -7
  38. package/dist/other-types/recursion.mjs.map +1 -1
  39. package/dist/other-types/set.d.mts +2 -2
  40. package/dist/other-types/set.d.mts.map +1 -1
  41. package/dist/other-types/set.mjs.map +1 -1
  42. package/dist/predefined/brand/string/email.d.mts +2 -2
  43. package/dist/predefined/brand/string/email.d.mts.map +1 -1
  44. package/dist/predefined/brand/string/email.mjs.map +1 -1
  45. package/dist/predefined/brand/string/json-string.d.mts +2 -2
  46. package/dist/predefined/brand/string/json-string.d.mts.map +1 -1
  47. package/dist/predefined/brand/string/json-string.mjs.map +1 -1
  48. package/dist/predefined/brand/string/uuid.d.mts +2 -2
  49. package/dist/predefined/brand/string/uuid.d.mts.map +1 -1
  50. package/dist/predefined/brand/string/uuid.mjs.map +1 -1
  51. package/dist/primitives/bigint.d.mts +10 -10
  52. package/dist/primitives/bigint.d.mts.map +1 -1
  53. package/dist/primitives/bigint.mjs.map +1 -1
  54. package/dist/primitives/number.d.mts +10 -10
  55. package/dist/primitives/number.d.mts.map +1 -1
  56. package/dist/primitives/number.mjs.map +1 -1
  57. package/dist/primitives/string.d.mts +20 -20
  58. package/dist/primitives/string.d.mts.map +1 -1
  59. package/dist/primitives/string.mjs.map +1 -1
  60. package/dist/record/key-value-record.d.mts +2 -2
  61. package/dist/record/key-value-record.d.mts.map +1 -1
  62. package/dist/record/key-value-record.mjs.map +1 -1
  63. package/dist/record/keyof.d.mts +2 -2
  64. package/dist/record/keyof.d.mts.map +1 -1
  65. package/dist/record/keyof.mjs.map +1 -1
  66. package/dist/record/omit.d.mts +2 -2
  67. package/dist/record/omit.d.mts.map +1 -1
  68. package/dist/record/omit.mjs.map +1 -1
  69. package/dist/record/partial.d.mts +8 -8
  70. package/dist/record/partial.d.mts.map +1 -1
  71. package/dist/record/partial.mjs.map +1 -1
  72. package/dist/record/pick.d.mts +2 -2
  73. package/dist/record/pick.d.mts.map +1 -1
  74. package/dist/record/pick.mjs.map +1 -1
  75. package/dist/record/record.d.mts +4 -4
  76. package/dist/record/record.d.mts.map +1 -1
  77. package/dist/record/record.mjs.map +1 -1
  78. package/dist/record/required.d.mts +8 -8
  79. package/dist/record/required.d.mts.map +1 -1
  80. package/dist/record/required.mjs.map +1 -1
  81. package/dist/record/valueof.d.mts +2 -2
  82. package/dist/record/valueof.d.mts.map +1 -1
  83. package/dist/record/valueof.mjs.map +1 -1
  84. package/dist/type.d.mts +4 -4
  85. package/dist/type.d.mts.map +1 -1
  86. package/package.json +26 -19
  87. package/src/array/array-at-least-length.mts +6 -4
  88. package/src/array/array-of-length.mts +6 -4
  89. package/src/array/array.mts +6 -4
  90. package/src/array/non-empty-array.mts +6 -4
  91. package/src/array/tuple.mts +8 -6
  92. package/src/brand/brand.mts +1 -1
  93. package/src/compose/intersection.mts +76 -59
  94. package/src/compose/merge-records.mts +74 -59
  95. package/src/compose/union-literal-array.test.mts +1 -1
  96. package/src/compose/union-nested-record.test.mts +10 -8
  97. package/src/compose/union-records.test.mts +10 -8
  98. package/src/compose/union.mts +18 -8
  99. package/src/enum/enum.mts +6 -4
  100. package/src/globals.d.mts +0 -2
  101. package/src/other-types/map.mts +5 -3
  102. package/src/other-types/recursion.mts +10 -10
  103. package/src/other-types/recursion.test.mts +1 -1
  104. package/src/other-types/set.mts +5 -3
  105. package/src/predefined/brand/string/email.mts +5 -3
  106. package/src/predefined/brand/string/json-string.mts +5 -3
  107. package/src/predefined/brand/string/uuid.mts +10 -8
  108. package/src/primitives/bigint.mts +24 -30
  109. package/src/primitives/number.mts +24 -30
  110. package/src/primitives/string.mts +53 -58
  111. package/src/record/key-value-record.mts +5 -3
  112. package/src/record/keyof.mts +17 -9
  113. package/src/record/omit.mts +19 -14
  114. package/src/record/partial.mts +25 -18
  115. package/src/record/pick.mts +19 -14
  116. package/src/record/record.mts +28 -24
  117. package/src/record/required.mts +27 -26
  118. package/src/record/valueof.mts +9 -7
  119. package/src/type.mts +9 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-fortress",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript"
@@ -32,8 +32,10 @@
32
32
  "scripts": {
33
33
  "build": "tsx ./scripts/cmd/build.mts",
34
34
  "build:min": "tsx ./scripts/cmd/build.mts --skip-check",
35
- "check-all": "tsx ./scripts/cmd/check-all.mts",
36
35
  "check:ext": "tsx ./scripts/cmd/check-ext.mts",
36
+ "check-all": "tsx ./scripts/cmd/check-all.mts",
37
+ "codemod": "run-s codemod:all fmt",
38
+ "codemod:all": "convert-to-readonly '{src,scripts,samples,test}/**/*.{mts,tsx}'",
37
39
  "cspell": "cspell \"**\" --gitignore --gitignore-root ./ --no-progress",
38
40
  "doc": "tsx ./scripts/cmd/gen-docs.mts",
39
41
  "doc:embed": "tsx ./scripts/cmd/embed-samples.mts",
@@ -69,8 +71,8 @@
69
71
  },
70
72
  "dependencies": {
71
73
  "@sindresorhus/is": "^7.2.0",
72
- "ts-data-forge": "^6.2.1",
73
- "ts-type-forge": "^2.3.0"
74
+ "ts-data-forge": "^6.3.0",
75
+ "ts-type-forge": "^2.3.1"
74
76
  },
75
77
  "devDependencies": {
76
78
  "@rollup/plugin-replace": "6.0.3",
@@ -83,39 +85,44 @@
83
85
  "@semantic-release/github": "12.0.2",
84
86
  "@semantic-release/npm": "13.1.3",
85
87
  "@semantic-release/release-notes-generator": "14.1.0",
86
- "@types/node": "25.0.3",
87
- "@vitest/browser-playwright": "4.0.16",
88
- "@vitest/coverage-v8": "4.0.16",
89
- "@vitest/ui": "4.0.16",
88
+ "@types/node": "25.0.10",
89
+ "@vitest/browser-playwright": "4.0.17",
90
+ "@vitest/coverage-v8": "4.0.17",
91
+ "@vitest/ui": "4.0.17",
90
92
  "conventional-changelog-conventionalcommits": "9.1.0",
91
- "cspell": "9.4.0",
93
+ "cspell": "9.6.0",
92
94
  "eslint": "9.39.2",
93
- "eslint-config-typed": "4.3.0",
95
+ "eslint-config-typed": "4.6.0",
94
96
  "fast-glob": "3.3.3",
95
97
  "fp-ts": "2.16.11",
96
- "github-settings-as-code": "1.0.6",
98
+ "github-settings-as-code": "1.0.11",
97
99
  "io-ts": "2.2.22",
98
100
  "jiti": "2.6.1",
99
101
  "markdownlint": "0.40.0",
100
102
  "markdownlint-cli2": "0.20.0",
101
103
  "npm-run-all2": "8.0.4",
102
104
  "playwright": "1.57.0",
103
- "prettier": "3.7.4",
105
+ "prettier": "3.8.0",
104
106
  "prettier-plugin-organize-imports": "4.3.0",
105
- "prettier-plugin-packagejson": "2.5.20",
106
- "rollup": "4.54.0",
107
+ "prettier-plugin-packagejson": "3.0.0",
108
+ "rollup": "4.55.2",
107
109
  "semantic-release": "25.0.2",
108
- "ts-repo-utils": "7.9.5",
110
+ "ts-codemod-lib": "^1.1.3",
111
+ "ts-repo-utils": "8.1.0",
109
112
  "tslib": "2.8.1",
110
113
  "tsx": "4.21.0",
111
- "typedoc": "0.28.15",
114
+ "typedoc": "0.28.16",
112
115
  "typedoc-github-theme": "0.3.1",
113
116
  "typescript": "5.9.3",
114
- "vite": "7.3.0",
115
- "vitest": "4.0.16",
116
- "zod": "4.2.1"
117
+ "vite": "7.3.1",
118
+ "vitest": "4.0.17",
119
+ "zod": "4.3.5"
117
120
  },
118
121
  "packageManager": "pnpm@10.24.0",
122
+ "engines": {
123
+ "node": ">=20.11.0",
124
+ "pnpm": ">=8.0.0"
125
+ },
119
126
  "volta": {
120
127
  "node": "25.2.1"
121
128
  }
@@ -12,10 +12,12 @@ import {
12
12
  export const arrayAtLeastLength = <A, N extends SmallUint>(
13
13
  size: N,
14
14
  elementType: Type<A>,
15
- options?: PartialReadonly<{
16
- typeName: string;
17
- defaultValue: ArrayAtLeastLen<N, A>;
18
- }>,
15
+ options?: Partial<
16
+ Readonly<{
17
+ typeName: string;
18
+ defaultValue: ArrayAtLeastLen<N, A>;
19
+ }>
20
+ >,
19
21
  ): Type<ArrayAtLeastLen<N, A>> => {
20
22
  type T = ArrayAtLeastLen<N, A>;
21
23
 
@@ -12,10 +12,12 @@ import {
12
12
  export const arrayOfLength = <A, N extends SmallUint>(
13
13
  size: N,
14
14
  elementType: Type<A>,
15
- options?: PartialReadonly<{
16
- typeName: string;
17
- defaultValue: ArrayOfLength<N, A>;
18
- }>,
15
+ options?: Partial<
16
+ Readonly<{
17
+ typeName: string;
18
+ defaultValue: ArrayOfLength<N, A>;
19
+ }>
20
+ >,
19
21
  ): Type<ArrayOfLength<N, A>> => {
20
22
  type T = ArrayOfLength<N, A>;
21
23
 
@@ -11,10 +11,12 @@ import {
11
11
 
12
12
  export const array = <A,>(
13
13
  elementType: Type<A>,
14
- options?: PartialReadonly<{
15
- typeName: string;
16
- defaultValue: readonly A[];
17
- }>,
14
+ options?: Partial<
15
+ Readonly<{
16
+ typeName: string;
17
+ defaultValue: readonly A[];
18
+ }>
19
+ >,
18
20
  ): Type<readonly A[]> => {
19
21
  type T = readonly A[];
20
22
 
@@ -11,10 +11,12 @@ import {
11
11
 
12
12
  export const nonEmptyArray = <A,>(
13
13
  elementType: Type<A>,
14
- options?: PartialReadonly<{
15
- typeName: string;
16
- defaultValue: NonEmptyArray<A>;
17
- }>,
14
+ options?: Partial<
15
+ Readonly<{
16
+ typeName: string;
17
+ defaultValue: NonEmptyArray<A>;
18
+ }>
19
+ >,
18
20
  ): Type<NonEmptyArray<A>> => {
19
21
  type T = NonEmptyArray<A>;
20
22
 
@@ -9,15 +9,17 @@ import {
9
9
  type ValidationError,
10
10
  } from '../utils/index.mjs';
11
11
 
12
- type MapTuple<T extends readonly Type<unknown>[]> = {
13
- readonly [K in keyof T]: TypeOf<T[K]>;
14
- };
12
+ type MapTuple<T extends readonly Type<unknown>[]> = Readonly<{
13
+ [K in keyof T]: TypeOf<T[K]>;
14
+ }>;
15
15
 
16
16
  export const tuple = <const A extends readonly Type<unknown>[]>(
17
17
  types: A,
18
- options?: PartialReadonly<{
19
- typeName: string;
20
- }>,
18
+ options?: Partial<
19
+ Readonly<{
20
+ typeName: string;
21
+ }>
22
+ >,
21
23
  ): Type<MapTuple<A>> => {
22
24
  type T = MapTuple<A>;
23
25
 
@@ -9,7 +9,7 @@ type ArrayToUnion<A extends readonly unknown[]> = A extends readonly []
9
9
  export const brand = <
10
10
  const A extends StrictExtract<Primitive, string | number | bigint | boolean>,
11
11
  const BrandTrueKeys extends readonly string[],
12
- const BrandFalseKeys extends readonly string[] = [],
12
+ const BrandFalseKeys extends readonly string[] = readonly [],
13
13
  >({
14
14
  baseType,
15
15
  brandFalseKeys,
@@ -11,9 +11,11 @@ import {
11
11
  export const intersection = <const Types extends NonEmptyArray<Type<unknown>>>(
12
12
  types: Types,
13
13
  defaultType: IntersectionType<Types>,
14
- options?: PartialReadonly<{
15
- typeName: string;
16
- }>,
14
+ options?: Partial<
15
+ Readonly<{
16
+ typeName: string;
17
+ }>
18
+ >,
17
19
  ): IntersectionType<Types> => {
18
20
  type T = IntersectionTypeValue<Types>;
19
21
 
@@ -78,27 +80,35 @@ namespace TsFortressInternal {
78
80
  Types extends NonEmptyArray<Type<unknown>>,
79
81
  > = Intersection<Cast0<UnwrapTypeList<Types>>>;
80
82
 
81
- type Cast0<T> = [T] extends [NonEmptyArray<unknown>] ? T : never;
83
+ type Cast0<T> = readonly [T] extends readonly [NonEmptyArray<unknown>]
84
+ ? T
85
+ : never;
82
86
  }
83
87
 
84
88
  expectType<
85
89
  IntersectionType<
86
- [
87
- Type<{
88
- a: 0;
89
- b: 0;
90
- }>,
91
- Type<{
92
- b: 0;
93
- c: 0;
94
- }>,
90
+ readonly [
91
+ Type<
92
+ Readonly<{
93
+ a: 0;
94
+ b: 0;
95
+ }>
96
+ >,
97
+ Type<
98
+ Readonly<{
99
+ b: 0;
100
+ c: 0;
101
+ }>
102
+ >,
95
103
  ]
96
104
  >,
97
- Type<{
98
- a: 0;
99
- b: 0;
100
- c: 0;
101
- }>
105
+ Type<
106
+ Readonly<{
107
+ a: 0;
108
+ b: 0;
109
+ c: 0;
110
+ }>
111
+ >
102
112
  >('=');
103
113
 
104
114
  type UnwrapTypeList<Types extends readonly Type<unknown>[]> =
@@ -107,108 +117,115 @@ type UnwrapTypeList<Types extends readonly Type<unknown>[]> =
107
117
  namespace TsFortressInternal {
108
118
  export type UnwrapTypeImpl<Types extends readonly unknown[]> =
109
119
  Types extends readonly []
110
- ? []
120
+ ? readonly []
111
121
  : Types extends readonly [infer Head, ...infer Tail]
112
122
  ? readonly [TypeOf<Cast1<Head>>, ...UnwrapTypeImpl<Tail>]
113
123
  : never;
114
124
 
125
+ // transformer-ignore-next-line
115
126
  type Cast1<T> = [T] extends [Type<unknown>] ? T : never;
116
127
  }
117
128
 
118
129
  expectType<
119
130
  TypeOf<
120
- Type<{
121
- a: 0;
122
- b: 0;
123
- }>
131
+ Type<
132
+ Readonly<{
133
+ a: 0;
134
+ b: 0;
135
+ }>
136
+ >
124
137
  >,
125
- {
138
+ Readonly<{
126
139
  a: 0;
127
140
  b: 0;
128
- }
141
+ }>
129
142
  >('=');
130
143
 
131
144
  expectType<
132
145
  UnwrapTypeList<
133
- [
134
- Type<{
135
- a: 0;
136
- b: 0;
137
- }>,
138
- Type<{
139
- b: 0;
140
- c: 0;
141
- }>,
146
+ readonly [
147
+ Type<
148
+ Readonly<{
149
+ a: 0;
150
+ b: 0;
151
+ }>
152
+ >,
153
+ Type<
154
+ Readonly<{
155
+ b: 0;
156
+ c: 0;
157
+ }>
158
+ >,
142
159
  ]
143
160
  >,
144
161
  readonly [
145
- {
162
+ Readonly<{
146
163
  a: 0;
147
164
  b: 0;
148
- },
149
- {
165
+ }>,
166
+ Readonly<{
150
167
  b: 0;
151
168
  c: 0;
152
- },
169
+ }>,
153
170
  ]
154
171
  >('=');
155
172
 
156
173
  expectType<
157
174
  Intersection<
158
- [
159
- {
175
+ readonly [
176
+ Readonly<{
160
177
  a: 0;
161
178
  b: 0;
162
- },
163
- {
179
+ }>,
180
+ Readonly<{
164
181
  b: 0;
165
182
  c: 0;
166
- },
183
+ }>,
167
184
  ]
168
185
  >,
169
- {
186
+ Readonly<{
170
187
  a: 0;
171
188
  b: 0;
172
189
  c: 0;
173
- }
190
+ }>
174
191
  >('=');
175
192
 
176
193
  expectType<
177
194
  Intersection<
178
- [
179
- {
195
+ readonly [
196
+ Readonly<{
180
197
  a: 0;
181
198
  b: 0;
182
- },
183
- {
199
+ }>,
200
+ Readonly<{
184
201
  b: 0;
185
202
  c: 0;
186
- },
187
- {
203
+ }>,
204
+ Readonly<{
188
205
  c: 0;
189
206
  d: 0;
190
- },
207
+ }>,
191
208
  ]
192
209
  >,
193
- {
210
+ Readonly<{
194
211
  a: 0;
195
212
  b: 0;
196
213
  c: 0;
197
214
  d: 0;
198
- }
215
+ }>
199
216
  >('=');
200
217
 
201
218
  expectType<
202
219
  Intersection<
203
- [
204
- {
220
+ readonly [
221
+ Readonly<{
205
222
  a: 0;
206
223
  b: 0;
207
- },
208
- {
224
+ }>,
225
+ Readonly<{
209
226
  b: 1;
210
227
  c: 0;
211
- },
228
+ }>,
212
229
  ]
213
230
  >,
214
231
  never
@@ -12,10 +12,12 @@ export const mergeRecords = <
12
12
  const Types extends NonEmptyArray<Type<UnknownRecord>>,
13
13
  >(
14
14
  types: Types,
15
- options?: PartialReadonly<{
16
- typeName: string;
17
- defaultType: IntersectionType<Types>;
18
- }>,
15
+ options?: Partial<
16
+ Readonly<{
17
+ typeName: string;
18
+ defaultType: IntersectionType<Types>;
19
+ }>
20
+ >,
19
21
  ): IntersectionType<Types> => {
20
22
  type T = IntersectionTypeValue<Types>;
21
23
 
@@ -93,128 +95,141 @@ namespace TsFortressInternal {
93
95
 
94
96
  type UnwrapTypeImpl<Types extends readonly unknown[]> =
95
97
  Types extends readonly []
96
- ? []
98
+ ? readonly []
97
99
  : Types extends readonly [infer Head, ...infer Tail]
98
100
  ? readonly [TypeOf<Cast1<Head>>, ...UnwrapTypeImpl<Tail>]
99
101
  : never;
100
102
 
103
+ // transformer-ignore-next-line
101
104
  type Cast1<T> = [T] extends [Type<UnknownRecord>] ? T : never;
102
105
  }
103
106
 
104
107
  expectType<
105
108
  IntersectionType<
106
- [
107
- Type<{
108
- a: 0;
109
- b: 0;
110
- }>,
111
- Type<{
112
- b: 0;
113
- c: 0;
114
- }>,
109
+ readonly [
110
+ Type<
111
+ Readonly<{
112
+ a: 0;
113
+ b: 0;
114
+ }>
115
+ >,
116
+ Type<
117
+ Readonly<{
118
+ b: 0;
119
+ c: 0;
120
+ }>
121
+ >,
115
122
  ]
116
123
  >,
117
- Type<{
118
- a: 0;
119
- b: 0;
120
- c: 0;
121
- }>
124
+ Type<
125
+ Readonly<{
126
+ a: 0;
127
+ b: 0;
128
+ c: 0;
129
+ }>
130
+ >
122
131
  >('=');
123
132
 
124
133
  expectType<
125
134
  TypeOf<
126
- Type<{
127
- a: 0;
128
- b: 0;
129
- }>
135
+ Type<
136
+ Readonly<{
137
+ a: 0;
138
+ b: 0;
139
+ }>
140
+ >
130
141
  >,
131
- {
142
+ Readonly<{
132
143
  a: 0;
133
144
  b: 0;
134
- }
145
+ }>
135
146
  >('=');
136
147
 
137
148
  expectType<
138
149
  TsFortressInternal.UnwrapTypeList<
139
- [
140
- Type<{
141
- a: 0;
142
- b: 0;
143
- }>,
144
- Type<{
145
- b: 0;
146
- c: 0;
147
- }>,
150
+ readonly [
151
+ Type<
152
+ Readonly<{
153
+ a: 0;
154
+ b: 0;
155
+ }>
156
+ >,
157
+ Type<
158
+ Readonly<{
159
+ b: 0;
160
+ c: 0;
161
+ }>
162
+ >,
148
163
  ]
149
164
  >,
150
165
  readonly [
151
- {
166
+ Readonly<{
152
167
  a: 0;
153
168
  b: 0;
154
- },
155
- {
169
+ }>,
170
+ Readonly<{
156
171
  b: 0;
157
172
  c: 0;
158
- },
173
+ }>,
159
174
  ]
160
175
  >('=');
161
176
 
162
177
  expectType<
163
178
  Intersection<
164
- [
165
- {
179
+ readonly [
180
+ Readonly<{
166
181
  a: 0;
167
182
  b: 0;
168
- },
169
- {
183
+ }>,
184
+ Readonly<{
170
185
  b: 0;
171
186
  c: 0;
172
- },
187
+ }>,
173
188
  ]
174
189
  >,
175
- {
190
+ Readonly<{
176
191
  a: 0;
177
192
  b: 0;
178
193
  c: 0;
179
- }
194
+ }>
180
195
  >('=');
181
196
 
182
197
  expectType<
183
198
  Intersection<
184
- [
185
- {
199
+ readonly [
200
+ Readonly<{
186
201
  a: 0;
187
202
  b: 0;
188
- },
189
- {
203
+ }>,
204
+ Readonly<{
190
205
  b: 0;
191
206
  c: 0;
192
- },
193
- {
207
+ }>,
208
+ Readonly<{
194
209
  c: 0;
195
210
  d: 0;
196
- },
211
+ }>,
197
212
  ]
198
213
  >,
199
- {
214
+ Readonly<{
200
215
  a: 0;
201
216
  b: 0;
202
217
  c: 0;
203
218
  d: 0;
204
- }
219
+ }>
205
220
  >('=');
206
221
 
207
222
  expectType<
208
223
  Intersection<
209
- [
210
- {
224
+ readonly [
225
+ Readonly<{
211
226
  a: 0;
212
227
  b: 0;
213
- },
214
- {
228
+ }>,
229
+ Readonly<{
215
230
  b: 1;
216
231
  c: 0;
217
- },
232
+ }>,
218
233
  ]
219
234
  >,
220
235
  never
@@ -16,7 +16,7 @@ describe('union - literal and array', () => {
16
16
 
17
17
  type TargetType = TypeOf<typeof targetType>;
18
18
 
19
- expectType<TargetType, 'none' | readonly number[] | false>('=');
19
+ expectType<TargetType, 'none' | false | readonly number[]>('=');
20
20
 
21
21
  expectType<typeof targetType.defaultValue, TargetType>('=');
22
22
 
@@ -32,14 +32,16 @@ describe('union - nested records', () => {
32
32
 
33
33
  expectType<
34
34
  TargetType,
35
- | Readonly<{
36
- type: string;
37
- data: Readonly<{ value: number }>;
38
- }>
39
- | Readonly<{
40
- kind: string;
41
- config: Readonly<{ enabled: string }>;
42
- }>
35
+ Readonly<
36
+ | {
37
+ type: string;
38
+ data: Readonly<{ value: number }>;
39
+ }
40
+ | {
41
+ kind: string;
42
+ config: Readonly<{ enabled: string }>;
43
+ }
44
+ >
43
45
  >('=');
44
46
 
45
47
  expectType<typeof targetType.defaultValue, TargetType>('=');