-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property 'noticeError' does not exist on type 'MicroAgent' #608
Comments
This sort of works: import { MicroAgent } from "@newrelic/browser-agent/loaders/micro-agent";
import type { setAPI } from "@newrelic/browser-agent/loaders/api/api";
type NewRelicAPI = ReturnType<typeof setAPI>;
const agent = new MicroAgent({ /* config */ })
(agent as unknown as NewRelicAPI).noticeError(error, {}); A minor issue is that the second argument -- |
Hi @jamesarosen , all the code excerpts in the README are in JS, as we do not have support for TS. There's however a community-created typings for our agent's interface at: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/new-relic-browser . Please note we're not responsible for this typing. For more, see thread on this: https://forum.newrelic.com/s/hubtopic/aAX8W0000008YeBWAU/typescript-for-browser-agent. |
You might want to remove this from your
Having that in the published |
Typescript types generation cannot determine the actual types due to the dynamic nature of the agent. I will look into fixing the types generation in our build process. |
I think you actually can by applying type predicates when mixing in the capabilities in |
The types for
MicroAgent
don't includenoticeError
despite that appearing in the docs.Description
The README has this code:
But when I try that locally, TypeScript complains:
Steps to Reproduce
@newrelic/[email protected]
Expected Behavior
The code compiles
Your Environment
I haven't yet gotten to a runtime environment, but it will be running in Fastly's Compute@Edge, which mimics a ServiceWorker environment.
The text was updated successfully, but these errors were encountered: