Skip to content
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

Lint fixes - api module #4272

Closed
wants to merge 3 commits into from
Closed
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
14 changes: 7 additions & 7 deletions api/src/diag/ComponentLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ export class DiagComponentLogger implements DiagLogger {
this._namespace = props.namespace || 'DiagComponentLogger';
}

public debug(...args: any[]): void {
public debug(...args: Parameters<DiagLogFunction>): void {
return logProxy('debug', this._namespace, args);
}

public error(...args: any[]): void {
public error(...args: Parameters<DiagLogFunction>): void {
return logProxy('error', this._namespace, args);
}

public info(...args: any[]): void {
public info(...args: Parameters<DiagLogFunction>): void {
return logProxy('info', this._namespace, args);
}

public warn(...args: any[]): void {
public warn(...args: Parameters<DiagLogFunction>): void {
return logProxy('warn', this._namespace, args);
}

public verbose(...args: any[]): void {
public verbose(...args: Parameters<DiagLogFunction>): void {
return logProxy('verbose', this._namespace, args);
}
}

function logProxy(
funcName: keyof DiagLogger,
namespace: string,
args: any
args: Parameters<DiagLogFunction>
): void {
const logger = getGlobal('diag');
// shortcut if logger not set
Expand All @@ -66,5 +66,5 @@ function logProxy(
}

args.unshift(namespace);
return logger[funcName](...(args as Parameters<DiagLogFunction>));
return logger[funcName](...args);
}
6 changes: 3 additions & 3 deletions api/src/propagation/TextMapPropagator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* usually implemented via library-specific request interceptors, where the
* client-side injects values and the server-side extracts them.
*/
export interface TextMapPropagator<Carrier = any> {
Copy link
Member

Choose a reason for hiding this comment

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

Changing the default value of a parameter would be a breaking change. I'd suggest leaving this as is.

export interface TextMapPropagator<Carrier> {
/**
* Injects values from a given `Context` into a carrier.
*
Expand Down Expand Up @@ -75,7 +75,7 @@
* A setter is specified by the caller to define a specific method
* to set key/value pairs on the carrier within a propagator.
*/
export interface TextMapSetter<Carrier = any> {
export interface TextMapSetter<Carrier> {
/**
* Callback used to set a key/value pair on an object.
*
Expand All @@ -93,7 +93,7 @@
* A getter is specified by the caller to define a specific method
* to get the value of a key from a carrier.
*/
export interface TextMapGetter<Carrier = any> {
export interface TextMapGetter<Carrier> {
/**
* Get a list of all keys available on the carrier.
*
Expand All @@ -110,15 +110,15 @@
get(carrier: Carrier, key: string): undefined | string | string[];
}

export const defaultTextMapGetter: TextMapGetter = {

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).

Check failure on line 113 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Generic type 'TextMapGetter<Carrier>' requires 1 type argument(s).
get(carrier, key) {

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Parameter 'key' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Parameter 'key' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Parameter 'key' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Parameter 'key' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Parameter 'key' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Parameter 'key' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 114 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'key' implicitly has an 'any' type.
if (carrier == null) {
return undefined;
}
return carrier[key];
},

keys(carrier) {

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 121 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'carrier' implicitly has an 'any' type.
if (carrier == null) {
return [];
}
Expand All @@ -126,8 +126,8 @@
},
};

export const defaultTextMapSetter: TextMapSetter = {

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).

Check failure on line 129 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Generic type 'TextMapSetter<Carrier>' requires 1 type argument(s).
set(carrier, key, value) {

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / browser-tests

Parameter 'value' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

Parameter 'value' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

Parameter 'value' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

Parameter 'value' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

Parameter 'value' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

Parameter 'value' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'carrier' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'key' implicitly has an 'any' type.

Check failure on line 130 in api/src/propagation/TextMapPropagator.ts

View workflow job for this annotation

GitHub Actions / build

Parameter 'value' implicitly has an 'any' type.
if (carrier == null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/trace/NoopTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class NoopTracer implements Tracer {
}
}

function isSpanContext(spanContext: any): spanContext is SpanContext {
function isSpanContext(spanContext: SpanContext): spanContext is SpanContext {
return (
typeof spanContext === 'object' &&
typeof spanContext['spanId'] === 'string' &&
Expand Down
Loading