Whats the correct type for FileMetadata now?
Since
getFileMetadata
is deprecated, I'm changing my code to use db.system.get(<storageId>)
. As the docs point out, the return is not anymore of type "FileMetadata". But what is the correct type now?1 Reply
Looking into
dataModel.d.ts
in convex/generated. The definition of document IDs seems to contain both my tables and Systemtables:
export type Id<TableName extends TableNames | SystemTableNames> =
GenericId<TableName>;
But the Doc definition omits SystemTableNames:
export type Doc<TableName extends TableNames> = DocumentByName<
DataModel,
TableName
>;
Should this not also be TableNames | SystemTableNames
?
Then we could just use Doc<"_storage"> for the Metadata type.
Hmm, i managed to solve this by defining a
SystemDoc type, similar to the
Doc type:
```export type SystemDoc<TableName extends SystemTableNames> = DocumentByName<
SystemDataModel,
TableName
>;
```
Then i can specify metadata type as
SystemDoc<"_storage">`.
Should something like this be included in the generated dataModel.d.ts? Or maybe it is, and I'm just not seeing it 🙂