Skip to content

Use before declaration false positive when combined with binding exports #14679

@Jessidhia

Description

@Jessidhia

TypeScript Version: 2.2.1

Code

import methodFactory from './http-client'

export { httpDelete as delete } // block scoped httpDelete used before declaration
const httpDelete = methodFactory('DELETE')

Expected behavior:

No error. The export declaration makes no use of the variable; what should happen is that httpDelete's TDZ should extend to the delete export, but that happens regardless of the relative position of the export declaration.

Actual behavior:

Two errors in the same line about the variable being used before assignment.

This error is correct in the case of export default and the typescript-specific export =, but not in any other use of export.

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