TypeScript Version: Version 2.1.4
code
Animates.Dogs.ts
export namespace Animates {
export namespace Dogs {
export class SmallDog {
}
}
}
Animates.Dogs.SmallBreeds.ts
/// <reference path="./Animates.Dogs.ts" />
export namespace Animates {
export namespace Dogs {
export class Chihuahua extends Animates.Dogs.SmallDog {}
}
}
Expected behavior:
Chihuahua is kind of SmallDog
Actual behavior:
Animates.Dogs.SmallBreeds.ts(5,53): error TS2694: Namespace '"Animates.Dogs.SmallBreeds".Animates.Dogs' has no exported member 'SmallDog'.
A top level import or export declaration makes the file a module. This is a duplicate of #11879
The following is what you are after (this creates a global spread across multiple files)
Animates.Dogs.ts
namespace Animates {
export namespace Dogs {
export class SmallDog {
}
}
}
Animates.Dogs.SmallBreeds.ts
/// <reference path="./Animates.Dogs.ts" />
namespace Animates {
export namespace Dogs {
export class Chihuahua extends Animates.Dogs.SmallDog {}
}
}
@aluanhaddad Is there a way to use that in an npm package?
Most helpful comment
A top level
importorexportdeclaration makes the file a module. This is a duplicate of #11879The following is what you are after (this creates a global spread across multiple files)
Animates.Dogs.ts
Animates.Dogs.SmallBreeds.ts