compiler still thinks Dog | Dachshund, but we know for certain it's a Dachshund at this point
是否有可能让TypeScript编译器推断我们添加了必要的属性来缩小联合类型?是否有不同的方法来构造我的类型来避免这种问题?
我已经创建了一个npm包,在这里我扩展了样式化的组件DefaultTheme。当我传递主题(这是DefaultTheme的类型)时,会出现一些错误,说明Type 'DefaultTheme' is not assignable to type 'DefaultTheme | ((theme: DefaultTheme) => DefaultTheme)'.使用的是^5.2.0 &@types/styled ^5.1.9版本的样式组件。