Skip to content

@types/express is needed for @sentry/apm on a TypeScript (and Vue) browser project ? #2749

@mdartic

Description

@mdartic

Package + Version

  • @sentry/browser 5.19.2
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other: @sentry/apm 5.19.2 and @sentry/integrations 5.19.2

Version:

5.19.2

Description

  • after creating a project with vue-cli + TypeScript
  • after adding the three packages as indicated in the doc for vuejs (but I think it's the same for only TS ?)
  • the ts compiler says :
 DONE  Compiled successfully in 4232ms                                                                                                                                    21:25:33

Type checking in progress...

  App running at:
  - Local:   http://localhost:8080/ 
  - Network: http://192.168.1.66:8080/

  Note that the development build is not optimized.
  To create a production build, run yarn build.

ERROR in /home/mdartic/workspace/project-sentry-apm-vue-ts/node_modules/@sentry/apm/dist/integrations/express.d.ts(2,29):
2:29 Could not find a declaration file for module 'express'. '/home/mdartic/workspace/project-sentry-apm-vue-ts/node_modules/express/index.js' implicitly has an 'any' type.
  Try `npm install @types/express` if it exists or add a new declaration (.d.ts) file containing `declare module 'express';`
    1 | import { Integration } from '@sentry/types';
  > 2 | import { Application } from 'express';
      |                             ^
    3 | /**
    4 |  * Express integration
    5 |  *
Version: typescript 3.9.6
Time: 4696ms

The server is up, and I can see the result in my browser, but this error doesn't sound good ?

After this error, I've added the express types as a dependency via npm i @types/express and the error has gone !

Two questions :

  • why for a browser app we need express typings ?
  • if this is really needed, could we add it as a dependency of @sentry/apm package ?

Here is a repo to reproduce : https://github.com/mdartic/project-sentry-apm-vue-ts

Thanks for your feedback !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions