mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
prevent newElementWith from accepting undefined values
This commit is contained in:
parent
9cfe7b45e5
commit
2dc84f04be
1 changed files with 5 additions and 2 deletions
|
@ -84,9 +84,12 @@ export const mutateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
|||
Scene.getScene(element)?.informMutation();
|
||||
};
|
||||
|
||||
export const newElementWith = <TElement extends ExcalidrawElement>(
|
||||
export const newElementWith = <
|
||||
TElement extends ExcalidrawElement,
|
||||
K extends keyof Omit<TElement, "id" | "version" | "versionNonce">
|
||||
>(
|
||||
element: TElement,
|
||||
updates: ElementUpdate<TElement>,
|
||||
updates: Pick<TElement, K>,
|
||||
): TElement => ({
|
||||
...element,
|
||||
...updates,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue