UNPKG

1.47 kBTypeScriptView Raw
1import { ErrorConstant } from '@remirror/core-constants';
2import type { GetFixedDynamic, GetPartialDynamic, ValidOptions } from '@remirror/core-types';
3import type { GetChangeOptionsReturn } from './types';
4export interface GetChangedOptionsProps<Options extends ValidOptions> {
5 /**
6 * The previous readonly properties object.
7 */
8 previousOptions: GetFixedDynamic<Options>;
9 /**
10 * The partial update object that was passed through.
11 */
12 update: GetPartialDynamic<Options>;
13 /**
14 * A method to check whether two values are equal.
15 */
16 equals?: (valueA: unknown, valueB: unknown) => boolean;
17}
18/**
19 * Get the property changes and the next value from an update.
20 */
21export declare function getChangedOptions<Options extends ValidOptions>(props: GetChangedOptionsProps<Options>): GetChangeOptionsReturn<Options>;
22export interface IsNameUniqueProps {
23 /**
24 * The name to check against
25 */
26 name: string;
27 /**
28 * The set to check within
29 */
30 set: Set<string>;
31 /**
32 * The error code to use
33 *
34 * @default 'extension'
35 */
36 code: ErrorConstant.DUPLICATE_HELPER_NAMES | ErrorConstant.DUPLICATE_COMMAND_NAMES;
37}
38/**
39 * Checks whether a given string is unique to the set. Add the name if it
40 * doesn't already exist, or throw an error when `shouldThrow` is true.
41 *
42 * @param props - destructured params
43 */
44export declare function throwIfNameNotUnique(props: IsNameUniqueProps): void;