|
| 1 | +/** |
| 2 | + * DO NOT EDIT |
| 3 | + * |
| 4 | + * This file was automatically generated by |
| 5 | + * https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations |
| 6 | + * |
| 7 | + * To modify these typings, edit the source file(s): |
| 8 | + * lib/legacy/legacy-data-mixin.html |
| 9 | + */ |
| 10 | + |
| 11 | + |
| 12 | +// tslint:disable:variable-name Describing an API that's defined elsewhere. |
| 13 | +// tslint:disable:no-any describes the API as best we are able today |
| 14 | + |
| 15 | +/// <reference path="class.d.ts" /> |
| 16 | +/// <reference path="../../polymer.d.ts" /> |
| 17 | +/// <reference path="../utils/mixin.d.ts" /> |
| 18 | +/// <reference path="../utils/templatize.d.ts" /> |
| 19 | + |
| 20 | +declare class UndefinedArgumentError extends Error { |
| 21 | + constructor(message: any, arg: any); |
| 22 | +} |
| 23 | + |
| 24 | +declare namespace Polymer { |
| 25 | + |
| 26 | + |
| 27 | + /** |
| 28 | + * Mixin to selectively add back Polymer 1.x's `undefined` rules |
| 29 | + * governing when observers & computing functions run based |
| 30 | + * on all arguments being defined (reference https://www.polymer-project.org/1.0/docs/devguide/observers#multi-property-observers). |
| 31 | + * |
| 32 | + * When loaded, all legacy elements (defined with `Polymer({...})`) |
| 33 | + * will have the mixin applied. The mixin only restores legacy data handling |
| 34 | + * if `_legacyUndefinedCheck: true` is set on the element's prototype. |
| 35 | + * |
| 36 | + * This mixin is intended for use to help migration from Polymer 1.x to |
| 37 | + * 2.x+ by allowing legacy code to work while identifying observers and |
| 38 | + * computing functions that need undefined checks to work without |
| 39 | + * the mixin in Polymer 2. |
| 40 | + */ |
| 41 | + function LegacyDataMixin<T extends new (...args: any[]) => {}>(base: T): T & LegacyDataMixinConstructor; |
| 42 | + |
| 43 | + interface LegacyDataMixinConstructor { |
| 44 | + new(...args: any[]): LegacyDataMixin; |
| 45 | + |
| 46 | + /** |
| 47 | + * Overrides `Polyer.PropertyEffects` to wrap effect functions to |
| 48 | + * catch `UndefinedArgumentError`s and warn. |
| 49 | + * |
| 50 | + * @param templateInfo Template metadata to add effect to |
| 51 | + * @param prop Property that should trigger the effect |
| 52 | + * @param effect Effect metadata object |
| 53 | + */ |
| 54 | + _addTemplatePropertyEffect(templateInfo: object|null, prop: string, effect?: object|null): void; |
| 55 | + } |
| 56 | + |
| 57 | + interface LegacyDataMixin { |
| 58 | + readonly _legacyUndefinedCheck: any; |
| 59 | + |
| 60 | + /** |
| 61 | + * Overrides `Polyer.PropertyEffects` to wrap effect functions to |
| 62 | + * catch `UndefinedArgumentError`s and warn. |
| 63 | + * |
| 64 | + * @param property Property that should trigger the effect |
| 65 | + * @param type Effect type, from this.PROPERTY_EFFECT_TYPES |
| 66 | + * @param effect Effect metadata object |
| 67 | + */ |
| 68 | + _addPropertyEffect(property: string, type: string, effect?: object|null): void; |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +declare class LegacyDataMixin extends superClass { |
| 73 | + |
| 74 | + /** |
| 75 | + * Overrides `Polyer.PropertyEffects` to wrap effect functions to |
| 76 | + * catch `UndefinedArgumentError`s and warn. |
| 77 | + * |
| 78 | + * @param templateInfo Template metadata to add effect to |
| 79 | + * @param prop Property that should trigger the effect |
| 80 | + * @param effect Effect metadata object |
| 81 | + */ |
| 82 | + static _addTemplatePropertyEffect(templateInfo: object|null, prop: string, effect?: object|null): void; |
| 83 | + |
| 84 | + /** |
| 85 | + * Overrides `Polyer.PropertyEffects` to wrap effect functions to |
| 86 | + * catch `UndefinedArgumentError`s and warn. |
| 87 | + * |
| 88 | + * @param property Property that should trigger the effect |
| 89 | + * @param type Effect type, from this.PROPERTY_EFFECT_TYPES |
| 90 | + * @param effect Effect metadata object |
| 91 | + */ |
| 92 | + _addPropertyEffect(property: string, type: string, effect?: object|null): void; |
| 93 | +} |
0 commit comments