-
Notifications
You must be signed in to change notification settings - Fork 48
Added typings for package #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
=======================================
Coverage 88.65% 88.65%
=======================================
Files 6 6
Lines 326 326
=======================================
Hits 289 289
Misses 37 37Continue to review full report at Codecov.
|
nezed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @SlNPacifist !
It would be great if you can help me with this little fixes
typings.d.ts
Outdated
|
|
||
| export type Value = any; | ||
|
|
||
| export type QueryResult = Array<Array<Value>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When dataObjects option is true there will be something like
Array<{ [key: string]: Value }>;
typings.d.ts
Outdated
| // Any object suitable for querystring.stringify() | ||
| // @see https://nodejs.org/docs/latest-v8.x/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options | ||
| queryOptions?: { | ||
| [key: string]: string | Array<string> | number | Array<number> | boolean | Array<boolean>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't this it is good idea to allow arrays or objects in query-stringified params.
The JS serialisation of querystring may be very very different from CH deserialisation (eg. foo=1&foo=2 vs foo[]=1&foo[]=2 vs foo=1,2 vs foo=[1,2])
|
Oh, you're right. |
|
Thank you, thats will be quite useful! |
Updated typings
|
Updated. I tried to leave as much as possible info in comments. This is needed to distinguish return type: If format is
However, such combination does not work:
For some reason Default record type is defined like this:
We cannot use Nodejs streams are untyped and I left Some usage examples in playground: https://clck.ru/JbpWd Don't forget to squash before merging if you're OK with these typings. |
|
@nezed ping |
|
@nezed Will it be merged? |
|
Typings is an outdated way to provide type info. Since TypeScript now supports parsing type info from JSDoc comments, it is better to provide typings in JSDoc. Package documentation will be improved too. |
|
@apla that's not true. Writing d.ts is the only way to get quality type definitions. The mentioned JSDoc parsing feature is limited and can't be even close to the hand-crafted typedefs. You can get the idea at least by looking to this definition Is there any other reason why not to merge this for the community benefit? |
|
polite ping |
Typings are true only after #35