Skip to content

Cannot use typeof on an empty module #3053

Closed
@NoelAbrahams

Description

@NoelAbrahams

Hi,

TS: 1.4/1.5

In the following, the compiler issues an error on the last line:

module foo {

    export module bar {
        export class F { }
    }

    export module empty {
    }
}

var x: typeof foo.bar; // okay
var y: typeof foo.empty; // Property empty does not exist on type 'typeof foo'

This has turned out to be a problem for the case when a module is defined across multiple files. For certain references the module will be empty, as it is initialised in a different context.

Why do we have no error for bar but an error for empty?

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions