Repository navigation
Error spans are not close enough to missing properties on deeply nested object literals #22170
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScript
on Feb 26, 2018 - addedHelp WantedYou can do thisYou can do thisEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".
on Feb 26, 2018 is this issue in community milestone?
DanielRosenwasser commented
on Feb 28, 2018 MemberMore actionsIt's not clear if we can even fix this without a decent amount of code complexity, since the error can be very non-local, but it's worth a shot. If you'd like to send a PR, we'd appreciate it!
Reacted by Wenlu Wang- changed the title
[-]Error markers are not localized properly for missing properties on deeply nested object literals[/-][+]Error spans are not close enough to missing properties on deeply nested object literals[/+]on Feb 28, 2018 - addedDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messaging
on Apr 26, 2018 DanielRosenwasser commented
on Jul 28, 2018 MemberMore actionsI think that Wesley Wigham (@weswigham) fixed this in TypeScript 3.0 (#25030 bug and #25140 for fix).
Reacted by Wesley Wigham and Tom CrockettDanielRosenwasser commented
on Jul 28, 2018 MemberMore actions- addedFixedA PR has been merged for this issueA PR has been merged for this issue
on Jul 28, 2018 Thanks, this is great to hear!
- locked as resolved and limited conversation to collaborators
on Oct 21, 2025
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".FixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this

TypeScript Version: all recent versions, including
@nextSearch Terms:
missing property literal error
Code
Consider this simplified example:
Expected behavior:
The error location should be that of the innermost part of the object literal where the property is missing.
Actual behavior:
The location is reported on the variable being assigned to. The pain of this is exacerbated dramatically if each of the intervening levels of nesting has lots of other properties too. It becomes incredibly laborious to find the real source of the problem.
Playground Link
Context
For context, my real-world use case is typing of Vega JSON specs, which are realized programmatically as large object literals, e.g.
(This is a relatively small example as Vega specs go.) If any of the required properties at a deeply nested level is missing, the
specvariable is annotated with the error, and one has to hunt through the long error message to discover where the actual problem lies.