Skip to content

arguments detection for jsdoc / javascript has a false positive #47004

Closed
@Raynos

Description

@Raynos

Typescript infers that if you touch the arguments value inside a function that it has extra arguments as ...args: any[]

However if you call a method with an object and one of the fields is called arguments: [] then it thinks you are using the arguments variable inside of the function, then it adds ...args: any[]

image

https://www.typescriptlang.org/play?filetype=js#code/LAKAxg9gdgzgLgAhgT3gUwLYILwIN5JpQAmAFBAJT4C+C1ooAZhBAEYCGATqQOTRo8KAbgYgA9ACoJoBBIQABAA5d2WPPE4BLKAHNa-GRLFMArlDBxN0BMzZcE5KGip4ZSVHEwA6GETKuQBCCEdkVNAC4EHlsOTh4AGjcgrh0TDCI4GEiAbR4ACzQAG0KIHgBdN2oKUGogA

const system = { send(o) {} }

foobar('one');

/**
 * @param {string} one
 */
function foobar (one) {
  system.send({
    api: 'foobar',
    arguments: ['hello']
  })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions