[英]Extend interface from another - MUI
我有一個界面
interface ThemeBase {
colors: {
[key: string]: Color;
};
borderRadius: {
base: string;
mobile: string;
};
navbar: {
'z-index': number;
};
typography: {
rootBase: string;
fontBase: string;
};
}
我想用這個界面擴展 MUI 主題。 這個解決方案對我有用:
declare module '@material-ui/core/styles/createMuiTheme' {
interface Theme extends ThemeBase {}
// allow configuration using `createMuiTheme`
interface ThemeOptions extends ThemeBase {}
}
但是我有一個來自 eslint 的錯誤
錯誤聲明沒有成員的接口等效於其超類型@typescript-eslint/no-empty-interface
如何在沒有主題和主題選項的代碼重復的情況下解決此問題
這是 IMO 完全可以將/* eslint-ignore @typescript-eslint/no-empty-interface */
放在第一行的少數幾個例子之一。 雖然我不會在常規代碼中這樣做,但模塊擴充有點不同,在這里嘗試找到解決方法是沒有意義的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.