Skip to content

Commit

Permalink
Fix some type issues
Browse files Browse the repository at this point in the history
(patch)
  • Loading branch information
flybayer committed Apr 24, 2020
1 parent 73f6be0 commit 5da2eae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/blitz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"main": "dist/index.js",
"module": "dist/blitz.esm.js",
"types": "dist/packages/blitz/src/index.d.ts",
"types": "dist/index.d.ts",
"files": [
"dist"
],
Expand Down
4 changes: 1 addition & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
"react-query": "1.2.9",
"serialize-error": "6.0.0"
},
"devDependencies": {
"@prisma/client": "2.0.0-beta.2"
},
"devDependencies": {},
"gitHead": "6719104cb3e78948e7f06aa948ff72bbb84cb682"
}
13 changes: 10 additions & 3 deletions packages/core/src/useQuery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import {useQuery as useReactQuery} from 'react-query'
import {PromiseReturnType} from '@prisma/client'
// TODO: why doesn't the type work properly from ../types?
// import {PromiseReturnType} from '../types'

/**
* Get the type of the value, that the Promise holds.
*/
export declare type PromiseType<T extends PromiseLike<any>> = T extends PromiseLike<infer U> ? U : T

/**
* Get the return type of a function which returns a Promise.
*/
export declare type PromiseReturnType<T extends (...args: any) => Promise<any>> = PromiseType<ReturnType<T>>

type QueryFn = (...args: any) => Promise<any>

Expand Down

0 comments on commit 5da2eae

Please sign in to comment.