Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
lint: remove redundant undefineds
  • Loading branch information
logaretm committed Mar 10, 2026
commit 355ad20fb858c846da23090448694fcba4e997f8
4 changes: 2 additions & 2 deletions packages/astro/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export declare const contextLinesIntegration: typeof clientSdk.contextLinesInteg
export declare const getDefaultIntegrations: (options: Options) => Integration[];
export declare const defaultStackParser: StackParser;

export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
export declare function close(timeout?: number): PromiseLike<boolean>;
export declare function flush(timeout?: number): PromiseLike<boolean>;

export declare const Span: clientSdk.Span;

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
* Receives an Event & EventHint as arguments.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
public on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;
public on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): () => void;

/**
* Register a callback for before sending a session or session aggregrates..
Expand All @@ -652,15 +652,15 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
* Receives an Event & EventHint as arguments.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
public on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;
public on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): () => void;

/**
* Register a callback for postprocessing an event,
* after it was passed to (global) event processors, before it is being sent.
* Receives an Event & EventHint as arguments.
* @returns {() => void} A function that, when executed, removes the registered callback.
*/
public on(hook: 'postprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;
public on(hook: 'postprocessEvent', callback: (event: Event, hint?: EventHint) => void): () => void;

/**
* Register a callback for when an event has been sent.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tracing/sentryNonRecordingSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class SentryNonRecordingSpan implements Span {
* @hidden
* @internal
*/
public recordException(_exception: unknown, _time?: number | undefined): void {
public recordException(_exception: unknown, _time?: number): void {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

h: see my other comment above regarding exactOptionalPropertyTypes. Unless I'm missing something (?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are right, I will revert those. I think I will create an issue for them since this is a valid use-case with undefined and optional parameters.

Perhaps it should be a configurable rule, for now I will turn it off.

// noop
}
}
2 changes: 1 addition & 1 deletion packages/core/src/tracing/sentrySpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class SentrySpan implements Span {
* @hidden
* @internal
*/
public recordException(_exception: unknown, _time?: number | undefined): void {
public recordException(_exception: unknown, _time?: number): void {
// noop
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/hasSpansEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare const __SENTRY_TRACING__: boolean | undefined;
* If this option is not provided, the function will use the current client's options.
*/
export function hasSpansEnabled(
maybeOptions?: Pick<CoreOptions, 'tracesSampleRate' | 'tracesSampler'> | undefined,
maybeOptions?: Pick<CoreOptions, 'tracesSampleRate' | 'tracesSampler'>,
): boolean {
if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type PartialURL = {
};

interface URLwithCanParse extends URL {
canParse: (url: string, base?: string | URL | undefined) => boolean;
canParse: (url: string, base?: string | URL) => boolean;
}

// A subset of the URL object that is valid for relative URLs
Expand Down Expand Up @@ -60,7 +60,7 @@ export function isURLObjectRelative(url: URLObject): url is RelativeURL {
* @param url - The URL to parse
* @returns The parsed URL object or undefined if the URL is invalid
*/
export function parseStringToURLObject(url: string, urlBase?: string | URL | undefined): URLObject | undefined {
export function parseStringToURLObject(url: string, urlBase?: string | URL): URLObject | undefined {
const isRelative = url.indexOf('://') <= 0 && url.indexOf('//') !== 0;
const base = urlBase ?? (isRelative ? DEFAULT_BASE_URL : undefined);
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class DenoClient extends ServerRuntimeClient<DenoClientOptions> {

/** @inheritDoc */
// @ts-expect-error - PromiseLike is a subset of Promise
public async close(timeout?: number | undefined): PromiseLike<boolean> {
public async close(timeout?: number): PromiseLike<boolean> {
if (this._logOnExitFlushListener) {
globalThis.removeEventListener('unload', this._logOnExitFlushListener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class AsyncSession implements DebugSession {
//
}

public static async create(orDefault?: DebugSession | undefined): Promise<DebugSession> {
public static async create(orDefault?: DebugSession): Promise<DebugSession> {
if (orDefault) {
return orDefault;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/node-core/src/light/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class LightNodeClient extends ServerRuntimeClient<NodeClientOptions> {

/** @inheritDoc */
// @ts-expect-error - PromiseLike is a subset of Promise
public async close(timeout?: number | undefined): PromiseLike<boolean> {
public async close(timeout?: number): PromiseLike<boolean> {
if (this._clientReportInterval) {
clearInterval(this._clientReportInterval);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/node-core/src/sdk/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class NodeClient extends ServerRuntimeClient<NodeClientOptions> {

/** @inheritDoc */
// @ts-expect-error - PromiseLike is a subset of Promise
public async close(timeout?: number | undefined): PromiseLike<boolean> {
public async close(timeout?: number): PromiseLike<boolean> {
if (this._clientReportInterval) {
clearInterval(this._clientReportInterval);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/remix/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type ServerRouteManifest = ServerBuild['routes'];
export async function storeFormDataKeys(
args: LoaderFunctionArgs | ActionFunctionArgs,
span: Span,
formDataKeys?: Record<string, string | boolean> | undefined,
formDataKeys?: Record<string, string | boolean>,
): Promise<void> {
try {
// We clone the request for Remix be able to read the FormData later.
Expand Down
4 changes: 2 additions & 2 deletions packages/solidstart/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export declare const contextLinesIntegration: typeof clientSdk.contextLinesInteg
export declare const getDefaultIntegrations: (options: Options) => Integration[];
export declare const defaultStackParser: StackParser;

export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
export declare function close(timeout?: number): PromiseLike<boolean>;
export declare function flush(timeout?: number): PromiseLike<boolean>;
export declare function lastEventId(): string | undefined;

export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
Expand Down
4 changes: 2 additions & 2 deletions packages/sveltekit/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export declare const vercelAIIntegration: typeof serverSdk.vercelAIIntegration;
export declare const getDefaultIntegrations: (options: Options) => Integration[];
export declare const defaultStackParser: StackParser;

export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
export declare function close(timeout?: number): PromiseLike<boolean>;
export declare function flush(timeout?: number): PromiseLike<boolean>;
export declare function lastEventId(): string | undefined;

export declare function trackComponent(options: clientSdk.TrackingOptions): ReturnType<typeof clientSdk.trackComponent>;
Expand Down