Skip to content

Fix mapped type hover nil dereference - #64112

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/fix-nil-dereference-error
Sep 1, 2026
Merged

Fix mapped type hover nil dereference#64112
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
mainfrom
copilot/fix-nil-dereference-error

Conversation

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Hovering a function whose parameter contains { [K in keyof T] } panics while printing the signature because the mapped property type is absent.

  • Printer: Emit : Type only when the mapped-type property type exists.
  • Regression coverage: Add a fourslash hover baseline for the failing declaration.
declare function uhoh<T>(x: { [K in keyof T] }): void;

Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix nil dereference when printing back mapped type Fix mapped type hover nil dereference Aug 31, 2026
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) marked this pull request as ready for review August 31, 2026 22:40
Copilot AI balanced review requested due to automatic review settings August 31, 2026 22:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents mapped-type hover crashes when the property type is absent.

Changes:

  • Guard mapped-type property type printing against nil.
  • Add fourslash hover regression coverage and baseline.
Show a summary per file
File Description
tsc/internal/printer/printer.go Conditionally emits mapped property types.
tsc/internal/fourslash/tests/hoverMappedTypePropertyJSDoc_test.go Adds hover regression test.
tsc/testdata/baselines/reference/fourslash/quickInfo/hoverMappedTypeWithoutPropertyType.baseline Records expected hover output.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Merged via the queue into main with commit 2708b6f Sep 1, 2026
27 checks passed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the copilot/fix-nil-dereference-error branch September 1, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nil dereference when printing back function that has mapped type with no mapped property type

4 participants