Repository navigation
Keep nested JSDoc properties after a property with a missing name - #65022
Open
NullVoxPopuli wants to merge 1 commit into
Open
NullVoxPopuli wants to merge 1 commit into
NullVoxPopuli wants to merge 1 commit into
Conversation
When a nested @Property type does not parse, the name of that tag is missing. The nested type literal then ended at that tag, so every later nested property was lost. Flat typedefs already keep the later properties. Fixes microsoft#65020 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues requiring changes.
No open issues 🎉
What changed in this PR
Fixes #65020 by improving JSDoc error recovery in the native TypeScript parser so a malformed nested property no longer drops subsequent valid properties.
Changes:
- Keeps property tags with missing names inside the nested type literal.
- Adds a regression test comparing nested and flat typedef recovery.
- Adds baselines confirming
onCancelremains available while the expectedTS1005diagnostics remain.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/jsdocNestedPropertyTagInvalidType.ts |
Tests nested and flat property recovery and access to onCancel. |
tsc/testdata/baselines/reference/compiler/jsdocNestedPropertyTagInvalidType.types |
Records recovered property keys and callback types. |
tsc/testdata/baselines/reference/compiler/jsdocNestedPropertyTagInvalidType.symbols |
Records symbol resolution for the regression test. |
tsc/testdata/baselines/reference/compiler/jsdocNestedPropertyTagInvalidType.errors.txt |
Records expected syntax errors and no consumer-file errors. |
tsc/internal/parser/jsdoc.go |
Prevents missing property names from ending nested property parsing. |
Review effort: Balanced
This was referenced Oct 29, 2026
This branch has not been deployed
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.
Fixes #65020
When a nested
@propertytype does not parse, every nested property after it is lost. With this change they are kept, as they are in flat typedefs and in TS 6.keyof Sig['Args']is"name".keyof Sig['Args']is"" | "name" | "onCancel". TheTS1005onfunction(stays.Cause
The type parse stops at
(, so the name of theArgs.onSavetag is a missing identifier.parseChildParameterOrPropertyTagreads a plain identifier name as the start of a new top-level property, so it ended theArgstype literal there.Args.onSaveandArgs.onCancelwere then parsed at the typedef level.The fix skips that check when the name is missing, so the tag stays in the nested literal. That gives the same
""property that a flat typedef gets for the same tag.Test
jsdocNestedPropertyTagInvalidType.tshas a nested and a flat typedef with the same broken property, andkeyofchecks in a.tsfile. Without the fix it reportsTS2322andTS2339foronCancel.npx hereby testpasses with no other baseline changes.hereby lintandhereby check:formatpass.🤖 Generated with Claude Code