Search code examples
javascripttypescriptdefinitelytyped

DefinitelyTyped ( import * as alias syntax doesn't work with export = class)


I m trying to create a DefinitelyTyped for a library, but when I import as alias import * as f from "foo"; I'm having this message

This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

File index.d.ts

declare module "foo" {
  function test(): void;
  export = test;
}

Solution

  • After adding namespace it's work

    declare module "foo" {
      function test(): void;
      namespace test{}
      export = test;
    }