Skip to content

When can body be undefined or null in vanilla espree? #734

Closed
@G-Rath

Description

@G-Rath

I'm working on converting eslint-plugin-jest to typescript, and have come across a type definition that I can't reproduce at runtime.

While converting no-test-callbacks, I found out that it's apparently possible for the body of a FunctionDeclaration to be null.

This has required me to add a null check in order to please typescript.

This in turn upsets our coverage b/c that branch is never tested, leading me here as I've not been able to write any code that reproduces the defined type.

Hence: how can I have a FunctionDeclaration w/ a body of null at runtime?

I suspect this heavily relates to #420, but theres too many moving parts for me to properly track :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpackage: parserIssues related to @typescript-eslint/parserpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions