mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Expose update scene via refs (#2217)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
8a10f2a0b8
commit
63566ecb92
4 changed files with 178 additions and 132 deletions
14
src/global.d.ts
vendored
14
src/global.d.ts
vendored
|
@ -40,3 +40,17 @@ type ResolutionType<T extends (...args: any) => any> = T extends (
|
|||
|
||||
// https://github.com/krzkaczor/ts-essentials
|
||||
type MarkOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
|
||||
// type getter for interface's callable type
|
||||
// src: https://stackoverflow.com/a/58658851/927631
|
||||
// -----------------------------------------------------------------------------
|
||||
type SignatureType<T> = T extends (...args: infer R) => any ? R : never;
|
||||
type CallableType<T extends (...args: any[]) => any> = (
|
||||
...args: SignatureType<T>
|
||||
) => ReturnType<T>;
|
||||
// --------------------------------------------------------------------------—
|
||||
|
||||
// Type for React.forwardRef --- supply only the first generic argument T
|
||||
type ForwardRef<T, P = any> = Parameters<
|
||||
CallableType<React.ForwardRefRenderFunction<T, P>>
|
||||
>[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue