I am a bit stuck here and I’m not sure if anyone will be able to help with how deep I am currently. I am 5hr, 43min. into this video by Ben Awad, where we are switching from MikroORM to TypeORM with a postgres DB.
The errors I am getting trying to run yarn watch is:
Apparently there have been changes in types definition for express-session (SO link).
You should remove caret (^) from @types/express-session in server/package.json to have exact version installed:
Hey, @vivikyd, I’m still trying to barge through this solution funny enough. I’m unable to start my server from yarn dev after yarn watch. He has it set to read the index.js file directly inside the /dist directory, and I’m not sure how it is working for him.
Type 'Request<ParamsDictionary, any, any, ParsedQs>' is not assignable to type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>> & { session: Session & Partial<SessionData> & { ...; }; }'.
Type 'Request<ParamsDictionary, any, any, ParsedQs>' is not assignable to type '{ session: Session & Partial<SessionData> & { userId: number; }; }'.
Types of property 'session' are incompatible.
Type 'Session & Partial<SessionData>' is not assignable to type 'Session & Partial<SessionData> & { userId: number; }'.
Property 'userId' is missing in type 'Session & Partial<SessionData>' but required in type '{ userId: number; }'.ts(2322)
types.ts(8, 49): 'userId' is declared here.
types.ts(7, 3): The expected type comes from property 'req' which is declared here on type 'RedditDbContext'
If there any guidance to resolve this, will highly appreciate. Thank you very much.
Wow, man. It works. Thank you very much.
If you don’t mind, can you please give me a little explanation here. Then next time I will able to prevent this kind of errors by understanding it.
Thank you very much for your time and consideration.