Ambient Typescript declaration file?

I’m trying to use Sentry in a typescript app that will run in the browser, so I’m including it like:

import * as Sentry from "@sentry/browser";

This gives me a compiler error, Cannot find module '@sentry/browser'. ts(2307), even though I’ve updated my package.json to include both @sentry/browser and @sentry/types. I’ve been trying to figure out this error for a while, but I found a reference to this error being thrown if TypeScript can’t find an ambient declaration file for a third-party library (https://basarat.gitbooks.io/typescript/docs/errors/common-errors.html). Is this the probable cause, and does one of these declaration files exist somewhere?

Thanks!

1 Like