From e4ff04e164e36ee9a9de52268be208f4a162c36e Mon Sep 17 00:00:00 2001 From: lgrignon Date: Mon, 14 Sep 2015 10:56:09 +0200 Subject: [PATCH 01/19] added polymer ts definition --- polymer-ts/polymer-ts.d.ts | 127 +++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 polymer-ts/polymer-ts.d.ts diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts new file mode 100644 index 0000000000..4f44de6d28 --- /dev/null +++ b/polymer-ts/polymer-ts.d.ts @@ -0,0 +1,127 @@ +declare module polymer { + class PolymerBase extends HTMLElement { + $: any; + $$: any; + root: HTMLElement; + shadyRoot: HTMLElement; + style: CSSStyleDeclaration; + customStyle: { + [property: string]: string; + }; + arrayDelete(path: string, item: string | any): any; + async(callback: Function, waitTime?: number): any; + attachedCallback(): void; + attributeFollows(name: string, toElement: HTMLElement, fromElement: HTMLElement): void; + cancelAsync(handle: number): void; + cancelDebouncer(jobName: string): void; + classFollows(name: string, toElement: HTMLElement, fromElement: HTMLElement): void; + create(tag: string, props: Object): any; + debounce(jobName: string, callback: Function, wait?: number): void; + deserialize(value: string, type: any): any; + distributeContent(): void; + domHost(): void; + elementMatches(selector: string, node: Element): any; + fire(type: string, detail?: Object, options?: FireOptions): any; + flushDebouncer(jobName: string): void; + get(path: string | Array): any; + getContentChildNodes(slctr: string): any; + getContentChildren(slctr: string): any; + getNativePrototype(tag: string): any; + getPropertyInfo(property: string): any; + importHref(href: string, onload?: Function, onerror?: Function): any; + instanceTemplate(template: any): any; + isDebouncerActive(jobName: string): any; + linkPaths(to: string, from: string): void; + listen(node: Element, eventName: string, methodName: string): void; + mixin(target: Object, source: Object): void; + notifyPath(path: string, value: any, fromAbove?: any): void; + pop(path: string): any; + push(path: string, value: any): any; + reflectPropertyToAttribute(name: string): void; + resolveUrl(url: string): any; + scopeSubtree(container: Element, shouldObserve: boolean): void; + serialize(value: string): any; + serializeValueToAttribute(value: any, attribute: string, node: Element): void; + set(path: string, value: any, root?: Object): any; + setScrollDirection(direction: string, node: HTMLElement): void; + shift(path: string, value: any): any; + splice(path: string, start: number, deleteCount: number): any; + toggleAttribute(name: string, bool: boolean, node?: HTMLElement): void; + toggleClass(name: string, bool: boolean, node?: HTMLElement): void; + transform(transform: string, node?: HTMLElement): void; + translate3d(x: any, y: any, z: any, node?: HTMLElement): void; + unlinkPaths(path: string): void; + unshift(path: string, value: any): any; + updateStyles(): void; + } + interface dom { + (node: HTMLElement): HTMLElement; + (node: polymer.Base): HTMLElement; + flush(): any; + } + interface FireOptions { + node?: HTMLElement | polymer.Base; + bubbles?: boolean; + cancelable?: boolean; + } + interface Element { + properties?: Object; + listeners?: Object; + behaviors?: Object[]; + observers?: String[]; + factoryImpl?(...args: any[]): void; + ready?(): void; + created?(): void; + attached?(): void; + detached?(): void; + attributeChanged?(attrName: string, oldVal: any, newVal: any): void; + prototype?: Object; + } + interface PolymerTSElement { + $custom_cons?: FunctionConstructor; + $custom_cons_args?: any[]; + template?: string; + style?: string; + } + interface Property { + name?: string; + type?: any; + value?: any; + reflectToAttribute?: boolean; + readonly?: boolean; + notify?: boolean; + computed?: string; + observer?: string; + } + class Base extends polymer.PolymerBase implements polymer.Element { + static create(...args: any[]): T; + static register(): void; + is: string; + } + function createEs6PolymerBase(): void; + function prepareForRegistration(elementClass: Function): polymer.Element; + function createDomModule(definition: polymer.Element): void; + function createElement(element: new (...args: any[]) => T): new (...args: any[]) => T; + function createClass(element: new (...args: any[]) => T): new (...args: any[]) => T; + function isRegistered(element: polymer.Element): boolean; +} +declare var Polymer: { + (prototype: polymer.Element): FunctionConstructor; + Class(prototype: polymer.Element): Function; + dom: polymer.dom; + appendChild(node: HTMLElement): HTMLElement; + insertBefore(node: HTMLElement, beforeNode: HTMLElement): HTMLElement; + removeChild(node: HTMLElement): HTMLElement; + updateStyles(): void; + Base: any; +}; +declare function component(tagname: string, extendsTag?: string): (target: Function) => void; +declare function extend(tagname: string): (target: Function) => void; +declare function template(templateString: string): (target: Function) => void; +declare function style(styleString: string): (target: Function) => void; +declare function hostAttributes(attributes: Object): (target: Function) => void; +declare function property(ob?: polymer.Property): (target: polymer.Element, propertyKey: string) => void; +declare function computed(ob?: polymer.Property): (target: polymer.Element, computedFuncName: string) => void; +declare function listen(eventName: string): (target: polymer.Element, propertyKey: string) => void; +declare function behavior(behaviorObject: any): any; +declare function observe(observedProps: string): (target: polymer.Element, observerFuncName: string) => void; From da0bddb559bd1dc599237a0fbc808d45bb71ad87 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:33:30 +0200 Subject: [PATCH 02/19] added backbone local storage def --- .../backbone.localStorage.d.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 backbone.localStorage/backbone.localStorage.d.ts diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts new file mode 100644 index 0000000000..b0a554828e --- /dev/null +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -0,0 +1,46 @@ + + +declare module Backbone { + interface Serializer { + serialize(item: any): any; + deserialize(data: any): any; + } + + declare class LocalStorage { + name: string; + serializer: Serializer; + records: string[]; + + constructor(name: string, serializer?: Serializer); + + save(); + + // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already + // have an id of it's own. + create(model: any): any; + + // Update a model by replacing its copy in `this.data`. + update(model: any): any; + + // Retrieve a model from `this.data` by id. + find(model: any): any; + + // Return the array of all models currently in storage. + findAll(): any; + + // Delete a model from `this.data`, returning it. + destroy(model: T): T; + + localStorage(): any; + + // Clear localStorage for specific collection. + _clear(): void; + + _storageSize(): number; + + _itemName(id): string; + }; +} + +export Store = Backbone.LocalStorage; + From ea76cec95c4f1698cda13ae5f0393eb30dcbc178 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:40:41 +0200 Subject: [PATCH 03/19] wrong version committed --- backbone.localStorage/backbone.localStorage.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts index b0a554828e..e0af97e1d2 100644 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -1,12 +1,11 @@ - declare module Backbone { interface Serializer { serialize(item: any): any; deserialize(data: any): any; } - declare class LocalStorage { + class LocalStorage { name: string; serializer: Serializer; records: string[]; @@ -39,8 +38,8 @@ declare module Backbone { _storageSize(): number; _itemName(id): string; - }; + } } -export Store = Backbone.LocalStorage; +import Store = Backbone.LocalStorage; From 581d094508cb40e4b571e2027142d5dd6134722e Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:44:37 +0200 Subject: [PATCH 04/19] added def typed header comments --- backbone.localStorage/backbone.localStorage.d.ts | 6 ++++++ polymer-ts/polymer-ts.d.ts | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts index e0af97e1d2..5696fa3d9f 100644 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -1,3 +1,9 @@ +// Type definitions for backbone.localStorage 1.0.0 +// Project: https://github.com/jeromegn/Backbone.localStorage +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// declare module Backbone { interface Serializer { diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts index 4f44de6d28..cd96dfe21a 100644 --- a/polymer-ts/polymer-ts.d.ts +++ b/polymer-ts/polymer-ts.d.ts @@ -1,3 +1,8 @@ +// Type definitions for PolymerTS 0.1.17 +// Project: https://github.com/nippur72/PolymerTS +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module polymer { class PolymerBase extends HTMLElement { $: any; From 99a76bb80179d43f48d5e942257135e41ddc4781 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:46:49 +0200 Subject: [PATCH 05/19] fixed implicit any --- backbone.localStorage/backbone.localStorage.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts index 5696fa3d9f..122c475876 100644 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -18,7 +18,7 @@ declare module Backbone { constructor(name: string, serializer?: Serializer); - save(); + save(): void; // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already // have an id of it's own. @@ -43,7 +43,7 @@ declare module Backbone { _storageSize(): number; - _itemName(id): string; + _itemName(id: any): string; } } From 8088f834010654f82033838c8baabc1b35c285e9 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sun, 20 Sep 2015 10:17:47 +0200 Subject: [PATCH 06/19] deleted for rename --- .../backbone.localStorage.d.ts | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 backbone.localStorage/backbone.localStorage.d.ts diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts deleted file mode 100644 index 122c475876..0000000000 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Type definitions for backbone.localStorage 1.0.0 -// Project: https://github.com/jeromegn/Backbone.localStorage -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module Backbone { - interface Serializer { - serialize(item: any): any; - deserialize(data: any): any; - } - - class LocalStorage { - name: string; - serializer: Serializer; - records: string[]; - - constructor(name: string, serializer?: Serializer); - - save(): void; - - // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already - // have an id of it's own. - create(model: any): any; - - // Update a model by replacing its copy in `this.data`. - update(model: any): any; - - // Retrieve a model from `this.data` by id. - find(model: any): any; - - // Return the array of all models currently in storage. - findAll(): any; - - // Delete a model from `this.data`, returning it. - destroy(model: T): T; - - localStorage(): any; - - // Clear localStorage for specific collection. - _clear(): void; - - _storageSize(): number; - - _itemName(id: any): string; - } -} - -import Store = Backbone.LocalStorage; - From 7f6349d245f67a5b56cf6c339a51bd80a293a359 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sun, 20 Sep 2015 10:20:47 +0200 Subject: [PATCH 07/19] renamed backbone.localStorage to backbone.localstorage --- .../backbone.localstorage.d.ts | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 backbone.localstorage/backbone.localstorage.d.ts diff --git a/backbone.localstorage/backbone.localstorage.d.ts b/backbone.localstorage/backbone.localstorage.d.ts new file mode 100644 index 0000000000..122c475876 --- /dev/null +++ b/backbone.localstorage/backbone.localstorage.d.ts @@ -0,0 +1,51 @@ +// Type definitions for backbone.localStorage 1.0.0 +// Project: https://github.com/jeromegn/Backbone.localStorage +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Backbone { + interface Serializer { + serialize(item: any): any; + deserialize(data: any): any; + } + + class LocalStorage { + name: string; + serializer: Serializer; + records: string[]; + + constructor(name: string, serializer?: Serializer); + + save(): void; + + // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already + // have an id of it's own. + create(model: any): any; + + // Update a model by replacing its copy in `this.data`. + update(model: any): any; + + // Retrieve a model from `this.data` by id. + find(model: any): any; + + // Return the array of all models currently in storage. + findAll(): any; + + // Delete a model from `this.data`, returning it. + destroy(model: T): T; + + localStorage(): any; + + // Clear localStorage for specific collection. + _clear(): void; + + _storageSize(): number; + + _itemName(id: any): string; + } +} + +import Store = Backbone.LocalStorage; + From be0eda50824f411753ec1364d341e5305000b4ab Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 10:59:11 +0100 Subject: [PATCH 08/19] gulp jshint + gulp notify + typescript require --- gulp-jshint/gulp-jshint-tests.ts | 16 +++ gulp-jshint/gulp-jshint.d.ts | 29 +++++ gulp-notify/gulp-notify-tests.ts | 41 +++++++ gulp-notify/gulp-notify.d.ts | 113 ++++++++++++++++++ .../typescript-require-tests.ts | 7 ++ typescript-require/typescript-require.d.ts | 31 +++++ 6 files changed, 237 insertions(+) create mode 100644 gulp-jshint/gulp-jshint-tests.ts create mode 100644 gulp-jshint/gulp-jshint.d.ts create mode 100644 gulp-notify/gulp-notify-tests.ts create mode 100644 gulp-notify/gulp-notify.d.ts create mode 100644 typescript-require/typescript-require-tests.ts create mode 100644 typescript-require/typescript-require.d.ts diff --git a/gulp-jshint/gulp-jshint-tests.ts b/gulp-jshint/gulp-jshint-tests.ts new file mode 100644 index 0000000000..fe4d930418 --- /dev/null +++ b/gulp-jshint/gulp-jshint-tests.ts @@ -0,0 +1,16 @@ +/// +/// +import gulp = require("gulp"); +import jshint = require("gulp-jshint"); + + +gulp.task('check1', function() { + gulp.src('lib/*.ts') + .pipe(jshint()) + .pipe(jshint.reporter('default')); +}); + +gulp.task('check2', function() { + gulp.src('lib/*.ts') + .pipe(jshint({ linter: 'jshint', lookup: true })); +}); \ No newline at end of file diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts new file mode 100644 index 0000000000..5e57694e48 --- /dev/null +++ b/gulp-jshint/gulp-jshint.d.ts @@ -0,0 +1,29 @@ +// Type definitions for gulp-jshint +// Project: https://github.com/spalger/gulp-jshint +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-jshint" { + function GulpJSHint(options?: IGulpJSHintOptions): NodeJS.ReadWriteStream; + + interface IGulpJSHintOptions { + /** + * When false do not lookup .jshintrc files. See the JSHint docs for more info. + * Default true. + */ + lookup?: boolean; + + /** + * Either the name of a module to use for linting the code or a linting function itself. This enables using an alternate (but jshint compatible) linter like "jsxhint". + * Default is "jshint" + */ + linter?: string; + } + + namespace GulpJSHint { + declare function reporter(kind: (string | Object)); + } + export = GulpJSHint; +} diff --git a/gulp-notify/gulp-notify-tests.ts b/gulp-notify/gulp-notify-tests.ts new file mode 100644 index 0000000000..0c434b4321 --- /dev/null +++ b/gulp-notify/gulp-notify-tests.ts @@ -0,0 +1,41 @@ +/// +/// +import gulp = require("gulp"); +import notify = require("gulp-notify"); + +var custom = notify.withReporter(function(options, callback) { + console.log("Title:", options.title); + console.log("Message:", options.message); + callback(); +}); + +notify.on('click', (options) => { + console.log('I clicked something!', options); +}); + +notify.on('timeout', (options) => { + console.log('The notification timed out', options); +}); + +gulp.task('notify1', function() { + gulp.src("./src/test.ext") + .pipe(notify("Hello Gulp! From file: <%= file.relative %>")); +}); + +gulp.task('notify2', function() { + gulp.src("./src/test.ext") + .pipe(notify({ + message: "Generated file: <%= file.relative %> @ <%= options.date %>", + templateOptions: { + date: new Date() + } + })); +}); + +gulp.task('notify3', function() { + gulp.src("./src/test.ext") + .pipe(custom("This is a message.")) + .on("error", notify.onError((error: Error) => { + return "Message to the notifier: " + error.message; + }); +}); \ No newline at end of file diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts new file mode 100644 index 0000000000..a1e00514fa --- /dev/null +++ b/gulp-notify/gulp-notify.d.ts @@ -0,0 +1,113 @@ +// Type definitions for gulp-jshint +// Project: https://github.com/mikaelbr/gulp-notify +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-notify" { + function GulpNotify(param: string | Function | GulpNotifyOptions): NodeJS.ReadWriteStream; + + interface GulpNotifyOptions { + /** + * Type: Boolean Default: false + * If the notification should only happen on the last file of the stream. Per default a notification is triggered on each file. + */ + onLast?: boolean; + + /** + * Type: Boolean Default: false + * If the returned stream should emit an error or not. If emitError is true, you have to handle .on('error') manually in case the notifier (gulp-notify) fails. If the default false is set, the error will not be emitted but simply printed to the console. + * This means you can run the notifier on a CI system without opting it out but simply letting it fail gracefully. + */ + emitError?: boolean; + + /** + * Type: String Default: File path in stream + * + * The message you wish to attach to file. The string can be a lodash template as it is passed through gulp-util.template. + * + * Example: Created <%= file.relative %>. + * as function + * + * Type: Function(vinylFile) + * + * See notify(Function). + */ + message?: string | Function; + + /** + * Type: String Default: "Gulp Notification" + * + * The title of the notification. The string can be a lodash template as it is passed through gulp-util.template. + * + * Example: Created <%= file.relative %>. + * as function + * + * Type: Function(vinylFile) + * + * See notify(Function). + */ + title?: string | Function; + + /** + * Object passed to the lodash template, for additional properties passed to the template. + */ + templateOptions?: Object; + + /** + * Type: Function(options, callback) Default: node-notifier module + * + * Swap out the notifier by passing in an function. The function expects two arguments: options and callback. + * + * The callback must be called when the notification is finished. Options will contain both title and message. + * + * See notify.withReporter for syntactic sugar. + */ + notifier?: (options, callback) => void; + + /** + * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. + */ + wait?: boolean; + } + + namespace GulpNotify { + + /** + * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. + */ + function on(event: string, callback: (notificationOptions?: Object) => void): void; + + /** + * Wraps options.notifier to return a new notify-function only using the passed in reporter. + */ + function withReporter(reporter: (options: GulpNotifyOptions, callback: () => void) => void): (message: string | Function) => NodeJS.ReadWriteStream; + + + /** + * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. + */ + function onError(callback: (string | (error: Error) => string | GulpNotifyOptions)): NodeJS.ReadWriteStream; + + /** + * Type: Integer Default: 2 + * + * Set if logger should be used or not. If log level is set to 0, no logging will be used. If no new log level is passed, the current log level is returned. + * + * 0: No logging + * 1: Log on error + * 2: Log both on error and regular notification. + * + * If logging is set to > 0, the title and message passed to gulp-notify will be logged like so: + * ➜ gulp-notify git:(master) ✗ gulp --gulpfile examples/gulpfile.js one + * [gulp] Using file /Users/example/gulp-notify/examples/gulpfile.js + * [gulp] Working directory changed to /Users/example/repos/gulp-notify/examples + * [gulp] Running 'one'... + * [gulp] Finished 'one' in 4.08 ms + * [gulp] gulp-notify: [Gulp notification] /Users/example/gulp-notify/test/fixtures/1.txt + */ + function logLevel(level: number): void; + } + export = GulpNotify; +} diff --git a/typescript-require/typescript-require-tests.ts b/typescript-require/typescript-require-tests.ts new file mode 100644 index 0000000000..6269a4b9d3 --- /dev/null +++ b/typescript-require/typescript-require-tests.ts @@ -0,0 +1,7 @@ +/// + +require('typescript-require')({ + nodeLib: false, + targetES5: true, + exitOnError: true +}); diff --git a/typescript-require/typescript-require.d.ts b/typescript-require/typescript-require.d.ts new file mode 100644 index 0000000000..68b24ca274 --- /dev/null +++ b/typescript-require/typescript-require.d.ts @@ -0,0 +1,31 @@ +// Type definitions for typescript-require +// Project: https://github.com/theblacksmith/typescript-require +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "typescript-require" { + function TypeScriptRequire(options?: TypeScriptRequireOptions): void; + + interface TypeScriptRequireOptions { + /** + * If true node.d.ts definitions file is loaded before custom ts files. This is disabled by default and you should use. + * Default false. + */ + nodeLib?: boolean; + + /** + * Target ES5 / ES3 output mode. + * Default true. + */ + targetES5?: boolean; + + /** + * Wether execution should stop on compile error. + */ + exitOnError?: boolean; + } + + export = TypeScriptRequire; +} From 29c447bbed3d657a09b2309098362460e5e681fc Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:07:52 +0100 Subject: [PATCH 09/19] fixed syntax --- gulp-notify/gulp-notify.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts index a1e00514fa..34b752065d 100644 --- a/gulp-notify/gulp-notify.d.ts +++ b/gulp-notify/gulp-notify.d.ts @@ -88,7 +88,7 @@ declare module "gulp-notify" { /** * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. */ - function onError(callback: (string | (error: Error) => string | GulpNotifyOptions)): NodeJS.ReadWriteStream; + function onError(param: string | (error: Error): string | GulpNotifyOptions): NodeJS.ReadWriteStream; /** * Type: Integer Default: 2 From 737e8319a93d28f0fe903b9200d67394c593cb81 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:08:46 +0100 Subject: [PATCH 10/19] fixed declare --- gulp-jshint/gulp-jshint.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts index 5e57694e48..8c10fe0de8 100644 --- a/gulp-jshint/gulp-jshint.d.ts +++ b/gulp-jshint/gulp-jshint.d.ts @@ -23,7 +23,7 @@ declare module "gulp-jshint" { } namespace GulpJSHint { - declare function reporter(kind: (string | Object)); + function reporter(kind: (string | Object)); } export = GulpJSHint; } From 0aa8a6c9f51f8c736f44dfcc2413e57356c7cd68 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:09:01 +0100 Subject: [PATCH 11/19] fixed test syntax --- gulp-notify/gulp-notify-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-notify/gulp-notify-tests.ts b/gulp-notify/gulp-notify-tests.ts index 0c434b4321..4175d08628 100644 --- a/gulp-notify/gulp-notify-tests.ts +++ b/gulp-notify/gulp-notify-tests.ts @@ -37,5 +37,5 @@ gulp.task('notify3', function() { .pipe(custom("This is a message.")) .on("error", notify.onError((error: Error) => { return "Message to the notifier: " + error.message; - }); + })); }); \ No newline at end of file From 709cf2cb918b1fff49bcbfa041f48fefa5462786 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:16:17 +0100 Subject: [PATCH 12/19] fixed syntax and implicit any --- gulp-jshint/gulp-jshint.d.ts | 2 +- gulp-notify/gulp-notify.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts index 8c10fe0de8..20db40a62a 100644 --- a/gulp-jshint/gulp-jshint.d.ts +++ b/gulp-jshint/gulp-jshint.d.ts @@ -23,7 +23,7 @@ declare module "gulp-jshint" { } namespace GulpJSHint { - function reporter(kind: (string | Object)); + function reporter(kind: (string | Object)): NodeJS.ReadWriteStream; } export = GulpJSHint; } diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts index 34b752065d..96b11f95d1 100644 --- a/gulp-notify/gulp-notify.d.ts +++ b/gulp-notify/gulp-notify.d.ts @@ -88,7 +88,7 @@ declare module "gulp-notify" { /** * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. */ - function onError(param: string | (error: Error): string | GulpNotifyOptions): NodeJS.ReadWriteStream; + function onError(param: string | { (error: Error): string } | GulpNotifyOptions): NodeJS.ReadWriteStream; /** * Type: Integer Default: 2 From dc05db5550ce7bd5156db2b6f228ad17185f3740 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:20:52 +0100 Subject: [PATCH 13/19] fixed implicit any --- gulp-notify/gulp-notify.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts index 96b11f95d1..4658616447 100644 --- a/gulp-notify/gulp-notify.d.ts +++ b/gulp-notify/gulp-notify.d.ts @@ -64,7 +64,7 @@ declare module "gulp-notify" { * * See notify.withReporter for syntactic sugar. */ - notifier?: (options, callback) => void; + notifier?: (options: GulpNotifyOptions, callback: () => void) => void; /** * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. @@ -77,7 +77,7 @@ declare module "gulp-notify" { /** * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. */ - function on(event: string, callback: (notificationOptions?: Object) => void): void; + function on(event: string, callback: (notificationOptions?: GulpNotifyOptions) => void): void; /** * Wraps options.notifier to return a new notify-function only using the passed in reporter. @@ -88,7 +88,7 @@ declare module "gulp-notify" { /** * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. */ - function onError(param: string | { (error: Error): string } | GulpNotifyOptions): NodeJS.ReadWriteStream; + function onError(param: string | { (error: Error): string } | GulpNotifyOptions): Function; /** * Type: Integer Default: 2 From 82764e58b49c370eff7127ae961750ed9f9921ac Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 20:18:08 +0100 Subject: [PATCH 14/19] jade definition --- gulp-jade/gulp-jade-tests.ts | 25 +++++++++++++++++++++++++ gulp-jade/gulp-jade.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 gulp-jade/gulp-jade-tests.ts create mode 100644 gulp-jade/gulp-jade.d.ts diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts new file mode 100644 index 0000000000..7334afc838 --- /dev/null +++ b/gulp-jade/gulp-jade-tests.ts @@ -0,0 +1,25 @@ +/// +/// +/// + +import gulp = require("gulp"); +import jade = require("gulp-jade"); + + +gulp.task('check1', function() { + gulp.src('lib/*.jade') + .pipe(jade({ + locals: {}, + client: false + })); +}); + +import jadeLib = require('jade'); + +gulp.task('check2', function() { + gulp.src('lib/*.jade') + .pipe(jade({ + jade: jadeLib, + pretty: true + })); +}); \ No newline at end of file diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts new file mode 100644 index 0000000000..2f31889c22 --- /dev/null +++ b/gulp-jade/gulp-jade.d.ts @@ -0,0 +1,24 @@ +// Type definitions for gulp-jade +// Project: https://github.com/phated/gulp-jade +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-jade" { + function GulpJade(options?: GulpJadeOptions): NodeJS.ReadWriteStream; + + interface GulpJadeOptions { + client?: boolean; + + locals?: Object; + + jade?: any; + + pretty?: boolean; + } + + namespace GulpJade { + } + export = GulpJade; +} From 9abd523d14733b66e641eba4ac94951cf98a554d Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 11 Dec 2015 08:40:27 +0100 Subject: [PATCH 15/19] polymer ts test file --- polymer-ts/polymer-ts-tests.ts | 38 ++++++++++++++++++++++++++++++++++ polymer-ts/polymer-ts.d.ts | 7 +------ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 polymer-ts/polymer-ts-tests.ts diff --git a/polymer-ts/polymer-ts-tests.ts b/polymer-ts/polymer-ts-tests.ts new file mode 100644 index 0000000000..5e4e42df26 --- /dev/null +++ b/polymer-ts/polymer-ts-tests.ts @@ -0,0 +1,38 @@ +/// + +namespace Components { + + export class TestComponent extends polymer.Base { + + public field: string = 'foo'; + public is: string; + + constructor() { + super(); + this.is = 'test-test'; + } + + public ready(): void { + console.log('ready'); + this.async(() => { + console.log('delayed'); + }, 500); + } + } + + polymer.createElement(TestComponent); + + @component('test-annotated') + export class AnnotatedComponent extends polymer.Base { + + public field: string = 'xx'; + + constructor() { + super(); + } + + public ready(): void { + console.log('annotated ready'); + } + } +} diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts index cd96dfe21a..c00c0ce1a0 100644 --- a/polymer-ts/polymer-ts.d.ts +++ b/polymer-ts/polymer-ts.d.ts @@ -1,8 +1,3 @@ -// Type definitions for PolymerTS 0.1.17 -// Project: https://github.com/nippur72/PolymerTS -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - declare module polymer { class PolymerBase extends HTMLElement { $: any; @@ -93,7 +88,7 @@ declare module polymer { type?: any; value?: any; reflectToAttribute?: boolean; - readonly?: boolean; + readOnly?: boolean; notify?: boolean; computed?: string; observer?: string; From 31ae86e54c72ad8e52e2c8f0abfed5f830672a80 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 11 Dec 2015 08:43:27 +0100 Subject: [PATCH 16/19] fixed def typed header --- polymer-ts/polymer-ts.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts index c00c0ce1a0..921b256656 100644 --- a/polymer-ts/polymer-ts.d.ts +++ b/polymer-ts/polymer-ts.d.ts @@ -1,3 +1,8 @@ +// Type definitions for PolymerTS 0.1.19 +// Project: https://github.com/nippur72/PolymerTS +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module polymer { class PolymerBase extends HTMLElement { $: any; From 5b8db10eaa365f248d644a14dd44f755d190a651 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 11 Dec 2015 08:48:01 +0100 Subject: [PATCH 17/19] tests modified --- polymer-ts/polymer-ts-tests.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/polymer-ts/polymer-ts-tests.ts b/polymer-ts/polymer-ts-tests.ts index 5e4e42df26..1347b3bb71 100644 --- a/polymer-ts/polymer-ts-tests.ts +++ b/polymer-ts/polymer-ts-tests.ts @@ -21,18 +21,4 @@ namespace Components { } polymer.createElement(TestComponent); - - @component('test-annotated') - export class AnnotatedComponent extends polymer.Base { - - public field: string = 'xx'; - - constructor() { - super(); - } - - public ready(): void { - console.log('annotated ready'); - } - } } From bba4c44ba25d6feb40fa100525bc76db9d3d33c0 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sat, 12 Dec 2015 20:08:50 +0100 Subject: [PATCH 18/19] deleted definitions to split PR --- gulp-jade/gulp-jade-tests.ts | 25 ------------------------- gulp-jade/gulp-jade.d.ts | 24 ------------------------ 2 files changed, 49 deletions(-) delete mode 100644 gulp-jade/gulp-jade-tests.ts delete mode 100644 gulp-jade/gulp-jade.d.ts diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts deleted file mode 100644 index 7334afc838..0000000000 --- a/gulp-jade/gulp-jade-tests.ts +++ /dev/null @@ -1,25 +0,0 @@ -/// -/// -/// - -import gulp = require("gulp"); -import jade = require("gulp-jade"); - - -gulp.task('check1', function() { - gulp.src('lib/*.jade') - .pipe(jade({ - locals: {}, - client: false - })); -}); - -import jadeLib = require('jade'); - -gulp.task('check2', function() { - gulp.src('lib/*.jade') - .pipe(jade({ - jade: jadeLib, - pretty: true - })); -}); \ No newline at end of file diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts deleted file mode 100644 index 2f31889c22..0000000000 --- a/gulp-jade/gulp-jade.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Type definitions for gulp-jade -// Project: https://github.com/phated/gulp-jade -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "gulp-jade" { - function GulpJade(options?: GulpJadeOptions): NodeJS.ReadWriteStream; - - interface GulpJadeOptions { - client?: boolean; - - locals?: Object; - - jade?: any; - - pretty?: boolean; - } - - namespace GulpJade { - } - export = GulpJade; -} From e3b69d13c85ebf92f9a721073376f87c6af74e46 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sat, 12 Dec 2015 20:16:50 +0100 Subject: [PATCH 19/19] deleted files to split PR --- .../backbone.localstorage.d.ts | 51 -------- gulp-jshint/gulp-jshint-tests.ts | 16 --- gulp-jshint/gulp-jshint.d.ts | 29 ----- gulp-notify/gulp-notify-tests.ts | 41 ------- gulp-notify/gulp-notify.d.ts | 113 ------------------ .../typescript-require-tests.ts | 7 -- typescript-require/typescript-require.d.ts | 31 ----- 7 files changed, 288 deletions(-) delete mode 100644 backbone.localstorage/backbone.localstorage.d.ts delete mode 100644 gulp-jshint/gulp-jshint-tests.ts delete mode 100644 gulp-jshint/gulp-jshint.d.ts delete mode 100644 gulp-notify/gulp-notify-tests.ts delete mode 100644 gulp-notify/gulp-notify.d.ts delete mode 100644 typescript-require/typescript-require-tests.ts delete mode 100644 typescript-require/typescript-require.d.ts diff --git a/backbone.localstorage/backbone.localstorage.d.ts b/backbone.localstorage/backbone.localstorage.d.ts deleted file mode 100644 index 122c475876..0000000000 --- a/backbone.localstorage/backbone.localstorage.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Type definitions for backbone.localStorage 1.0.0 -// Project: https://github.com/jeromegn/Backbone.localStorage -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module Backbone { - interface Serializer { - serialize(item: any): any; - deserialize(data: any): any; - } - - class LocalStorage { - name: string; - serializer: Serializer; - records: string[]; - - constructor(name: string, serializer?: Serializer); - - save(): void; - - // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already - // have an id of it's own. - create(model: any): any; - - // Update a model by replacing its copy in `this.data`. - update(model: any): any; - - // Retrieve a model from `this.data` by id. - find(model: any): any; - - // Return the array of all models currently in storage. - findAll(): any; - - // Delete a model from `this.data`, returning it. - destroy(model: T): T; - - localStorage(): any; - - // Clear localStorage for specific collection. - _clear(): void; - - _storageSize(): number; - - _itemName(id: any): string; - } -} - -import Store = Backbone.LocalStorage; - diff --git a/gulp-jshint/gulp-jshint-tests.ts b/gulp-jshint/gulp-jshint-tests.ts deleted file mode 100644 index fe4d930418..0000000000 --- a/gulp-jshint/gulp-jshint-tests.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// -/// -import gulp = require("gulp"); -import jshint = require("gulp-jshint"); - - -gulp.task('check1', function() { - gulp.src('lib/*.ts') - .pipe(jshint()) - .pipe(jshint.reporter('default')); -}); - -gulp.task('check2', function() { - gulp.src('lib/*.ts') - .pipe(jshint({ linter: 'jshint', lookup: true })); -}); \ No newline at end of file diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts deleted file mode 100644 index 20db40a62a..0000000000 --- a/gulp-jshint/gulp-jshint.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for gulp-jshint -// Project: https://github.com/spalger/gulp-jshint -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "gulp-jshint" { - function GulpJSHint(options?: IGulpJSHintOptions): NodeJS.ReadWriteStream; - - interface IGulpJSHintOptions { - /** - * When false do not lookup .jshintrc files. See the JSHint docs for more info. - * Default true. - */ - lookup?: boolean; - - /** - * Either the name of a module to use for linting the code or a linting function itself. This enables using an alternate (but jshint compatible) linter like "jsxhint". - * Default is "jshint" - */ - linter?: string; - } - - namespace GulpJSHint { - function reporter(kind: (string | Object)): NodeJS.ReadWriteStream; - } - export = GulpJSHint; -} diff --git a/gulp-notify/gulp-notify-tests.ts b/gulp-notify/gulp-notify-tests.ts deleted file mode 100644 index 4175d08628..0000000000 --- a/gulp-notify/gulp-notify-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// -/// -import gulp = require("gulp"); -import notify = require("gulp-notify"); - -var custom = notify.withReporter(function(options, callback) { - console.log("Title:", options.title); - console.log("Message:", options.message); - callback(); -}); - -notify.on('click', (options) => { - console.log('I clicked something!', options); -}); - -notify.on('timeout', (options) => { - console.log('The notification timed out', options); -}); - -gulp.task('notify1', function() { - gulp.src("./src/test.ext") - .pipe(notify("Hello Gulp! From file: <%= file.relative %>")); -}); - -gulp.task('notify2', function() { - gulp.src("./src/test.ext") - .pipe(notify({ - message: "Generated file: <%= file.relative %> @ <%= options.date %>", - templateOptions: { - date: new Date() - } - })); -}); - -gulp.task('notify3', function() { - gulp.src("./src/test.ext") - .pipe(custom("This is a message.")) - .on("error", notify.onError((error: Error) => { - return "Message to the notifier: " + error.message; - })); -}); \ No newline at end of file diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts deleted file mode 100644 index 4658616447..0000000000 --- a/gulp-notify/gulp-notify.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -// Type definitions for gulp-jshint -// Project: https://github.com/mikaelbr/gulp-notify -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "gulp-notify" { - function GulpNotify(param: string | Function | GulpNotifyOptions): NodeJS.ReadWriteStream; - - interface GulpNotifyOptions { - /** - * Type: Boolean Default: false - * If the notification should only happen on the last file of the stream. Per default a notification is triggered on each file. - */ - onLast?: boolean; - - /** - * Type: Boolean Default: false - * If the returned stream should emit an error or not. If emitError is true, you have to handle .on('error') manually in case the notifier (gulp-notify) fails. If the default false is set, the error will not be emitted but simply printed to the console. - * This means you can run the notifier on a CI system without opting it out but simply letting it fail gracefully. - */ - emitError?: boolean; - - /** - * Type: String Default: File path in stream - * - * The message you wish to attach to file. The string can be a lodash template as it is passed through gulp-util.template. - * - * Example: Created <%= file.relative %>. - * as function - * - * Type: Function(vinylFile) - * - * See notify(Function). - */ - message?: string | Function; - - /** - * Type: String Default: "Gulp Notification" - * - * The title of the notification. The string can be a lodash template as it is passed through gulp-util.template. - * - * Example: Created <%= file.relative %>. - * as function - * - * Type: Function(vinylFile) - * - * See notify(Function). - */ - title?: string | Function; - - /** - * Object passed to the lodash template, for additional properties passed to the template. - */ - templateOptions?: Object; - - /** - * Type: Function(options, callback) Default: node-notifier module - * - * Swap out the notifier by passing in an function. The function expects two arguments: options and callback. - * - * The callback must be called when the notification is finished. Options will contain both title and message. - * - * See notify.withReporter for syntactic sugar. - */ - notifier?: (options: GulpNotifyOptions, callback: () => void) => void; - - /** - * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. - */ - wait?: boolean; - } - - namespace GulpNotify { - - /** - * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. - */ - function on(event: string, callback: (notificationOptions?: GulpNotifyOptions) => void): void; - - /** - * Wraps options.notifier to return a new notify-function only using the passed in reporter. - */ - function withReporter(reporter: (options: GulpNotifyOptions, callback: () => void) => void): (message: string | Function) => NodeJS.ReadWriteStream; - - - /** - * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. - */ - function onError(param: string | { (error: Error): string } | GulpNotifyOptions): Function; - - /** - * Type: Integer Default: 2 - * - * Set if logger should be used or not. If log level is set to 0, no logging will be used. If no new log level is passed, the current log level is returned. - * - * 0: No logging - * 1: Log on error - * 2: Log both on error and regular notification. - * - * If logging is set to > 0, the title and message passed to gulp-notify will be logged like so: - * ➜ gulp-notify git:(master) ✗ gulp --gulpfile examples/gulpfile.js one - * [gulp] Using file /Users/example/gulp-notify/examples/gulpfile.js - * [gulp] Working directory changed to /Users/example/repos/gulp-notify/examples - * [gulp] Running 'one'... - * [gulp] Finished 'one' in 4.08 ms - * [gulp] gulp-notify: [Gulp notification] /Users/example/gulp-notify/test/fixtures/1.txt - */ - function logLevel(level: number): void; - } - export = GulpNotify; -} diff --git a/typescript-require/typescript-require-tests.ts b/typescript-require/typescript-require-tests.ts deleted file mode 100644 index 6269a4b9d3..0000000000 --- a/typescript-require/typescript-require-tests.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -require('typescript-require')({ - nodeLib: false, - targetES5: true, - exitOnError: true -}); diff --git a/typescript-require/typescript-require.d.ts b/typescript-require/typescript-require.d.ts deleted file mode 100644 index 68b24ca274..0000000000 --- a/typescript-require/typescript-require.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for typescript-require -// Project: https://github.com/theblacksmith/typescript-require -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "typescript-require" { - function TypeScriptRequire(options?: TypeScriptRequireOptions): void; - - interface TypeScriptRequireOptions { - /** - * If true node.d.ts definitions file is loaded before custom ts files. This is disabled by default and you should use. - * Default false. - */ - nodeLib?: boolean; - - /** - * Target ES5 / ES3 output mode. - * Default true. - */ - targetES5?: boolean; - - /** - * Wether execution should stop on compile error. - */ - exitOnError?: boolean; - } - - export = TypeScriptRequire; -}