diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 9d0c1d4ae..3c85e64df 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -1,5 +1,8 @@ import {Plugin, Cordova} from './plugin'; +/** + * The ActionSheet plugin shows a native list of options the user can choose from. + */ @Plugin({ name: 'ActionSheet', plugin: 'cordova-plugin-actionsheet', @@ -20,8 +23,8 @@ export class ActionSheet { * addCancelButtonWithLabel: string * addDestructiveButtonWithLabel: string * position: [x, y] (iPad pass in [x, y] coords of popover) - * @returns {Promise} returns a promise that resolves with a number indicating - * which button was pressed (1 for first, 2 for second). + * @returns {Promise} returns a promise that resolves with the index of the + * button pressed (1 based, so 1, 2, 3, etc.) */ @Cordova() static show(options?: { @@ -33,23 +36,26 @@ export class ActionSheet { addCancelButtonWithLabel?: string, addDestructiveButtonWithLabel?: string, position?: number[] - }){ - // This returned Promise is replaced by one from the @Cordova decorator, - // but since there's no way for TypeScript to know the return type from a - // decorator we provide it. See https://github.com/Microsoft/TypeScript/issues/4881. - return new Promise((s, e) => {}); + }) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); }; /** * Hide the ActionSheet. - * @param {options} */ @Cordova() - static hide(options:any){ - // This returned Promise is replaced by one from the @Cordova decorator, - // but since there's no way for TypeScript to know the return type from a - // decorator we provide it. See https://github.com/Microsoft/TypeScript/issues/4881. - return new Promise((s, e) => {}); + static hide() { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); }; }