Skip to content

Auto-fix array of union type from Array<> to [] yields incorrect type #565

@bytroli

Description

@bytroli

When settings.jsdoc.preferredTypes is configured in a way that [] array notation is preferred over the Array<> notation and the array contains a union type the auto-fix result type is incorrect.

given: Array<number|undefined> (array of "number or undefined")
yields: number|undefined[] ("number" or "array of undefined")
expected: (number|undefined)[]

Settings:

settings: {
    jsdoc: {
        preferredTypes: {
            'Array<>': '[]',
            'Array.<>': '[]',
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions