UNPKG

927 BTypeScriptView Raw
1/**
2 * The reserved type of the "Create Item" option in item lists. This is intended
3 * not to conflict with any custom item type `T` that might be used in item
4 * list.
5 */
6export interface ICreateNewItem {
7 __blueprintCreateNewItemBrand: "blueprint-create-new-item";
8}
9/** Returns an instance of a "Create Item" object. */
10export declare function getCreateNewItem(): ICreateNewItem;
11/**
12 * Type guard returning `true` if the provided item (e.g. the current
13 * `activeItem`) is a "Create Item" option.
14 */
15export declare function isCreateNewItem<T>(item: T | ICreateNewItem | null | undefined): item is ICreateNewItem;
16/**
17 * Returns the type of the the current active item. This will be a no-op unless
18 * the `activeItem` is `undefined` or a "Create Item" option, in which case
19 * `null` will be returned instead.
20 */
21export declare function getActiveItem<T>(activeItem: T | ICreateNewItem | null | undefined): T | null;