Extending Array in @typedef don't work as expected #42705
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Working as Intended
The behavior described is the intended behavior; this is not a bug
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
In a js file (
checkJs: true
) with JSDoc, extending theArray<T>
type doesn't allow to add properties to the extended type.Considering this:
Typescript understood that
ArrayExtA<string>
is an extension ofArray<string>
, allowing['']
to be assigned to the typedconst extA
, but failed to add theprop
property.Using a Intersection Type works, though
Failing to assign
['']
to the typedconst extB
is expected, sincestring[]
lacks theprop
property ofArrayExtB
🔎 Search Terms
jsdoc, typedef, extend, array
🕗 Version & Regression Information
4.2.0-dev.20210207
🙁 Actual behavior
@typedef {A} B
fails to add properties to typeB
if typeA
isArray
🙂 Expected behavior
Expected type
B
to be a typeA
with additional propertiesThe text was updated successfully, but these errors were encountered: