Stricter ID types (#1439)

We noticed that when inferring the type of a shape from its ID, it was
getting inferred as `any` which was hiding some issues. This diff
switches `BaseRecord`'s automatic ID to an explicit one, which lets us
pass in our correct `TLShapeId` definition and still have it play nicely
with other places.

### Change Type

- [x] `patch` — Bug Fix

### Release Notes

[internal only, covered by #1432 changelog]

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
alex 2023-05-24 12:25:41 +01:00 committed by GitHub
parent eb26964130
commit 0375b5d86d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 331 additions and 286 deletions

View file

@ -211,21 +211,22 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
trackEvent('toggle-auto-size', { source })
app.mark()
app.updateShapes(
(
app.selectedShapes.filter(
(shape) => app.isShapeOfType(shape, TLTextUtil) && shape.props.autoSize === false
) as TLTextShape[]
).map((shape) => {
return {
id: shape.id,
type: shape.type,
props: {
...shape.props,
w: 8,
autoSize: true,
},
}
})
app.selectedShapes
.filter(
(shape): shape is TLTextShape =>
app.isShapeOfType(shape, TLTextUtil) && shape.props.autoSize === false
)
.map((shape) => {
return {
id: shape.id,
type: shape.type,
props: {
...shape.props,
w: 8,
autoSize: true,
},
}
})
)
},
},