createShapePropsMigrationIds
See source codeCreates properly formatted migration IDs for shape properties.
Generates standardized migration IDs following the convention:
com.tldraw.shape.{shapeType}/{version}
function createShapePropsMigrationIds<
const S extends string,
const T extends Record<string, number>,
>(
shapeType: S,
ids: T
): {
[k in keyof T]: `com.tldraw.shape.${S}/${T[k]}`
}
Example
const myShapeVersions = createShapePropsMigrationIds('custom', {
AddColor: 1,
AddSize: 2,
RefactorProps: 3,
})
// Result: {
// AddColor: 'com.tldraw.shape.custom/1',
// AddSize: 'com.tldraw.shape.custom/2',
// RefactorProps: 'com.tldraw.shape.custom/3'
// }
Parameters
Name | Description |
---|---|
|
The type of shape these migrations apply to |
|
Record mapping migration names to version numbers |
Returns
{
[k in keyof T]: `com.tldraw.shape.${S}/${T[k]}`
}
Record with the same keys but formatted migration ID values
Prev
createShapeIdNext
createShapePropsMigrationSequence