refactor(haptic): add tuple types (#15651)

This commit is contained in:
Daniel Sogl
2018-09-24 18:47:23 +02:00
committed by Manu MA
parent 36a817c5f5
commit 94ac3ff149

View File

@ -53,7 +53,7 @@ export function hapticSelectionEnd() {
* Use this to indicate success/failure/warning to the user. * Use this to indicate success/failure/warning to the user.
* options should be of the type `{ type: 'success' }` (or `warning`/`error`) * options should be of the type `{ type: 'success' }` (or `warning`/`error`)
*/ */
export function hapticNotification(options: { type: string }) { export function hapticNotification(options: { type: 'success' | 'warning' | 'error' }) {
const engine = (window as any).TapticEngine; const engine = (window as any).TapticEngine;
if (engine) { if (engine) {
engine.notification(options); engine.notification(options);
@ -64,7 +64,7 @@ export function hapticNotification(options: { type: string }) {
* Use this to indicate success/failure/warning to the user. * Use this to indicate success/failure/warning to the user.
* options should be of the type `{ style: 'light' }` (or `medium`/`heavy`) * options should be of the type `{ style: 'light' }` (or `medium`/`heavy`)
*/ */
export function hapticImpact(options: { style: string }) { export function hapticImpact(options: { style: 'light' | 'medium' | 'heavy' }) {
const engine = (window as any).TapticEngine; const engine = (window as any).TapticEngine;
if (engine) { if (engine) {
engine.impact(options); engine.impact(options);