dropbox-sdk-js icon indicating copy to clipboard operation
dropbox-sdk-js copied to clipboard

TypeScript compiler did not support the import sdk

Open vincent-cm opened this issue 7 years ago • 3 comments

import { Dropbox } from 'dropbox';


const dbx = new Dropbox({ accessToken });
dbx.filesSearch({
            path: '',
            query: filename,
            start: nextPageToken,
            max_results: pageSize,
            mode: 'filename'
          })

The mode type here is string which is not assignable to the type definition: SearchMode. However, it is unclear how to import the type

(method) DropboxTypes.Dropbox.filesSearch(arg: DropboxTypes.files.SearchArg): Promise<DropboxTypes.files.SearchResult>

screen shot 2018-09-08 at 23 42 34

vincent-cm avatar Sep 08 '18 22:09 vincent-cm

Thanks for writing this up! I'm afraid I don't have a sample of how to do this with the SDK in TypeScript. I'll ask the team to look into this and follow up here when I have more information on this.

greg-db avatar Sep 11 '18 20:09 greg-db

To set search mode, you'll need to make the object like this:

mode: {'.tag': 'filename'},

I'll ask the team to update the SDK to support using the actual types instead in the future.

greg-db avatar Sep 12 '18 11:09 greg-db

@greg-db Great. thanks for the workaround

vincent-cm avatar Sep 12 '18 12:09 vincent-cm