Skip to content

index.TypeAlias.RequireCanBare

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

Type Alias: RequireCanBare<TSubjectMap>

type RequireCanBare<TSubjectMap> = <K>(action, subject, getSubjectData?, options?) => CheckableRule;

Defined in: packages/graphql-casl/src/createCan.ts:343

The rule builder returned by createCan when no buildSubject tagger is provided. Only bare-subject checks are possible: getSubjectData is omitted because, without a tagger, the built subject would carry no __typename, so CASL could not classify it and every conditioned check would silently fail. Pass a buildSubject to createCan to unlock condition checks.

Type Parameters

TSubjectMap

TSubjectMap extends Record<string, object>

The subject map, e.g. SubjectMap<Resolvers, ResolversTypes>.

Type Parameters

K

K extends keyof TSubjectMap & string

Parameters

action

Action

subject

K

getSubjectData?

undefined

options?

CanRuleOptions

Returns

CheckableRule

API Reference

Clone this wiki locally