ValidateFieldMaps
ValidateFieldMaps<
TPermissions,TSubjects> ={ [R in keyof TPermissions]: TPermissions[R] extends object ? { [S in keyof TPermissions[R]]: S extends keyof TSubjects ? TPermissions[R][S] extends object ? { [A in keyof TPermissions[R][S]]: ExcessFieldKeys<FieldMapReturnOf<(...)[(...)][A]>, FieldPermissionKey<(...)[(...)] extends { data: ... } ? D : unknown>> extends never ? TPermissions[R][S][A] : FieldMapError<ExcessFieldKeys<FieldMapReturnOf<(...)[(...)]>, FieldPermissionKey<(...) extends (...) ? (...) : (...)>>> } : TPermissions[R][S] : TPermissions[R][S] } : TPermissions[R] }
Defined in: packages/core/src/access/types.ts:870
Replaces every action entry whose returned field map names an unknown field with a FieldMapError, leaving every valid entry as it was.
Exists because excess-property checking does not reach an object literal
returned from a contextually typed arrow. Intersecting the inferred
permissions literal with this mapped type turns a bad key into a
STRUCTURAL mismatch instead, which needs no freshness — and it reports the
key by name at the exact property, which freshness would not have.
Walks role → subject → action and touches nothing else: a boolean role
entry, a boolean subject entry, a subject key that is not a declared
subject, and the role-level wildcard all pass through unchanged, as does any
check that cannot return a map.
Type Parameters
Section titled “Type Parameters”TPermissions
Section titled “TPermissions”TPermissions
The inferred permissions literal.
TSubjects
Section titled “TSubjects”TSubjects
The resolved SubjectMap.