Repository navigation
Make index signature declarations without a type annotation an implicit any, not a grammar error - #65283
Merged
Andrew Branch (andrewbranch) merged 2 commits intoNov 3, 2026
Conversation
…it any, not a grammar error
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The review identifies no active issues with the index-signature behavior and AST API changes.
No open issues 🎉
1 file not reviewed
tsc/internal/diagnostics/diagnostics_generated.go: Generated file
What changed in this PR
This PR separates the index-signature behavior change from #65063: omitted value types become implicit any rather than grammar errors, with matching optionality in the TypeScript AST API.
Changes:
- Replace TS1021 with implicit-
anydiagnostic TS7062 whennoImplicitAnyis enabled. - Make index-signature types optional in the AST schema and generated factory APIs.
- Add compiler and API tests, including declaration emit, and update diagnostic baselines.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/indexSignatureMissingType.ts |
Tests omitted types with both noImplicitAny settings. |
tsc/testdata/baselines/reference/conformance/parserObjectType6.errors.txt |
Adds implicit-any diagnostic for an empty signature. |
tsc/testdata/baselines/reference/conformance/parserIndexSignature8.errors.txt |
Adds implicit-any diagnostics alongside invalid-key errors. |
tsc/testdata/baselines/reference/conformance/parserIndexSignature7.errors.txt |
Replaces the missing-type grammar diagnostic. |
tsc/testdata/baselines/reference/conformance/parserIndexSignature6.errors.txt |
Records implicit any alongside the boolean-key error. |
tsc/testdata/baselines/reference/conformance/parserIndexSignature11.errors.txt |
Removes the obsolete missing-type error. |
tsc/testdata/baselines/reference/compiler/indexWithoutParamType.errors.txt |
Records implicit any for an empty signature. |
tsc/testdata/baselines/reference/compiler/indexTypeCheck.errors.txt |
Removes errors for permitted omitted types. |
tsc/testdata/baselines/reference/compiler/indexSignatureWithoutTypeAnnotation1.errors.txt |
Updates the class index-signature diagnostic. |
tsc/testdata/baselines/reference/compiler/indexSignatureTypeCheck2.errors.txt |
Adds implicit-any diagnostics for malformed signatures. |
tsc/testdata/baselines/reference/compiler/indexSignatureTypeCheck.errors.txt |
Adds implicit-any diagnostics while retaining parameter errors. |
tsc/testdata/baselines/reference/compiler/indexSignatureMustHaveTypeAnnotation.errors.txt |
Replaces missing-type grammar errors with TS7062. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=true).types |
Records inferred any types with checking enabled. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=true).symbols |
Records symbol bindings with checking enabled. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=true).js |
Records JavaScript and explicit-any declaration emit. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=true).errors.txt |
Records implicit-any and existing validation errors. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=false).types |
Records inferred any types with checking disabled. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=false).symbols |
Records symbol bindings with checking disabled. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=false).js |
Records JavaScript and declaration emit with checking disabled. |
tsc/testdata/baselines/reference/compiler/indexSignatureMissingType(noimplicitany=false).errors.txt |
Confirms only unrelated validation errors remain. |
tsc/testdata/baselines/reference/compiler/indexerConstraints2.errors.txt |
Updates the missing-type diagnostic. |
tsc/testdata/baselines/reference/compiler/giant.errors.txt |
Removes obsolete missing-type grammar errors. |
tsc/testdata/baselines/reference/compiler/arraySigChecking.errors.txt |
Adds implicit any alongside an invalid-key error. |
tsc/internal/diagnostics/diagnostics_generated.go |
Regenerates Go diagnostic definitions. |
tsc/internal/diagnostics/diagnosticMessages.json |
Replaces TS1021 with TS7062. |
tsc/internal/diagnostics/diagnosticMessages.generated.json |
Updates generated diagnostic messages. |
tsc/internal/checker/grammarchecks.go |
Removes the mandatory value-type grammar check. |
tsc/internal/checker/checker.go |
Reports implicit any for unannotated index signatures. |
tools/scripts/tsc/ast.json |
Marks index-signature types optional in the schema. |
packages/typescript/test/sync/ast.test.ts |
Tests parsed and factory-created signatures without types. |
packages/typescript/src/ast/factory.generated.ts |
Allows omitted types in create and update factories. |
packages/typescript/src/ast/ast.generated.ts |
Removes the required-type override. |
Review effort: Balanced
Merged
Andrew Branch (andrewbranch)
requested review from
Ryan Cavanaugh (RyanCavanaugh) and
Jake Bailey (jakebailey)
November 3, 2026 17:50
Jake Bailey (jakebailey)
approved these changes
Nov 3, 2026
Jake Bailey (jakebailey)
left a comment
Member
There was a problem hiding this comment.
LGTM but merge conflict
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Jake Bailey (jakebailey)
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracted out of #65063
was previously a grammar error; now it's an implicit
any.