Commit 757893c
fix(openapi-typescript-helpers): preserve built-in objects in Readable/Writable types for TS6
In TypeScript 6, `Date extends object` evaluates to `true` (changed from
TS5). This caused `Readable<T>` and `Writable<T>` to structurally expand
Date, RegExp, and function fields instead of preserving them.
Add a guard clause for built-in objects (Date, RegExp, functions) before
the `T extends object` branch in both type utilities.
Ref: #27231 parent 541d6e0 commit 757893c
3 files changed
Lines changed: 300 additions & 275 deletions
File tree
- .changeset
- packages/openapi-typescript-helpers/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
| |||
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
0 commit comments