我有一些由第三方库生成的TS代码,如下所示:
export namespace com {
namespace rynop {
namespace alaynapage {
interface IPage {
id?: (string|null);
}
}
}
}
我想从一个新文件中重新导出IPage
接口(将其称为page.model.ts
),这样我每次使用此接口时都不必执行以下操作:
import { com } from '../../shared/apiclient';
export class Page implements com.rynop.alaynapage.IPage {
// Or use it as a param type...
factory(data: com.rynop.alaynapage.IPage) {
}
}
我尝试过:
export { com.rynop.alaynapage.IPage as IPage } from '../../shared/apiclient';
// Error: has no exported member alaynapage
import { com } from '../../shared/apiclient';
export const IPage = com.rynop.alaynapage.IPage;
// Error: IPage' does not exist on type 'typeof alaynapage'. Did you mean 'Page`?
// Makes sense cuz interface can't be const
我该怎么做?我可能可以选择更改生成的代码,但不希望更改。