callumacrae
callumacrae

Reputation: 8433

Typescript ambient declaration with function as default export

I'm trying to shim the types for the express syntax for locale in my project, but am unsure how to do it as it is a function as a default export, not an object.

Currently I have this which stops typescript from erroring but doesn't give me types:

declare module 'locale';

I tried this, but it didn't work:

declare function locale(supported: string[], def: string): void;

What do I need to do? I can't find any useful documentation here.

Upvotes: 0

Views: 394

Answers (1)

lukasgeiter
lukasgeiter

Reputation: 152860

Try this:

declare module 'locale' {
  export default function locale(supported: string[], def: string): void;
}

Also: official documentation on the topic

Upvotes: 2

Related Questions