mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix(app.tsx): add safe check for readyPromise (#2489)
* fix(app.tsx): add safe check for readyPromise * make type-safe Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
fba37e422d
commit
8f8fd023f8
4 changed files with 15 additions and 8 deletions
10
src/types.ts
10
src/types.ts
|
@ -133,14 +133,16 @@ export declare class GestureEvent extends UIEvent {
|
|||
export type LibraryItem = readonly NonDeleted<ExcalidrawElement>[];
|
||||
export type LibraryItems = readonly LibraryItem[];
|
||||
|
||||
// NOTE ready/readyPromise props are optional for host apps' sake (our own
|
||||
// implem guarantees existence)
|
||||
export type ExcalidrawAPIRefValue =
|
||||
| (ExcalidrawImperativeAPI & {
|
||||
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
||||
ready: true;
|
||||
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
||||
ready?: true;
|
||||
})
|
||||
| {
|
||||
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
||||
ready: false;
|
||||
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
||||
ready?: false;
|
||||
};
|
||||
|
||||
export interface ExcalidrawProps {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue