【发布时间】:2022-06-16 17:24:34
【问题描述】:
我有以下接口,它们非常相似,但属性类型不同:
export interface ChannelOverlayStyles {
bigChannelLogoWrapper: ViewStyle;
bigPackshotChannelLogo: ViewStyle;
channelLogo: ViewStyle;
channelPackshotGradient: ViewStyle;
smallChannelLogoWrapper: ViewStyle;
portraitLogo: ViewStyle;
landscapeLogo: ViewStyle;
}
export interface ChannelOverlayStylesWeb {
bigChannelLogoWrapper: ViewStyleWeb;
bigPackshotChannelLogo: ViewStyleWeb;
channelLogo: ViewStyleWeb;
smallChannelLogoWrapper: ViewStyleWeb;
portraitLogo: ViewStyleWeb;
landscapeLogo: ViewStyleWeb;
}
我可以通过创建一个复制第一个接口但自动替换属性类型的类型来避免重复这些吗?
【问题讨论】:
-
您尝试了什么,为什么没有成功?
标签: typescript