Skip to content

Extending a short hand ambient module import #12971

Closed
@eggers

Description

@eggers

TypeScript Version: 2.1.1

Code

declare module 'base';
import * as Base from 'base';

class Derived extends Base { // error TS2507: Type 'any' is not a constructor function type.
}

Expected behavior:

An easy concise way of declaring a module so that the base import can be extended

Actual behavior:

error TS2507: Type 'any' is not a constructor function type.

In order to get around the error, I have to do something like this:

declare module 'base' {
  interface Constructor {
      new (...args: any[]): this;
  }

  const _: Constructor;
  export = _;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions