Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

TypeScript compilerOptions -> "strict" : true #8

Description

@cgers

Hi There

In typescript-express-example/src/index.ts you have some beautifully elegant code:

`
// register all application routes

AppRoutes.forEach(route => {

    app[route.method](route.path, (request: Request, response: Response, next: Function) => {

        route.action(request, response)

            .then(() => next)

            .catch(err => next(err));

    });

});

`

That registers all applications routes.

If you enable

"strict": true

in the tsconfig.json I get the error:

src/index.ts:19:4 - error TS7017: Element implicitly has an 'any' type because type 'Express' has no index signature. 19 app[route.method](route.path, (request: Request, response: Response, next: Function) => { ~~~~~~~~~~~~~~~~~

Is there a way to combine modules in this elegant way and enable strict?

Kind regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions