【发布时间】:2022-12-02 19:07:32
【问题描述】:
How do I create a discriminated union where I can check either for a statusCode of \'0000\' or not \'0000\', so that the correct object type is used?
type Foo = {
statusCode: \'0000\',
something: string
} | {
statusCode: // any string that is not \'0000\'
somethingElse: string
}
标签: typescript