Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Namespace exported function return causing later code to be marked unreachable #127

Closed
@blemoine

Description

@blemoine

What version of TypeScript are you using?
TypeScript 2.1.4

What version of typescript-eslint-parser are you using?
typescript-eslint-parser@1.0.0
eslint@3.12.1

What code were you trying to parse?

export namespace query {
    export interface Query {
        from: string;
    }

    export function isQuery(query: any): query is Query {
        return (query as Query).from !== undefined;
    }
}

export type SearchQuery = query.Query;

What did you expect to happen?

With

"rules": {
      'no-unreachable': 2
    }

in my config, I would expect no error (the last line is reachable, because it's exported)

What happened?

I get "Unreachable code no-unreachable" error.
When I remove the type guard function, the problem disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions