Commit 47a1211
fix(jit): align union type resolution with Angular's typeReferenceToExpression
Angular's reference filters only `null` literal types from union types
and requires exactly one non-null type to remain. Previously we iterated
all union members and returned the first resolvable one, which is more
permissive than Angular's behavior.
With Angular-aligned semantics:
- `T | null` → resolves to T (1 non-null type remains)
- `undefined | T` → unresolvable (2 non-null types remain)
- `null | undefined | T` → unresolvable (2 non-null types remain)
Unresolvable types emit `{ type: undefined }` matching Angular's
`paramType || ts.factory.createIdentifier('undefined')` fallback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 61b518f commit 47a1211
File tree
3 files changed
+41
-23
lines changed- crates/oxc_angular_compiler
- src/component
- tests
- snapshots
3 files changed
+41
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
940 | 945 | | |
941 | | - | |
942 | 946 | | |
943 | 947 | | |
944 | 948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6307 | 6307 | | |
6308 | 6308 | | |
6309 | 6309 | | |
6310 | | - | |
6311 | | - | |
6312 | | - | |
| 6310 | + | |
| 6311 | + | |
| 6312 | + | |
| 6313 | + | |
| 6314 | + | |
| 6315 | + | |
| 6316 | + | |
| 6317 | + | |
| 6318 | + | |
6313 | 6319 | | |
6314 | 6320 | | |
6315 | 6321 | | |
6316 | 6322 | | |
6317 | 6323 | | |
| 6324 | + | |
6318 | 6325 | | |
6319 | 6326 | | |
6320 | 6327 | | |
6321 | 6328 | | |
6322 | 6329 | | |
6323 | 6330 | | |
| 6331 | + | |
6324 | 6332 | | |
6325 | 6333 | | |
6326 | 6334 | | |
| |||
6329 | 6337 | | |
6330 | 6338 | | |
6331 | 6339 | | |
6332 | | - | |
| 6340 | + | |
6333 | 6341 | | |
6334 | | - | |
6335 | | - | |
| 6342 | + | |
| 6343 | + | |
6336 | 6344 | | |
6337 | 6345 | | |
| 6346 | + | |
| 6347 | + | |
| 6348 | + | |
6338 | 6349 | | |
6339 | | - | |
6340 | | - | |
| 6350 | + | |
| 6351 | + | |
6341 | 6352 | | |
6342 | 6353 | | |
6343 | | - | |
6344 | | - | |
6345 | 6354 | | |
6346 | | - | |
6347 | | - | |
| 6355 | + | |
| 6356 | + | |
6348 | 6357 | | |
6349 | 6358 | | |
6350 | 6359 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
17 | | - | |
18 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
0 commit comments