From 063a6ccc292bedc15c6210e8fdc0bcfbaa6211b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Mar 2015 10:44:54 +0100 Subject: [PATCH] fixed definition files for polymer (description on app router and any types) --- polymer/polymer-tests.ts | 12 ++++-------- polymer/polymer.app-router.d.ts | 5 +++++ polymer/polymer.d.ts | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/polymer/polymer-tests.ts b/polymer/polymer-tests.ts index e24445aca..80227cab6 100644 --- a/polymer/polymer-tests.ts +++ b/polymer/polymer-tests.ts @@ -10,10 +10,6 @@ class AbstractPolymerElement implements PolymerElement { asyncFire(eventName: string, details?: any, targetNode?: any, bubbles?: boolean, cancelable?: boolean): void { } cancelUnbindAll(): void { } - - // these are mix in API's.. hacky way to deal with them at the moment. - resizableAttachedHandler; - resizableDetachedHandler; } class AbstractWebComponent extends AbstractPolymerElement { @@ -30,11 +26,10 @@ class AbstractWebComponent extends AbstractPolymerElement { } } -function registerWebComponent(webComponentClass: Function, ...mixins): void { +function registerWebComponent(webComponentClass: Function, ...mixins: any[]): void { // we need a flat object, without prototype in order to polymer to work on our components - var flattenedComponent = {}; - var poly_func = ["async", "job", "fire", "asyncFire", "cancelUnbindAll"]; + var flattenedComponent: any = {}; if (mixins) { // apply mixins mixins.forEach(mixin => { @@ -47,7 +42,8 @@ function registerWebComponent(webComponentClass: Function, ...mixins): void { } var webComponent: AbstractWebComponent = new (webComponentClass)(); for (var i in webComponent) { - if (!_.contains(poly_func, i)) { + // do not include polymer functions + if (i != "async" && i != "job" && i != "fire" && i != "asyncFire" && i != "cancelUnbindAll") { flattenedComponent[i] = webComponent[i]; } } diff --git a/polymer/polymer.app-router.d.ts b/polymer/polymer.app-router.d.ts index 1643c58a6..633479ba2 100644 --- a/polymer/polymer.app-router.d.ts +++ b/polymer/polymer.app-router.d.ts @@ -1,3 +1,8 @@ +// Type definitions for app-router +// Project: https://github.com/erikringsmuth/app-router +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module PolymerComponents { module App { export interface Router extends HTMLElement { diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index f501d8655..dfb812f8c 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -22,16 +22,16 @@ interface PolymerElement { interface Polymer { - importElements(node: Node, callback: Function); + importElements(node: Node, callback: Function): void; import(url: string, callback?: () => void): void; - mixin(target: any, ...obj1): any; + mixin(target: any, ...mixins: any[]): any; waitingFor(): Array; // should be an "integer" for milliseconds forceReady(timeout: number): void; - (tag_name: string, prototype: PolymerElement): void; - (tag_name: string, prototype: any): void; + (tagName: string, prototype: PolymerElement): void; + (tagName: string, prototype: any): void; (prototype: PolymerElement): void; (): void; // hacks for mixins