microsoft / microsoft/TypeScript
Function parameter hover info is inconsistent between contexts
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
“hover”
🕗 Version & Regression Information
- This changed between versions 5.4 and 5.5
⏯ Playground Link
💻 Code
// User defined inside MDX files. We don’t control this.
type Props = {
someProp: string
}
// Internal helper type.
type MDXContentProps = Props & {components?: {}}
function MDXContent(props: {readonly [K in keyof MDXContentProps]: MDXContentProps[K]}) {
// ^?
// The types of props is pretty when hovering over props
}
MDXContent
// ^?
// The type of props is ugly when hovering over MDXContent
// Can we make this pretty as well? Preferably without introducing intermediate helper types.
🙁 Actual behavior
Hovering over MDXContent shows the type of the props as written.
🙂 Expected behavior
Hovering over MDXContent shows a pretty formatted type of the props, just like TypeScript 5.4.
Additional information about the issue
I initially asked for help on Twitter to prettify this, not realizing this was a regression in TypeScript 5.5.
Later in the thread I was asked to report this bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the hover difference using the linked TypeScript Playground and the provided MDXContent example, comparing the function declaration hover with the function reference hover. Trace the hover display path for mapped and readonly types; done when hovering over MDXContent shows the same pretty props type as TypeScript 5.4.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers, developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100