stories.controller.ts:47:5 - error TS2322: Type '{ [key: string]: any; } | null' is not assignable to type 'User'.
Type 'null' is not assignable to type 'User'.
47 story.author = ctx.user;
Maybe there is a better way to fix this?
Issue
$ npm run build
src/app/controllers/api/stories.controller.ts:47:5 - error TS2322: Type '{ [key: string]: any; } | null' is not assignable to type 'User'.
Type 'null' is not assignable to type 'User'.
47 story.author = ctx.user;
~~~~~~~~~~~~
47 story.author = ctx.user;
Solution and steps
Add casting
Checklist
[x] Add/update/check docs (code comments and docs/ folder).
Add casting to prevent build error:
Maybe there is a better way to fix this?
Issue
Solution and steps
Add casting
Checklist