Skip to content

TableName

TableName<TTables> = Extract<keyof TTables, string> | SqlNameOf<TTables[keyof TTables]>

Defined in: packages/permissions/src/types.ts:70

Extracts the string-literal union of valid subject keys from a SchemaMap, including both the JS schema keys (e.g. "postVersions") and the SQL table names (e.g. "post_versions").

The runtime side of definePermissions<User, Schema>() builds a matching lookup table keyed by both forms, so the two string forms are fully interchangeable — whichever matches your mental model.

Without this, string subjects were accidentally constrained to JS keys only (#177), causing confusion when a schema’s JS key differs from its SQL table name (e.g. documentVersions vs document_versions).

TTables extends SchemaMap