Closed maraisr closed 3 years ago
This errors on the passport.use
call now 😢 Any ideas how to fix this?
error TS2345: Argument of type 'MagicLoginStrategy' is not assignable to parameter of type 'Strategy'.
Types of property 'authenticate' are incompatible.
Type '(req: Request) => void' is not assignable to type '(this: StrategyCreated<Strategy, Strategy & StrategyCreatedStatic>, req: Request<ParamsDictionary, any, any, ParsedQs>, options?: any) => any'.
Types of parameters 'req' and 'req' are incompatible.
Type 'Request<ParamsDictionary, any, any, ParsedQs>' is not assignable to type 'Request'.
Types of property 'query' are incompatible.
Type 'ParsedQs' is not assignable to type 'Record<string, string | string[]>'.
Index signatures are incompatible.
Type 'string | string[] | ParsedQs | ParsedQs[] | undefined' is not assignable to type 'string | string[]'.
Type 'undefined' is not assignable to type 'string | string[]'.
13 passport.use(magicLink);
~~~~~~~~~
I can take a look at this. I think its the Record, which isnt quite compat with an object. I think i may need to make query
be any, and not type it as strongly. Ill send up another PR shortly.
Further that, can you tell me why you're using util's inherit method, and not just a class extend?
This removes the next "dev dep", that would caused non next users typing to fail, or for those not using express having potentially incompatible typing.
This I believe is a phase 1 of 2, seeing as both Express and Next extend the native http interface we could simply just do away with their magic wrapper methods, like
json
andredirect
and implement those ourselves, meaning server's like Polka could also make use of this, and not have to expose those methods.Here is an image proving typings still work:![image](https://user-images.githubusercontent.com/599459/104247326-4fd26600-54b3-11eb-8894-296b5be6bbc4.png)