Skip to content

Property 'groups' does not exist on type 'RegExprMatchArray' for named captured groups #29465

@mateja176

Description

@mateja176

TypeScript Version: 3.3.0-dev.201xxxxx

Search Terms:

Code

// Property 'groups' does not exist on type 'RegExprMatchArray
console.log("john_doe".match(/^(?<first>[a-z]+).+$/).groups.first) // john

console.log((<any>"john_doe".match(/^(?<first>[a-z]+).+$/)).groups.first) // john

Expected behavior:

Not type error

Actual behavior:

Type mismatch: Property 'groups' does not exist on type 'RegExprMatchArray'

Playground Link:

reproduced on stackblitz using the default typescript project

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions