diff --git a/koa/koa-1.1.2.d.ts b/koa/koa-1.1.2.d.ts
index 2520f8fae..abcb471be 100644
--- a/koa/koa-1.1.2.d.ts
+++ b/koa/koa-1.1.2.d.ts
@@ -13,13 +13,22 @@
///
///
+declare module Koa {
+
+ // These open interfaces may be extended in an application-specific manner via declaration merging.
+ // See for example method-override.d.ts (https://github.com/borisyankov/DefinitelyTyped/blob/master/method-override/method-override.d.ts)
+ export interface Request { }
+ export interface Response { }
+ export interface Application { }
+}
+
declare module "koa" {
import * as net from 'net';
import * as http from 'http';
import * as events from 'events';
import * as Cookies from 'cookies';
- interface IRequest {
+ interface IRequest extends Koa.Request {
/**
* Return request header.
*
@@ -272,7 +281,7 @@ declare module "koa" {
get(field: string): string;
}
- interface IResponse {
+ interface IResponse extends Koa.Response{
/**
* Get/Set response status code.
*/
@@ -543,7 +552,7 @@ declare module "koa" {
state: any;
}
- interface Application extends events.EventEmitter {
+ interface Application extends events.EventEmitter , Koa.Application{
env: string;
subdomainOffset: number;
middleware: any[];
@@ -560,6 +569,7 @@ declare module "koa" {
listen(port: number, hostname?: string, callback?: Function): http.Server;
listen(path: string, callback?: Function): http.Server;
listen(handle: any, listeningListener?: Function): http.Server;
+ listen(): http.Server;
/**
* Return JSON representation.
* We only bother showing settings.
@@ -602,4 +612,4 @@ declare module "koa" {
var koa: KoaStatic;
export = koa;
-}
\ No newline at end of file
+}
diff --git a/parse5/parse5-tests.ts b/parse5/parse5-tests.ts
new file mode 100644
index 000000000..420fda599
--- /dev/null
+++ b/parse5/parse5-tests.ts
@@ -0,0 +1,41 @@
+// Type definitions for parse5 2.1.5
+// Project: https://github.com/inikulin/parse5
+// Definitions by: Nico Jansen
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+import * as parse5 from 'parse5';
+
+// parse5.SAXParser()
+var parser = new parse5.SAXParser({ locationInfo: true });
+parser.on('startTag', (name, attrs, selfClosing, location) => {
+ console.log(name, attrs, selfClosing, location);
+});
+parser.on('text', (text, location) => {
+ console.log(text, location);
+});
+
+// parse5.parse()
+parse5.parse('html', { locationInfo: true, treeAdapter: parse5.treeAdapters.default });
+parse5.parse('html', {});
+parse5.parse('html');
+
+// parse5.ParserStream()
+var parserStream = new parse5.ParserStream({ locationInfo: true, treeAdapter: parse5.treeAdapters.htmlparser2 });
+parserStream = new parse5.ParserStream({ });
+parserStream = new parse5.ParserStream();
+var node = parserStream.document.childNodes[0];
+node.parentNode.attrs = [{name: '', value: ''}];
+
+// parse5.parseFragment()
+var fragment = parse5.parseFragment('');
+fragment = parse5.parseFragment('', {locationInfo: true});
+
+// parse5.ASTNode
+fragment.quirksMode = true;
+fragment.namespaceURI = '';
+fragment.nodeName = '';
+fragment.value = '';
+fragment = fragment.parentNode;
+fragment = fragment.childNodes[0];
diff --git a/parse5/parse5.d.ts b/parse5/parse5.d.ts
new file mode 100644
index 000000000..287225150
--- /dev/null
+++ b/parse5/parse5.d.ts
@@ -0,0 +1,263 @@
+// Type definitions for parse5 2.1.5
+// Project: https://github.com/inikulin/parse5
+// Definitions by: Nico Jansen
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare module 'parse5' {
+ import * as stream from "stream";
+ import * as events from "events";
+
+ /**
+ * Parses an HTML string.
+ * @function
+ * @param {string} html - Input HTML string.
+ * @param {ParserOptions} html - Parsing options.
+ *
+ * @example
+ * var parse5 = require('parse5');
+ * var document = parse5.parse('Hi there!');
+ */
+ export function parse(html: string, options?: ParserOptions): ASTNode;
+
+ /**
+ * Parses an HTML fragment.
+ *
+ * @param {string} html - Input html fragment
+ * @param {ParserOptions} - Parsign options
+ * @example
+ * var parse5 = require('parse5');
+ * var documentFragment = parse5.parseFragment('');
+ * // Parses the html fragment in the context of the parsed element.
+ * var trFragment = parser.parseFragment(documentFragment.childNodes[0], '| Shake it, baby |
');
+ */
+ export function parseFragment(html: string, options?: ParserOptions): ASTNode;
+ export function parseFragment(fragmentContext: any, html: string, options?: ParserOptions): ASTNode;
+
+ /**
+ * Serializes an AST node to an HTML string.
+ * @param node Node to serialize.
+ * @param options Serialization options
+ */
+ export function serialize(node: ASTNode, options?: SerializerOptions): string;
+
+ export interface ASTAttribute {
+ name: string;
+ value: string;
+ }
+
+ export interface Attribute {
+ key: string;
+ value: string;
+ }
+
+ export interface ASTNode {
+ attrs: ASTAttribute[];
+ childNodes?: ASTNode[];
+ namespaceURI?: string;
+ parentNode?: ASTNode;
+ nodeName: string;
+ quirksMode?: boolean;
+ value?: string;
+ __location: LocationInfo | ElementLocationInfo;
+ }
+
+ export interface LocationInfo {
+ /**
+ * One-based line index
+ */
+ line: number;
+ /**
+ * Zero-based first character index
+ */
+ col: number;
+ /**
+ * Zero-based first character index
+ */
+ startOffset: number;
+ /**
+ * Zero-based last character index
+ */
+ endOffset: number;
+ }
+
+
+ /**
+ * Streaming AST node to an HTML serializer. A readable stream.
+ */
+ export class SerializerStream extends stream.Readable {
+ /**
+ * Streaming AST node to an HTML serializer. A readable stream.
+ *
+ * @param Node to serialize.
+ * @param options Serialization options.
+ */
+ constructor(node: ASTNode, options: SerializerOptions);
+ }
+
+ /**
+ * Streaming HTML parser with scripting support. A writable stream.
+ */
+ export class ParserStream extends stream.Writable {
+ /**
+ * @param options Parsing options.
+ */
+ constructor(options?: ParserOptions);
+ /**
+ * The resulting document node.
+ */
+ document: ASTNode;
+ on(event: string, listener: Function): ParserStream;
+ /**
+ * Raised then parser encounters a