export const Component: React.FC<SpaProps> = function({
a,
b,
c,
d
})
a, b, c属于spprops。然而,d没有。如何添加一个同时支持a,b,c,d的道具类型?顺便说一句,我知道d
的类型export interface IT {
d: AxiosInstance;
}
你可以用Typescript扩展这个类型,像这样:
export const Component: React.FC<SpaProps & IT> = function({
a,
b,
c,
d
})
即使你不知道它的类型,你也可以这样写:
export const Component: React.FC<SpaProps & {d: AxiosInterface}> = function({
a,
b,
c,
d
})