What's the recommended way to make the `NextApiReq...
# general
p
What's the recommended way to make the
NextApiRequest
and express'
Request
types match? I see that in the nextjs example basically works with supertoken's express adapter and imports the
import { middleware } from 'supertokens-node/framework/express';
which TypeScript doesn't like. https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/pages/api/auth/%5B%5B...path%5D%5D.js
r
hey!
can you open an issue about this on our github please? I don't think it's possible right now (other than doing what you said or using
any
)
p
sure! I prefer type casting it as of now
I'm encountering more type issues though, so there might be a few issues that come together I believe
r
hmm. that is interesting
p
e.g. your example for
with-localstorage
also has some types off https://github.com/supertokens/supertokens-auth-react/blob/master/examples/with-localstorage/api-server.js @rp should we pass input.res to the updateHeaders rather than
session
?
Or is session supposed to contain the
res
r
yea.. it's input.res. Not session.res
p
Okay, should I submit a PR for this?
r
Yes. Please do. thanks!
Sorry for bothering you about the types, but when can
Session.APIInterface.signOutPOST
be undefined? And morte importantly, how am I supposed to handle it if it is
undefined
? throw an error or return
undefined
?
r
So it will never be undefined, unless you set it to undefined instead of giving a function
So you can handle it by throwing an error in the if block - cause it will never come thrrr
There*
p
There's also a return missing for the signOutPOST method (expects
{status: "OK"}
) If I get the implementation working, I can add it to the above PR by fixing the example. 😅
r
Right! Thank you!
The problem is also that these examples are all in JS. So we will also be converting them to TS sometime soon. Which should point out all these errors
p
Okay, I have to throw in the towel. I was unable to make supertokens work for my use case 😦
r
What is your use case?
p
Making the
with-localstorage
example work on nextjs
r
An right. That is a complex customisation., why do you need to use localstorage?
r
Ahh I see
Well yea. It is difficult to customise it for this use case. We will probably have to have a dedicated way of using it for extensions
2 Views