Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

- Enhancement: jsdoc/typescript type for better clarity and specificty#115

Open
brettz9 wants to merge 6 commits into
JSONPath-Plus:mainJSONPath-Plus/JSONPath:mainfrom
brettz9:type-adjustmentsbrettz9/JSONPath:type-adjustmentsCopy head branch name to clipboard
Open

- Enhancement: jsdoc/typescript type for better clarity and specificty#115
brettz9 wants to merge 6 commits into
JSONPath-Plus:mainJSONPath-Plus/JSONPath:mainfrom
brettz9:type-adjustmentsbrettz9/JSONPath:type-adjustmentsCopy head branch name to clipboard

Conversation

@brettz9

@brettz9 brettz9 commented Jan 14, 2020

Copy link
Copy Markdown
Collaborator

No description provided.

@brettz9 brettz9 force-pushed the type-adjustments branch 2 times, most recently from 04cdac0 to f4d1be4 Compare January 21, 2020 04:27
@brettz9 brettz9 force-pushed the type-adjustments branch from f4d1be4 to 38c7be1 Compare July 29, 2021 16:23

@kf6kjg kf6kjg left a comment

Copy link
Copy Markdown

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.

Comment thread src/jsonpath.d.ts
* expressions; see the Syntax section for details.)
*/
sandbox?: Map<string, any>
sandbox?: { [key: string]: any }

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.