-
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
I want to define following object.
import { is } from "https://deno.land/x/unknownutil@v3.17.0/mod.ts";
export const isResponse = is.IntersectionOf([
is.ObjectOf({
id: is.String,
}),
is.UnionOf([
is.ObjectOf({
result: is.String,
}),
is.ObjectOf({
error: is.String,
}),
]),
]); but occurs this error.
error: TS2345 [ERROR]: Argument of type '[Predicate<{ id: string; }> & WithMetadata<IsObjectOfMetadata>, Predicate<{ result: string; } | { error: string; }> & WithMetadata<...>]' is not assignable to parameter of type 'readonly [Predicate<unknown> & WithMetadata<IsObjectOfMetadata>, ...(Predicate<unknown> & WithMetadata<IsObjectOfMetadata>)[]]'.
Type at position 1 in source is not compatible with type at position 1 in target.
Type 'Predicate<{ result: string; } | { error: string; }> & WithMetadata<IsUnionOfMetadata>' is not assignable to type 'Predicate<unknown> & WithMetadata<IsObjectOfMetadata>'.
Type 'Predicate<{ result: string; } | { error: string; }> & WithMetadata<IsUnionOfMetadata>' is not assignable to type 'WithMetadata<IsObjectOfMetadata>'.
The types of '[metadataKey].name' are incompatible between these types.
Type '"isUnionOf"' is not assignable to type '"isObjectOf"'.
export const isResponse = is.IntersectionOf([
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed