Definitelytyped: @types/globalize: globalize/index.d.ts is not a module

Created on 27 Feb 2017  路  4Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [X] I tried using the @types/globalize package and had problems.
  • [X] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

In the Globalize documentation, there is

var Globalize = require( "globalize" );

but when I try to do

import * as Globalize from "globalize";
// OR
import Globalize = require("globalize");

I have the error : @types/globalize/index.d.ts is not a module.

But if I ignore the error, it works in runtime.

Most helpful comment

Here's what to do:

  • Delete declare var Globalize: GlobalizeStatic;.
  • Move all the interfaces into:
declare namespace globalize {
    interface DateFormatterOptions { ... }
    ...other interfaces...
}
  • Delete /// <reference types="cldrjs" /> and use:
declare var globalize: globalize.Static;
export as namespace Globalize;
export = globalize;

You should now be able to import Globalize = require("globalize");.
Also, could you fix the tests? Apparently they were commented out in #4872. No idea what they should be like now since they don't work any more.

All 4 comments

Here's what to do:

  • Delete declare var Globalize: GlobalizeStatic;.
  • Move all the interfaces into:
declare namespace globalize {
    interface DateFormatterOptions { ... }
    ...other interfaces...
}
  • Delete /// <reference types="cldrjs" /> and use:
declare var globalize: globalize.Static;
export as namespace Globalize;
export = globalize;

You should now be able to import Globalize = require("globalize");.
Also, could you fix the tests? Apparently they were commented out in #4872. No idea what they should be like now since they don't work any more.

Just ran into this

me too, can someone fix this in the npm package?

+1

Was this page helpful?
0 / 5 - 0 ratings