better auto-generated docs for Tldraw and TldrawEditor (#4012)

Simplify the types used by the props of the `Tldraw` and `TldrawEditor`
components. This doesn't make the docs perfect, but it makes them quite
a bit better than they were.


![image](https://github.com/tldraw/tldraw/assets/1489520/66c72e0e-c22b-4414-b194-f0598e4a3736)


### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `docs` — Changes to the documentation, examples, or templates.
- [x] `improvement` — Improving existing features
This commit is contained in:
alex 2024-06-24 16:55:46 +01:00 committed by GitHub
parent 8ac48877de
commit 4ccac5da96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 147 additions and 108 deletions

View file

@ -4,18 +4,28 @@ import { TLAnyBindingUtilConstructor, checkBindings } from './defaultBindings'
import { TLAnyShapeUtilConstructor, checkShapesAndAddCore } from './defaultShapes'
/** @public */
export type TLStoreOptions = {
export interface TLStoreBaseOptions {
/** The initial data for the store. */
initialData?: SerializedStore<TLRecord>
/** The default name for the store. */
defaultName?: string
id?: string
} & (
| {
shapeUtils?: readonly TLAnyShapeUtilConstructor[]
migrations?: readonly MigrationSequence[]
bindingUtils?: readonly TLAnyBindingUtilConstructor[]
}
| { schema?: StoreSchema<TLRecord, TLStoreProps> }
)
}
/** @public */
export type TLStoreOptions = TLStoreBaseOptions &
(
| {
id?: string
shapeUtils?: readonly TLAnyShapeUtilConstructor[]
migrations?: readonly MigrationSequence[]
bindingUtils?: readonly TLAnyBindingUtilConstructor[]
}
| {
id?: string
schema?: StoreSchema<TLRecord, TLStoreProps>
}
)
/** @public */
export type TLStoreEventInfo = HistoryEntry<TLRecord>