Skip to content

Commit

Permalink
chore(package): add missing typings
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Feb 15, 2023
1 parent 829bec2 commit 6658552
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
11 changes: 7 additions & 4 deletions package/client/resource/interface/context.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';

interface ContextMenuItem {
title?: string;
menu?: string;
title?: string;
description?: string;
arrow?: boolean;
image?: string;
icon?: IconName | [IconPrefix, IconName];
iconColor?: string;
progress?: number;
colorScheme?: string;
onSelect?: (args: any) => void;
arrow?: boolean;
description?: string;
metadata?: string | { [key: string]: any } | string[];
metadata?: string[] | { [key: string]: any } | { label: string; value: any; progress?: number }[];
disabled?: boolean;
event?: string;
serverEvent?: string;
Expand Down
22 changes: 20 additions & 2 deletions package/client/resource/interface/input.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';

// Should really be improved at some point to only display properties depending on the input type
interface InputDialogRowProps {
type: 'input' | 'number' | 'checkbox' | 'select' | 'slider';
type:
| 'input'
| 'number'
| 'checkbox'
| 'select'
| 'multi-select'
| 'slider'
| 'color'
| 'date'
| 'date-range'
| 'time'
| 'text-area';
label: string;
options?: { value: string; label: string; default?: string }[];
password?: boolean;
Expand All @@ -13,13 +25,19 @@ interface InputDialogRowProps {
checked?: boolean;
min?: number;
max?: number;
autosize?: boolean;
step?: number;
required?: boolean;
format?: string;
description?: string;
}

type inputDialog = (
heading: string,
rows: string[] | InputDialogRowProps[]
rows: string[] | InputDialogRowProps[],
options: {
allowCancel?: boolean;
}
) => Promise<Array<string | number | boolean> | undefined>;
export const inputDialog: inputDialog = async (heading, rows) => await exports.ox_lib.inputDialog(heading, rows);

Expand Down
13 changes: 11 additions & 2 deletions package/client/resource/interface/notify.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { CSSProperties } from 'react';
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';

type NotificationPosition = 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
type NotificationPosition =
| 'top'
| 'top-right'
| 'top-left'
| 'bottom'
| 'bottom-right'
| 'bottom-left'
| 'center-right'
| 'center-left';
type NotificationType = 'inform' | 'error' | 'success';

interface NotifyProps {
id?: string;
id?: string | number;
title?: string;
description?: string;
duration?: number;
Expand All @@ -18,6 +26,7 @@ interface NotifyProps {

export const notify = (data: NotifyProps): void => exports.ox_lib.notify(data);

// Keep for backwards compat with v2
interface DefaultNotifyProps {
title?: string;
description?: string;
Expand Down
2 changes: 1 addition & 1 deletion package/client/resource/interface/skillcheck.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type SkillCheckDifficulty = 'easy' | 'medium' | 'hard' | { areaSize: number; speedMultiplier: number };

export const skillCheck = (difficulty: SkillCheckDifficulty | SkillCheckDifficulty[]) =>
export const skillCheck = (difficulty: SkillCheckDifficulty | SkillCheckDifficulty[], inputs?: string[]) =>
exports.ox_lib.skillCheck(difficulty);

0 comments on commit 6658552

Please sign in to comment.