chore: update typescript to 4.3 and enable noImplicitOverride (#2241)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
This commit is contained in:
Gerhard Stöbich 2021-06-01 21:40:04 +02:00 committed by GitHub
parent 56c032ec71
commit d5517812b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 86 additions and 85 deletions

View File

@ -13,7 +13,7 @@
},
"devDependencies": {
"@types/node": "10.17.59",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0"

View File

@ -13,7 +13,7 @@
},
"devDependencies": {
"@types/node": "12.20.11",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0"

View File

@ -13,7 +13,7 @@
},
"devDependencies": {
"@types/node": "8.10.66",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0"

View File

@ -20,7 +20,7 @@
},
"devDependencies": {
"@opentelemetry/api": "^0.20.0",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -47,21 +47,21 @@
"devDependencies": {
"@commitlint/cli": "12.1.1",
"@commitlint/config-conventional": "12.1.1",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"@typescript-eslint/eslint-plugin": "4.25.0",
"@typescript-eslint/parser": "4.25.0",
"beautify-benchmark": "0.2.4",
"benchmark": "2.1.4",
"eslint": "7.25.0",
"eslint": "7.27.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-import": "2.23.3",
"eslint-plugin-node": "11.1.0",
"gh-pages": "3.1.0",
"husky": "4.3.8",
"lerna": "3.22.1",
"lerna-changelog": "1.0.1",
"markdownlint-cli": "0.27.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"update-ts-references": "2.3.0"
},
"husky": {

View File

@ -72,7 +72,7 @@
"nyc": "15.1.0",
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0"
}
}

View File

