Skip to content

Commit

Permalink
Use LiteralUnion
Browse files Browse the repository at this point in the history
"x" | "y" | string => LiteralUnion<"x" | "y", string>
  • Loading branch information
izyuumi committed Aug 21, 2023
1 parent 407ee7c commit 67adfba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/action-sheet-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AnimationBuilder, Mode } from '../../interface';
import type { AnimationBuilder, LiteralUnion, Mode } from '../../interface';

export interface ActionSheetOptions {
header?: string;
Expand All @@ -19,7 +19,7 @@ export interface ActionSheetOptions {

export interface ActionSheetButton<T = any> {
text?: string;
role?: 'cancel' | 'destructive' | 'selected' | string;
role?: LiteralUnion<'cancel' | 'destructive' | 'selected', string>;
icon?: string;
cssClass?: string | string[];
id?: string;
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/alert/alert-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AnimationBuilder, Mode, TextFieldTypes } from '../../interface';
import type { AnimationBuilder, LiteralUnion, Mode, TextFieldTypes } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';

export interface AlertOptions {
Expand Down Expand Up @@ -45,7 +45,7 @@ type AlertButtonOverlayHandler = boolean | void | { [key: string]: any };

export interface AlertButton {
text: string;
role?: 'cancel' | 'destructive' | Omit<string, 'cancel' | 'destructive'>;
role?: LiteralUnion<'cancel' | 'destructive', string>;
cssClass?: string | string[];
id?: string;
htmlAttributes?: { [key: string]: any };
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/toast/toast-interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LiteralUnion } from 'prettier';
import type { AnimationBuilder, Color, Mode } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';

Expand Down Expand Up @@ -29,7 +30,7 @@ export interface ToastButton {
text?: string;
icon?: string;
side?: 'start' | 'end';
role?: 'cancel' | string;
role?: LiteralUnion<'cancel', string>;
cssClass?: string | string[];
htmlAttributes?: { [key: string]: any };
handler?: () => boolean | void | Promise<boolean | void>;
Expand Down

0 comments on commit 67adfba

Please sign in to comment.