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

Namespaces and modules #11

Closed
vojtechhabarta opened this issue Oct 19, 2015 · 1 comment
Closed

Namespaces and modules #11

vojtechhabarta opened this issue Oct 19, 2015 · 1 comment
Milestone

Comments

@vojtechhabarta
Copy link
Owner

Reflect changes in TypeScript terminology https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Namespaces%20and%20Modules.md:

  • namespaces (previously called internal modules)
  • modules (previously called external modules)

User should have possibility to configure namespace or module name.

Examples:

// namespace
declare namespace NS1 {
    interface MyObject1 {}
}
// module
declare module 'mod2' {
    interface MyObject2 {}
}
// global
interface MyObject3 {}
vojtechhabarta added a commit that referenced this issue Oct 19, 2015
@vojtechhabarta vojtechhabarta added this to the 1.2 milestone Oct 19, 2015
@vojtechhabarta
Copy link
Owner Author

Summarizing export keyword usage in *.d.ts and also *.ts files for future reference:
example.d.ts file

// namespace
declare namespace NS1 {
    interface MayHaveExportKeyword1a {}
    export interface MayHaveExportKeyword1b {}
}
// global
interface CannotHaveExportKeyword4 {}

// module
declare module 'module2' {
    interface MayHaveExportKeyword2a {}
    export interface MayHaveExportKeyword2b {}
    // namespace inside a module
    namespace MayHaveExportKeywordNS3a {}
    export namespace MayHaveExportKeywordNS3b {}
}

no-module-compiler-flag.ts file

// namespace
namespace NS1 {
    export interface MustHaveExportKeyword1 {}
}
// global
interface CannotHaveExportKeyword4 {}

module2.ts file

// exported from module
export interface MustHaveExportKeyword2 {}
// namespace exported from a module
export namespace MustHaveExportKeywordNS3 {
    export interface MustHaveExportKeyword3 {}
}

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