#req.session.redirectTo = req.query.redirecTo; //typescript error
1 messages · Page 1 of 1 (latest)
the error message is pretty explicit
in your code, you are doing req.session.redirectTo = req.query.redirecTo
except the first part is of type string (probably defined by your typings), and the other half is of type string | string[] | ParsedQs | ParsedQs[] (most likely coming from the library)
and you can't assign string | string[] | ParsedQs | ParsedQs[] to string
since you can't assign string[] to string, or ParsedQs to string, or ParsedQs[] to string
yea thanks i saw that.... can you please explain with code solution and further readings Thanks7
well, first
why did you write your own typing file?
express-session has some, just use them npm i -D @types/express-session
hum, ok
"@types/express-session": "^1.17.5",
but you should use the same types as req.query.redirecTo
since you are assigning one to the other
or else make sure req.query.redirecTo is a string and nothing else before assigning it to req.session.redirectTo
ok
!resolved