OneTable provides TypeScript type declaration files so that OneTable APIs, requests and responses can be fully type checked.
Using the magic of TypeScript dynamic typing, OneTable automatically converts your OneTable schema into fully typed generic Model APIs. This way, OneTable creates type declarations for your table entities and attributes so that TypeScript will catch any invalid entity or entity attribute references.
When defining your OneTable schema for Typescript, you must use type objects (String, Date, Number etc) as the value for your
You also need to append the
as const to the end of your models in the schema.
Typed Application Models
Entity generic type, you can create types for your schema models.
With these types, you can declare typed variables.
Similarly you can use a typed version of
getModel to retrieve a typed Model to interact with OneTable.