Skip to content

index.TypeAlias.AnyResolvers

github-actions[bot] edited this page Nov 30, 2026 · 16 revisions

Type Alias: AnyResolvers

type AnyResolvers = Record<string, Record<string, unknown>>;

Defined in: packages/graphql-casl/src/rules.ts:582

The loose stand-in for a generated Resolvers type.

Remarks

PermissionsMap<AnyResolvers> accepts any type and field name, so the map compiles without codegen. Nothing is lost at runtime: applyPermissions walks the real schema and raises an aggregated PermissionsError for every key that does not exist, so a stale key still fails — at startup rather than at build.

This is the intended starting point on a large generated CRUD schema (Prisma/TypeGraphQL, Pothos CRUD, drizzle-graphql), where running typescript-resolvers over the whole surface is a project of its own. Swap in your generated Resolvers when you have them and the same map starts being checked at compile time; it is an upgrade, not a precondition.

It is also the default type argument, so omitting the generic entirely gives this behaviour rather than a misleading inference error.

Example

const permissions: PermissionsMap<AnyResolvers> = {
  Query: { notes: canUser(Actions.read, Subject.Note) },
};

API Reference

Clone this wiki locally