<link rel="stylesheet" href="/_merged_assets/_static/search/noscript.css">
Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Class Mixins: TypePoliciesMixin

Optional mixin which lets you declare type policies for a component's query.

import { ApolloQueryElement } from '@apollo-elements/interfaces';
import { TypePoliciesMixin } from '@apollo-elements/mixins/type-policies-mixin';

export class HelloQueryElement extends TypePoliciesMixin(ApolloQueryElement) {
  typePolicies = {
    Greeting: {
      fields: {
        name(next) { return next ?? 'friend'; },
        greeting(next) { return next ?? 'friend'; },
      },
    },
  }
}

Lazily adds TypePolicies to the Apollo client when the element connects to the DOM, from the element's typePolicies instance property.

Signature

TypePoliciesMixin

Lazily adds TypePolicies to the Apollo client when the element connects to the DOM, from the element's typePolicies instance property.

Parameters

superclass

B

Properties

typePolicies

TypePolicies | undefined

TypePolicies to lazy-load.

Exports

import { TypePoliciesMixin } from '@apollo-elements/mixins/type-policies-mixin';