@ -38,7 +38,7 @@ describe('API', () => {
});
class TestMeterProvider extends NoopMeterProvider {
getMeter() {
override getMeter() {
return dummyMeter;
}
}

View File

@ -50,7 +50,7 @@
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -68,7 +68,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"zone.js": "0.11.4"

View File

@ -61,7 +61,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -76,7 +76,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0"
},
"peerDependencies": {

View File

@ -60,7 +60,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -60,7 +60,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -57,7 +57,7 @@ export abstract class CollectorExporterNodeBase<
this._sendingPromises.push(promise);
}
onInit(config: CollectorExporterNodeConfigBase): void {
override onInit(config: CollectorExporterNodeConfigBase): void {
this._isShutdown = false;
// defer to next tick and lazy load to avoid loading protobufjs too early
// and making this impossible to be instrumented
@ -68,7 +68,7 @@ export abstract class CollectorExporterNodeBase<
});
}
send(
override send(
objects: ExportItem[],
onSuccess: () => void,
onError: (error: collectorTypes.CollectorExporterError) => void

View File

@ -76,7 +76,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -315,7 +315,7 @@ export namespace opentelemetryProto {
*/
export class CollectorExporterError extends Error {
readonly code?: number;
readonly name: string = 'CollectorExporterError';
override readonly name: string = 'CollectorExporterError';
readonly data?: string;
constructor(message?: string, code?: number, data?: string) {

View File

@ -53,7 +53,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -50,7 +50,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -74,7 +74,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -72,7 +72,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -458,7 +458,7 @@ export class FetchInstrumentation extends InstrumentationBase<
/**
* implements enable function
*/
enable() {
override enable() {
if (isWrapped(window.fetch)) {
this._unwrap(window, 'fetch');
api.diag.debug('removing previous patch for constructor');
@ -469,7 +469,7 @@ export class FetchInstrumentation extends InstrumentationBase<
/**
* implements unpatch function
*/
disable() {
override disable() {
this._unwrap(window, 'fetch');
this._usedResources = new WeakSet<PerformanceResourceTiming>();
}

View File

@ -63,7 +63,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -57,14 +57,14 @@ import { AttributeNames } from '../enums/AttributeNames';
export class GrpcJsInstrumentation extends InstrumentationBase {
constructor(
protected _config: GrpcInstrumentationConfig & InstrumentationConfig = {},
protected override _config: GrpcInstrumentationConfig & InstrumentationConfig = {},
name: string,
version: string
) {
super(name, version, _config);
}
public setConfig(
public override setConfig(
config: GrpcInstrumentationConfig & InstrumentationConfig = {}
) {
this._config = Object.assign({}, config);

View File

@ -56,14 +56,14 @@ export class GrpcNativeInstrumentation extends InstrumentationBase<
typeof grpcTypes
> {
constructor(
protected _config: GrpcInstrumentationConfig & InstrumentationConfig = {},
protected override _config: GrpcInstrumentationConfig & InstrumentationConfig = {},
name: string,
version: string
) {
super(name, version, _config);
}
public setConfig(
public override setConfig(
config: GrpcInstrumentationConfig & InstrumentationConfig = {}
) {
this._config = Object.assign({}, config);

View File

@ -65,7 +65,7 @@
"superagent": "6.1.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -73,7 +73,7 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
return this._config;
}
setConfig(config: HttpInstrumentationConfig & InstrumentationConfig = {}) {
override setConfig(config: HttpInstrumentationConfig & InstrumentationConfig = {}) {
this._config = Object.assign({}, config);
}

View File

@ -71,7 +71,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -510,7 +510,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase<XMLHttpRe
/**
* implements enable function
*/
enable() {
override enable() {
api.diag.debug('applying patch to', this.moduleName, this.version);
if (isWrapped(XMLHttpRequest.prototype.open)) {
@ -530,7 +530,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase<XMLHttpRe
/**
* implements disable function
*/
disable() {
override disable() {
api.diag.debug('removing patch from', this.moduleName, this.version);
this._unwrap(XMLHttpRequest.prototype, 'open');

View File

@ -93,7 +93,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -24,8 +24,8 @@ export abstract class InstrumentationBase
extends InstrumentationAbstract
implements types.Instrumentation {
constructor(
readonly instrumentationName: string,
readonly instrumentationVersion: string,
instrumentationName: string,
instrumentationVersion: string,
config: types.InstrumentationConfig = {}
) {
super(instrumentationName, instrumentationVersion, config);

View File

@ -29,8 +29,8 @@ class TestInstrumentation extends InstrumentationBase {
constructor(config: TestInstrumentationConfig & InstrumentationConfig = {}) {
super('test', '1.0.0', Object.assign({}, config));
}
enable() {}
disable() {}
override enable() {}
override disable() {}
init() {}
}
@ -56,7 +56,7 @@ describe('BaseInstrumentation', () => {
it('should enable instrumentation by default', () => {
let called = false;
class TestInstrumentation2 extends TestInstrumentation {
enable() {
override enable() {
called = true;
}
}

View File

@ -29,8 +29,8 @@ class FooInstrumentation extends InstrumentationBase {
init() {
return [];
}
enable() {}
disable() {}
override enable() {}
override disable() {}
}
describe('autoLoader', () => {

View File

@ -27,9 +27,9 @@ class FooInstrumentation extends InstrumentationBase {
return [];
}
enable() {}
override enable() {}
disable() {}
override disable() {}
}
// const fooInstrumentation = new FooInstrumentation();

View File

@ -56,7 +56,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -55,7 +55,7 @@ export abstract class BaseObserverMetric
);
}
async getMetricRecord(): Promise<MetricRecord[]> {
override async getMetricRecord(): Promise<MetricRecord[]> {
const observerResult = new ObserverResult();
await this._callback(observerResult);

View File

@ -45,7 +45,7 @@ export class SumObserverMetric
);
}
protected _processResults(observerResult: ObserverResult) {
protected override _processResults(observerResult: ObserverResult) {
observerResult.values.forEach((value, labels) => {
const instrument = this.bind(labels);
// SumObserver is monotonic which means it should only accept values

View File

@ -57,7 +57,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -36,7 +36,7 @@ import { JaegerPropagator } from '@opentelemetry/propagator-jaeger';
* @param config Configuration object for SDK registration
*/
export class NodeTracerProvider extends BasicTracerProvider {
protected static readonly _registeredPropagators = new Map<
protected static override readonly _registeredPropagators = new Map<
string,
PROPAGATOR_FACTORY
>([
@ -56,7 +56,7 @@ export class NodeTracerProvider extends BasicTracerProvider {
super(config);
}
register(config: SDKRegistrationConfig = {}) {
override register(config: SDKRegistrationConfig = {}) {
if (config.contextManager === undefined) {
const ContextManager = semver.gte(process.version, '14.8.0')
? AsyncLocalStorageContextManager
@ -68,7 +68,7 @@ export class NodeTracerProvider extends BasicTracerProvider {
super.register(config);
}
protected _getPropagator(name: string): TextMapPropagator | undefined {
protected override _getPropagator(name: string): TextMapPropagator | undefined {
return (
super._getPropagator(name) ||
NodeTracerProvider._registeredPropagators.get(name)?.()

View File

@ -59,6 +59,6 @@
"rimraf": "3.0.2",
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"typescript": "4.2.4"
"typescript": "4.3.2"
}
}

View File

@ -67,7 +67,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0"
},
"peerDependencies": {

View File

@ -51,7 +51,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -51,7 +51,7 @@
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -60,7 +60,7 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -70,6 +70,6 @@
"sinon": "10.0.0",
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"typescript": "4.2.4"
"typescript": "4.3.2"
}
}

View File

@ -54,6 +54,6 @@
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
}
}

View File

@ -52,7 +52,7 @@
"ts-node": "9.1.1",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"

View File

@ -95,14 +95,14 @@ export class SpanContextShim extends opentracing.SpanContext {
/**
* Returns the trace ID as a string.
*/
toTraceId(): string {
override toTraceId(): string {
return this._spanContext.traceId;
}
/**
* Returns the span ID as a string.
*/
toSpanId(): string {
override toSpanId(): string {
return this._spanContext.spanId;
}
@ -130,7 +130,7 @@ export class TracerShim extends opentracing.Tracer {
this._propagators = propagators;
}
startSpan(
override startSpan(
name: string,
options: opentracing.SpanOptions = {}
): opentracing.Span {
@ -155,7 +155,7 @@ export class TracerShim extends opentracing.Tracer {
return new SpanShim(this, span, baggage);
}
_inject(
override _inject(
spanContext: opentracing.SpanContext,
format: string,
carrier: unknown
@ -182,7 +182,7 @@ export class TracerShim extends opentracing.Tracer {
}
}
_extract(format: string, carrier: unknown): opentracing.SpanContext | null {
override _extract(format: string, carrier: unknown): opentracing.SpanContext | null {
if (format === opentracing.FORMAT_BINARY) {
api.diag.warn('OpentracingShim.extract() does not support FORMAT_BINARY');
// @todo: Implement binary format
@ -243,14 +243,14 @@ export class SpanShim extends opentracing.Span {
*
* @returns a {@link SpanContextShim} containing the underlying context.
*/
context(): opentracing.SpanContext {
override context(): opentracing.SpanContext {
return this._contextShim;
}
/**
* Returns the {@link opentracing.Tracer} that created the span.
*/
tracer(): opentracing.Tracer {
override tracer(): opentracing.Tracer {
return this._tracerShim;
}
@ -259,7 +259,7 @@ export class SpanShim extends opentracing.Span {
*
* @param name the Span name.
*/
setOperationName(name: string): this {
override setOperationName(name: string): this {
this._span.updateName(name);
return this;
}
@ -270,7 +270,7 @@ export class SpanShim extends opentracing.Span {
*
* @param finishTime An optional timestamp to explicitly set the span's end time.
*/
finish(finishTime?: number): void {
override finish(finishTime?: number): void {
this._span.end(finishTime);
}
@ -279,7 +279,7 @@ export class SpanShim extends opentracing.Span {
* @param eventName name of the event.
* @param payload an arbitrary object to be attached to the event.
*/
logEvent(eventName: string, payload?: SpanAttributes): void {
override logEvent(eventName: string, payload?: SpanAttributes): void {
this._span.addEvent(eventName, payload);
}
@ -287,7 +287,7 @@ export class SpanShim extends opentracing.Span {
* Logs a set of key value pairs. Since OpenTelemetry only supports events,
* the KV pairs are used as attributes on an event named "log".
*/
log(keyValuePairs: SpanAttributes, _timestamp?: number): this {
override log(keyValuePairs: SpanAttributes, _timestamp?: number): this {
// @todo: Handle timestamp
this._span.addEvent('log', keyValuePairs);
return this;
@ -297,7 +297,7 @@ export class SpanShim extends opentracing.Span {
* Adds a set of tags to the span.
* @param keyValueMap set of KV pairs representing tags
*/
addTags(keyValueMap: SpanAttributes): this {
override addTags(keyValueMap: SpanAttributes): this {
this._span.setAttributes(keyValueMap);
return this;
}
@ -308,7 +308,7 @@ export class SpanShim extends opentracing.Span {
* @param key key for the tag
* @param value value for the tag
*/
setTag(key: string, value: SpanAttributeValue): this {
override setTag(key: string, value: SpanAttributeValue): this {
if (
key === opentracing.Tags.ERROR &&
(value === true || value === 'true')
@ -321,11 +321,11 @@ export class SpanShim extends opentracing.Span {
return this;
}
getBaggageItem(key: string): string | undefined {
override getBaggageItem(key: string): string | undefined {
return this._contextShim.getBaggageItem(key);
}
setBaggageItem(key: string, value: string): this {
override setBaggageItem(key: string, value: string): this {
this._contextShim.setBaggageItem(key, value);
return this;
}

View File

@ -74,7 +74,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0"
},
"peerDependencies": {

View File

@ -225,7 +225,7 @@ describe('BasicTracerProvider', () => {
describe('exporter', () => {
class CustomTracerProvider extends BasicTracerProvider {
protected _getSpanExporter(name: string): SpanExporter | undefined {
protected override _getSpanExporter(name: string): SpanExporter | undefined {
return name === 'memory'
? new InMemorySpanExporter()
: BasicTracerProvider._registeredExporters.get(name)?.();

View File

@ -58,7 +58,7 @@ export class TestTracingSpanExporter extends InMemorySpanExporter {
);
}
export(
override export(
spans: ReadableSpan[],
resultCallback: (result: ExportResult) => void
): void {
@ -71,13 +71,13 @@ export class TestTracingSpanExporter extends InMemorySpanExporter {
super.export(spans, resultCallback);
}
shutdown(): Promise<void> {
override shutdown(): Promise<void> {
return super.shutdown().then(() => {
this._exporterCreatedSpans = [];
});
}
reset() {
override reset() {
super.reset();
this._exporterCreatedSpans = [];
}

View File

@ -72,7 +72,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"

View File

@ -55,7 +55,7 @@ export class WebTracerProvider extends BasicTracerProvider {
*
* @param config Configuration object for SDK registration
*/
register(config: SDKRegistrationConfig = {}) {
override register(config: SDKRegistrationConfig = {}) {
if (config.contextManager === undefined) {
config.contextManager = new StackContextManager();
}

View File

@ -66,7 +66,7 @@
],
"devDependencies": {
"@types/node": "14.14.43",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"Add these to devDependencies for testing": {
"@types/mocha": "8.2.0",

View File

@ -11,6 +11,7 @@
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noImplicitOverride": true,
"pretty": true,
"sourceMap": true,
"strict": true,