Reputation: 516
I have an ambient .d.ts
module which directly depends on Immutable:
/// <reference path="../node_modules/immutable/dist/immutable.d.ts" />
import I = require('immutable');
declare module 'morearty' {
}
But referencing the immutable directly is prohibited by the compiler with this error:
error TS2435: Ambient external modules cannot be nested in other modules.
How could I include the Immutable ambient declarations inside my ambient module? I tried to import immutable from another proxy module but with no luck.
Upvotes: 11
Views: 8700
Reputation: 275857
Ambient external modules cannot be nested in other modules.
Using an import
or export
at the root of a file creates a file module. That explains the error nested module.
Fix: Import inside and not at the root of the file:
/// <reference path="../node_modules/immutable/dist/immutable.d.ts" />
declare module 'morearty' {
import I = require('immutable');
}
Upvotes: 21