Skip to content

Commit

Permalink
fix: removed unnecessary type arguments declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowplay1 committed Jan 6, 2024
1 parent 45a64a7 commit ebeddfe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 🕘 | Changelog

**v2.0.1**
**v2.0.2**
- Removed the `TValue` type parameter from all database operations methods due to it breaking the type of the specifying value.
- Changed the default value of type parameter `K` of `QuickMongo` class from `any` to `string`.
- Fixed the incorrect documentation for `QuickMongo.random()` method.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quick-mongo-super",
"version": "2.0.1",
"version": "2.0.2",
"description": "Quick Mongo Super is a light-weight and easy-to-use Node.js module written in TypeScript to work with MongoDB.",
"main": "./dist/src/index.js",
"types": "./dist/typings/src/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/QuickMongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class QuickMongo<K extends string = string, V = any> {

const writeStartDate = Date.now()

await this.set(pingDatabaseKey, 1 as V)
await this.set(pingDatabaseKey, 1 as any)
writeLatency = Date.now() - writeStartDate

const deleteStartDate = Date.now()
Expand Down Expand Up @@ -530,7 +530,7 @@ export class QuickMongo<K extends string = string, V = any> {
throw new QuickMongoError('INVALID_TYPE', 'numberToSubtract', 'number', typeOf(numberToSubtract))
}

const result = await this.set(key, targetNumber - numberToSubtract as V)
const result = await this.set(key, targetNumber - numberToSubtract as any)
return result as any
}

Expand Down
16 changes: 8 additions & 8 deletions tests/math.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('addition operation', () => {
await database.loadCache()
await sleep(3000)

const setResult = await database.set<number>('number', 1)
const setResult = await database.set('number', 1)
return expect(setResult).toEqual(1)
})

Expand Down Expand Up @@ -72,9 +72,9 @@ describe('addition operation', () => {
await sleep(3000)

const additionResults = [
database.get<number>('number'),
database.get<number>('numbers.number'),
database.get<number>('unexistentNumber')
database.get('number'),
database.get('numbers.number'),
database.get('unexistentNumber')
]

return expect(additionResults).toEqual([6, 10, 15])
Expand All @@ -93,7 +93,7 @@ describe('subtraction operation', () => {
await database.loadCache()
await sleep(3000)

const setResult = await database.set<number>('number', 1)
const setResult = await database.set('number', 1)
return expect(setResult).toEqual(1)
})

Expand Down Expand Up @@ -140,9 +140,9 @@ describe('subtraction operation', () => {
await sleep(3000)

const subtractionResults = [
database.get<number>('number'),
database.get<number>('numbers.number'),
database.get<number>('unexistentNumber')
database.get('number'),
database.get('numbers.number'),
database.get('unexistentNumber')
]

return expect(subtractionResults).toEqual([-4, 0, -15])
Expand Down
12 changes: 6 additions & 6 deletions tests/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ describe('get, set, delete operations', () => {
await sleep(1000)

const setResults = [
await database.set<string>('someString', 'hello'),
await database.set<string>('someString123', 'hello123')
await database.set('someString', 'hello'),
await database.set('someString123', 'hello123')
]

await sleep(1000)
Expand Down Expand Up @@ -57,8 +57,8 @@ describe('get, set, delete operations', () => {
await sleep(3000)

const getResults = [
database.get<string>('someString'),
database.get<string>('someString123')
database.get('someString'),
database.get('someString123')
]

await sleep(3000)
Expand All @@ -70,8 +70,8 @@ describe('get, set, delete operations', () => {
await sleep(3000)

const getResults = [
database.get<string>('someObject.someProperty.hello'),
database.get<string>('someObject.someProperty.hi')
database.get('someObject.someProperty.hello'),
database.get('someObject.someProperty.hi')
]

await sleep(3000)
Expand Down

0 comments on commit ebeddfe

Please sign in to comment.