-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
- Enhancement: jsdoc/typescript type for better clarity and specificty #115
base: main
Are you sure you want to change the base?
Conversation
04cdac0
to
f4d1be4
Compare
f4d1be4
to
38c7be1
Compare
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.
In general I'm against the use of the any
type in TypeScript. If you don't know the type then unknown
is a better fit as it forces the user to determine the type. The any
type simply bypasses all the type features of TypeScript.
That said, in any of my comments where I suggest code changes and I use the unknown
type, I'm perfectly OK with you using the any
type instead: it's your library.
Other than those bits of being informative, I like the change and it's a definite improvement.
@@ -54,7 +58,7 @@ declare module 'jsonpath-plus' { | |||
* (Note that the current path and value will also be available to those | |||
* expressions; see the Syntax section for details.) | |||
*/ | |||
sandbox?: Map<string, any> | |||
sandbox?: { [key: string]: any } |
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.
While valid, there's also the following types that may express your intent better, or not:
{ [key: PropertyKey]: unknown }
Record<string, unknown>
Record<PropertyKey, unknown>
- this one's my preference.
Ditto for the other places where you use an index notation.
No description provided.