Get type from select object ?
Is it possible to get the type from my select object ? I know its inferred in the response, which gives me the correct type. But i want to be able also set the type myself so it can be used in other files.
const SourceSelectFields = {
siteCode: mapboxSources.siteCode,
id: mapboxSources.id,
type: mapboxSources.type,
url: mapboxSources.url,
isFunction: mapboxSources.isFunction,
tiles: sql
json_group_array(${mapboxSourceTiles.tile})
.mapWith(
(json: string) => JSON.parse(json) as string[]
),
};
type SourceWithField = typeof SourceSelectFields //For instance something like so ?2 Replies
I go about it this way:
you can further improve on this by providing the select with the correct type.
The following is a type that i put together to get Select/Columns/With typing for by providing a table
This has som caveats though... (eg: Columns/With types only work for findMany)
Hope this helps
Great thanks !