Skip to content

Commit

Permalink
Improve typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed May 29, 2024
1 parent ca90e0b commit 1ce9b95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
29 changes: 10 additions & 19 deletions src/ckeditorcontext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useIsMountedRef } from './hooks/useIsMountedRef';

import type { WatchdogConfig } from '@ckeditor/ckeditor5-watchdog/src/watchdog';
import type { Context, ContextConfig } from '@ckeditor/ckeditor5-core';
import type { OptionalRecord } from './types';
import { randomID } from './utils/randomId';

export const ContextWatchdogContext = React.createContext<ContextWatchdogValue | null>( null );
Expand Down Expand Up @@ -195,24 +194,16 @@ export type ExtractContextWatchdogValueByStatus<S extends ContextWatchdogValueSt
/**
* Props for the CKEditorContext component.
*/
type Props<TContext extends Context> =
& OptionalRecord<{
id: string;
isLayoutReady: boolean;
context: { create( ...args: any ): Promise<any> };
watchdogConfig: object;
config: object;
onReady: Function;
onError: Function;
}>
& {
context?: { create( ...args: any ): Promise<TContext> };
watchdogConfig?: WatchdogConfig;
config?: ContextConfig;
onReady?: ( context: TContext, watchdog: ContextWatchdog<TContext> ) => void;
onError?: ( error: Error, details: ErrorDetails ) => void;
children?: ReactNode;
};
type Props<TContext extends Context> = {
id?: string;
isLayoutReady?: boolean;
context?: { create( ...args: any ): Promise<TContext> };
watchdogConfig?: WatchdogConfig;
config?: ContextConfig;
onReady?: ( context: TContext, watchdog: ContextWatchdog<TContext> ) => void;
onError?: ( error: Error, details: ErrorDetails ) => void;
children?: ReactNode;
};

type ErrorDetails = {
phase: 'initialization' | 'runtime';
Expand Down
10 changes: 0 additions & 10 deletions src/types.ts

This file was deleted.

0 comments on commit 1ce9b95

Please sign in to comment.