Skip to content

Commit

Permalink
Bring in latest gen-typescript-declarations updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed Dec 12, 2017
1 parent c9be530 commit 6a0d214
Show file tree
Hide file tree
Showing 30 changed files with 180 additions and 83 deletions.
8 changes: 4 additions & 4 deletions types/lib/elements/array-selector.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,30 @@ declare namespace Polymer {
*
* @param item Item from `items` array to deselect
*/
deselect(item: any): void|null;
deselect(item: any): void;

/**
* Deselects the given index if it is already selected.
*
* @param idx Index from `items` array to deselect
*/
deselectIndex(idx: number): void|null;
deselectIndex(idx: number): void;

/**
* Selects the given item. When `toggle` is true, this will automatically
* deselect the item if already selected.
*
* @param item Item from `items` array to select
*/
select(item: any): void|null;
select(item: any): void;

/**
* Selects the given index. When `toggle` is true, this will automatically
* deselect the item if already selected.
*
* @param idx Index from `items` array to select
*/
selectIndex(idx: number): void|null;
selectIndex(idx: number): void;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion types/lib/elements/dom-bind.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare namespace Polymer {
* Forces the element to render its content. This is typically only
* necessary to call if HTMLImports with the async attribute are used.
*/
render(): void|null;
render(): void;
}
}

Expand Down
2 changes: 1 addition & 1 deletion types/lib/elements/dom-if.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ declare namespace Polymer {
* should be called if, for example, template rendering is required to
* validate application state.
*/
render(): void|null;
render(): void;
_showHideChildren(): any;
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/lib/elements/dom-module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare namespace Polymer {
*
* @param id The id at which to register the dom-module.
*/
register(id?: string): void|null;
register(id?: string): void;
}
}

Expand Down
2 changes: 1 addition & 1 deletion types/lib/elements/dom-repeat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ declare namespace Polymer {
* should be called if, for example, template rendering is required to
* validate application state.
*/
render(): void|null;
render(): void;

/**
* Implements extension point from Templatize mixin
Expand Down
9 changes: 7 additions & 2 deletions types/lib/legacy/class.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ declare namespace Polymer {
* Note: this method will automatically also apply the `Polymer.LegacyElementMixin`
* to ensure that any legacy behaviors can rely on legacy Polymer API on
* the underlying element.
*
* @returns Returns a new Element class extended by the
* passed in `behaviors` and also by `Polymer.LegacyElementMixin`.
*/
function mixinBehaviors(behaviors: Object|any[]|null, klass: HTMLElement|(() => any)): () => any;
function mixinBehaviors(behaviors: Object|any[]|null, klass: HTMLElement|{new(): HTMLElement}): {new(): HTMLElement};


/**
Expand Down Expand Up @@ -85,8 +88,10 @@ declare namespace Polymer {
* - `ready`: called before first `attached`, after all properties of
* this element have been propagated to its template and all observers
* have run
*
* @returns Generated class
*/
function Class(info: PolymerInit): () => any;
function Class(info: PolymerInit): {new(): HTMLElement};
}

