SDK does not allow to overwrite field of core collection
Author: fabian-hillerCreated Aug 12, 2024Updated Sep 15, 2026
LabelsImprovementSDK
Describe the Improvement
In my application, I know that a user will always have an email because that is the only way I allow to authenticate. So I want to override the email field of the directus_users core collection to be string instead of string | null. Unfortunately this does not work.
Here is a code example that can be used to reproduce the "problem":
import { createDirectus, readUsers, rest } from '@directus/sdk';
interface CustomUser {
email: string;
}
interface Collections {
directus_users: CustomUser;
}
const client = createDirectus<Collections>('URL').with(rest());
const users = await client.request(readUsers({ fields: ['email'] }));
const email = users[0]?.email; // string | nullSource: directus/directus