Commit 1663184
committed
fix(parser): allow conditional types in function type parameters (#18886)
## Summary
- Allow conditional types inside function type parameter annotations, even when the function type itself is being parsed in a `DisallowConditionalTypes` context
- Wrap `parse_formal_parameters` in `parse_function_or_constructor_type` with `context_remove(DisallowConditionalTypes, ...)`
This fixes parsing of nested conditional types like:
```typescript
type Equals = A extends (x: B extends C ? D : E) => 0 ? F : G;
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent a7b360a commit 1663184
File tree
3 files changed
+8
-15
lines changed- crates/oxc_parser/src/ts
- tasks/coverage/snapshots
3 files changed
+8
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | 307 | | |
318 | 308 | | |
319 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
742 | | - | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
743 | 745 | | |
744 | 746 | | |
745 | 747 | | |
| |||
0 commit comments