diff --git a/package.json b/package.json index cb7c8a4..17f6973 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,8 @@ "@libp2p/interface-metrics": "^4.0.0" }, "devDependencies": { - "aegir": "^37.0.7", + "@types/sinon": "^10.0.15", + "aegir": "^39.0.10", "sinon": "^15.0.1", "sinon-ts": "^1.0.0" } diff --git a/src/index.ts b/src/index.ts index da948c4..6cf3fa3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,24 +17,24 @@ class TrackedMap extends Map { this.updateComponentMetric() } - set (key: K, value: V) { + set (key: K, value: V): this { super.set(key, value) this.updateComponentMetric() return this } - delete (key: K) { + delete (key: K): boolean { const deleted = super.delete(key) this.updateComponentMetric() return deleted } - clear () { + clear (): void { super.clear() this.updateComponentMetric() } - private updateComponentMetric () { + private updateComponentMetric (): void { this.metric.update(this.size) } } diff --git a/test/index.spec.ts b/test/index.spec.ts index d6f38b5..4450f41 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -1,8 +1,8 @@ import { expect } from 'aegir/chai' +import { stubInterface } from 'sinon-ts' import { trackedMap } from '../src/index.js' -import type { SinonStubbedInstance } from 'sinon' import type { Metric, Metrics } from '@libp2p/interface-metrics' -import { stubInterface } from 'sinon-ts' +import type { SinonStubbedInstance } from 'sinon' describe('tracked-map', () => { let metrics: SinonStubbedInstance