import { createDirectus, rest, readFiles } from "@directus/sdk"; interface Example { id: string; related: number[] | Relational[]; } interface Relational { id: number; } interface Schema { example: Example[]; relational: Relational[]; // For some unexplained reason this fixes it // directus_non_existent: string; } const directus = createDirectus<Schema>("http://0.0.0.0:8055").with(rest()); const result = await directus.request( readFiles({ fields: ["non-existing", "count(non-existing)"], }) ); console.log(result[0]);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter