How to include ambient module declarations inside another ambient module?

后端 未结 1 1469
孤街浪徒
孤街浪徒 2021-01-11 20:19

I have an ambient .d.ts module which directly depends on Immutable:

/// 

        
相关标签:
1条回答
  • 2021-01-11 20:53

    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');
    }
    
    0 讨论(0)
提交回复
热议问题