Typescript issue with app.get

I implementing POC that has a nextJs API that needs some of the routes secured, but not all.
I am following the blog Developing a Secure API with NestJS: Managing Identity

This suggests an update to main.ts

  app.get('/authorized', function (req, res) {
      res.send('Secured Resource');

This generates the typescript error

Argument of type '(req: any, res: any) => void' is not assignable to parameter of type '{ strict: boolean; }'

Could you confirm that this command is required?
Does this secure the whole API? Is there a way to apply security to specific modules/routes only?

Many thanks