Skip to content

TypeError: Cannot read property 'type' of undefined #1000

Open
@Novynn

Description

@Novynn

Came across this problem while trying to optimize a script that requires [email protected]. It looks like this line is the culprit:

if (bodyNode.consequent && bodyNode.consequent.body) {

I've fixed it locally by adding && bodyNode.consequent.body.length to the end of the if statement linked because consequent.body is an object not an array in this case ({type: 'BlockStatement', body: {...}}).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions