diff --git a/.eslintrc.js b/.eslintrc.js index 99f890d..3db6aa1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -57,24 +57,26 @@ module.exports = { 'never' ], - '@typescript-eslint/no-extra-semi': 'warn', - + '@typescript-eslint/ban-types': 'off', + 'no-plusplus': 'off', 'implicit-arrow-linebreak': 'off', 'operator-linebreak': 'off', - + 'arrow-body-style': 'off', 'no-param-reassign': 'off', 'consistent-return': 'off', 'function-paren-newline': 'off', 'no-mixed-spaces-and-tabs': 'off', - + 'eol-last': 'warn', - + 'linebreak-style': [ 'error', 'unix' ], + + '@typescript-eslint/no-extra-semi': 'warn', '@typescript-eslint/consistent-type-definitions': [ 'warn', diff --git a/changelog.md b/changelog.md index a7f9cc5..6d92459 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,9 @@ ## 🕘 | Changelog +**v3.0.1** +- Now all the `key` parameters allow to pass in the normal `string` type, alongside the **keys autocomplete** feature released in **v3.0.0**. + **v3.0.0** - Improved documentation, fixed typos & mismatches. - Fixed minor types bugs. diff --git a/docs/README.md b/docs/README.md index 16b0898..e7da083 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# `quick-mongo-super v3.0.0` documentation +# `quick-mongo-super v3.0.1` documentation ## Classes - [`QuickMongo`](classes/QuickMongo.md) @@ -21,6 +21,7 @@ - [`ExtractObjectKeys`](types/ExtractObjectKeys.md) - [`ExtractObjectValues`](types/ExtractObjectValues.md) - [`ExtractObjectEntries`](types/ExtractObjectEntries.md) +- [`AutocompletableString`](types/AutocompletableString.md) ## Interfaces - [`IDatabaseConfiguration`](interfaces/IDatabaseConfiguration.md) diff --git a/docs/classes/QuickMongo.md b/docs/classes/QuickMongo.md index 00caa3e..77b17fc 100644 --- a/docs/classes/QuickMongo.md +++ b/docs/classes/QuickMongo.md @@ -22,6 +22,7 @@ You can see the **detailed** examples on usage of each method in both **JavaScri - [`FirstObjectKey`](../types/FirstObjectKey.md) - [`ObjectPath`](../types/ObjectPath.md) - [`ObjectValue`](../types/ObjectValue.md) + - [`AutocompletableString`](../types/AutocompletableString.md) - Interfaces: - [`IDatabaseConfiguration`](../interfaces/IDatabaseConfiguration.md) - [`IDatabaseInternalStructure`](../interfaces/IDatabaseInternalStructure.md) @@ -82,7 +83,7 @@ new QuickMongo(quickMongoClient: QuickMongoClient, databaseOptions?: IData ## Methods -## `get

>(key: P): Maybe>` +## `get

>(key: AutocompletableString

): Maybe>` Retrieves a value from database by a key. - **Parameters:** @@ -99,7 +100,7 @@ Retrieves a value from database by a key. console.log(objectPropertyAccessed) // -> [] ``` -## `getFromDatabase

>(key: P): Promise>>` +## `getFromDatabase

>(key: AutocompletableString

): Promise>>` Retrieves a value from database by a key via sending a **direct request** to remote cluster, **omitting** the cache. - **Parameters:** @@ -117,7 +118,7 @@ Retrieves a value from database by a key via sending a **direct request** to rem ``` -## `fetch

>(key: P): Maybe>` +## `fetch

>(key: AutocompletableString

): Maybe>` Retrieves a value from database by a key. - **Parameters:** @@ -135,7 +136,7 @@ Retrieves a value from database by a key. ``` -## `has

>(key: P): boolean` +## `has

>(key: AutocompletableString

): boolean` Determines if the data is stored in database. - **Parameters:** @@ -156,7 +157,7 @@ Determines if the data is stored in database. ``` -## `set

>(key: P, value: ObjectValue): Promise, FirstObjectKey

, V>>` +## `set

>(key: AutocompletableString

, value: ObjectValue): Promise, FirstObjectKey

, V>>` Writes the specified value into database under the specified key. - **Parameters:** @@ -190,7 +191,7 @@ Writes the specified value into database under the specified key. ``` -## `delete

>(key: P): Promise` +## `delete

>(key: AutocompletableString

): Promise` Deletes the data from database by key. - **Parameters:** @@ -215,7 +216,7 @@ Sends a read, write and delete requests to the remote database and returns the r ``` -## `add

>(key: P, numberToAdd: number): Promise` +## `add

>(key: AutocompletableString

, numberToAdd: number): Promise` Performs an arithmetical addition on a target number in the database. **[!!!] The type of target value must be a number.** @@ -233,7 +234,7 @@ Performs an arithmetical addition on a target number in the database. ``` -## `subtract

>(key: P, numberToSubtract: number): Promise` +## `subtract

>(key: AutocompletableString

, numberToSubtract: number): Promise` Performs an arithmetical subtraction on a target number in the database. **[!!!] The type of target value must be a number.** @@ -245,7 +246,7 @@ Performs an arithmetical subtraction on a target number in the database. - **Returns:** `Promise` - Subtraction operation result. -## `isTargetArray

>(key: P): boolean` +## `isTargetArray

>(key: AutocompletableString

): boolean` Determines whether the specified target is an array. - **Parameters:** @@ -259,7 +260,7 @@ Determines whether the specified target is an array. ``` -## `isTargetNumber

>(key: P): boolean` +## `isTargetNumber

>(key: AutocompletableString

): boolean` Determines whether the specified target is a number. - **Parameters:** @@ -334,7 +335,7 @@ Iterates over root database values and checks if the specified condition in the - **Returns:** `boolean -## `push

>(key: P, ...values: RestOrArray>>): Promise>[]>` +## `push

>(key: AutocompletableString

, ...values: RestOrArray>>): Promise>[]>` Pushes the specified value(s) into the target array in the database. **[!!!] The type of target value must be an array.** @@ -351,7 +352,7 @@ Pushes the specified value(s) into the target array in the database. ``` -## `pull

>(key: P, targetArrayElementIndex: number, value: ObjectValue): Promise>[]>` +## `pull

>(key: AutocompletableString

, targetArrayElementIndex: number, value: ObjectValue): Promise>[]>` Pushes the specified value into the target array in the database. **[!!!] The type of target value must be an array.** @@ -369,7 +370,7 @@ Pushes the specified value into the target array in the database. ``` -## `pop

>(key: P, ...targetArrayElementIndexes: RestOrArray>): Promise>[]>` +## `pop

>(key: AutocompletableString

, ...targetArrayElementIndexes: RestOrArray>): Promise>[]>` Removes the specified element(s) from the target array in the database. **[!!!] The type of target value must be an array.** @@ -412,7 +413,7 @@ Returns an array of object values by specified database key. ``` -## `random

>(key: P): Maybe>` +## `random

>(key: AutocompletableString

): Maybe>` Picks a random element of array in the database and returns the picked array element. - **Parameters:** diff --git a/docs/types/AutocompletableString.md b/docs/types/AutocompletableString.md new file mode 100644 index 0000000..09d4e50 --- /dev/null +++ b/docs/types/AutocompletableString.md @@ -0,0 +1,11 @@ +# **`AutocompletableString` Type** + +Makes an autocompletable union string type compatible with a `string` type. + +## Implementation +```ts +export type AutocompletableString = S | (string & {}) +``` + +- **Type Parameters:** + - `S` (`string`): The autocompletable union string type to make compatible with a `string` type. diff --git a/package-lock.json b/package-lock.json index f3ceddd..8b4c389 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "quick-mongo-super", - "version": "2.3.0", + "version": "3.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "quick-mongo-super", - "version": "2.3.0", + "version": "3.0.1", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -18,11 +18,11 @@ "@jest/globals": "^29.7.0", "@types/jest": "^29.5.7", "@types/node-fetch": "^2.6.1", - "@typescript-eslint/eslint-plugin": "^6.18.1", + "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.18.1", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "^5.3.2" + "typescript": "^5.5.4" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -1469,16 +1469,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", - "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/type-utils": "6.18.1", - "@typescript-eslint/utils": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1503,16 +1503,14 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/type-utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", - "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.18.1", - "@typescript-eslint/utils": "6.18.1", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1520,29 +1518,29 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", - "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/typescript-estree": "6.18.1", - "semver": "^7.5.4" + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1550,9 +1548,6 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" } }, "node_modules/@typescript-eslint/parser": { @@ -1600,6 +1595,115 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/types": { "version": "6.18.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", @@ -1665,6 +1769,130 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "6.18.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", @@ -5132,9 +5360,9 @@ } }, "node_modules/typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -6514,16 +6742,16 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", - "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/type-utils": "6.18.1", - "@typescript-eslint/utils": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -6532,31 +6760,30 @@ "ts-api-utils": "^1.0.1" }, "dependencies": { - "@typescript-eslint/type-utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", - "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", + "@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "6.18.1", - "@typescript-eslint/utils": "6.18.1", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" } }, - "@typescript-eslint/utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", - "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", + "@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true + }, + "@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "requires": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/typescript-estree": "6.18.1", - "semver": "^7.5.4" + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" } } } @@ -6584,6 +6811,70 @@ "@typescript-eslint/visitor-keys": "6.18.1" } }, + "@typescript-eslint/type-utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, "@typescript-eslint/types": { "version": "6.18.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", @@ -6626,6 +6917,83 @@ } } }, + "@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + } + }, + "@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, "@typescript-eslint/visitor-keys": { "version": "6.18.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", @@ -9099,9 +9467,9 @@ "peer": true }, "typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true }, "update-browserslist-db": { diff --git a/package.json b/package.json index 9e3cbf7..43b4ae7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quick-mongo-super", - "version": "3.0.0", + "version": "3.0.1", "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", @@ -79,10 +79,10 @@ "@jest/globals": "^29.7.0", "@types/jest": "^29.5.7", "@types/node-fetch": "^2.6.1", - "@typescript-eslint/eslint-plugin": "^6.18.1", + "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.18.1", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "^5.3.2" + "typescript": "^5.5.4" } } diff --git a/src/lib/QuickMongo.ts b/src/lib/QuickMongo.ts index f306b2e..ec5d093 100644 --- a/src/lib/QuickMongo.ts +++ b/src/lib/QuickMongo.ts @@ -20,6 +20,7 @@ import { TypedObject } from './utils/TypedObject' import { QuickMongoError } from './utils/QuickMongoError' import { + AutocompletableString, ExtractFromArray, FirstObjectKey, If, IsObject, Maybe, ObjectPath, ObjectValue, QueryFunction, RestOrArray @@ -359,7 +360,7 @@ export class QuickMongo { /** * Retrieves a value from database by a key. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {Maybe>} The value of the target in database. * * @example @@ -379,7 +380,7 @@ export class QuickMongo { * // } * // } */ - public get

>(key: P): Maybe> { + public get

>(key: AutocompletableString

): Maybe> { return this._cache.get(key) } @@ -387,7 +388,7 @@ export class QuickMongo { * Retrieves a value from database by a key via sending a **direct request** * to remote cluster, **omitting** the cache. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {Promise>>} The value of the target in database. * * @example @@ -407,7 +408,7 @@ export class QuickMongo { * // } * // } */ - public async getFromDatabase

>(key: P): Promise>> { + public async getFromDatabase

>(key: AutocompletableString

): Promise>> { if (!this._client.connected) { throw new QuickMongoError('CONNECTION_NOT_ESTABLISHED') } @@ -441,7 +442,7 @@ export class QuickMongo { * * - This method is an alias for {@link QuickMongo.get()} method. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {Maybe>} The value from database. * * @example @@ -460,13 +461,13 @@ export class QuickMongo { * // } * // } */ - public fetch

>(key: P): Maybe> { + public fetch

>(key: AutocompletableString

): Maybe> { return this.get(key) } /** * Determines if the data is stored in database. - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {boolean} Whether the data is stored in database. * * @example @@ -493,7 +494,7 @@ export class QuickMongo { * // } * // } */ - public has

>(key: P): boolean { + public has

>(key: AutocompletableString

): boolean { const target = this.get(key) return target !== null && target !== undefined } @@ -501,7 +502,7 @@ export class QuickMongo { /** * Writes the specified value into database under the specified key. * - * @param {string} key The key to write in the target. + * @param {AutocompletableString

} key The key to write in the target. * @param {ObjectValue} value The value to write. * * @returns {Promise, FirstObjectKey

, V>>} @@ -547,7 +548,7 @@ export class QuickMongo { * // } */ public async set

>( - key: P, + key: AutocompletableString

, value: ObjectValue ): Promise, FirstObjectKey

, V>> { const allDatabase = this.all() @@ -589,7 +590,7 @@ export class QuickMongo { /** * Deletes the data from database by key. - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {Promise} Whether the deletition was successful. * * @example @@ -611,7 +612,7 @@ export class QuickMongo { * // } * // } */ - public async delete

>(key: P): Promise { + public async delete

>(key: AutocompletableString

): Promise { const allDatabase = this.all() if (!this.has(key)) { @@ -654,7 +655,7 @@ export class QuickMongo { * * [!!!] The type of target value must be a number. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @param {number} numberToAdd The number to add to the target number in database. * @returns {Promise} Addition operation result. * @@ -675,7 +676,7 @@ export class QuickMongo { * // points: 5 * // } */ - public async add

>(key: P, numberToAdd: number): Promise { + public async add

>(key: AutocompletableString

, numberToAdd: number): Promise { const targetNumber = this.get(key) ?? 0 as any if (!isNumber(targetNumber)) { @@ -699,7 +700,7 @@ export class QuickMongo { * * [!!!] The type of target value must be a number. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @param {number} numberToSubtract The number to subtract from the target number in database. * @returns {Promise} Subtraction operation result. * @@ -720,7 +721,10 @@ export class QuickMongo { * // points: 10 * // } */ - public async subtract

>(key: P, numberToSubtract: number): Promise { + public async subtract

>( + key: AutocompletableString

, + numberToSubtract: number + ): Promise { const targetNumber: any = this.get(key) ?? 0 if (!isNumber(targetNumber)) { @@ -742,7 +746,7 @@ export class QuickMongo { /** * Determines whether the specified target is an array. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {boolean} Whether the target is an array. * * @example @@ -758,7 +762,7 @@ export class QuickMongo { * // notArray: 123 * // } */ - public isTargetArray

>(key: P): boolean { + public isTargetArray

>(key: AutocompletableString

): boolean { const target = this.get(key) return Array.isArray(target) } @@ -766,7 +770,7 @@ export class QuickMongo { /** * Determines whether the specified target is a number. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {boolean} Whether the target is a number. * * @example @@ -782,7 +786,7 @@ export class QuickMongo { * // notNumber: [] * // } */ - public isTargetNumber

>(key: P): boolean { + public isTargetNumber

>(key: AutocompletableString

): boolean { const target = this.get(key) return isNumber(target) } @@ -792,7 +796,7 @@ export class QuickMongo { * * [!!!] The type of target value must be an array. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @param {RestOrArray>>} values * The value(s) to be pushed into the target array in database. * @@ -813,7 +817,7 @@ export class QuickMongo { * // } */ public async push

>( - key: P, + key: AutocompletableString

, ...values: RestOrArray>> ): Promise>[]> { const targetArray = this.get(key) || [] @@ -837,7 +841,7 @@ export class QuickMongo { * * [!!!] The type of target value must be an array. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @param {number} targetArrayElementIndex The index to find the element in target array by. * @param {V} value The value to be pushed into the target array in database. * @returns {Promise>>>} Updated target array from database. @@ -852,7 +856,7 @@ export class QuickMongo { * // } */ public async pull

>( - key: P, + key: AutocompletableString

, targetArrayElementIndex: number, value: ObjectValue ): Promise>[]> { @@ -889,7 +893,7 @@ export class QuickMongo { * * [!!!] The type of target value must be an array. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @param {RestOrArray>} targetArrayElementIndexes * The index(es) to find the element(s) in target array by. * @@ -909,7 +913,7 @@ export class QuickMongo { * // } */ public async pop

>( - key: P, + key: AutocompletableString

, ...targetArrayElementIndexes: RestOrArray> ): Promise>[]> { const targetArray = this.get(key) ?? [] @@ -1057,7 +1061,7 @@ export class QuickMongo { * * [!!!] The type of target value must be an array. * - * @param {P} key The key to access the target in database by. + * @param {AutocompletableString

} key The key to access the target in database by. * @returns {Maybe>} The randomly picked element in the database array. * * @example @@ -1067,7 +1071,7 @@ export class QuickMongo { * const randomArrayElement = quickMongo.random('exampleArray') * console.log(randomArrayElement) // -> randomly picked array element: either 'example1', 'example2', or 'example3' */ - public random

>(key: P): Maybe> { + public random

>(key: AutocompletableString

): Maybe> { const array = this.get(key) if (!Array.isArray(array)) { diff --git a/src/types/utils.ts b/src/types/utils.ts index 6bff5a1..c512e6d 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -152,6 +152,17 @@ export type ExtractObjectEntries> = [ExtractObject */ export type IsAny = 0 extends (1 & T) ? true : false +/** + * Makes the string union type autocompletable with a `string` type. + * + * Type parameters: + * + * - `S` (`string`) - The autocompletable union string type to make compatible with a `string` type. + * + * @template S - The autocompletable union string type to make compatible with a `string` type. + */ +export type AutocompletableString = S | (string & {}) + /** * Extracts the first key from the specified object path. * (for example, in key `member.user.id`, the first key will be `member`) diff --git a/tests/types-test.ts b/tests/types-test.ts index 1b3cbef..21f8baa 100644 --- a/tests/types-test.ts +++ b/tests/types-test.ts @@ -67,17 +67,15 @@ quickMongo.get('nested.nested2') quickMongo.get('nested.nested3') quickMongo.get('nested.nested3.nested31') quickMongo.get('nested.nested3.nested32') -quickMongo1.get('test') -quickMongo1.get('sdfsdfsdf') - -// @ts-expect-error +quickMongo.get('test') +quickMongo.get('sdfsdfsdf') quickMongo.get('sdfsdfsdf') -// @ts-expect-error quickMongo.get('nested123') -// @ts-expect-error quickMongo.get('nested.nested3.asdasdasd') -// @ts-expect-error quickMongo.get('nested.nested2.nested31') +quickMongo1.get('test') +quickMongo1.get('sdfsdfsdf') + // @ts-expect-error quickMongo.get(123) // @ts-expect-error @@ -102,7 +100,6 @@ quickMongo.set('nested.nested3', { quickMongo.set('nested.nested3.nested31', 'asdasdasd') quickMongo.set('nested.nested3.nested32', 123) - // @ts-expect-error quickMongo.set('name', 123) // @ts-expect-error