Skip to content

Return value of String.match has an index property #184

@binil

Description

@binil
"x".match(/.*/).index

fails to compile. The String.match function is declared as:

interface String {
    match(regexp: RegExp): string[];
}

Instead, String.match(_: RegExp) should probably return an interface which is a string[] but has an extra index property.

There's also an extra input property on the array with the value of the this string.

"abcabc".match(/b/).input === "abcabc"

Originally filed at: http://typescript.codeplex.com/workitem/2175

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions