Normalize NoInferred tuple types in rest/spread positions - #4597
Normalize NoInferred tuple types in rest/spread positions#4597Mateusz Burzyński (Andarist) wants to merge 3 commits into
NoInferred tuple types in rest/spread positions#4597Conversation
There was a problem hiding this comment.
Pull request overview
Adds coverage and a checker-side normalization to ensure NoInfer-wrapped tuple types behave consistently when used in rest/spread positions (addressing microsoft/TypeScript#59668 and #63627).
Changes:
- Normalize
NoInfer<T>when it appears in rest parameters and variadic tuple elements, so tuple spreads are handled predictably. - Add new conformance tests for
NoInferin rest/spread scenarios and commit the corresponding reference baselines.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/checker/checker.go | Adds normalizeNoInferSpread and applies it when computing types for rest parameters and variadic tuple elements. |
| testdata/tests/cases/conformance/types/typeRelationships/typeInference/noInferRestSpread1.ts | New test cases covering contextual typing and error behavior with NoInfer in rest parameters. |
| testdata/tests/cases/conformance/types/typeRelationships/typeInference/noInferRestSpread2.ts | New test cases covering tuple spread/rest normalization for NoInfer (including empty tuple rest). |
| testdata/baselines/reference/conformance/noInferRestSpread1.types | Reference type baseline for the new noInferRestSpread1 test. |
| testdata/baselines/reference/conformance/noInferRestSpread1.symbols | Reference symbols baseline for the new noInferRestSpread1 test. |
| testdata/baselines/reference/conformance/noInferRestSpread1.errors.txt | Reference error baseline for the expected failure in noInferRestSpread1. |
| testdata/baselines/reference/conformance/noInferRestSpread2.types | Reference type baseline for the new noInferRestSpread2 test. |
| testdata/baselines/reference/conformance/noInferRestSpread2.symbols | Reference symbols baseline for the new noInferRestSpread2 test. |
| return c.mapType(t.AsSubstitutionType().baseType, func(element *Type) *Type { | ||
| if !isTupleType(element) { | ||
| return c.getNoInferType(t) | ||
| } |
|
Thank you for contributing to the TypeScript native port! Development has moved from this repository back to the main microsoft/TypeScript repository. GitHub does not have PR transfer functionality, so we're closing this PR here. If this change is still relevant, please reopen it as a new pull request in See microsoft/typescript-go#4918 for more information about the move. |
fixes microsoft/TypeScript#59668
fixes microsoft/TypeScript#63627