#Choosing left/right in type

1 messages · Page 1 of 1 (latest)

vestal atlas
#

Type '(r: Response) => boolean' is not assignable to type '((x: Response) => boolean) | ((x: Response) => Promise<boolean>)'.

I think this type should unify, how can I tell typescript to choose one or the other?

pulsar trail
#

This error can't appear, it's assignable because it appears exactly in the union

mighty sleetBOT
#
jakoxb#0

Preview:```ts
declare const a: (r: Response) => boolean

const b:
| ((x: Response) => boolean)
| ((x: Response) => Promise<boolean>) = a```

pulsar trail
#

unless you import Response from somewhere in one place and use the global Response in another

vestal atlas
#

hm Iḿ probably doing something wrong somewhere

#

or my lsp is acting up

#

thanks a lot!