Description
Current description of export assignments in the spec states:
Export assignments exist for backward compatibility with earlier versions of TypeScript. An export assignment designates a module member as the entity to be exported in place of the module itself.
ExportAssignment: export = IdentifierReference ;A module containing an export assignment can be imported using an import require declaration (11.3.3), and the local alias introduced by the import require declaration then takes on all meanings of the identifier named in the export assignment.
However current implementation also permits dotted names - in this case only value meaning is exported. This change seems to be quite recent, example below compiles with no errors in current master and issues a syntax error ';' expected."
in v1.4.
declare module foo.bar {
export type X = number;
export var X: { A: number };
}
declare module "test" {
export = foo.bar;
}
This issue can have several interpretations:
- this is only spec bug - current behavior for dotted names should be documented
- this is both spec and implementation issue - we export all meanings also for dotted names and spec should be adjusted to reflect this
- this is implementation bug - we should prohibit usage of dotted names in export assignments.