DefinitelyTyped / definitelytyped.github.io

Website content for definitelytyped.org
http://definitelytyped.org
MIT License
240 stars 95 forks source link

Separate internal/external definitions? #34

Open altano opened 9 years ago

altano commented 9 years ago

Hello,

knockout.d.ts defines both an ambient internal module as well as an ambient external module. This sucks because your entire solution will then assume that "ko" is a global variable, even if you intent to use Knockout as a CommonJS package via NPM rather than inject it as a script tag.

Would you be okay with my splitting knockout.d.ts into two separate files? The proposal is to change:

knockout.d.ts:

// <Common definitions here>
declare module "knockout" {
    export = ko;
}
declare var ko: KnockoutStatic;

to:

knockout.internal-module.d.ts:

// <Common definitions here>
declare var ko: KnockoutStatic;

and knockout.external-module.d.ts:

// <Common definitions here>
declare module "knockout" {
    var ko: KnockoutStatic;
    export = ko;
}

Thoughts?

altano commented 9 years ago

Optionally we can leave knockout.d.ts alone and just create knockout-external.d.ts or something.