Cesar Jr Rodriguez
Cesar Jr Rodriguez

Reputation: 1821

What it does 'declare' in Javascript?

Taking a brief look of electron-react-boilerplate repository in github I realized a code in javascript that couldn't understand.

declare module "flow-bin" {
  declare module.exports: string;
}

What it does declare?, it's part of ES6, ES7? I've searching in the way though can't find something about it. Anyone can give me some information about what it mean?

Upvotes: 0

Views: 449

Answers (1)

sinbar
sinbar

Reputation: 1063

That is typescript's grammar. Use to

ambient module declaration

Typescript use declare to do a strict type checking.Then make a grammar check before compile.For eg.

declare var jQuery: (string) => any;

jQuery('#foo');

The above code declare that the jQuery accept a string parameter.

Upvotes: 3

Related Questions