Skip to content

Shorten error spans for missing key errors reported on object literalsΒ #58062

Open
@ssalbdivad

Description

@ssalbdivad

πŸ” Search Terms

object literal, error span, squigglies, highlight, decoration, editor, range

βœ… Viability Checklist

⭐ Suggestion

When defining an object literal with a missing key, e.g. as a function input, highlight only the first line of the object literal as opposed to the entire node.

πŸ“ƒ Motivating Example

Current behavior (one parameter with missing key):

image

Suggested behavior (one parameter with missing key):
image

Current behavior (two parameters with missing keys):
image

Suggested behavior(two parameters with missing keys):
image

Here's a TS playground link with the original source:

https://tsplay.dev/N9a3qN

πŸ’» Use Cases

This would make errors clearer and less jarring when defining large objects as function inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions