- Enhancement: jsdoc/typescript type for better clarity and specificty#115
Open
brettz9 wants to merge 6 commits intoJSONPath-Plus:mainfrom
Open
- Enhancement: jsdoc/typescript type for better clarity and specificty#115brettz9 wants to merge 6 commits intoJSONPath-Plus:mainfrom
brettz9 wants to merge 6 commits intoJSONPath-Plus:mainfrom
Conversation
04cdac0 to
f4d1be4
Compare
f4d1be4 to
38c7be1
Compare
kf6kjg
reviewed
Feb 2, 2023
kf6kjg
left a comment
There was a problem hiding this comment.
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.
| * expressions; see the Syntax section for details.) | ||
| */ | ||
| sandbox?: Map<string, any> | ||
| sandbox?: { [key: string]: any } |
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.