diff --git a/types/dropbox-chooser/dropbox-chooser-tests.ts b/types/dropbox-chooser/dropbox-chooser-tests.ts index f0930733f8..e998bad7bf 100644 --- a/types/dropbox-chooser/dropbox-chooser-tests.ts +++ b/types/dropbox-chooser/dropbox-chooser-tests.ts @@ -1,7 +1,7 @@ // Tests for Dropbox Chooser DefinitelyTyped TS definitions -const options: DropboxChooserOptions = { - success: (files: ReadonlyArray) => { +const options: Dropbox.ChooserOptions = { + success: (files: ReadonlyArray) => { console.log('Success, selected files were:', files); }, }; @@ -9,7 +9,7 @@ const options: DropboxChooserOptions = { const Dropbox = window.Dropbox!; Dropbox.choose(options); -const sampleFile: DropboxChooserFile = { +const sampleFile: Dropbox.ChooserFile = { id: 'SAMPLE_ID', name: 'HelloBox.jpg', link: 'http://localhost/1.png', diff --git a/types/dropbox-chooser/index.d.ts b/types/dropbox-chooser/index.d.ts index 8c9db6f72d..c5fd8a6cd6 100644 --- a/types/dropbox-chooser/index.d.ts +++ b/types/dropbox-chooser/index.d.ts @@ -4,13 +4,13 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Dropbox { - interface DropboxChooser { + interface Chooser { choose(options: ChooserOptions): void; } interface ChooserOptions { - // alled when a user selects an item in the Chooser - success(files: ReadonlyArray): void; + // called when a user selects an item in the Chooser + success(files: ReadonlyArray): void; // called when the user closes the dialog without selecting a file cancel?(): void; @@ -31,7 +31,7 @@ declare namespace Dropbox { sizeLimit?: number; } - interface File { + interface ChooserFile { // Unique ID for the file, compatible with Dropbox API v2. id: string; @@ -55,12 +55,12 @@ declare namespace Dropbox { // whether or not the file is actually a directory isDir: boolean; } -} -type DropboxChooser = Dropbox.DropboxChooser; -type DropboxChooserOptions = Dropbox.ChooserOptions; -type DropboxChooserFile = Dropbox.File; + // Refer to "Handling the response" section of: https://www.dropbox.com/developers/chooser + type ChooserFileBoundingBox = 75 | 256 | 800 | 1280 | 2048; + type ChooserFileMode = 'fit' | 'crop' | 'fit_one_and_overflow'; +} interface Window { - Dropbox?: DropboxChooser; + Dropbox?: Dropbox.Chooser; }