-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Description
🔎 Search Terms
“unresolved any”
🕗 Version & Regression Information
- This changed between versions 5.4.5 and 5.5.2
⏯ Playground Link
💻 Code
// type Props = any
type MDXContentProps = (0 extends 1 & Props ? {} : Props)
🙁 Actual behavior
The type of MDXContentProps
is any
🙂 Expected behavior
The type of MDXContentProps
is {}
Additional information about the issue
When you hover over a type that doesn’t exist, the editor shows /*unresolved*/ any
. In TypeScript 5.4, this type was equivalent to any
. In TypeScript 5.5, it behaves slightly different. This can be seen in the playground by toggling the line type Props = any
and hovering the MDXContentProps
type.
If an unresolved any
is assigned to another type, that type becomes equivalent to an unresolved any
, except the /*unresolved*/
label is gone when hovering over it.
I use this pattern in MDX analyzer (https://github.com/mdx-js/mdx-analyzer/blob/[email protected]/packages/language-service/lib/virtual-code.js#L96). This allows users to optionally define props for their MDX file. This used to work great, but now everything is just inferred to any
.
If there’s a better way to detect whether a type is defined, I would love to hear about it.