If I declare the namespace globally for an application, I can use it (it works without compilation errors), but I won t have suggestion/autocompletion for the namespace specifically. However types from this namespace do appear in the intellisense suggestions.
换言之,我对名称空间进行分类(例如<条码>libTypes)。 没有人对此提出建议,但在我完成名称空间的打字和在名称之后添加一个标识(libTypes.
)之后,开始在座标语中向我建议这一名称空间中的所有可用类型。
Example of global.d.ts
import * as _libTypes from library/types ;
declare global {
const libTypes: typeof _libTypes;
}
export as namespace libTypes;
export = _libTypes;
tsconfig.json
{
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}