declare class PolymerGenerated {
Expand Down
24 changes: 12 additions & 12 deletions types/lib/legacy/legacy-element-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ declare namespace Polymer {
* @param attribute Attribute name to reflect.
* @param value Property value to reflect.
*/
reflectPropertyToAttribute(property: string, attribute?: string, value?: any): void|null;
reflectPropertyToAttribute(property: string, attribute?: string, value?: any): void;

/**
* Sets a typed value to an HTML attribute on a node.
Expand All @@ -177,7 +177,7 @@ declare namespace Polymer {
* @param attribute Attribute name to serialize to.
* @param node Element to set attribute to.
*/
serializeValueToAttribute(value: any, attribute: string, node: Element|null): void|null;
serializeValueToAttribute(value: any, attribute: string, node: Element|null): void;

/**
* Copies own properties (including accessor descriptors) from a source
Expand Down Expand Up @@ -238,7 +238,7 @@ declare namespace Polymer {
* `node` on which to fire the event (HTMLElement, defaults to `this`).
* @returns The new event that was fired.
*/
fire(type: string, detail?: any, options?: any): Event|null;
fire(type: string, detail?: any, options?: {bubbles?: boolean, cancelable?: boolean, composed?: boolean}): Event|null;

/**
* Convenience method to add an event listener on a given element,
Expand All @@ -248,7 +248,7 @@ declare namespace Polymer {
* @param eventName Name of event to listen for.
* @param methodName Name of handler method on `this` to call.
*/
listen(node: Element|null, eventName: string, methodName: string): void|null;
listen(node: Element|null, eventName: string, methodName: string): void;

/**
* Convenience method to remove an event listener from a given element,
Expand All @@ -259,7 +259,7 @@ declare namespace Polymer {
* @param methodName Name of handler method on `this` to not call
* anymore.
*/
unlisten(node: Element|null, eventName: string, methodName: string): void|null;
unlisten(node: Element|null, eventName: string, methodName: string): void;

/**
* Override scrolling behavior to all direction, one direction, or none.
Expand All @@ -275,7 +275,7 @@ declare namespace Polymer {
* @param node Element to apply scroll direction setting.
* Defaults to `this`.
*/
setScrollDirection(direction?: string, node?: Element|null): void|null;
setScrollDirection(direction?: string, node?: Element|null): void;

/**
* Convenience method to run `querySelector` on this local DOM scope.
Expand All @@ -292,7 +292,7 @@ declare namespace Polymer {
* This should not be necessary as of Polymer 2.0.2 and is provided only
* for backwards compatibility.
*/
distributeContent(): void|null;
distributeContent(): void;

/**
* Returns a list of nodes that are the effective childNodes. The effective
Expand Down Expand Up @@ -450,14 +450,14 @@ declare namespace Polymer {
*
* @param jobName The name of the debouncer started with `debounce`
*/
flushDebouncer(jobName: string): void|null;
flushDebouncer(jobName: string): void;

/**
* Cancels an active debouncer. The `callback` will not be called.
*
* @param jobName The name of the debouncer started with `debounce`
*/
cancelDebouncer(jobName: string): void|null;
cancelDebouncer(jobName: string): void;

/**
* Runs a callback function asynchronously.
Expand All @@ -479,7 +479,7 @@ declare namespace Polymer {
* @param handle Handle returned from original `async` call to
* cancel.
*/
cancelAsync(handle: number): void|null;
cancelAsync(handle: number): void;

/**
* Convenience method for creating an element and configuring it.
Expand Down Expand Up @@ -547,7 +547,7 @@ declare namespace Polymer {
* @param node Element to apply the transform to.
* Defaults to `this`
*/
transform(transformText: string, node?: Element|null): void|null;
transform(transformText: string, node?: Element|null): void;

/**
* Cross-platform helper for setting an element's CSS `translate3d`
Expand All @@ -559,7 +559,7 @@ declare namespace Polymer {
* @param node Element to apply the transform to.
* Defaults to `this`.
*/
translate3d(x: number, y: number, z: number, node?: Element|null): void|null;
translate3d(x: number, y: number, z: number, node?: Element|null): void;

/**
* Removes an item from an array, if it exists.
Expand Down
2 changes: 2 additions & 0 deletions types/lib/legacy/polymer-fn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@
* `customElements.define(info.is, Polymer.Class(info));`
*
* See `Polymer.Class` for details on valid legacy metadata format for `info`.
*
* @returns Generated class
*/
declare function Polymer(info: PolymerInit): HTMLElement;
8 changes: 6 additions & 2 deletions types/lib/legacy/polymer.dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ declare namespace Polymer {

/**
* Cross-platform `element.matches` shim.
*
* @returns True if node matched selector
*/
function matchesSelector(node: Element, selector: string): boolean;
}
Expand All @@ -55,12 +57,12 @@ declare namespace Polymer {
* @param observerHandle Observer instance
* to disconnect.
*/
unobserveNodes(observerHandle: Polymer.FlattenedNodesObserver|null): void|null;
unobserveNodes(observerHandle: Polymer.FlattenedNodesObserver|null): void;

/**
* Provided as a backwards-compatible API only. This method does nothing.
*/
notifyObserver(): void|null;
notifyObserver(): void;

/**
* Returns true if the provided node is contained with this element's
Expand Down Expand Up @@ -133,6 +135,8 @@ declare namespace Polymer {
* Note that in Polymer 2.x use of `Polymer.dom` is no longer required and
* in the majority of cases simply facades directly to the standard native
* API.
*
* @returns Wrapper providing either node API or event API
*/
function dom(obj: Node|Event|null): DomApi|EventApi|null;
}
Expand Down
2 changes: 1 addition & 1 deletion types/lib/legacy/templatizer-behavior.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ declare namespace Polymer {
* strict dirty-checking for objects and arrays (always consider them to
* be "dirty"). Defaults to false.
*/
templatize(template: HTMLTemplateElement|null, mutableData?: boolean): void|null;
templatize(template: HTMLTemplateElement|null, mutableData?: boolean): void;

/**
* Creates an instance of the template prepared by `templatize`. The object
Expand Down
2 changes: 1 addition & 1 deletion types/lib/mixins/element-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ declare namespace Polymer {
* @param properties Bag of custom property key/values to
* apply to this element.
*/
updateStyles(properties?: Object|null): void|null;
updateStyles(properties?: Object|null): void;

/**
* Rewrites a given URL relative to a base URL. The base URL defaults to
Expand Down
24 changes: 12 additions & 12 deletions types/lib/mixins/property-accessors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ declare namespace Polymer {
* Provided as an override point for performing any setup work prior
* to initializing the property accessor system.
*/
_initializeProperties(): void|null;
_initializeProperties(): void;

/**
* Called at instance time with bag of properties that were overwritten
Expand All @@ -66,7 +66,7 @@ declare namespace Polymer {
* @param props Bag of property values that were overwritten
* when creating property accessors.
*/
_initializeProtoProperties(props: Object|null): void|null;
_initializeProtoProperties(props: Object|null): void;

/**
* Called at ready time with bag of instance properties that overwrote
Expand All @@ -79,7 +79,7 @@ declare namespace Polymer {
* @param props Bag of property values that were overwritten
* when creating property accessors.
*/
_initializeInstanceProperties(props: Object|null): void|null;
_initializeInstanceProperties(props: Object|null): void;

/**
* Ensures the element has the given attribute. If it does not,
Expand All @@ -88,7 +88,7 @@ declare namespace Polymer {
* @param attribute Name of attribute to ensure is set.
* @param value of the attribute.
*/
_ensureAttribute(attribute: string, value: string): void|null;
_ensureAttribute(attribute: string, value: string): void;

/**
* Deserializes an attribute to its associated property.
Expand All @@ -100,7 +100,7 @@ declare namespace Polymer {
* @param value of the attribute.
* @param type type to deserialize to.
*/
_attributeToProperty(attribute: string, value: string|null, type?: any): void|null;
_attributeToProperty(attribute: string, value: string|null, type?: any): void;

/**
* Serializes a property to its associated attribute.
Expand All @@ -109,7 +109,7 @@ declare namespace Polymer {
* @param attribute Attribute name to reflect.
* @param value Property value to refect.
*/
_propertyToAttribute(property: string, attribute?: string, value?: any): void|null;
_propertyToAttribute(property: string, attribute?: string, value?: any): void;

/**
* Sets a typed value to an HTML attribute on a node.
Expand All @@ -123,7 +123,7 @@ declare namespace Polymer {
* @param value Value to serialize.
* @param attribute Attribute name to serialize to.
*/
_valueToNodeAttribute(node: Element|null, value: any, attribute: string): void|null;
_valueToNodeAttribute(node: Element|null, value: any, attribute: string): void;

/**
* Converts a typed JavaScript value to a string.
Expand Down Expand Up @@ -176,7 +176,7 @@ declare namespace Polymer {
* @param readOnly When true, no setter is created; the
* protected `_setProperty` function must be used to set the property
*/
_createPropertyAccessor(property: string, readOnly?: boolean): void|null;
_createPropertyAccessor(property: string, readOnly?: boolean): void;

/**
* Returns true if this library created an accessor for the given property.
Expand All @@ -193,7 +193,7 @@ declare namespace Polymer {
* @param property Name of the property
* @param value Value to set
*/
_setProperty(property: string, value: any): void|null;
_setProperty(property: string, value: any): void;

/**
* Updates the local storage for a property, records the previous value,
Expand All @@ -219,7 +219,7 @@ declare namespace Polymer {
* Marks the properties as invalid, and enqueues an async
* `_propertiesChanged` callback.
*/
_invalidateProperties(): void|null;
_invalidateProperties(): void;

/**
* Call to enable property accessor processing. Before this method is
Expand All @@ -229,15 +229,15 @@ declare namespace Polymer {
* It is safe to call this method multiple times as it only turns on
* property accessors once.
*/
_enableProperties(): void|null;
_enableProperties(): void;

/**
* Calls the `_propertiesChanged` callback with the current set of
* pending changes (and old values recorded when pending changes were
* set), and resets the pending set of changes. Generally, this method
* should not be called in user code.
*/
_flushProperties(): void|null;
_flushProperties(): void;

/**
* Lifecycle callback called the first time properties are being flushed.
Expand Down
Loading

0 comments on commit 6a0d214

Please sign in to comment.