MatchingResource <S>
Index
Constructors
Properties
Methods
Constructors
constructor
Type parameters
Parameters
actual: AResource<S, any>
The resource that was matched.
optionalschemaTranslator: (synth: BaseResourceSchema) => S
Reads
actualas the matched schema, when the two differ.
Returns MatchingResource<S>
Properties
optionalreadonlyschemaTranslator
Reads actual as the matched schema, when the two differ.
Type declaration
Parameters
synth: BaseResourceSchema
Returns S
Methods
getActual
The resource itself, with its schema hidden - read it through MatchingResource.getSchemaInstance.
Returns AResource<Omit<S, properties | response | tags> & { properties: Record<never, never> } & { response: Record<never, never> } & { tags: Record<never, never> }, any>
getSchemaInstance
The resource read as the schema you matched on.
Returns S
getSchemaInstanceInResourceAction
The resource read as the schema you matched on, with its
responsetyped as fully populated. Only call it from a resource action, where the parent is guaranteed to already exist.Returns Omit<S, response> & { response: Required<S[response]> }
hasSchemaTranslator
Whether the match went through a schema translation.
Returns boolean
A resource found by schema. See MatchingAnchor.
Pass one wherever a resource parent is expected, and the translation is carried into the graph, so the child keeps reading its parent through the schema it was written against.
Types