Don't use the TypeScript `any` type for return types
See original GitHub issueFunctions in the JS API use the TypeScript any
type for return types. Please instead use real types so we can use these APIs with type safety.
For example:
![Screen Shot 2022-06-18 at 5 32 08 pm](https://user-images.githubusercontent.com/1754873/174428301-77b0dcda-a7bc-41f3-bd6a-3cf606622efd.png)
![Screen Shot 2022-06-18 at 5 48 02 pm](https://user-images.githubusercontent.com/1754873/174428327-d26b78df-b8fc-4972-b326-2dc1ad643322.png)
In the mean time, it’s not clear the right way to manually type this.
Feature Description
Don’t use the TypeScript any
type for return types; instead use detailed types that describe the possible variations of the real data that could be returned.
Motivation
So we can use the BitGo JS SDK with type safety.
Context
N/A
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Documentation - Do's and Don'ts - TypeScript
Don't ever use the types Number , String , Boolean , Symbol , or Object These ... Don't use the return type any...
Read more >TypeScript: Stop Using 'any', There's a Type For That
Chances are you've worked with the `any` type in TypeScript. It's widely overused, and subtly dangerous. Let's explore why you should avoid ...
Read more >Why you should not use the type any in TypeScript
In JavaScript, you reassign any type to any variable, or even access attributes that do not exist. Not with TypeScript since TypeScript checks ......
Read more >How to type to prevent a return value in Typescript
Typescript can help you restrict what type you can return. The specific things you can return are: void: nothing (no return statement) ...
Read more >typescript-eslint/explicit-function-return-type.md at main - GitHub
Functions in TypeScript often don't need to be given an explicit return type ... types do make it visually more clear what type...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @jaydenseric, refactoring this particular function, would require us to also refactor all the modules for our SDK. We created an internal ticket to track this, and we’ll assess and scope the effort soon. In the meantime, we’ll keep this issue open. Thank you!
Not stale.