Skip to content

Commit

Permalink
Merge pull request #33 from pineromarcos/types
Browse files Browse the repository at this point in the history
  • Loading branch information
pbatey authored Sep 4, 2023
2 parents bf09dea + 4b8363d commit e3bef66
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.10.2",
"description": "Convert query parameters into mongo query criteria and options.",
"main": "index.js",
"types": "types/index.d.ts",
"repository": {
"type": "git",
"url": "http://github.com/pbatey/query-to-mongo"
Expand Down
20 changes: 20 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
declare module 'query-to-mongo' {
interface QueryToMongoOptions {
maxLimit?: string | number
ignore?: 'fields' | 'omit' | 'sort' | 'offset' | 'limit'
parser?: object
}

interface QueryToMongoResult<T> {
criteria: Omit<T, 'limit' | 'offset' | 'sort'>;
options: {
limit?: number,
skip?: number,
sort?: object
};
link: Function
}

export function queryToMongo<T>(query: T, options?: QueryToMongoOptions): QueryToMongoResult<T>;

}

0 comments on commit e3bef66

Please sign in to comment.