根据handbook(在“速记环境模块”下):
所有从速记模块导入的内容将具有任意类型。
但是,如果我尝试使用声明文件其余部分中模块中的任何内容,则会出现错误。
declare module "module1";
declare module "module2" {
import * as deps from "module1"
import { ValueType } from "module1"
export type ComplexType = {
value1: deps.ValueType, // ERROR: Namespace '"internal"' has no exported member 'ValueType'.
value2: ValueType // ERROR: Cannot use namespace 'ValueType' as a type.
}
}
这是预期的行为吗?这似乎与文档相反。