Open ivodolenc opened 1 month ago
Please reduce the repro down to something that can at least fit in one screen; the whole setup here doesn't seem necessary to describe the issue
I intentionally left comments and separate interfaces (because they extends the base one), so that one can see which description is displayed and which is not in the quickinfo
after hovering over the property inside object.
The example is actually very simple which can be seen in the playground.
Here are new example:
// code from playground
interface EntryBase {
/**
* base
*/
type: 'default' | 'declaration'
output?: string
format?: string
name?: string
}
interface PluginsDefault {
esbuild?: Record<string, unknown>
}
interface PluginsDeclaration {
dts?: Record<string, unknown>
}
interface EntryDefault extends EntryBase {
/**
* default
*/
input: string
/**
* default
*/
name?: string
/**
* default
*/
plugins?: PluginsDefault
}
interface EntryDeclaration extends EntryBase {
/**
* declaration
*/
input: string
/**
* declaration
*/
plugins?: PluginsDeclaration
}
type EntriesOptions = EntryDefault | EntryDeclaration
const options: EntriesOptions[] = [
{
type: 'default', // =>
input: './src/index.ts', // => no quickinfo when hover
plugins: { dts: {} }, // => should be an error here, also no quickinfo when hover
name: 'default name', // => no quickinfo when hover
},
{
type: 'declaration',
input: './src/types/index.ts', // => no quickinfo when hover
plugins: { esbuild: {} }, // => should be an error here, also no quickinfo when hover
},
]
https://github.com/user-attachments/assets/a9c3458a-4f3c-42c1-954d-ecfe419b3e2b
๐ Search Terms
"array of object unions", "array union narrowing", "union narrowing", "object union operator in"
๐ Version & Regression Information
5.2.2
and the latest5.6.2
โฏ Playground Link
Playground
๐ป Code
๐ Actual behavior
Hi, as discussed in previous issue #56082 and the merged PR, it seems like this area could use some internal improvements.
When we have multiple interfaces that extend the base interface, then the types are not picked up correctly when defining a new array of object unions.
Also, properties from the object do not get description information or offer correct auto-completion which can be confusing.
๐ Expected behavior
I expect it to offer the correct auto-completion for each object and give the right information when I hover over a property to see the type or description of what that option does.
Additional information about the issue
I mentioned some examples and expectations of behavior in the playground.