input_pill: Define a type for pill_config object.

(cherry picked from commit ede88191a8)
This commit is contained in:
Sahil Batra 2024-01-03 12:30:43 +05:30 committed by Alex Vandiver
parent 3decf380d7
commit f9eea995fd
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,6 @@
import $ from "jquery";
import type {InputPillConfig} from "./input_pill";
import * as input_pill from "./input_pill";
import type {User} from "./people";
import * as people from "./people";
@ -9,7 +10,7 @@ import * as util from "./util";
export let widget: UserPillWidget;
const pill_config = {
const pill_config: InputPillConfig = {
show_user_status_emoji: true,
};

View File

@ -21,11 +21,13 @@ export type InputPillItem<T> = {
should_add_guest_user_indicator?: boolean;
} & T;
export type InputPillConfig = {
show_user_status_emoji?: boolean;
};
type InputPillCreateOptions<T> = {
$container: JQuery;
pill_config?: {
show_user_status_emoji?: boolean;
};
pill_config?: InputPillConfig | undefined;
create_item_from_text: (
text: string,
existing_items: InputPillItem<T>[],

View File

@ -1,5 +1,5 @@
import * as blueslip from "./blueslip";
import type {InputPillContainer, InputPillItem} from "./input_pill";
import type {InputPillConfig, InputPillContainer, InputPillItem} from "./input_pill";
import * as input_pill from "./input_pill";
import {page_params} from "./page_params";
import type {User} from "./people";
@ -147,9 +147,7 @@ export function append_user(user: User, pills: UserPillWidget): void {
export function create_pills(
$pill_container: JQuery,
pill_config?: {
show_user_status_emoji?: boolean;
},
pill_config?: InputPillConfig | undefined,
): input_pill.InputPillContainer<UserPill> {
const pills = input_pill.create({
$container: $pill_container,