/** * @license * Copyright 2022 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import { ReactiveElement } from '@lit/reactive-element'; import { Context } from '../create-context.js'; /** * A property decorator that adds a ContextConsumer controller to the component * which will try and retrieve a value for the property via the Context API. * * @param context A Context identifier value created via `createContext` * @param subscribe An optional boolean which when true allows the value to be updated * multiple times. * * @example * * ```ts * import {consume} from '@lit/context'; * import {loggerContext, Logger} from 'community-protocols/logger'; * * class MyElement { * @consume({context: loggerContext}) * logger?: Logger; * * doThing() { * this.logger!.log('thing was done'); * } * } * ``` * @category Decorator */ export declare function consume({ context, subscribe, }: { context: Context; subscribe?: boolean; }): ConsumeDecorator; /** * Generates a public interface type that removes private and protected fields. * This allows accepting otherwise incompatible versions of the type (e.g. from * multiple copies of the same package in `node_modules`). */ type Interface = { [K in keyof T]: T[K]; }; type ConsumeDecorator = { >>(protoOrDescriptor: Proto, name?: K): FieldMustMatchProvidedType; >, V extends ValueType>(value: ClassAccessorDecoratorTarget, context: ClassAccessorDecoratorContext): void; }; type DecoratorReturn = void | any; type FieldMustMatchProvidedType = Obj extends Record ? [ ProvidedType ] extends [ConsumingType] ? DecoratorReturn : { message: 'provided type not assignable to consuming field'; provided: ProvidedType; consuming: ConsumingType; } : Obj extends Partial> ? [ ProvidedType ] extends [ConsumingType | undefined] ? DecoratorReturn : { message: 'provided type not assignable to consuming field'; provided: ProvidedType; consuming: ConsumingType | undefined; } : DecoratorReturn; export {}; //# sourceMappingURL=consume.d.ts.map