Unresolved variable or type `Dropbox`
See original GitHub issueBefore you start Have you checked StackOverflow, previous issues, and Dropbox Developer Forums for help? Yes
What is your question?
I’m trying to adjust a JSDoc annotation for Dropbox 6.x.x but face an issue with Dropbox
type.
I’m importing Dropbox:
import dropbox from "dropbox";
And then I get a warning «Unresolved variable or type Dropbox
»:
Is it a Dropbox or IDEA/WebStorm issue?
Versions
- What version of the SDK are you using? 6.0.2
- What version of the language are you using? 2020
- Are you using Javascript or Typescript? JS
- What platform are you using? (if applicable) Windows, Node.js + NPM
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (10 by maintainers)
Top Results From Across the Web
WebStorm: unresolved variable or type altough library is loaded
There is a warning 'unresolved variable or type' although the corresponding library 'TweenMax' is loaded like:
Read more >Automatically defined variables triggering "Unresolved ...
I'm getting errors like this in my nodejs files: "Unresolved variable or type __dirname" node automatically sets that variable, so it should not...
Read more >I have a problem with connecting Dropbox API to my iOS app ...
For the "Use of undeclared type 'DropboxOAuthCompletion'" and "Use of unresolved ... This screenshot doesn't show where that variable would be set or...
Read more >Unresolved and Unresolvable? Tensions in the Refugee ...
State interests vis-à-vis refugees are enmeshed with moral values, and are also highly variable, depending in part on historical experience, ...
Read more >Unresolved reference to CRF in Define.XML - Pinnacle 21
pdf » in the column « Href » of the sheet « Documents ») and I write the corresponding pages in the column...
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 FreeTop 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
Top GitHub Comments
Unfortunately, with the way the SDK is structured, it doesn’t make sense to have a default export. We have two main objects
Dropbox
which handles all of the main route logic, andDropboxAuth
which handles all auth related logic.What this means in the case of this is that when you import the entire package, you cannot reference it as a default object. However, if you use named imports, you can reference it directly. This example gives no errors and correctly links to the classes when I command+click into them (both JetBrains & VSCode):
Still working through the import error when this example is run but from a JSDoc standpoint it should be fine.
From what I understand, there would be no case in which the return variable type would not match the constructor. Meaning if you construct via
new Dropbox.Dropbox()
then the return JSDoc annotation would be* @return {Dropbox.Dropbox} ...
. This is because the plainDropbox
object contains the entire package not a default export. If you inspect that object directly, it containsDropbox
andDropboxAuth
which is what we expect.When I try to run this example however:
I am able to successfully see the class definitions in VSCode and am unable to see them in JetBrains. I added this comment to the ticket you posted above also.
I see, yes we did migrate away from the DropboxTypes because internally it was a mess of local references to itself. I do believe that it should work if you use
dropbox.Dropbox
, or at least this works in VSCode. I will continue to investigate this issue though.