|
1 | | -import { SimpleTypeNegation, SimpleTypeTag } from './internal/UtilTypes.ts'; |
2 | | -import { TagsMarker } from './internal/TagsMarker.ts'; |
| 1 | +import { NegatedTagWrapper, TagWrapper } from './internal/TagUtils.ts'; |
| 2 | +import { OptionalTagsMarker, TagsMarker } from './internal/Markers.ts'; |
3 | 3 |
|
4 | 4 | export type NegateTag< |
5 | 5 | BaseType, |
6 | 6 | TypeTag extends string | symbol |
7 | 7 | > = BaseType extends TagsMarker<infer BaseType0, infer TypeTags0> |
8 | 8 | ? BaseType0 & |
9 | | - (TagsMarker<BaseType0, SimpleTypeTag<TypeTag>> extends TagsMarker< |
| 9 | + (TagsMarker<BaseType0, TagWrapper<TypeTag>> extends TagsMarker< |
10 | 10 | BaseType0, |
11 | 11 | TypeTags0 |
12 | 12 | > |
13 | 13 | ? Partial< |
14 | 14 | TagsMarker< |
15 | 15 | BaseType0, |
16 | | - TypeTags0 extends SimpleTypeTag<TypeTag> & infer RestTypeTags |
17 | | - ? RestTypeTags & SimpleTypeNegation<TypeTag> |
18 | | - : Omit<TypeTags0, TypeTag> & SimpleTypeNegation<TypeTag> |
| 16 | + TypeTags0 extends TagWrapper<TypeTag> & infer RestTypeTags |
| 17 | + ? RestTypeTags & NegatedTagWrapper<TypeTag> |
| 18 | + : Omit<TypeTags0, TypeTag> & NegatedTagWrapper<TypeTag> |
19 | 19 | > |
20 | 20 | > |
21 | 21 | : TagsMarker< |
22 | 22 | BaseType0, |
23 | | - TypeTags0 extends SimpleTypeTag<TypeTag> & infer RestTypeTags |
24 | | - ? RestTypeTags & SimpleTypeNegation<TypeTag> |
25 | | - : Omit<TypeTags0, TypeTag> & SimpleTypeNegation<TypeTag> |
| 23 | + TypeTags0 extends TagWrapper<TypeTag> & infer RestTypeTags |
| 24 | + ? RestTypeTags & NegatedTagWrapper<TypeTag> |
| 25 | + : Omit<TypeTags0, TypeTag> & NegatedTagWrapper<TypeTag> |
26 | 26 | >) |
27 | | - : BaseType & Partial<TagsMarker<BaseType, SimpleTypeNegation<TypeTag>>> |
| 27 | + : BaseType extends OptionalTagsMarker<infer BaseType0, infer TypeTags0> |
| 28 | + ? BaseType0 & |
| 29 | + Partial< |
| 30 | + TagsMarker< |
| 31 | + BaseType0, |
| 32 | + TypeTags0 extends TagWrapper<TypeTag> & infer RestTypeTags |
| 33 | + ? RestTypeTags & NegatedTagWrapper<TypeTag> |
| 34 | + : Omit<TypeTags0, TypeTag> & NegatedTagWrapper<TypeTag> |
| 35 | + > |
| 36 | + > |
| 37 | + : BaseType & Partial<TagsMarker<BaseType, NegatedTagWrapper<TypeTag>>> |
0 commit comments