Skip to content

String.split in lib.d.ts should use a union, not overloads #12922

Description

TypeScript Version: master

Code

function split(notSure: string | RegExp) {
  return foo.split(notSure);
}

Expected behavior:

No error

Actual behavior:

Error: "Argument of type 'string | RegExp' is not assignable to parameter of type 'RegExp'."

Metadata

Metadata

Labels

DuplicateAn existing issue was already created

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions