-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Function 'pick' returns is documented to always return a value. #14320
Conversation
- See issue DefinitelyTyped#14319 Function 'pick' returns is documented to always return a value. Before it's return type was :void, I'm sending this proposal as :any would fix this issue. Reference to dot-object documentation: https://github.com/rhalff/dot-object#pickremove-a-value-using-dot-notation
dot-object/index.d.ts to author (@nkovacic). Could you review this PR? Checklist
|
URL to documentation & info: #14319 |
cc @rhalff - author of dot-object - for his advice/input |
@@ -109,7 +109,7 @@ declare namespace DotObject { | |||
* @param {Object} obj | |||
* @param {Boolean} remove | |||
*/ | |||
pick(path: string, obj: any, remove?: boolean): void; | |||
pick(path: string, obj: any, remove?: boolean): 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.
- tested this in my production code, and TypeScript was now happy.
- did this according to my experience with using the function and the documentation as described in https://github.com/rhalff/dot-object#pickremove-a-value-using-dot-notation
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.
The return type is definitely 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.
thanks for the quick feedback @rhalff
Bumped version number as asked in checklist
@@ -1,4 +1,4 @@ | |||
// Type definitions for Dot-Object v1.4.2 | |||
// Type definitions for Dot-Object v1.4.3 |
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.
- Bumped the version number, as asked in the checklist/guidelines
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.
We only use MAJOR.MINOR for version numbers. Can you strip the last portion off?
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.
Ok, will make it 1.5 then I guess?
@@ -1,4 +1,4 @@ | |||
// Type definitions for Dot-Object v1.4.2 | |||
// Type definitions for Dot-Object v1.4.3 |
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.
We only use MAJOR.MINOR for version numbers. Can you strip the last portion off?
To comply with maj.min versioning ref comment DefinitelyTyped#14320 (comment)
@@ -1,4 +1,4 @@ | |||
// Type definitions for Dot-Object v1.4.2 | |||
// Type definitions for Dot-Object v1.5 |
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.
@DanielRosenwasser bumped it now straight to v1.5
thanks
is there a way I can work around this in typescript "typings" of "tsconfig.json" (in stead of editing the
|
- added info on workaround for current @types/dot-object pick method (see PR: DefinitelyTyped/DefinitelyTyped#14320)
👍 Looks good |
A polite ping/bump to @DanielRosenwasser and @nkovacic to futher review/merge the PR when appropriate? |
Thanks! Sorry for the delay! To answer your question: right now you can take the There's an extremely technical document about path mappings here: microsoft/TypeScript#5039 |
Thanks @DanielRosenwasser - no prob on the delay, I know we all have a job (or multiple) and this is all voluntary work. Thanks for introducting me to the path mappings as well! |
To comply with maj.min versioning ref comment DefinitelyTyped#14320 (comment)
Function 'pick' returns is documented to always return a value. Before it's return type was :void, I'm sending this proposal as :any would fix this issue.
Reference to dot-object documentation: https://github.com/rhalff/dot-object#pickremove-a-value-using-dot-notation
Please fill in this template.
master
branch.tsc
without errors.npm run lint package-name
if atslint.json
is present.Select one of these and delete the others:
If adding a new definition:
npm run new-package package-name
, not by basing it on an existing project.tslint.json
should be present, andtsconfig.json
should havenoImplicitAny
,noImplicitThis
, andstrictNullChecks
set totrue
.If changing an existing definition:
tslint.json
containing{ "extends": "../tslint.json" }
.If removing a declaration:
notNeededPackages.json
.