Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion on modules section #603

Open
devserkan opened this issue Sep 2, 2020 · 0 comments
Open

Confusion on modules section #603

devserkan opened this issue Sep 2, 2020 · 0 comments

Comments

@devserkan
Copy link

The section where the global module declaration explained there is an example like that:

// global.d.ts
declare module 'foo' {
  // Some variable declarations
  export var bar: number; /*sample*/
}

and

// anyOtherTsFileInYourProject.ts
import * as foo from 'foo';
// TypeScript assumes (without doing any lookup) that
// foo is {bar:number}

I can't achieve to make this work. I'm not quite sure this is a typo or something else or I don't understand the concept very well as a learner. But if I define the module like that, I can make it work:

declare module "foo" {
  // Some variable declarations
  export type bar = number; /*sample*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant