make restore migration types required (#1977)
This commit is contained in:
parent
925db9dcca
commit
ab980b252c
@ -24,8 +24,8 @@ const getFontFamilyByName = (fontFamilyName: string): FontFamily => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function migrateElementWithProperties<T extends ExcalidrawElement>(
|
function migrateElementWithProperties<T extends ExcalidrawElement>(
|
||||||
element: T,
|
element: Required<T>,
|
||||||
extra: Omit<T, keyof ExcalidrawElement>,
|
extra: Omit<Required<T>, keyof ExcalidrawElement>,
|
||||||
): T {
|
): T {
|
||||||
const base: Pick<T, keyof ExcalidrawElement> = {
|
const base: Pick<T, keyof ExcalidrawElement> = {
|
||||||
type: element.type,
|
type: element.type,
|
||||||
@ -93,6 +93,7 @@ const migrateElement = (
|
|||||||
[element.width, element.height],
|
[element.width, element.height],
|
||||||
]
|
]
|
||||||
: element.points,
|
: element.points,
|
||||||
|
lastCommittedPoint: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// generic elements
|
// generic elements
|
||||||
|
@ -210,13 +210,12 @@ export const updateTextElement = (
|
|||||||
export const newLinearElement = (
|
export const newLinearElement = (
|
||||||
opts: {
|
opts: {
|
||||||
type: ExcalidrawLinearElement["type"];
|
type: ExcalidrawLinearElement["type"];
|
||||||
lastCommittedPoint?: ExcalidrawLinearElement["lastCommittedPoint"];
|
|
||||||
} & ElementConstructorOpts,
|
} & ElementConstructorOpts,
|
||||||
): NonDeleted<ExcalidrawLinearElement> => {
|
): NonDeleted<ExcalidrawLinearElement> => {
|
||||||
return {
|
return {
|
||||||
..._newElementBase<ExcalidrawLinearElement>(opts.type, opts),
|
..._newElementBase<ExcalidrawLinearElement>(opts.type, opts),
|
||||||
points: [],
|
points: [],
|
||||||
lastCommittedPoint: opts.lastCommittedPoint || null,
|
lastCommittedPoint: null,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export type ExcalidrawLinearElement = _ExcalidrawElementBase &
|
|||||||
Readonly<{
|
Readonly<{
|
||||||
type: "arrow" | "line" | "draw";
|
type: "arrow" | "line" | "draw";
|
||||||
points: readonly Point[];
|
points: readonly Point[];
|
||||||
lastCommittedPoint?: Point | null;
|
lastCommittedPoint: Point | null;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type PointerType = "mouse" | "pen" | "touch";
|
export type PointerType = "mouse" | "pen" | "touch";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user