我正在尝试找到一种键入导入成员的方法:
<Custom Action="CloseApplication" Before="InstallInitialize"> <![CDATA[ NOT UPGRADINGPRODUCTCODE AND REMOVE="ALL" ]]> </Custom>
我尝试在index.d.ts中添加一个全局类型:
//a.ts (will come from an outside service, I cannot add a type here)
export const configs = {
a: 123,
b: 456
};
//a.d.ts
interface MyInterface {
a: number;
b: number;
c: string;
}
//c.ts
import { configs } from './a';
//this line will cause an error since the type of configs is inferred from the imported object
if (configs.c) {
return;
}
这也可以用于内联强制转换,但我真的不想这样:
declare global {
const configs: MyInterface;
}
export {};