Skip to content

Disambiguating between module and variable when using let #3168

@NoelAbrahams

Description

@NoelAbrahams

Hi,

In the code below, I'm attempting to refer to the foo module, but the compiler issues an error:

declare module foo {

    interface Bar {

    }
}

// Error: Block-scoped variable 'foo' used before its declaration.
let foo: foo.Bar; 

Is this expected? And how do I make this work without using `var'? I would like to use the same name for the module and the variable in order to avoid introducing unnecessary globals..

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