Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/core/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
Client,
Event,
EventHint,
EventProcessor,
Integration,
IntegrationClass,
IntegrationFn,
Expand Down Expand Up @@ -148,9 +149,9 @@ export function setupIntegration(client: Client, integration: Integration, integ
if (client.addEventProcessor && typeof integration.processEvent === 'function') {
const callback = integration.processEvent.bind(integration) as typeof integration.processEvent;

const processor = Object.assign((event: Event, hint: EventHint) => callback(event, hint, client), {
id: integration.name,
});
const processor: EventProcessor = (event: Event, hint: EventHint): ReturnType<typeof callback> =>
callback(event, hint, client);
processor.id = integration.name;

client.addEventProcessor(processor);
}
Expand Down Expand Up @@ -191,12 +192,11 @@ export function convertIntegrationFnToClass<Fn extends IntegrationFn>(
name: string,
fn: Fn,
): IntegrationClass<Integration> {
return Object.assign(
function ConvertedIntegration(...args: Parameters<Fn>): Integration {
return fn(...args);
},
{ id: name },
) as unknown as IntegrationClass<Integration>;
const ConvertedIntegration = function ConvertedIntegration(...args: Parameters<Fn>): Integration {
return fn(...args);
};
ConvertedIntegration.id = name;
return ConvertedIntegration as unknown as IntegrationClass<Integration>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ module.exports = {
const functionName = node.callee.property.name;

const es6ArrayFunctions = ['copyWithin', 'values', 'fill'];
const es6ObjectFunctions = ['assign'];
const es6StringFunctions = ['repeat'];

const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions);
const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions, es6ObjectFunctions);
if (es6Functions.indexOf(functionName) > -1) {
context.report({
node: node.callee.property,
Expand Down
14 changes: 5 additions & 9 deletions packages/tracing-internal/src/browser/web-vitals/lib/observe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ export const observe = <K extends keyof PerformanceEntryMap>(
const po = new PerformanceObserver(list => {
callback(list.getEntries() as PerformanceEntryMap[K]);
});
po.observe(
Object.assign(
{
type,
buffered: true,
},
opts || {},
) as PerformanceObserverInit,
);
po.observe({
type,
buffered: true,
...opts,
} as PerformanceObserverInit);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Function Fails When Optional Parameter Is Undefined

The observe function throws a TypeError when the optional opts parameter is undefined because ...opts is used directly. This occurs when the function is called without the opts argument. The previous implementation safely handled this case by using opts || {}.

Locations (1)

Fix in CursorFix in Web

return po;
}
} catch (e) {
Expand Down