Skip to content

Show code comments in union typesΒ #44959

@AlexStacker

Description

@AlexStacker

Suggestion

When I use union types in Typescript, the annotations of the types are missing and cannot be given. I would like to be able to show some code its meaning with the help of annotation hints.

πŸ” Search Terms

union types comments

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

image

playground

πŸ“ƒ Motivating Example

πŸ’» Use Cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions