新的遗物浏览器找不到名称newRelic
我正在使用新的Relic浏览器报告我的React应用程序中的错误。最近,我从 react-error-boundary 软件包中介绍了 errorboundary 组件,该软件包似乎阻止了将任何错误发送给新遗物,我必须使用custic onerror 方法,像这样:
...
const onError = (error: Error) => {
newrelic.noticeError(error);
};
return (
<Router>
<Layout>
<ErrorBoundary FallbackComponent={FallbackComponent} onError={onError}>
<Layout>
...
</Layout>
</ErrorBoundary>
</Router>
);
....
但是我无法使这种新的调用工作,现在我有一个问题说:找不到名称'newrelic'。如何使Typescript识别我当新Relic与开发人员共享NPM软件包时,NewRelic是否在上下文中?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有这个错误。我从其他GIST 。或者,您可以直接转到 https://github.com/肯定/肯定的/tree/tree/master/types/new-Relic-browser 。从
index.d.ts
中将值复制到您的欲望位置,也不要忘记设置tsconfig.json
,使用keyfiles
。I also got this error. I found solution from other gist https://gist.github.com/piotrkubisa/4a1cc7355afcec46651a896d59ec8d50. Or you can directly go to https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/new-relic-browser . copy the value from
index.d.ts
to your desire location, also don't forget setuptsconfig.json
with keyfiles
.