Skip to content

Commit

Permalink
update types
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed Feb 21, 2018
1 parent 59d7f97 commit 5bc45ce
Show file tree
Hide file tree
Showing 20 changed files with 176 additions and 33 deletions.
28 changes: 27 additions & 1 deletion externs/closure-types.js
Expand Up @@ -1374,4 +1374,30 @@ Polymer_ArraySelectorMixin.prototype.select = function(item){};
* @param {number} idx Index from `items` array to select
* @return {void}
*/
Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){};
Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){};
/**
* @interface
*/
function Polymer_DisableUpgradeMixin(){}
/**
* @param {*} name
* @param {*} old
* @param {*} value
*/
Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value){};
/**
* @return {undefined}
*/
Polymer_DisableUpgradeMixin.prototype._initializeProperties = function(){};
/**
* @return {undefined}
*/
Polymer_DisableUpgradeMixin.prototype.connectedCallback = function(){};
/**
* @return {undefined}
*/
Polymer_DisableUpgradeMixin.prototype._enableProperties = function(){};
/**
* @return {undefined}
*/
Polymer_DisableUpgradeMixin.prototype.disconnectedCallback = function(){};
2 changes: 1 addition & 1 deletion test/unit/disable-upgrade.html
Expand Up @@ -79,7 +79,7 @@ <h2 id="element">[[prop]]</h2>
Polymer.Class = function(info) {
const ctor = polymerClass(info);
return Polymer.DisableUpgradeMixin(ctor);
}
};

