Update typedefs

This commit is contained in:
quas94
2018-11-27 16:27:11 +11:00
parent e32ea94e93
commit 82d92693da
2 changed files with 13 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',
+10 -9
View File
@@ -4,13 +4,14 @@
// 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 +32,7 @@ declare namespace Dropbox {
sizeLimit?: number;
}
interface File {
interface ChooserFile {
// Unique ID for the file, compatible with Dropbox API v2.
id: string;
@@ -55,12 +56,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;
}