dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
12 lines (11 loc) • 452 B
TypeScript
/**
* Possible Table Key or Index attribute type
*/
export type IndexableKeyType = 'string' | 'binary' | 'number';
/**
* Returns the corresponding TS type of a Key or Index attribute type
*
* @param KEY_TYPE Attribute Type
* @return Type
*/
export type ResolveIndexableKeyType<KEY_TYPE extends IndexableKeyType> = KEY_TYPE extends 'string' ? string : KEY_TYPE extends 'number' ? number | bigint : KEY_TYPE extends 'binary' ? Uint8Array : never;