Merge pull request #30855 from Quas94/master

Update names and cleanup for Dropbox Chooser definitions
This commit is contained in:
Mine Starks
2018-11-29 09:58:15 -08:00
committed by GitHub
2 changed files with 12 additions and 12 deletions
@@ -1,7 +1,7 @@
// Tests for Dropbox Chooser DefinitelyTyped TS definitions
const options: DropboxChooserOptions = {
success: (files: ReadonlyArray<DropboxChooserFile>) => {
const options: Dropbox.ChooserOptions = {
success: (files: ReadonlyArray<Dropbox.ChooserFile>) => {
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',
+9 -9
View File
@@ -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<File>): void;
// called when a user selects an item in the Chooser
success(files: ReadonlyArray<ChooserFile>): 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;
}