Polymer({
is: 'x-disabled-legacy',
Expand Down
10 changes: 10 additions & 0 deletions types/externs/closure-types.d.ts
@@ -0,0 +1,10 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* externs/closure-types.js
*/

10 changes: 10 additions & 0 deletions types/externs/polymer-externs.d.ts
@@ -0,0 +1,10 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* externs/polymer-externs.js
*/

10 changes: 10 additions & 0 deletions types/externs/polymer-internal-shared-types.d.ts
@@ -0,0 +1,10 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* externs/polymer-internal-shared-types.js
*/

10 changes: 10 additions & 0 deletions types/externs/webcomponents-externs.d.ts
@@ -0,0 +1,10 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* externs/webcomponents-externs.js
*/

18 changes: 18 additions & 0 deletions types/gulpfile.d.ts
@@ -0,0 +1,18 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* gulpfile.js
*/

declare class BackfillStream {
_transform(file: any, enc: any, cb: any): any;
_flush(cb: any): any;
}

declare class AddClosureTypeImport {
_transform(file: any, enc: any, cb: any): any;
}
2 changes: 1 addition & 1 deletion types/lib/elements/array-selector.d.ts
Expand Up @@ -29,7 +29,7 @@ declare namespace Polymer {
* representing the last selected item. When `multi` is true, `selected`
* is an array of multiply selected items.
*/
function ArraySelectorMixin<T extends new (...args: any[]) => {}>(base: T): T & ArraySelectorMixinConstructor & Polymer.ElementMixinConstructor & Polymer.PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor & Polymer.PropertiesMixinConstructor;
function ArraySelectorMixin<T extends new (...args: any[]) => {}>(base: T): T & ArraySelectorMixinConstructor & Polymer.ElementMixinConstructor;

interface ArraySelectorMixinConstructor {
new(...args: any[]): ArraySelectorMixin;
Expand Down
13 changes: 0 additions & 13 deletions types/lib/elements/dom-module.d.ts
Expand Up @@ -33,19 +33,6 @@ declare namespace Polymer {
* let img = customElements.get('dom-module').import('foo', 'img');
*/
class DomModule extends HTMLElement {

/**
* The absolute URL of the original location of this `dom-module`.
*
* This value will differ from this element's `ownerDocument` in the
* following ways:
* - Takes into account any `assetpath` attribute added during bundling
* to indicate the original location relative to the bundled location
* - Uses the HTMLImports polyfill's `importForElement` API to ensure
* the path is relative to the import document's location since
* `ownerDocument` is not currently polyfilled
*
*/
readonly assetpath: any;

/**
Expand Down
2 changes: 1 addition & 1 deletion types/lib/legacy/legacy-element-mixin.d.ts
Expand Up @@ -26,7 +26,7 @@ declare namespace Polymer {
* found on the Polymer 1.x `Polymer.Base` prototype applied to all elements
* defined using the `Polymer({...})` function.
*/
function LegacyElementMixin<T extends new (...args: any[]) => {}>(base: T): T & LegacyElementMixinConstructor & Polymer.ElementMixinConstructor & Polymer.PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor & Polymer.PropertiesMixinConstructor & Polymer.GestureEventListenersConstructor;
function LegacyElementMixin<T extends new (...args: any[]) => {}>(base: T): T & LegacyElementMixinConstructor & Polymer.ElementMixinConstructor & Polymer.GestureEventListenersConstructor;

interface LegacyElementMixinConstructor {
new(...args: any[]): LegacyElementMixin;
Expand Down
4 changes: 0 additions & 4 deletions types/lib/legacy/mutable-data-behavior.d.ts
Expand Up @@ -66,8 +66,6 @@ declare namespace Polymer {
_shouldPropertyChange(property: string, value: any, old: any): boolean;
}

const MutableDataBehavior: object;

/**
* Legacy element behavior to add the optional ability to skip strict
* dirty-checking for objects and arrays (always consider them to be
Expand Down Expand Up @@ -130,6 +128,4 @@ declare namespace Polymer {
*/
_shouldPropertyChange(property: string, value: any, old: any): boolean;
}

const OptionalMutableDataBehavior: object;
}
2 changes: 0 additions & 2 deletions types/lib/legacy/templatizer-behavior.d.ts
Expand Up @@ -111,6 +111,4 @@ declare namespace Polymer {
*/
modelForElement(el: HTMLElement|null): TemplateInstanceBase|null;
}

const Templatizer: object;
}
2 changes: 1 addition & 1 deletion types/lib/mixins/dir-mixin.d.ts
Expand Up @@ -29,7 +29,7 @@ declare namespace Polymer {
* - Changing `dir` at runtime is supported.
* - Opting out of the global direction styling is permanent
*/
function DirMixin<T extends new (...args: any[]) => {}>(base: T): T & DirMixinConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor;
function DirMixin<T extends new (...args: any[]) => {}>(base: T): T & DirMixinConstructor & Polymer.PropertyAccessorsConstructor;

interface DirMixinConstructor {
new(...args: any[]): DirMixin;
Expand Down
65 changes: 65 additions & 0 deletions types/lib/mixins/disable-upgrade-mixin.d.ts
@@ -0,0 +1,65 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* lib/mixins/disable-upgrade-mixin.html
*/

declare namespace Polymer {


/**
* Element class mixin that allows the element to boot up in a non-enabled
* state when the `disable-upgrade` attribute is present. This mixin is
* designed to be used with element classes like Polymer.Element that perform
* initial startup work when they are first connected. When the
* `disable-upgrade` attribute is removed, if the element is connected, it
* boots up and "enables" as it otherwise would; if it is not connected, the
* element boots up when it is next connected.
*
* Using `disable-upgrade` with Polymer.Element prevents any data propagation
* to the element, any element DOM from stamping, or any work done in
* connected/disconnctedCallback from occuring, but it does not prevent work
* done in the element constructor.
*
* Note, this mixin must be applied on top of any element class that
* itself implements a `connectedCallback` so that it can control the work
* done in `connectedCallback`. For example,
*
* MyClass = Polymer.DisableUpgradeMixin(class extends BaseClass {...});
*/
function DisableUpgradeMixin<T extends new (...args: any[]) => {}>(base: T): T & DisableUpgradeMixinConstructor;

interface DisableUpgradeMixinConstructor {
new(...args: any[]): DisableUpgradeMixin;
}

interface DisableUpgradeMixin {
attributeChangedCallback(name: any, old: any, value: any): any;

/**
* NOTE: cannot gate on attribute because this is called before
* attributes are delivered. Therefore, we stub this out and
* call `super._initializeProperties()` manually.
*/
_initializeProperties(): any;

/**
* prevent user code in connected from running
*/
connectedCallback(): any;

/**
* prevent element from turning on properties
*/
_enableProperties(): any;

/**
* only go if "enabled"
*/
disconnectedCallback(): any;
}
}
2 changes: 1 addition & 1 deletion types/lib/mixins/element-mixin.d.ts
Expand Up @@ -76,7 +76,7 @@ declare namespace Polymer {
* `observedAttributes` implementation will automatically return an array
* of dash-cased attributes based on `properties`)
*/
function ElementMixin<T extends new (...args: any[]) => {}>(base: T): T & ElementMixinConstructor & Polymer.PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor & Polymer.PropertiesMixinConstructor;
function ElementMixin<T extends new (...args: any[]) => {}>(base: T): T & ElementMixinConstructor & Polymer.PropertyEffectsConstructor & Polymer.PropertiesMixinConstructor;

interface ElementMixinConstructor {
new(...args: any[]): ElementMixin;
Expand Down
4 changes: 2 additions & 2 deletions types/lib/mixins/properties-changed.d.ts
Expand Up @@ -56,7 +56,7 @@ declare namespace Polymer {
*
* @param name Name of property
*/
typeForProperty(name: string): void;
typeForProperty(name: string): any;
}

interface PropertiesChanged {
Expand Down Expand Up @@ -84,7 +84,7 @@ declare namespace Polymer {
*
* @param property Name of the property
*/
_addPropertyToAttributeMap(property: string): void;
_addPropertyToAttributeMap(property: string): any;

/**
* Defines a property accessor for the given property.
Expand Down
2 changes: 1 addition & 1 deletion types/lib/mixins/properties-mixin.d.ts
Expand Up @@ -53,7 +53,7 @@ declare namespace Polymer {
* accessors exist on the element prototype. This method is called by
* `finalize` and finalizes the class constructor.
*/
_finalizeClass(): void;
_finalizeClass(): any;
}

interface PropertiesMixin {
Expand Down
8 changes: 4 additions & 4 deletions types/lib/mixins/property-accessors.d.ts
Expand Up @@ -24,14 +24,14 @@ declare namespace Polymer {
* For basic usage of this mixin:
*
* - Declare attributes to observe via the standard `static get observedAttributes()`. Use
* `dash-case` attribute names to represent `camelCase` property names.
* `dash-case` attribute names to represent `camelCase` property names.
* - Implement the `_propertiesChanged` callback on the class.
* - Call `MyClass.createPropertiesForAttributes()` **once** on the class to generate
* property accessors for each observed attribute. This must be called before the first
* - Call `MyClass.createPropertiesForAttributes()` **once** on the class to generate
* property accessors for each observed attribute. This must be called before the first
* instance is created, for example, by calling it before calling `customElements.define`.
* It can also be called lazily from the element's `constructor`, as long as it's guarded so
* that the call is only made once, when the first instance is created.
* - Call `this._enableProperties()` in the element's `connectedCallback` to enable
* - Call `this._enableProperties()` in the element's `connectedCallback` to enable
* the accessors.
*
* Any `observedAttributes` will automatically be
Expand Down
2 changes: 1 addition & 1 deletion types/lib/mixins/property-effects.d.ts
Expand Up @@ -46,7 +46,7 @@ declare namespace Polymer {
* whereas the default when using `PropertyAccessors` standalone is to be
* async by default.
*/
function PropertyEffects<T extends new (...args: any[]) => {}>(base: T): T & PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor;
function PropertyEffects<T extends new (...args: any[]) => {}>(base: T): T & PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor;

interface PropertyEffectsConstructor {
new(...args: any[]): PropertyEffects;
Expand Down
13 changes: 13 additions & 0 deletions types/util/minimalDocument.d.ts
@@ -0,0 +1,13 @@
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* util/minimalDocument.js
*/

declare class MinimalDocTransform {
_transform(file: any, enc: any, cb: any): any;
}

0 comments on commit 5bc45ce

Please sign in to comment.