Skip to content

Reopening external modules broken in TS 1.5-alpha #2784

Closed
@basarat

Description

@basarat

Consider a.d.ts (which compiles fine in isolation) without any error:

declare module "foo" {
    interface Foo {
        a: number;
    }
    var _:Foo;
    export = _;
}

And b.d.ts that plans to add stuff to module foo's Foo interface:

/// <reference path="./a"/>

declare module "foo" {
    interface Foo {
        b: number;
    }
}

With this we have two errors:

  • a.d.ts gets an error on export = "An export assignment cannot be used in a module with other exported elements.
  • b.d.ts doesn't actually manage to add to the interface Foo as demonstrated by a test file test.ts:
/// <reference path="./a"/>
/// <reference path="./b"/>

import foo = require("foo");
foo.b = 123; // ERROR: Property b to not exist on type Foo

Discovered in DefinitelyTyped : DefinitelyTyped/DefinitelyTyped#4101 /cc @vvakame

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions