@sentry/browser
@sentry/node
raven-js
raven-node
_(raven for node)_5.1.1
I'm getting a Typescript error when trying to init Sentry.
Try Sentry.init({dsn} as Sentry.BrowserOptions);
Same issue here on 5.4.3
.
@luki86 casting does not help as the BrowserOptions
does not have a dsn
property. See https://github.com/getsentry/sentry-javascript/blob/4d60369ee724365d8e24cdeda854cfa7c2f30b97/packages/browser/src/backend.ts#L22
For me this works:
```
import { BrowserOptions, init } from '@sentry/browser';
...
const config: BrowserOptions = {
dsn: REACT_APP_SENTRY_DSN,
...
};
init(config);
...
@Sirius-A it does. https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/options.ts#L25
It's most likely due to some misconfiguration of typescript compiler. I'll close this issue, however, feel free to post the repro-case and I'll be more than happy to reopen it and fix if there's something broken :)
TS2559: Type '{ dsn: string; }' has no properties in common with type 'BrowserOptions'.
I got same issue on ^5.5.0
Can you post come repro TS config that I could use to debug this?
Can you post come repro TS config that I could use to debug this?
I had the same problem, the original tsconfig was
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"jsx": "react",
"allowJs": true,
}
}
After I changed "moduleResolution" to node, it works
Most helpful comment
I had the same problem, the original tsconfig was
{ "compilerOptions": { "outDir": "./dist/", "noImplicitAny": true, "module": "es6", "target": "es5", "jsx": "react", "allowJs": true, } }
After I changed "moduleResolution" to node, it works