chore: improve TypeScript types in callbacks
The RUM agent lets the user add some callback to have better control of the telemetry collected and sent to the APM server. Some examples are
- [addFilter](https://www.elastic.co/docs/reference/apm/agents/rum-js/agent-api#apm-add-filter) agent API
- [observe](https://www.elastic.co/docs/reference/apm/agents/rum-js/agent-api#observe) agent API
- [apmRequest](https://www.elastic.co/docs/reference/apm/agents/rum-js/configuration#apm-request) config option
Such callbacks receive objects that have relevant properties for the logic that can be placed in the callback but their types are quite generic. As an example we have the [addFilter payload](https://github.com/elastic/apm-agent-rum-js/blob/3fffde1519a911207949c42618a2758e0b2b3bd4/packages/rum/src/index.d.ts#L190).
The consequence is that IDEs that reads the types do not benefit at all from this loose typing.
0 条评论