dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
16 lines (15 loc) • 572 B
TypeScript
import type { ItemSchema, MapSchema, Never } from '../../../../schema/index.js';
import type { OmitKeys } from '../../../../types/omitKeys.js';
export type RequiredProperties<SCHEMA extends MapSchema | ItemSchema> = ItemSchema extends SCHEMA ? string : MapSchema extends SCHEMA ? string : {
[KEY in OmitKeys<SCHEMA['attributes'], {
props: {
hidden: true;
};
}>]: SCHEMA['attributes'][KEY]['props'] extends {
required: Never;
} ? never : KEY;
}[OmitKeys<SCHEMA['attributes'], {
props: {
hidden: true;
};
}>];