diff --git a/angular-environment/angular-environment-tests.ts b/angular-environment/angular-environment-tests.ts
index b3f83b14f..e7c077faf 100644
--- a/angular-environment/angular-environment-tests.ts
+++ b/angular-environment/angular-environment-tests.ts
@@ -1,30 +1,30 @@
-///
-var envServiceProvider: angular.environment.ServiceProvider;
-var envService: angular.environment.Service;
-
-envServiceProvider.config({
- domains: {
- development: ['localhost', 'dev.local'],
- production: ['acme.com', 'acme.net', 'acme.org']
- },
- vars: {
- development: {
- apiUrl: '//localhost/api',
- staticUrl: '//localhost/static'
- },
- production: {
- apiUrl: '//api.acme.com/v2',
- staticUrl: '//static.acme.com'
- }
- }
-});
-
-envServiceProvider.check();
-
-envService.get();
-
-envService.set('production');
-
-var isProd: boolean = envService.is('production');
-
-var val: any = envService.read('apiUrl');
+///
+var envServiceProvider: angular.environment.ServiceProvider;
+var envService: angular.environment.Service;
+
+envServiceProvider.config({
+ domains: {
+ development: ['localhost', 'dev.local'],
+ production: ['acme.com', 'acme.net', 'acme.org']
+ },
+ vars: {
+ development: {
+ apiUrl: '//localhost/api',
+ staticUrl: '//localhost/static'
+ },
+ production: {
+ apiUrl: '//api.acme.com/v2',
+ staticUrl: '//static.acme.com'
+ }
+ }
+});
+
+envServiceProvider.check();
+
+envService.get();
+
+envService.set('production');
+
+var isProd: boolean = envService.is('production');
+
+var val: any = envService.read('apiUrl');
diff --git a/angular-environment/angular-environment.d.ts b/angular-environment/angular-environment.d.ts
index 6651817b6..bb38b8f0a 100644
--- a/angular-environment/angular-environment.d.ts
+++ b/angular-environment/angular-environment.d.ts
@@ -1,52 +1,52 @@
-// Type definitions for angular-environment v1.0.4
-// Project: https://github.com/juanpablob/angular-environment
-// Definitions by: Matt Wheatley
-// Definitions: https://github.com/LiberisLabs
-
-declare module angular.environment {
- interface ServiceProvider {
- /**
- * Sets the configuration object
- */
- config: (config: angular.environment.Config) => void;
- /**
- * Evaluates the current domain and
- * loads the correct environment variables.
- */
- check: () => void;
- }
- interface Service {
- /**
- * Retrieve the current environment
- */
- get: () => string,
-
- /**
- * Force sets the current environment
- */
- set: (environment: string) => void,
-
- /**
- * Evaluates current environment against
- * environment parameter.
- */
- is: (environment: string) => boolean,
-
- /**
- * Retrieves the correct version of a
- * variable for the current environment.
- */
- read: (key: string) => any;
- }
-
- interface Config {
- /**
- * Map of domains to their environments
- */
- domains: { [environment: string]: Array },
- /**
- * List of variables split by environment
- */
- vars: { [environment: string]: { [variable: string]: any }},
- }
-}
+// Type definitions for angular-environment v1.0.4
+// Project: https://github.com/juanpablob/angular-environment
+// Definitions by: Matt Wheatley
+// Definitions: https://github.com/LiberisLabs
+
+declare module angular.environment {
+ interface ServiceProvider {
+ /**
+ * Sets the configuration object
+ */
+ config: (config: angular.environment.Config) => void;
+ /**
+ * Evaluates the current domain and
+ * loads the correct environment variables.
+ */
+ check: () => void;
+ }
+ interface Service {
+ /**
+ * Retrieve the current environment
+ */
+ get: () => string,
+
+ /**
+ * Force sets the current environment
+ */
+ set: (environment: string) => void,
+
+ /**
+ * Evaluates current environment against
+ * environment parameter.
+ */
+ is: (environment: string) => boolean,
+
+ /**
+ * Retrieves the correct version of a
+ * variable for the current environment.
+ */
+ read: (key: string) => any;
+ }
+
+ interface Config {
+ /**
+ * Map of domains to their environments
+ */
+ domains: { [environment: string]: Array },
+ /**
+ * List of variables split by environment
+ */
+ vars: { [environment: string]: { [variable: string]: any }},
+ }
+}
diff --git a/express/express-tests.ts b/express/express-tests.ts
index 6ac53bf2d..d344dc6eb 100644
--- a/express/express-tests.ts
+++ b/express/express-tests.ts
@@ -1,70 +1,70 @@
-///
-
-import * as express from 'express';
-var app = express();
-
-app.engine('jade', require('jade').__express);
-app.engine('html', require('ejs').renderFile);
-
-express.static.mime.define({
- 'application/fx': ['fx']
-});
-app.use('/static', express.static(__dirname + '/public'));
-
-// simple logger
-app.use(function(req, res, next){
- console.log('%s %s', req.method, req.url);
- next();
-});
-
-app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
- console.error(err);
- next(err);
-});
-
-
-app.get('/', function(req, res){
- res.send('hello world');
-});
-
-const router = express.Router();
-
-
-const pathStr : string = 'test';
-const pathRE : RegExp = /test/;
-const path = true? pathStr : pathRE;
-
-router.get(path);
-router.put(path)
-router.post(path);
-router.delete(path);
-router.get(pathStr);
-router.put(pathStr)
-router.post(pathStr);
-router.delete(pathStr);
-router.get(pathRE);
-router.put(pathRE)
-router.post(pathRE);
-router.delete(pathRE);
-
-router.use((req, res, next) => { next(); })
-router.route('/users')
- .get((req, res, next) => {
- res.send(req.query['token']);
- });
-
-router.get('/user/:id', function(req, res, next) {
- if (req.params.id == 0) next('route');
- else next();
-}, function(req, res, next) {
- res.render('regular');
-});
-
-app.use((req, res, next) => {
- // hacky trick, router is just a handler
- router(req, res, next);
-});
-
-app.use(router);
-
-app.listen(3000);
+///
+
+import * as express from 'express';
+var app = express();
+
+app.engine('jade', require('jade').__express);
+app.engine('html', require('ejs').renderFile);
+
+express.static.mime.define({
+ 'application/fx': ['fx']
+});
+app.use('/static', express.static(__dirname + '/public'));
+
+// simple logger
+app.use(function(req, res, next){
+ console.log('%s %s', req.method, req.url);
+ next();
+});
+
+app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
+ console.error(err);
+ next(err);
+});
+
+
+app.get('/', function(req, res){
+ res.send('hello world');
+});
+
+const router = express.Router();
+
+
+const pathStr : string = 'test';
+const pathRE : RegExp = /test/;
+const path = true? pathStr : pathRE;
+
+router.get(path);
+router.put(path)
+router.post(path);
+router.delete(path);
+router.get(pathStr);
+router.put(pathStr)
+router.post(pathStr);
+router.delete(pathStr);
+router.get(pathRE);
+router.put(pathRE)
+router.post(pathRE);
+router.delete(pathRE);
+
+router.use((req, res, next) => { next(); })
+router.route('/users')
+ .get((req, res, next) => {
+ res.send(req.query['token']);
+ });
+
+router.get('/user/:id', function(req, res, next) {
+ if (req.params.id == 0) next('route');
+ else next();
+}, function(req, res, next) {
+ res.render('regular');
+});
+
+app.use((req, res, next) => {
+ // hacky trick, router is just a handler
+ router(req, res, next);
+});
+
+app.use(router);
+
+app.listen(3000);
diff --git a/express/express.d.ts b/express/express.d.ts
index 171b6e6a7..3404ce903 100644
--- a/express/express.d.ts
+++ b/express/express.d.ts
@@ -1,1081 +1,1081 @@
-// Type definitions for Express 4.x
-// Project: http://expressjs.com
-// Definitions by: Boris Yankov
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-/* =================== USAGE ===================
-
- import * as express from "express";
- var app = express();
-
- =============================================== */
-
-///
-///
-
-declare module Express {
-
- // 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 "express" {
- import * as http from "http";
- import * as serveStatic from "serve-static";
-
- function e(): e.Express;
-
- module e {
- interface IRoute {
- path: string;
- stack: any;
- all(...handler: RequestHandler[]): IRoute;
- get(...handler: RequestHandler[]): IRoute;
- post(...handler: RequestHandler[]): IRoute;
- put(...handler: RequestHandler[]): IRoute;
- delete(...handler: RequestHandler[]): IRoute;
- patch(...handler: RequestHandler[]): IRoute;
- options(...handler: RequestHandler[]): IRoute;
- head(...handler: RequestHandler[]): IRoute;
- }
-
- interface IRouterMatcher {
- (name: string|RegExp, ...handlers: RequestHandler[]): T;
- }
-
- interface IRouter extends RequestHandler {
- /**
- * Map the given param placeholder `name`(s) to the given callback(s).
- *
- * Parameter mapping is used to provide pre-conditions to routes
- * which use normalized placeholders. For example a _:user_id_ parameter
- * could automatically load a user's information from the database without
- * any additional code,
- *
- * The callback uses the samesignature as middleware, the only differencing
- * being that the value of the placeholder is passed, in this case the _id_
- * of the user. Once the `next()` function is invoked, just like middleware
- * it will continue on to execute the route, or subsequent parameter functions.
- *
- * app.param('user_id', function(req, res, next, id){
- * User.find(id, function(err, user){
- * if (err) {
- * next(err);
- * } else if (user) {
- * req.user = user;
- * next();
- * } else {
- * next(new Error('failed to load user'));
- * }
- * });
- * });
- *
- * @param name
- * @param fn
- */
- param(name: string, handler: RequestParamHandler): T;
- param(name: string, matcher: RegExp): T;
- param(name: string, mapper: (param: any) => any): T;
- // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API
- param(callback: (name: string, matcher: RegExp) => RequestParamHandler): T;
-
- /**
- * Special-cased "all" method, applying the given route `path`,
- * middleware, and callback to _every_ HTTP method.
- *
- * @param path
- * @param fn
- */
- all: IRouterMatcher;
- get: IRouterMatcher;
- post: IRouterMatcher;
- put: IRouterMatcher;
- delete: IRouterMatcher;
- patch: IRouterMatcher;
- options: IRouterMatcher;
- head: IRouterMatcher;
-
- route(path: string): IRoute;
-
- use(...handler: RequestHandler[]): T;
- use(handler: ErrorRequestHandler|RequestHandler): T;
- use(path: string, ...handler: RequestHandler[]): T;
- use(path: string, handler: ErrorRequestHandler|RequestHandler): T;
- use(path: string[], ...handler: RequestHandler[]): T;
- use(path: string[], handler: ErrorRequestHandler): T;
- use(path: RegExp, ...handler: RequestHandler[]): T;
- use(path: RegExp, handler: ErrorRequestHandler): T;
- use(path:string, router:Router): T;
- }
-
- export function Router(options?: any): Router;
-
- export interface Router extends IRouter {}
-
- interface CookieOptions {
- maxAge?: number;
- signed?: boolean;
- expires?: Date;
- httpOnly?: boolean;
- path?: string;
- domain?: string;
- secure?: boolean;
- }
-
- interface Errback { (err: Error): void; }
-
- interface Request extends http.ServerRequest, Express.Request {
-
- /**
- * Return request header.
- *
- * The `Referrer` header field is special-cased,
- * both `Referrer` and `Referer` are interchangeable.
- *
- * Examples:
- *
- * req.get('Content-Type');
- * // => "text/plain"
- *
- * req.get('content-type');
- * // => "text/plain"
- *
- * req.get('Something');
- * // => undefined
- *
- * Aliased as `req.header()`.
- *
- * @param name
- */
- get (name: string): string;
-
- header(name: string): string;
-
- headers: { [key: string]: string; };
-
- /**
- * Check if the given `type(s)` is acceptable, returning
- * the best match when true, otherwise `undefined`, in which
- * case you should respond with 406 "Not Acceptable".
- *
- * The `type` value may be a single mime type string
- * such as "application/json", the extension name
- * such as "json", a comma-delimted list such as "json, html, text/plain",
- * or an array `["json", "html", "text/plain"]`. When a list
- * or array is given the _best_ match, if any is returned.
- *
- * Examples:
- *
- * // Accept: text/html
- * req.accepts('html');
- * // => "html"
- *
- * // Accept: text/*, application/json
- * req.accepts('html');
- * // => "html"
- * req.accepts('text/html');
- * // => "text/html"
- * req.accepts('json, text');
- * // => "json"
- * req.accepts('application/json');
- * // => "application/json"
- *
- * // Accept: text/*, application/json
- * req.accepts('image/png');
- * req.accepts('png');
- * // => undefined
- *
- * // Accept: text/*;q=.5, application/json
- * req.accepts(['html', 'json']);
- * req.accepts('html, json');
- * // => "json"
- */
- accepts(type: string): string;
-
- accepts(type: string[]): string;
-
- /**
- * Returns the first accepted charset of the specified character sets,
- * based on the request’s Accept-Charset HTTP header field.
- * If none of the specified charsets is accepted, returns false.
- *
- * For more information, or if you have issues or concerns, see accepts.
- * @param charset
- */
- acceptsCharsets(charset?: string|string[]): string[];
-
- /**
- * Returns the first accepted encoding of the specified encodings,
- * based on the request’s Accept-Encoding HTTP header field.
- * If none of the specified encodings is accepted, returns false.
- *
- * For more information, or if you have issues or concerns, see accepts.
- * @param encoding
- */
- acceptsEncodings(encoding?: string|string[]): string[];
-
- /**
- * Returns the first accepted language of the specified languages,
- * based on the request’s Accept-Language HTTP header field.
- * If none of the specified languages is accepted, returns false.
- *
- * For more information, or if you have issues or concerns, see accepts.
- *
- * @param lang
- */
- acceptsLanguages(lang?: string|string[]): string[];
-
- /**
- * Parse Range header field,
- * capping to the given `size`.
- *
- * Unspecified ranges such as "0-" require
- * knowledge of your resource length. In
- * the case of a byte range this is of course
- * the total number of bytes. If the Range
- * header field is not given `null` is returned,
- * `-1` when unsatisfiable, `-2` when syntactically invalid.
- *
- * NOTE: remember that ranges are inclusive, so
- * for example "Range: users=0-3" should respond
- * with 4 users when available, not 3.
- *
- * @param size
- */
- range(size: number): any[];
-
- /**
- * Return an array of Accepted media types
- * ordered from highest quality to lowest.
- */
- accepted: MediaType[];
-
- /**
- * Return the value of param `name` when present or `defaultValue`.
- *
- * - Checks route placeholders, ex: _/user/:id_
- * - Checks body params, ex: id=12, {"id":12}
- * - Checks query string params, ex: ?id=12
- *
- * To utilize request bodies, `req.body`
- * should be an object. This can be done by using
- * the `connect.bodyParser()` middleware.
- *
- * @param name
- * @param defaultValue
- */
- param(name: string, defaultValue?: any): string;
-
- /**
- * Check if the incoming request contains the "Content-Type"
- * header field, and it contains the give mime `type`.
- *
- * Examples:
- *
- * // With Content-Type: text/html; charset=utf-8
- * req.is('html');
- * req.is('text/html');
- * req.is('text/*');
- * // => true
- *
- * // When Content-Type is application/json
- * req.is('json');
- * req.is('application/json');
- * req.is('application/*');
- * // => true
- *
- * req.is('html');
- * // => false
- *
- * @param type
- */
- is(type: string): boolean;
-
- /**
- * Return the protocol string "http" or "https"
- * when requested with TLS. When the "trust proxy"
- * setting is enabled the "X-Forwarded-Proto" header
- * field will be trusted. If you're running behind
- * a reverse proxy that supplies https for you this
- * may be enabled.
- */
- protocol: string;
-
- /**
- * Short-hand for:
- *
- * req.protocol == 'https'
- */
- secure: boolean;
-
- /**
- * Return the remote address, or when
- * "trust proxy" is `true` return
- * the upstream addr.
- */
- ip: string;
-
- /**
- * When "trust proxy" is `true`, parse
- * the "X-Forwarded-For" ip address list.
- *
- * For example if the value were "client, proxy1, proxy2"
- * you would receive the array `["client", "proxy1", "proxy2"]`
- * where "proxy2" is the furthest down-stream.
- */
- ips: string[];
-
- /**
- * Return subdomains as an array.
- *
- * Subdomains are the dot-separated parts of the host before the main domain of
- * the app. By default, the domain of the app is assumed to be the last two
- * parts of the host. This can be changed by setting "subdomain offset".
- *
- * For example, if the domain is "tobi.ferrets.example.com":
- * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
- * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
- */
- subdomains: string[];
-
- /**
- * Short-hand for `url.parse(req.url).pathname`.
- */
- path: string;
-
- /**
- * Parse the "Host" header field hostname.
- */
- hostname: string;
-
- /**
- * @deprecated Use hostname instead.
- */
- host: string;
-
- /**
- * Check if the request is fresh, aka
- * Last-Modified and/or the ETag
- * still match.
- */
- fresh: boolean;
-
- /**
- * Check if the request is stale, aka
- * "Last-Modified" and / or the "ETag" for the
- * resource has changed.
- */
- stale: boolean;
-
- /**
- * Check if the request was an _XMLHttpRequest_.
- */
- xhr: boolean;
-
- //body: { username: string; password: string; remember: boolean; title: string; };
- body: any;
-
- //cookies: { string; remember: boolean; };
- cookies: any;
-
- method: string;
-
- params: any;
-
- user: any;
-
- authenticatedUser: any;
-
- /**
- * Clear cookie `name`.
- *
- * @param name
- * @param options
- */
- clearCookie(name: string, options?: any): Response;
-
- query: any;
-
- route: any;
-
- signedCookies: any;
-
- originalUrl: string;
-
- url: string;
-
- baseUrl: string;
-
- app: Application;
- }
-
- interface MediaType {
- value: string;
- quality: number;
- type: string;
- subtype: string;
- }
-
- interface Send {
- (status: number, body?: any): Response;
- (body: any): Response;
- }
-
- interface Response extends http.ServerResponse, Express.Response {
- /**
- * Set status `code`.
- *
- * @param code
- */
- status(code: number): Response;
-
- /**
- * Set the response HTTP status code to `statusCode` and send its string representation as the response body.
- * @link http://expressjs.com/4x/api.html#res.sendStatus
- *
- * Examples:
- *
- * res.sendStatus(200); // equivalent to res.status(200).send('OK')
- * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
- * res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
- * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
- *
- * @param code
- */
- sendStatus(code: number): Response;
-
- /**
- * Set Link header field with the given `links`.
- *
- * Examples:
- *
- * res.links({
- * next: 'http://api.example.com/users?page=2',
- * last: 'http://api.example.com/users?page=5'
- * });
- *
- * @param links
- */
- links(links: any): Response;
-
- /**
- * Send a response.
- *
- * Examples:
- *
- * res.send(new Buffer('wahoo'));
- * res.send({ some: 'json' });
- * res.send('some html
');
- * res.send(404, 'Sorry, cant find that');
- * res.send(404);
- */
- send: Send;
-
- /**
- * Send JSON response.
- *
- * Examples:
- *
- * res.json(null);
- * res.json({ user: 'tj' });
- * res.json(500, 'oh noes!');
- * res.json(404, 'I dont have that');
- */
- json: Send;
-
- /**
- * Send JSON response with JSONP callback support.
- *
- * Examples:
- *
- * res.jsonp(null);
- * res.jsonp({ user: 'tj' });
- * res.jsonp(500, 'oh noes!');
- * res.jsonp(404, 'I dont have that');
- */
- jsonp: Send;
-
- /**
- * Transfer the file at the given `path`.
- *
- * Automatically sets the _Content-Type_ response header field.
- * The callback `fn(err)` is invoked when the transfer is complete
- * or when an error occurs. Be sure to check `res.sentHeader`
- * if you wish to attempt responding, as the header and some data
- * may have already been transferred.
- *
- * Options:
- *
- * - `maxAge` defaulting to 0 (can be string converted by `ms`)
- * - `root` root directory for relative filenames
- * - `headers` object of headers to serve with file
- * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them
- *
- * Other options are passed along to `send`.
- *
- * Examples:
- *
- * The following example illustrates how `res.sendFile()` may
- * be used as an alternative for the `static()` middleware for
- * dynamic situations. The code backing `res.sendFile()` is actually
- * the same code, so HTTP cache support etc is identical.
- *
- * app.get('/user/:uid/photos/:file', function(req, res){
- * var uid = req.params.uid
- * , file = req.params.file;
- *
- * req.user.mayViewFilesFrom(uid, function(yes){
- * if (yes) {
- * res.sendFile('/uploads/' + uid + '/' + file);
- * } else {
- * res.send(403, 'Sorry! you cant see that.');
- * }
- * });
- * });
- *
- * @api public
- */
- sendFile(path: string): void;
- sendFile(path: string, options: any): void;
- sendFile(path: string, fn: Errback): void;
- sendFile(path: string, options: any, fn: Errback): void;
-
- /**
- * @deprecated Use sendFile instead.
- */
- sendfile(path: string): void;
- /**
- * @deprecated Use sendFile instead.
- */
- sendfile(path: string, options: any): void;
- /**
- * @deprecated Use sendFile instead.
- */
- sendfile(path: string, fn: Errback): void;
- /**
- * @deprecated Use sendFile instead.
- */
- sendfile(path: string, options: any, fn: Errback): void;
-
- /**
- * Transfer the file at the given `path` as an attachment.
- *
- * Optionally providing an alternate attachment `filename`,
- * and optional callback `fn(err)`. The callback is invoked
- * when the data transfer is complete, or when an error has
- * ocurred. Be sure to check `res.headerSent` if you plan to respond.
- *
- * This method uses `res.sendfile()`.
- */
- download(path: string): void;
- download(path: string, filename: string): void;
- download(path: string, fn: Errback): void;
- download(path: string, filename: string, fn: Errback): void;
-
- /**
- * Set _Content-Type_ response header with `type` through `mime.lookup()`
- * when it does not contain "/", or set the Content-Type to `type` otherwise.
- *
- * Examples:
- *
- * res.type('.html');
- * res.type('html');
- * res.type('json');
- * res.type('application/json');
- * res.type('png');
- *
- * @param type
- */
- contentType(type: string): Response;
-
- /**
- * Set _Content-Type_ response header with `type` through `mime.lookup()`
- * when it does not contain "/", or set the Content-Type to `type` otherwise.
- *
- * Examples:
- *
- * res.type('.html');
- * res.type('html');
- * res.type('json');
- * res.type('application/json');
- * res.type('png');
- *
- * @param type
- */
- type(type: string): Response;
-
- /**
- * Respond to the Acceptable formats using an `obj`
- * of mime-type callbacks.
- *
- * This method uses `req.accepted`, an array of
- * acceptable types ordered by their quality values.
- * When "Accept" is not present the _first_ callback
- * is invoked, otherwise the first match is used. When
- * no match is performed the server responds with
- * 406 "Not Acceptable".
- *
- * Content-Type is set for you, however if you choose
- * you may alter this within the callback using `res.type()`
- * or `res.set('Content-Type', ...)`.
- *
- * res.format({
- * 'text/plain': function(){
- * res.send('hey');
- * },
- *
- * 'text/html': function(){
- * res.send('hey
');
- * },
- *
- * 'appliation/json': function(){
- * res.send({ message: 'hey' });
- * }
- * });
- *
- * In addition to canonicalized MIME types you may
- * also use extnames mapped to these types:
- *
- * res.format({
- * text: function(){
- * res.send('hey');
- * },
- *
- * html: function(){
- * res.send('hey
');
- * },
- *
- * json: function(){
- * res.send({ message: 'hey' });
- * }
- * });
- *
- * By default Express passes an `Error`
- * with a `.status` of 406 to `next(err)`
- * if a match is not made. If you provide
- * a `.default` callback it will be invoked
- * instead.
- *
- * @param obj
- */
- format(obj: any): Response;
-
- /**
- * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
- *
- * @param filename
- */
- attachment(filename?: string): Response;
-
- /**
- * Set header `field` to `val`, or pass
- * an object of header fields.
- *
- * Examples:
- *
- * res.set('Foo', ['bar', 'baz']);
- * res.set('Accept', 'application/json');
- * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
- *
- * Aliased as `res.header()`.
- */
- set(field: any): Response;
- set(field: string, value?: string): Response;
-
- header(field: any): Response;
- header(field: string, value?: string): Response;
-
- // Property indicating if HTTP headers has been sent for the response.
- headersSent: boolean;
-
- /**
- * Get value for header `field`.
- *
- * @param field
- */
- get (field: string): string;
-
- /**
- * Clear cookie `name`.
- *
- * @param name
- * @param options
- */
- clearCookie(name: string, options?: any): Response;
-
- /**
- * Set cookie `name` to `val`, with the given `options`.
- *
- * Options:
- *
- * - `maxAge` max-age in milliseconds, converted to `expires`
- * - `signed` sign the cookie
- * - `path` defaults to "/"
- *
- * Examples:
- *
- * // "Remember Me" for 15 minutes
- * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
- *
- * // save as above
- * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
- */
- cookie(name: string, val: string, options: CookieOptions): Response;
- cookie(name: string, val: any, options: CookieOptions): Response;
- cookie(name: string, val: any): Response;
-
- /**
- * Set the location header to `url`.
- *
- * The given `url` can also be the name of a mapped url, for
- * example by default express supports "back" which redirects
- * to the _Referrer_ or _Referer_ headers or "/".
- *
- * Examples:
- *
- * res.location('/foo/bar').;
- * res.location('http://example.com');
- * res.location('../login'); // /blog/post/1 -> /blog/login
- *
- * Mounting:
- *
- * When an application is mounted and `res.location()`
- * is given a path that does _not_ lead with "/" it becomes
- * relative to the mount-point. For example if the application
- * is mounted at "/blog", the following would become "/blog/login".
- *
- * res.location('login');
- *
- * While the leading slash would result in a location of "/login":
- *
- * res.location('/login');
- *
- * @param url
- */
- location(url: string): Response;
-
- /**
- * Redirect to the given `url` with optional response `status`
- * defaulting to 302.
- *
- * The resulting `url` is determined by `res.location()`, so
- * it will play nicely with mounted apps, relative paths,
- * `"back"` etc.
- *
- * Examples:
- *
- * res.redirect('/foo/bar');
- * res.redirect('http://example.com');
- * res.redirect(301, 'http://example.com');
- * res.redirect('http://example.com', 301);
- * res.redirect('../login'); // /blog/post/1 -> /blog/login
- */
- redirect(url: string): void;
- redirect(status: number, url: string): void;
- redirect(url: string, status: number): void;
-
- /**
- * Render `view` with the given `options` and optional callback `fn`.
- * When a callback function is given a response will _not_ be made
- * automatically, otherwise a response of _200_ and _text/html_ is given.
- *
- * Options:
- *
- * - `cache` boolean hinting to the engine it should cache
- * - `filename` filename of the view being rendered
- */
- render(view: string, options?: Object, callback?: (err: Error, html: string) => void ): void;
- render(view: string, callback?: (err: Error, html: string) => void ): void;
-
- locals: any;
-
- charset: string;
- }
-
- interface NextFunction {
- (): void;
- (err: any): void;
- }
-
- interface ErrorRequestHandler {
- (err: any, req: Request, res: Response, next: NextFunction): any;
- }
-
- interface RequestHandler {
- (req: Request, res: Response, next: NextFunction): any;
- }
-
- interface Handler extends RequestHandler {}
-
- interface RequestParamHandler {
- (req: Request, res: Response, next: NextFunction, param: any): any;
- }
-
- interface Application extends IRouter, Express.Application {
- /**
- * Initialize the server.
- *
- * - setup default configuration
- * - setup default middleware
- * - setup route reflection methods
- */
- init(): void;
-
- /**
- * Initialize application configuration.
- */
- defaultConfiguration(): void;
-
- /**
- * Register the given template engine callback `fn`
- * as `ext`.
- *
- * By default will `require()` the engine based on the
- * file extension. For example if you try to render
- * a "foo.jade" file Express will invoke the following internally:
- *
- * app.engine('jade', require('jade').__express);
- *
- * For engines that do not provide `.__express` out of the box,
- * or if you wish to "map" a different extension to the template engine
- * you may use this method. For example mapping the EJS template engine to
- * ".html" files:
- *
- * app.engine('html', require('ejs').renderFile);
- *
- * In this case EJS provides a `.renderFile()` method with
- * the same signature that Express expects: `(path, options, callback)`,
- * though note that it aliases this method as `ejs.__express` internally
- * so if you're using ".ejs" extensions you dont need to do anything.
- *
- * Some template engines do not follow this convention, the
- * [Consolidate.js](https://github.com/visionmedia/consolidate.js)
- * library was created to map all of node's popular template
- * engines to follow this convention, thus allowing them to
- * work seamlessly within Express.
- */
- engine(ext: string, fn: Function): Application;
-
- /**
- * Assign `setting` to `val`, or return `setting`'s value.
- *
- * app.set('foo', 'bar');
- * app.get('foo');
- * // => "bar"
- * app.set('foo', ['bar', 'baz']);
- * app.get('foo');
- * // => ["bar", "baz"]
- *
- * Mounted servers inherit their parent server's settings.
- *
- * @param setting
- * @param val
- */
- set(setting: string, val: any): Application;
- get: {
- (name: string): any; // Getter
- (name: string|RegExp, ...handlers: RequestHandler[]): Application;
- };
-
- /**
- * Return the app's absolute pathname
- * based on the parent(s) that have
- * mounted it.
- *
- * For example if the application was
- * mounted as "/admin", which itself
- * was mounted as "/blog" then the
- * return value would be "/blog/admin".
- */
- path(): string;
-
- /**
- * Check if `setting` is enabled (truthy).
- *
- * app.enabled('foo')
- * // => false
- *
- * app.enable('foo')
- * app.enabled('foo')
- * // => true
- */
- enabled(setting: string): boolean;
-
- /**
- * Check if `setting` is disabled.
- *
- * app.disabled('foo')
- * // => true
- *
- * app.enable('foo')
- * app.disabled('foo')
- * // => false
- *
- * @param setting
- */
- disabled(setting: string): boolean;
-
- /**
- * Enable `setting`.
- *
- * @param setting
- */
- enable(setting: string): Application;
-
- /**
- * Disable `setting`.
- *
- * @param setting
- */
- disable(setting: string): Application;
-
- /**
- * Configure callback for zero or more envs,
- * when no `env` is specified that callback will
- * be invoked for all environments. Any combination
- * can be used multiple times, in any order desired.
- *
- * Examples:
- *
- * app.configure(function(){
- * // executed for all envs
- * });
- *
- * app.configure('stage', function(){
- * // executed staging env
- * });
- *
- * app.configure('stage', 'production', function(){
- * // executed for stage and production
- * });
- *
- * Note:
- *
- * These callbacks are invoked immediately, and
- * are effectively sugar for the following:
- *
- * var env = process.env.NODE_ENV || 'development';
- *
- * switch (env) {
- * case 'development':
- * ...
- * break;
- * case 'stage':
- * ...
- * break;
- * case 'production':
- * ...
- * break;
- * }
- *
- * @param env
- * @param fn
- */
- configure(fn: Function): Application;
- configure(env0: string, fn: Function): Application;
- configure(env0: string, env1: string, fn: Function): Application;
- configure(env0: string, env1: string, env2: string, fn: Function): Application;
- configure(env0: string, env1: string, env2: string, env3: string, fn: Function): Application;
- configure(env0: string, env1: string, env2: string, env3: string, env4: string, fn: Function): Application;
-
- /**
- * Render the given view `name` name with `options`
- * and a callback accepting an error and the
- * rendered template string.
- *
- * Example:
- *
- * app.render('email', { name: 'Tobi' }, function(err, html){
- * // ...
- * })
- *
- * @param name
- * @param options or fn
- * @param fn
- */
- render(name: string, options?: Object, callback?: (err: Error, html: string) => void): void;
- render(name: string, callback: (err: Error, html: string) => void): void;
-
-
- /**
- * Listen for connections.
- *
- * A node `http.Server` is returned, with this
- * application (which is a `Function`) as its
- * callback. If you wish to create both an HTTP
- * and HTTPS server you may do so with the "http"
- * and "https" modules as shown here:
- *
- * var http = require('http')
- * , https = require('https')
- * , express = require('express')
- * , app = express();
- *
- * http.createServer(app).listen(80);
- * https.createServer({ ... }, app).listen(443);
- */
- listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server;
- listen(port: number, hostname: string, callback?: Function): http.Server;
- listen(port: number, callback?: Function): http.Server;
- listen(path: string, callback?: Function): http.Server;
- listen(handle: any, listeningListener?: Function): http.Server;
-
- route(path: string): IRoute;
-
- router: string;
-
- settings: any;
-
- resource: any;
-
- map: any;
-
- locals: any;
-
- /**
- * The app.routes object houses all of the routes defined mapped by the
- * associated HTTP verb. This object may be used for introspection
- * capabilities, for example Express uses this internally not only for
- * routing but to provide default OPTIONS behaviour unless app.options()
- * is used. Your application or framework may also remove routes by
- * simply by removing them from this object.
- */
- routes: any;
- }
-
- interface Express extends Application {
- /**
- * Framework version.
- */
- version: string;
-
- /**
- * Expose mime.
- */
- mime: string;
-
- (): Application;
-
- /**
- * Create an express application.
- */
- createApplication(): Application;
-
- createServer(): Application;
-
- application: any;
-
- request: Request;
-
- response: Response;
- }
-
- var static: typeof serveStatic;
- }
-
- export = e;
-}
+// Type definitions for Express 4.x
+// Project: http://expressjs.com
+// Definitions by: Boris Yankov
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+/* =================== USAGE ===================
+
+ import * as express from "express";
+ var app = express();
+
+ =============================================== */
+
+///
+///
+
+declare module Express {
+
+ // 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 "express" {
+ import * as http from "http";
+ import * as serveStatic from "serve-static";
+
+ function e(): e.Express;
+
+ module e {
+ interface IRoute {
+ path: string;
+ stack: any;
+ all(...handler: RequestHandler[]): IRoute;
+ get(...handler: RequestHandler[]): IRoute;
+ post(...handler: RequestHandler[]): IRoute;
+ put(...handler: RequestHandler[]): IRoute;
+ delete(...handler: RequestHandler[]): IRoute;
+ patch(...handler: RequestHandler[]): IRoute;
+ options(...handler: RequestHandler[]): IRoute;
+ head(...handler: RequestHandler[]): IRoute;
+ }
+
+ interface IRouterMatcher {
+ (name: string|RegExp, ...handlers: RequestHandler[]): T;
+ }
+
+ interface IRouter extends RequestHandler {
+ /**
+ * Map the given param placeholder `name`(s) to the given callback(s).
+ *
+ * Parameter mapping is used to provide pre-conditions to routes
+ * which use normalized placeholders. For example a _:user_id_ parameter
+ * could automatically load a user's information from the database without
+ * any additional code,
+ *
+ * The callback uses the samesignature as middleware, the only differencing
+ * being that the value of the placeholder is passed, in this case the _id_
+ * of the user. Once the `next()` function is invoked, just like middleware
+ * it will continue on to execute the route, or subsequent parameter functions.
+ *
+ * app.param('user_id', function(req, res, next, id){
+ * User.find(id, function(err, user){
+ * if (err) {
+ * next(err);
+ * } else if (user) {
+ * req.user = user;
+ * next();
+ * } else {
+ * next(new Error('failed to load user'));
+ * }
+ * });
+ * });
+ *
+ * @param name
+ * @param fn
+ */
+ param(name: string, handler: RequestParamHandler): T;
+ param(name: string, matcher: RegExp): T;
+ param(name: string, mapper: (param: any) => any): T;
+ // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API
+ param(callback: (name: string, matcher: RegExp) => RequestParamHandler): T;
+
+ /**
+ * Special-cased "all" method, applying the given route `path`,
+ * middleware, and callback to _every_ HTTP method.
+ *
+ * @param path
+ * @param fn
+ */
+ all: IRouterMatcher;
+ get: IRouterMatcher;
+ post: IRouterMatcher;
+ put: IRouterMatcher;
+ delete: IRouterMatcher;
+ patch: IRouterMatcher;
+ options: IRouterMatcher;
+ head: IRouterMatcher;
+
+ route(path: string): IRoute;
+
+ use(...handler: RequestHandler[]): T;
+ use(handler: ErrorRequestHandler|RequestHandler): T;
+ use(path: string, ...handler: RequestHandler[]): T;
+ use(path: string, handler: ErrorRequestHandler|RequestHandler): T;
+ use(path: string[], ...handler: RequestHandler[]): T;
+ use(path: string[], handler: ErrorRequestHandler): T;
+ use(path: RegExp, ...handler: RequestHandler[]): T;
+ use(path: RegExp, handler: ErrorRequestHandler): T;
+ use(path:string, router:Router): T;
+ }
+
+ export function Router(options?: any): Router;
+
+ export interface Router extends IRouter {}
+
+ interface CookieOptions {
+ maxAge?: number;
+ signed?: boolean;
+ expires?: Date;
+ httpOnly?: boolean;
+ path?: string;
+ domain?: string;
+ secure?: boolean;
+ }
+
+ interface Errback { (err: Error): void; }
+
+ interface Request extends http.ServerRequest, Express.Request {
+
+ /**
+ * Return request header.
+ *
+ * The `Referrer` header field is special-cased,
+ * both `Referrer` and `Referer` are interchangeable.
+ *
+ * Examples:
+ *
+ * req.get('Content-Type');
+ * // => "text/plain"
+ *
+ * req.get('content-type');
+ * // => "text/plain"
+ *
+ * req.get('Something');
+ * // => undefined
+ *
+ * Aliased as `req.header()`.
+ *
+ * @param name
+ */
+ get (name: string): string;
+
+ header(name: string): string;
+
+ headers: { [key: string]: string; };
+
+ /**
+ * Check if the given `type(s)` is acceptable, returning
+ * the best match when true, otherwise `undefined`, in which
+ * case you should respond with 406 "Not Acceptable".
+ *
+ * The `type` value may be a single mime type string
+ * such as "application/json", the extension name
+ * such as "json", a comma-delimted list such as "json, html, text/plain",
+ * or an array `["json", "html", "text/plain"]`. When a list
+ * or array is given the _best_ match, if any is returned.
+ *
+ * Examples:
+ *
+ * // Accept: text/html
+ * req.accepts('html');
+ * // => "html"
+ *
+ * // Accept: text/*, application/json
+ * req.accepts('html');
+ * // => "html"
+ * req.accepts('text/html');
+ * // => "text/html"
+ * req.accepts('json, text');
+ * // => "json"
+ * req.accepts('application/json');
+ * // => "application/json"
+ *
+ * // Accept: text/*, application/json
+ * req.accepts('image/png');
+ * req.accepts('png');
+ * // => undefined
+ *
+ * // Accept: text/*;q=.5, application/json
+ * req.accepts(['html', 'json']);
+ * req.accepts('html, json');
+ * // => "json"
+ */
+ accepts(type: string): string;
+
+ accepts(type: string[]): string;
+
+ /**
+ * Returns the first accepted charset of the specified character sets,
+ * based on the request’s Accept-Charset HTTP header field.
+ * If none of the specified charsets is accepted, returns false.
+ *
+ * For more information, or if you have issues or concerns, see accepts.
+ * @param charset
+ */
+ acceptsCharsets(charset?: string|string[]): string[];
+
+ /**
+ * Returns the first accepted encoding of the specified encodings,
+ * based on the request’s Accept-Encoding HTTP header field.
+ * If none of the specified encodings is accepted, returns false.
+ *
+ * For more information, or if you have issues or concerns, see accepts.
+ * @param encoding
+ */
+ acceptsEncodings(encoding?: string|string[]): string[];
+
+ /**
+ * Returns the first accepted language of the specified languages,
+ * based on the request’s Accept-Language HTTP header field.
+ * If none of the specified languages is accepted, returns false.
+ *
+ * For more information, or if you have issues or concerns, see accepts.
+ *
+ * @param lang
+ */
+ acceptsLanguages(lang?: string|string[]): string[];
+
+ /**
+ * Parse Range header field,
+ * capping to the given `size`.
+ *
+ * Unspecified ranges such as "0-" require
+ * knowledge of your resource length. In
+ * the case of a byte range this is of course
+ * the total number of bytes. If the Range
+ * header field is not given `null` is returned,
+ * `-1` when unsatisfiable, `-2` when syntactically invalid.
+ *
+ * NOTE: remember that ranges are inclusive, so
+ * for example "Range: users=0-3" should respond
+ * with 4 users when available, not 3.
+ *
+ * @param size
+ */
+ range(size: number): any[];
+
+ /**
+ * Return an array of Accepted media types
+ * ordered from highest quality to lowest.
+ */
+ accepted: MediaType[];
+
+ /**
+ * Return the value of param `name` when present or `defaultValue`.
+ *
+ * - Checks route placeholders, ex: _/user/:id_
+ * - Checks body params, ex: id=12, {"id":12}
+ * - Checks query string params, ex: ?id=12
+ *
+ * To utilize request bodies, `req.body`
+ * should be an object. This can be done by using
+ * the `connect.bodyParser()` middleware.
+ *
+ * @param name
+ * @param defaultValue
+ */
+ param(name: string, defaultValue?: any): string;
+
+ /**
+ * Check if the incoming request contains the "Content-Type"
+ * header field, and it contains the give mime `type`.
+ *
+ * Examples:
+ *
+ * // With Content-Type: text/html; charset=utf-8
+ * req.is('html');
+ * req.is('text/html');
+ * req.is('text/*');
+ * // => true
+ *
+ * // When Content-Type is application/json
+ * req.is('json');
+ * req.is('application/json');
+ * req.is('application/*');
+ * // => true
+ *
+ * req.is('html');
+ * // => false
+ *
+ * @param type
+ */
+ is(type: string): boolean;
+
+ /**
+ * Return the protocol string "http" or "https"
+ * when requested with TLS. When the "trust proxy"
+ * setting is enabled the "X-Forwarded-Proto" header
+ * field will be trusted. If you're running behind
+ * a reverse proxy that supplies https for you this
+ * may be enabled.
+ */
+ protocol: string;
+
+ /**
+ * Short-hand for:
+ *
+ * req.protocol == 'https'
+ */
+ secure: boolean;
+
+ /**
+ * Return the remote address, or when
+ * "trust proxy" is `true` return
+ * the upstream addr.
+ */
+ ip: string;
+
+ /**
+ * When "trust proxy" is `true`, parse
+ * the "X-Forwarded-For" ip address list.
+ *
+ * For example if the value were "client, proxy1, proxy2"
+ * you would receive the array `["client", "proxy1", "proxy2"]`
+ * where "proxy2" is the furthest down-stream.
+ */
+ ips: string[];
+
+ /**
+ * Return subdomains as an array.
+ *
+ * Subdomains are the dot-separated parts of the host before the main domain of
+ * the app. By default, the domain of the app is assumed to be the last two
+ * parts of the host. This can be changed by setting "subdomain offset".
+ *
+ * For example, if the domain is "tobi.ferrets.example.com":
+ * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
+ * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
+ */
+ subdomains: string[];
+
+ /**
+ * Short-hand for `url.parse(req.url).pathname`.
+ */
+ path: string;
+
+ /**
+ * Parse the "Host" header field hostname.
+ */
+ hostname: string;
+
+ /**
+ * @deprecated Use hostname instead.
+ */
+ host: string;
+
+ /**
+ * Check if the request is fresh, aka
+ * Last-Modified and/or the ETag
+ * still match.
+ */
+ fresh: boolean;
+
+ /**
+ * Check if the request is stale, aka
+ * "Last-Modified" and / or the "ETag" for the
+ * resource has changed.
+ */
+ stale: boolean;
+
+ /**
+ * Check if the request was an _XMLHttpRequest_.
+ */
+ xhr: boolean;
+
+ //body: { username: string; password: string; remember: boolean; title: string; };
+ body: any;
+
+ //cookies: { string; remember: boolean; };
+ cookies: any;
+
+ method: string;
+
+ params: any;
+
+ user: any;
+
+ authenticatedUser: any;
+
+ /**
+ * Clear cookie `name`.
+ *
+ * @param name
+ * @param options
+ */
+ clearCookie(name: string, options?: any): Response;
+
+ query: any;
+
+ route: any;
+
+ signedCookies: any;
+
+ originalUrl: string;
+
+ url: string;
+
+ baseUrl: string;
+
+ app: Application;
+ }
+
+ interface MediaType {
+ value: string;
+ quality: number;
+ type: string;
+ subtype: string;
+ }
+
+ interface Send {
+ (status: number, body?: any): Response;
+ (body: any): Response;
+ }
+
+ interface Response extends http.ServerResponse, Express.Response {
+ /**
+ * Set status `code`.
+ *
+ * @param code
+ */
+ status(code: number): Response;
+
+ /**
+ * Set the response HTTP status code to `statusCode` and send its string representation as the response body.
+ * @link http://expressjs.com/4x/api.html#res.sendStatus
+ *
+ * Examples:
+ *
+ * res.sendStatus(200); // equivalent to res.status(200).send('OK')
+ * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
+ * res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
+ * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
+ *
+ * @param code
+ */
+ sendStatus(code: number): Response;
+
+ /**
+ * Set Link header field with the given `links`.
+ *
+ * Examples:
+ *
+ * res.links({
+ * next: 'http://api.example.com/users?page=2',
+ * last: 'http://api.example.com/users?page=5'
+ * });
+ *
+ * @param links
+ */
+ links(links: any): Response;
+
+ /**
+ * Send a response.
+ *
+ * Examples:
+ *
+ * res.send(new Buffer('wahoo'));
+ * res.send({ some: 'json' });
+ * res.send('some html
');
+ * res.send(404, 'Sorry, cant find that');
+ * res.send(404);
+ */
+ send: Send;
+
+ /**
+ * Send JSON response.
+ *
+ * Examples:
+ *
+ * res.json(null);
+ * res.json({ user: 'tj' });
+ * res.json(500, 'oh noes!');
+ * res.json(404, 'I dont have that');
+ */
+ json: Send;
+
+ /**
+ * Send JSON response with JSONP callback support.
+ *
+ * Examples:
+ *
+ * res.jsonp(null);
+ * res.jsonp({ user: 'tj' });
+ * res.jsonp(500, 'oh noes!');
+ * res.jsonp(404, 'I dont have that');
+ */
+ jsonp: Send;
+
+ /**
+ * Transfer the file at the given `path`.
+ *
+ * Automatically sets the _Content-Type_ response header field.
+ * The callback `fn(err)` is invoked when the transfer is complete
+ * or when an error occurs. Be sure to check `res.sentHeader`
+ * if you wish to attempt responding, as the header and some data
+ * may have already been transferred.
+ *
+ * Options:
+ *
+ * - `maxAge` defaulting to 0 (can be string converted by `ms`)
+ * - `root` root directory for relative filenames
+ * - `headers` object of headers to serve with file
+ * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them
+ *
+ * Other options are passed along to `send`.
+ *
+ * Examples:
+ *
+ * The following example illustrates how `res.sendFile()` may
+ * be used as an alternative for the `static()` middleware for
+ * dynamic situations. The code backing `res.sendFile()` is actually
+ * the same code, so HTTP cache support etc is identical.
+ *
+ * app.get('/user/:uid/photos/:file', function(req, res){
+ * var uid = req.params.uid
+ * , file = req.params.file;
+ *
+ * req.user.mayViewFilesFrom(uid, function(yes){
+ * if (yes) {
+ * res.sendFile('/uploads/' + uid + '/' + file);
+ * } else {
+ * res.send(403, 'Sorry! you cant see that.');
+ * }
+ * });
+ * });
+ *
+ * @api public
+ */
+ sendFile(path: string): void;
+ sendFile(path: string, options: any): void;
+ sendFile(path: string, fn: Errback): void;
+ sendFile(path: string, options: any, fn: Errback): void;
+
+ /**
+ * @deprecated Use sendFile instead.
+ */
+ sendfile(path: string): void;
+ /**
+ * @deprecated Use sendFile instead.
+ */
+ sendfile(path: string, options: any): void;
+ /**
+ * @deprecated Use sendFile instead.
+ */
+ sendfile(path: string, fn: Errback): void;
+ /**
+ * @deprecated Use sendFile instead.
+ */
+ sendfile(path: string, options: any, fn: Errback): void;
+
+ /**
+ * Transfer the file at the given `path` as an attachment.
+ *
+ * Optionally providing an alternate attachment `filename`,
+ * and optional callback `fn(err)`. The callback is invoked
+ * when the data transfer is complete, or when an error has
+ * ocurred. Be sure to check `res.headerSent` if you plan to respond.
+ *
+ * This method uses `res.sendfile()`.
+ */
+ download(path: string): void;
+ download(path: string, filename: string): void;
+ download(path: string, fn: Errback): void;
+ download(path: string, filename: string, fn: Errback): void;
+
+ /**
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
+ *
+ * Examples:
+ *
+ * res.type('.html');
+ * res.type('html');
+ * res.type('json');
+ * res.type('application/json');
+ * res.type('png');
+ *
+ * @param type
+ */
+ contentType(type: string): Response;
+
+ /**
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
+ *
+ * Examples:
+ *
+ * res.type('.html');
+ * res.type('html');
+ * res.type('json');
+ * res.type('application/json');
+ * res.type('png');
+ *
+ * @param type
+ */
+ type(type: string): Response;
+
+ /**
+ * Respond to the Acceptable formats using an `obj`
+ * of mime-type callbacks.
+ *
+ * This method uses `req.accepted`, an array of
+ * acceptable types ordered by their quality values.
+ * When "Accept" is not present the _first_ callback
+ * is invoked, otherwise the first match is used. When
+ * no match is performed the server responds with
+ * 406 "Not Acceptable".
+ *
+ * Content-Type is set for you, however if you choose
+ * you may alter this within the callback using `res.type()`
+ * or `res.set('Content-Type', ...)`.
+ *
+ * res.format({
+ * 'text/plain': function(){
+ * res.send('hey');
+ * },
+ *
+ * 'text/html': function(){
+ * res.send('hey
');
+ * },
+ *
+ * 'appliation/json': function(){
+ * res.send({ message: 'hey' });
+ * }
+ * });
+ *
+ * In addition to canonicalized MIME types you may
+ * also use extnames mapped to these types:
+ *
+ * res.format({
+ * text: function(){
+ * res.send('hey');
+ * },
+ *
+ * html: function(){
+ * res.send('hey
');
+ * },
+ *
+ * json: function(){
+ * res.send({ message: 'hey' });
+ * }
+ * });
+ *
+ * By default Express passes an `Error`
+ * with a `.status` of 406 to `next(err)`
+ * if a match is not made. If you provide
+ * a `.default` callback it will be invoked
+ * instead.
+ *
+ * @param obj
+ */
+ format(obj: any): Response;
+
+ /**
+ * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
+ *
+ * @param filename
+ */
+ attachment(filename?: string): Response;
+
+ /**
+ * Set header `field` to `val`, or pass
+ * an object of header fields.
+ *
+ * Examples:
+ *
+ * res.set('Foo', ['bar', 'baz']);
+ * res.set('Accept', 'application/json');
+ * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
+ *
+ * Aliased as `res.header()`.
+ */
+ set(field: any): Response;
+ set(field: string, value?: string): Response;
+
+ header(field: any): Response;
+ header(field: string, value?: string): Response;
+
+ // Property indicating if HTTP headers has been sent for the response.
+ headersSent: boolean;
+
+ /**
+ * Get value for header `field`.
+ *
+ * @param field
+ */
+ get (field: string): string;
+
+ /**
+ * Clear cookie `name`.
+ *
+ * @param name
+ * @param options
+ */
+ clearCookie(name: string, options?: any): Response;
+
+ /**
+ * Set cookie `name` to `val`, with the given `options`.
+ *
+ * Options:
+ *
+ * - `maxAge` max-age in milliseconds, converted to `expires`
+ * - `signed` sign the cookie
+ * - `path` defaults to "/"
+ *
+ * Examples:
+ *
+ * // "Remember Me" for 15 minutes
+ * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
+ *
+ * // save as above
+ * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
+ */
+ cookie(name: string, val: string, options: CookieOptions): Response;
+ cookie(name: string, val: any, options: CookieOptions): Response;
+ cookie(name: string, val: any): Response;
+
+ /**
+ * Set the location header to `url`.
+ *
+ * The given `url` can also be the name of a mapped url, for
+ * example by default express supports "back" which redirects
+ * to the _Referrer_ or _Referer_ headers or "/".
+ *
+ * Examples:
+ *
+ * res.location('/foo/bar').;
+ * res.location('http://example.com');
+ * res.location('../login'); // /blog/post/1 -> /blog/login
+ *
+ * Mounting:
+ *
+ * When an application is mounted and `res.location()`
+ * is given a path that does _not_ lead with "/" it becomes
+ * relative to the mount-point. For example if the application
+ * is mounted at "/blog", the following would become "/blog/login".
+ *
+ * res.location('login');
+ *
+ * While the leading slash would result in a location of "/login":
+ *
+ * res.location('/login');
+ *
+ * @param url
+ */
+ location(url: string): Response;
+
+ /**
+ * Redirect to the given `url` with optional response `status`
+ * defaulting to 302.
+ *
+ * The resulting `url` is determined by `res.location()`, so
+ * it will play nicely with mounted apps, relative paths,
+ * `"back"` etc.
+ *
+ * Examples:
+ *
+ * res.redirect('/foo/bar');
+ * res.redirect('http://example.com');
+ * res.redirect(301, 'http://example.com');
+ * res.redirect('http://example.com', 301);
+ * res.redirect('../login'); // /blog/post/1 -> /blog/login
+ */
+ redirect(url: string): void;
+ redirect(status: number, url: string): void;
+ redirect(url: string, status: number): void;
+
+ /**
+ * Render `view` with the given `options` and optional callback `fn`.
+ * When a callback function is given a response will _not_ be made
+ * automatically, otherwise a response of _200_ and _text/html_ is given.
+ *
+ * Options:
+ *
+ * - `cache` boolean hinting to the engine it should cache
+ * - `filename` filename of the view being rendered
+ */
+ render(view: string, options?: Object, callback?: (err: Error, html: string) => void ): void;
+ render(view: string, callback?: (err: Error, html: string) => void ): void;
+
+ locals: any;
+
+ charset: string;
+ }
+
+ interface NextFunction {
+ (): void;
+ (err: any): void;
+ }
+
+ interface ErrorRequestHandler {
+ (err: any, req: Request, res: Response, next: NextFunction): any;
+ }
+
+ interface RequestHandler {
+ (req: Request, res: Response, next: NextFunction): any;
+ }
+
+ interface Handler extends RequestHandler {}
+
+ interface RequestParamHandler {
+ (req: Request, res: Response, next: NextFunction, param: any): any;
+ }
+
+ interface Application extends IRouter, Express.Application {
+ /**
+ * Initialize the server.
+ *
+ * - setup default configuration
+ * - setup default middleware
+ * - setup route reflection methods
+ */
+ init(): void;
+
+ /**
+ * Initialize application configuration.
+ */
+ defaultConfiguration(): void;
+
+ /**
+ * Register the given template engine callback `fn`
+ * as `ext`.
+ *
+ * By default will `require()` the engine based on the
+ * file extension. For example if you try to render
+ * a "foo.jade" file Express will invoke the following internally:
+ *
+ * app.engine('jade', require('jade').__express);
+ *
+ * For engines that do not provide `.__express` out of the box,
+ * or if you wish to "map" a different extension to the template engine
+ * you may use this method. For example mapping the EJS template engine to
+ * ".html" files:
+ *
+ * app.engine('html', require('ejs').renderFile);
+ *
+ * In this case EJS provides a `.renderFile()` method with
+ * the same signature that Express expects: `(path, options, callback)`,
+ * though note that it aliases this method as `ejs.__express` internally
+ * so if you're using ".ejs" extensions you dont need to do anything.
+ *
+ * Some template engines do not follow this convention, the
+ * [Consolidate.js](https://github.com/visionmedia/consolidate.js)
+ * library was created to map all of node's popular template
+ * engines to follow this convention, thus allowing them to
+ * work seamlessly within Express.
+ */
+ engine(ext: string, fn: Function): Application;
+
+ /**
+ * Assign `setting` to `val`, or return `setting`'s value.
+ *
+ * app.set('foo', 'bar');
+ * app.get('foo');
+ * // => "bar"
+ * app.set('foo', ['bar', 'baz']);
+ * app.get('foo');
+ * // => ["bar", "baz"]
+ *
+ * Mounted servers inherit their parent server's settings.
+ *
+ * @param setting
+ * @param val
+ */
+ set(setting: string, val: any): Application;
+ get: {
+ (name: string): any; // Getter
+ (name: string|RegExp, ...handlers: RequestHandler[]): Application;
+ };
+
+ /**
+ * Return the app's absolute pathname
+ * based on the parent(s) that have
+ * mounted it.
+ *
+ * For example if the application was
+ * mounted as "/admin", which itself
+ * was mounted as "/blog" then the
+ * return value would be "/blog/admin".
+ */
+ path(): string;
+
+ /**
+ * Check if `setting` is enabled (truthy).
+ *
+ * app.enabled('foo')
+ * // => false
+ *
+ * app.enable('foo')
+ * app.enabled('foo')
+ * // => true
+ */
+ enabled(setting: string): boolean;
+
+ /**
+ * Check if `setting` is disabled.
+ *
+ * app.disabled('foo')
+ * // => true
+ *
+ * app.enable('foo')
+ * app.disabled('foo')
+ * // => false
+ *
+ * @param setting
+ */
+ disabled(setting: string): boolean;
+
+ /**
+ * Enable `setting`.
+ *
+ * @param setting
+ */
+ enable(setting: string): Application;
+
+ /**
+ * Disable `setting`.
+ *
+ * @param setting
+ */
+ disable(setting: string): Application;
+
+ /**
+ * Configure callback for zero or more envs,
+ * when no `env` is specified that callback will
+ * be invoked for all environments. Any combination
+ * can be used multiple times, in any order desired.
+ *
+ * Examples:
+ *
+ * app.configure(function(){
+ * // executed for all envs
+ * });
+ *
+ * app.configure('stage', function(){
+ * // executed staging env
+ * });
+ *
+ * app.configure('stage', 'production', function(){
+ * // executed for stage and production
+ * });
+ *
+ * Note:
+ *
+ * These callbacks are invoked immediately, and
+ * are effectively sugar for the following:
+ *
+ * var env = process.env.NODE_ENV || 'development';
+ *
+ * switch (env) {
+ * case 'development':
+ * ...
+ * break;
+ * case 'stage':
+ * ...
+ * break;
+ * case 'production':
+ * ...
+ * break;
+ * }
+ *
+ * @param env
+ * @param fn
+ */
+ configure(fn: Function): Application;
+ configure(env0: string, fn: Function): Application;
+ configure(env0: string, env1: string, fn: Function): Application;
+ configure(env0: string, env1: string, env2: string, fn: Function): Application;
+ configure(env0: string, env1: string, env2: string, env3: string, fn: Function): Application;
+ configure(env0: string, env1: string, env2: string, env3: string, env4: string, fn: Function): Application;
+
+ /**
+ * Render the given view `name` name with `options`
+ * and a callback accepting an error and the
+ * rendered template string.
+ *
+ * Example:
+ *
+ * app.render('email', { name: 'Tobi' }, function(err, html){
+ * // ...
+ * })
+ *
+ * @param name
+ * @param options or fn
+ * @param fn
+ */
+ render(name: string, options?: Object, callback?: (err: Error, html: string) => void): void;
+ render(name: string, callback: (err: Error, html: string) => void): void;
+
+
+ /**
+ * Listen for connections.
+ *
+ * A node `http.Server` is returned, with this
+ * application (which is a `Function`) as its
+ * callback. If you wish to create both an HTTP
+ * and HTTPS server you may do so with the "http"
+ * and "https" modules as shown here:
+ *
+ * var http = require('http')
+ * , https = require('https')
+ * , express = require('express')
+ * , app = express();
+ *
+ * http.createServer(app).listen(80);
+ * https.createServer({ ... }, app).listen(443);
+ */
+ listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server;
+ listen(port: number, hostname: string, callback?: Function): http.Server;
+ listen(port: number, callback?: Function): http.Server;
+ listen(path: string, callback?: Function): http.Server;
+ listen(handle: any, listeningListener?: Function): http.Server;
+
+ route(path: string): IRoute;
+
+ router: string;
+
+ settings: any;
+
+ resource: any;
+
+ map: any;
+
+ locals: any;
+
+ /**
+ * The app.routes object houses all of the routes defined mapped by the
+ * associated HTTP verb. This object may be used for introspection
+ * capabilities, for example Express uses this internally not only for
+ * routing but to provide default OPTIONS behaviour unless app.options()
+ * is used. Your application or framework may also remove routes by
+ * simply by removing them from this object.
+ */
+ routes: any;
+ }
+
+ interface Express extends Application {
+ /**
+ * Framework version.
+ */
+ version: string;
+
+ /**
+ * Expose mime.
+ */
+ mime: string;
+
+ (): Application;
+
+ /**
+ * Create an express application.
+ */
+ createApplication(): Application;
+
+ createServer(): Application;
+
+ application: any;
+
+ request: Request;
+
+ response: Response;
+ }
+
+ var static: typeof serveStatic;
+ }
+
+ export = e;
+}
diff --git a/iscroll/iscroll-5.d.ts b/iscroll/iscroll-5.d.ts
index 8b7a80543..686fa6821 100644
--- a/iscroll/iscroll-5.d.ts
+++ b/iscroll/iscroll-5.d.ts
@@ -1,91 +1,91 @@
-// Type definitions for iScroll 5
-// Project: http://cubiq.org/iscroll-5-ready-for-beta-test
-// Definitions by: Christiaan Rakowski
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-interface IScrollOptions {
- //hScroll?: boolean;
- //vScroll?: boolean;
- x?: number;
- y?: number;
- bounce?: boolean;
- bounceLock?: boolean;
- momentum?: boolean;
- lockDirection?: boolean;
- useTransform?: boolean;
- useTransition?: boolean;
- topOffset?: number;
- checkDOMChanges?: boolean;
- handleClick?: boolean;
-
- // Scrollbar
- hScrollbar?: boolean;
- vScrollbar?: boolean;
- fixedScrollbar?: boolean;
- hideScrollbar?: boolean;
- fadeScrollbar?: boolean;
- scrollbarClass?: string;
-
- // Zoom
- zoom?: boolean;
- zoomMin?: number;
- zoomMax?: number;
- doubleTapZoom?: number;
- wheelAction?: string;
-
-
- ///String or boolean
- snap?: any;
- snapThreshold?: number;
-
- //new in IScroll 5?
-
- resizeIndicator?: boolean;
- mouseWheelSpeed?: number;
- startX?: number;
- startY?: number;
- scrollX?: boolean;
- scrollY?: boolean;
- directionLockThreshold?: number;
-
- bounceTime?: number;
-
- ///String or function
- bounceEasing?: any;
-
- preventDefault?: boolean;
- preventDefaultException?: boolean;
-
- HWCompositing?: boolean;
-
- freeScroll?: boolean;
-
- resizePolling?: number;
- tap?: boolean;
- click?: boolean;
- invertWheelDirection?: boolean;
-
- ///Boolean or string
- eventPassthrough?: any;
-}
-
-declare class IScroll {
-
- constructor (element: string, options?: IScrollOptions);
- constructor (element: HTMLElement, options?: IScrollOptions);
-
- destroy(): void;
- refresh(): void;
- scrollTo(x: number, y: number, time?: number, relative?: boolean): void;
- scrollToElement(element: string, time?: number): void;
- scrollToElement(element: HTMLElement, time?: number): void;
- goToPage(pageX: number, pageY: number, time?: number): void;
- disable(): void;
- enable(): void;
- stop(): void;
- zoom(x: number, y: number, scale: number, time?: number): void;
- isReady(): boolean;
-
- // Events
- on: (type: string, fn: () => void) => void;
-}
+// Type definitions for iScroll 5
+// Project: http://cubiq.org/iscroll-5-ready-for-beta-test
+// Definitions by: Christiaan Rakowski
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+interface IScrollOptions {
+ //hScroll?: boolean;
+ //vScroll?: boolean;
+ x?: number;
+ y?: number;
+ bounce?: boolean;
+ bounceLock?: boolean;
+ momentum?: boolean;
+ lockDirection?: boolean;
+ useTransform?: boolean;
+ useTransition?: boolean;
+ topOffset?: number;
+ checkDOMChanges?: boolean;
+ handleClick?: boolean;
+
+ // Scrollbar
+ hScrollbar?: boolean;
+ vScrollbar?: boolean;
+ fixedScrollbar?: boolean;
+ hideScrollbar?: boolean;
+ fadeScrollbar?: boolean;
+ scrollbarClass?: string;
+
+ // Zoom
+ zoom?: boolean;
+ zoomMin?: number;
+ zoomMax?: number;
+ doubleTapZoom?: number;
+ wheelAction?: string;
+
+
+ ///String or boolean
+ snap?: any;
+ snapThreshold?: number;
+
+ //new in IScroll 5?
+
+ resizeIndicator?: boolean;
+ mouseWheelSpeed?: number;
+ startX?: number;
+ startY?: number;
+ scrollX?: boolean;
+ scrollY?: boolean;
+ directionLockThreshold?: number;
+
+ bounceTime?: number;
+
+ ///String or function
+ bounceEasing?: any;
+
+ preventDefault?: boolean;
+ preventDefaultException?: boolean;
+
+ HWCompositing?: boolean;
+
+ freeScroll?: boolean;
+
+ resizePolling?: number;
+ tap?: boolean;
+ click?: boolean;
+ invertWheelDirection?: boolean;
+
+ ///Boolean or string
+ eventPassthrough?: any;
+}
+
+declare class IScroll {
+
+ constructor (element: string, options?: IScrollOptions);
+ constructor (element: HTMLElement, options?: IScrollOptions);
+
+ destroy(): void;
+ refresh(): void;
+ scrollTo(x: number, y: number, time?: number, relative?: boolean): void;
+ scrollToElement(element: string, time?: number): void;
+ scrollToElement(element: HTMLElement, time?: number): void;
+ goToPage(pageX: number, pageY: number, time?: number): void;
+ disable(): void;
+ enable(): void;
+ stop(): void;
+ zoom(x: number, y: number, scale: number, time?: number): void;
+ isReady(): boolean;
+
+ // Events
+ on: (type: string, fn: () => void) => void;
+}
diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts
index e94cc262e..50679d86d 100644
--- a/jasmine/jasmine.d.ts
+++ b/jasmine/jasmine.d.ts
@@ -1,496 +1,496 @@
-// Type definitions for Jasmine 2.2
-// Project: http://jasmine.github.io/
-// Definitions by: Boris Yankov , Theodore Brown , David Pärsson
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-
-// For ddescribe / iit use : https://github.com/borisyankov/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts
-
-declare function describe(description: string, specDefinitions: () => void): void;
-declare function fdescribe(description: string, specDefinitions: () => void): void;
-declare function xdescribe(description: string, specDefinitions: () => void): void;
-
-declare function it(expectation: string, assertion?: () => void, timeout?: number): void;
-declare function it(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void;
-declare function fit(expectation: string, assertion?: () => void, timeout?: number): void;
-declare function fit(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void;
-declare function xit(expectation: string, assertion?: () => void, timeout?: number): void;
-declare function xit(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void;
-
-/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
-declare function pending(reason?: string): void;
-
-declare function beforeEach(action: () => void, timeout?: number): void;
-declare function beforeEach(action: (done: () => void) => void, timeout?: number): void;
-declare function afterEach(action: () => void, timeout?: number): void;
-declare function afterEach(action: (done: () => void) => void, timeout?: number): void;
-
-declare function beforeAll(action: () => void, timeout?: number): void;
-declare function beforeAll(action: (done: () => void) => void, timeout?: number): void;
-declare function afterAll(action: () => void, timeout?: number): void;
-declare function afterAll(action: (done: () => void) => void, timeout?: number): void;
-
-declare function expect(spy: Function): jasmine.Matchers;
-declare function expect(actual: any): jasmine.Matchers;
-
-declare function fail(e?: any): void;
-
-declare function spyOn(object: any, method: string): jasmine.Spy;
-
-declare function runs(asyncMethod: Function): void;
-declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void;
-declare function waits(timeout?: number): void;
-
-declare module jasmine {
-
- var clock: () => Clock;
-
- function any(aclass: any): Any;
- function anything(): Any;
- function arrayContaining(sample: any[]): ArrayContaining;
- function objectContaining(sample: any): ObjectContaining;
- function createSpy(name: string, originalFn?: Function): Spy;
- function createSpyObj(baseName: string, methodNames: any[]): any;
- function createSpyObj(baseName: string, methodNames: any[]): T;
- function pp(value: any): string;
- function getEnv(): Env;
- function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
- function addMatchers(matchers: CustomMatcherFactories): void;
- function stringMatching(str: string): Any;
- function stringMatching(str: RegExp): Any;
-
- interface Any {
-
- new (expectedClass: any): any;
-
- jasmineMatches(other: any): boolean;
- jasmineToString(): string;
- }
-
- // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
- interface ArrayLike {
- length: number;
- [n: number]: T;
- }
-
- interface ArrayContaining {
- new (sample: any[]): any;
-
- asymmetricMatch(other: any): boolean;
- jasmineToString(): string;
- }
-
- interface ObjectContaining {
- new (sample: any): any;
-
- jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
- jasmineToString(): string;
- }
-
- interface Block {
-
- new (env: Env, func: SpecFunction, spec: Spec): any;
-
- execute(onComplete: () => void): void;
- }
-
- interface WaitsBlock extends Block {
- new (env: Env, timeout: number, spec: Spec): any;
- }
-
- interface WaitsForBlock extends Block {
- new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any;
- }
-
- interface Clock {
- install(): void;
- uninstall(): void;
- /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
- tick(ms: number): void;
- mockDate(date?: Date): void;
- }
-
- interface CustomEqualityTester {
- (first: any, second: any): boolean;
- }
-
- interface CustomMatcher {
- compare(actual: T, expected: T): CustomMatcherResult;
- compare(actual: any, expected: any): CustomMatcherResult;
- }
-
- interface CustomMatcherFactory {
- (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher;
- }
-
- interface CustomMatcherFactories {
- [index: string]: CustomMatcherFactory;
- }
-
- interface CustomMatcherResult {
- pass: boolean;
- message?: string;
- }
-
- interface MatchersUtil {
- equals(a: any, b: any, customTesters?: Array): boolean;
- contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean;
- buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string;
- }
-
- interface Env {
- setTimeout: any;
- clearTimeout: void;
- setInterval: any;
- clearInterval: void;
- updateInterval: number;
-
- currentSpec: Spec;
-
- matchersClass: Matchers;
-
- version(): any;
- versionString(): string;
- nextSpecId(): number;
- addReporter(reporter: Reporter): void;
- execute(): void;
- describe(description: string, specDefinitions: () => void): Suite;
- // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these
- beforeEach(beforeEachFunction: () => void): void;
- beforeAll(beforeAllFunction: () => void): void;
- currentRunner(): Runner;
- afterEach(afterEachFunction: () => void): void;
- afterAll(afterAllFunction: () => void): void;
- xdescribe(desc: string, specDefinitions: () => void): XSuite;
- it(description: string, func: () => void): Spec;
- // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these
- xit(desc: string, func: () => void): XSpec;
- compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
- compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
- equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
- contains_(haystack: any, needle: any): boolean;
- addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
- addMatchers(matchers: CustomMatcherFactories): void;
- specFilter(spec: Spec): boolean;
- }
-
- interface FakeTimer {
-
- new (): any;
-
- reset(): void;
- tick(millis: number): void;
- runFunctionsWithinRange(oldMillis: number, nowMillis: number): void;
- scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void;
- }
-
- interface HtmlReporter {
- new (): any;
- }
-
- interface HtmlSpecFilter {
- new (): any;
- }
-
- interface Result {
- type: string;
- }
-
- interface NestedResults extends Result {
- description: string;
-
- totalCount: number;
- passedCount: number;
- failedCount: number;
-
- skipped: boolean;
-
- rollupCounts(result: NestedResults): void;
- log(values: any): void;
- getItems(): Result[];
- addResult(result: Result): void;
- passed(): boolean;
- }
-
- interface MessageResult extends Result {
- values: any;
- trace: Trace;
- }
-
- interface ExpectationResult extends Result {
- matcherName: string;
- passed(): boolean;
- expected: any;
- actual: any;
- message: string;
- trace: Trace;
- }
-
- interface Trace {
- name: string;
- message: string;
- stack: any;
- }
-
- interface PrettyPrinter {
-
- new (): any;
-
- format(value: any): void;
- iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void;
- emitScalar(value: any): void;
- emitString(value: string): void;
- emitArray(array: any[]): void;
- emitObject(obj: any): void;
- append(value: any): void;
- }
-
- interface StringPrettyPrinter extends PrettyPrinter {
- }
-
- interface Queue {
-
- new (env: any): any;
-
- env: Env;
- ensured: boolean[];
- blocks: Block[];
- running: boolean;
- index: number;
- offset: number;
- abort: boolean;
-
- addBefore(block: Block, ensure?: boolean): void;
- add(block: any, ensure?: boolean): void;
- insertNext(block: any, ensure?: boolean): void;
- start(onComplete?: () => void): void;
- isRunning(): boolean;
- next_(): void;
- results(): NestedResults;
- }
-
- interface Matchers {
-
- new (env: Env, actual: any, spec: Env, isNot?: boolean): any;
-
- env: Env;
- actual: any;
- spec: Env;
- isNot?: boolean;
- message(): any;
-
- toBe(expected: any, expectationFailOutput?: any): boolean;
- toEqual(expected: any, expectationFailOutput?: any): boolean;
- toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean;
- toBeDefined(expectationFailOutput?: any): boolean;
- toBeUndefined(expectationFailOutput?: any): boolean;
- toBeNull(expectationFailOutput?: any): boolean;
- toBeNaN(): boolean;
- toBeTruthy(expectationFailOutput?: any): boolean;
- toBeFalsy(expectationFailOutput?: any): boolean;
- toHaveBeenCalled(): boolean;
- toHaveBeenCalledWith(...params: any[]): boolean;
- toHaveBeenCalledTimes(expected: number): boolean;
- toContain(expected: any, expectationFailOutput?: any): boolean;
- toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
- toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
- toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean;
- toThrow(expected?: any): boolean;
- toThrowError(message?: string | RegExp): boolean;
- toThrowError(expected?: Error, message?: string | RegExp): boolean;
- not: Matchers;
-
- Any: Any;
- }
-
- interface Reporter {
- reportRunnerStarting(runner: Runner): void;
- reportRunnerResults(runner: Runner): void;
- reportSuiteResults(suite: Suite): void;
- reportSpecStarting(spec: Spec): void;
- reportSpecResults(spec: Spec): void;
- log(str: string): void;
- }
-
- interface MultiReporter extends Reporter {
- addReporter(reporter: Reporter): void;
- }
-
- interface Runner {
-
- new (env: Env): any;
-
- execute(): void;
- beforeEach(beforeEachFunction: SpecFunction): void;
- afterEach(afterEachFunction: SpecFunction): void;
- beforeAll(beforeAllFunction: SpecFunction): void;
- afterAll(afterAllFunction: SpecFunction): void;
- finishCallback(): void;
- addSuite(suite: Suite): void;
- add(block: Block): void;
- specs(): Spec[];
- suites(): Suite[];
- topLevelSuites(): Suite[];
- results(): NestedResults;
- }
-
- interface SpecFunction {
- (spec?: Spec): void;
- }
-
- interface SuiteOrSpec {
- id: number;
- env: Env;
- description: string;
- queue: Queue;
- }
-
- interface Spec extends SuiteOrSpec {
-
- new (env: Env, suite: Suite, description: string): any;
-
- suite: Suite;
-
- afterCallbacks: SpecFunction[];
- spies_: Spy[];
-
- results_: NestedResults;
- matchersClass: Matchers;
-
- getFullName(): string;
- results(): NestedResults;
- log(arguments: any): any;
- runs(func: SpecFunction): Spec;
- addToQueue(block: Block): void;
- addMatcherResult(result: Result): void;
- expect(actual: any): any;
- waits(timeout: number): Spec;
- waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
- fail(e?: any): void;
- getMatchersClass_(): Matchers;
- addMatchers(matchersPrototype: CustomMatcherFactories): void;
- finishCallback(): void;
- finish(onComplete?: () => void): void;
- after(doAfter: SpecFunction): void;
- execute(onComplete?: () => void): any;
- addBeforesAndAftersToQueue(): void;
- explodes(): void;
- spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy;
- removeAllSpies(): void;
- }
-
- interface XSpec {
- id: number;
- runs(): void;
- }
-
- interface Suite extends SuiteOrSpec {
-
- new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any;
-
- parentSuite: Suite;
-
- getFullName(): string;
- finish(onComplete?: () => void): void;
- beforeEach(beforeEachFunction: SpecFunction): void;
- afterEach(afterEachFunction: SpecFunction): void;
- beforeAll(beforeAllFunction: SpecFunction): void;
- afterAll(afterAllFunction: SpecFunction): void;
- results(): NestedResults;
- add(suiteOrSpec: SuiteOrSpec): void;
- specs(): Spec[];
- suites(): Suite[];
- children(): any[];
- execute(onComplete?: () => void): void;
- }
-
- interface XSuite {
- execute(): void;
- }
-
- interface Spy {
- (...params: any[]): any;
-
- identity: string;
- and: SpyAnd;
- calls: Calls;
- mostRecentCall: { args: any[]; };
- argsForCall: any[];
- wasCalled: boolean;
- }
-
- interface SpyAnd {
- /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
- callThrough(): Spy;
- /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
- returnValue(val: any): Spy;
- /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
- callFake(fn: Function): Spy;
- /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
- throwError(msg: string): Spy;
- /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
- stub(): Spy;
- }
-
- interface Calls {
- /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/
- any(): boolean;
- /** By chaining the spy with calls.count(), will return the number of times the spy was called **/
- count(): number;
- /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/
- argsFor(index: number): any[];
- /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/
- allArgs(): any[];
- /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/
- all(): CallInfo[];
- /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/
- mostRecent(): CallInfo;
- /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/
- first(): CallInfo;
- /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
- reset(): void;
- }
-
- interface CallInfo {
- /** The context (the this) for the call */
- object: any;
- /** All arguments passed to the call */
- args: any[];
- }
-
- interface Util {
- inherit(childClass: Function, parentClass: Function): any;
- formatException(e: any): any;
- htmlEscape(str: string): string;
- argsToArray(args: any): any;
- extend(destination: any, source: any): any;
- }
-
- interface JsApiReporter extends Reporter {
-
- started: boolean;
- finished: boolean;
- result: any;
- messages: any;
-
- new (): any;
-
- suites(): Suite[];
- summarize_(suiteOrSpec: SuiteOrSpec): any;
- results(): any;
- resultsForSpec(specId: any): any;
- log(str: any): any;
- resultsForSpecs(specIds: any): any;
- summarizeResult_(result: any): any;
- }
-
- interface Jasmine {
- Spec: Spec;
- clock: Clock;
- util: Util;
- }
-
- export var HtmlReporter: HtmlReporter;
- export var HtmlSpecFilter: HtmlSpecFilter;
- export var DEFAULT_TIMEOUT_INTERVAL: number;
-}
+// Type definitions for Jasmine 2.2
+// Project: http://jasmine.github.io/
+// Definitions by: Boris Yankov , Theodore Brown , David Pärsson
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+// For ddescribe / iit use : https://github.com/borisyankov/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts
+
+declare function describe(description: string, specDefinitions: () => void): void;
+declare function fdescribe(description: string, specDefinitions: () => void): void;
+declare function xdescribe(description: string, specDefinitions: () => void): void;
+
+declare function it(expectation: string, assertion?: () => void, timeout?: number): void;
+declare function it(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void;
+declare function fit(expectation: string, assertion?: () => void, timeout?: number): void;
+declare function fit(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void;
+declare function xit(expectation: string, assertion?: () => void, timeout?: number): void;
+declare function xit(expectation: string, assertion?: (done: () => void) => void, timeout?: number): void;
+
+/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
+declare function pending(reason?: string): void;
+
+declare function beforeEach(action: () => void, timeout?: number): void;
+declare function beforeEach(action: (done: () => void) => void, timeout?: number): void;
+declare function afterEach(action: () => void, timeout?: number): void;
+declare function afterEach(action: (done: () => void) => void, timeout?: number): void;
+
+declare function beforeAll(action: () => void, timeout?: number): void;
+declare function beforeAll(action: (done: () => void) => void, timeout?: number): void;
+declare function afterAll(action: () => void, timeout?: number): void;
+declare function afterAll(action: (done: () => void) => void, timeout?: number): void;
+
+declare function expect(spy: Function): jasmine.Matchers;
+declare function expect(actual: any): jasmine.Matchers;
+
+declare function fail(e?: any): void;
+
+declare function spyOn(object: any, method: string): jasmine.Spy;
+
+declare function runs(asyncMethod: Function): void;
+declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void;
+declare function waits(timeout?: number): void;
+
+declare module jasmine {
+
+ var clock: () => Clock;
+
+ function any(aclass: any): Any;
+ function anything(): Any;
+ function arrayContaining(sample: any[]): ArrayContaining;
+ function objectContaining(sample: any): ObjectContaining;
+ function createSpy(name: string, originalFn?: Function): Spy;
+ function createSpyObj(baseName: string, methodNames: any[]): any;
+ function createSpyObj(baseName: string, methodNames: any[]): T;
+ function pp(value: any): string;
+ function getEnv(): Env;
+ function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
+ function addMatchers(matchers: CustomMatcherFactories): void;
+ function stringMatching(str: string): Any;
+ function stringMatching(str: RegExp): Any;
+
+ interface Any {
+
+ new (expectedClass: any): any;
+
+ jasmineMatches(other: any): boolean;
+ jasmineToString(): string;
+ }
+
+ // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
+ interface ArrayLike {
+ length: number;
+ [n: number]: T;
+ }
+
+ interface ArrayContaining {
+ new (sample: any[]): any;
+
+ asymmetricMatch(other: any): boolean;
+ jasmineToString(): string;
+ }
+
+ interface ObjectContaining {
+ new (sample: any): any;
+
+ jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
+ jasmineToString(): string;
+ }
+
+ interface Block {
+
+ new (env: Env, func: SpecFunction, spec: Spec): any;
+
+ execute(onComplete: () => void): void;
+ }
+
+ interface WaitsBlock extends Block {
+ new (env: Env, timeout: number, spec: Spec): any;
+ }
+
+ interface WaitsForBlock extends Block {
+ new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any;
+ }
+
+ interface Clock {
+ install(): void;
+ uninstall(): void;
+ /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
+ tick(ms: number): void;
+ mockDate(date?: Date): void;
+ }
+
+ interface CustomEqualityTester {
+ (first: any, second: any): boolean;
+ }
+
+ interface CustomMatcher {
+ compare(actual: T, expected: T): CustomMatcherResult;
+ compare(actual: any, expected: any): CustomMatcherResult;
+ }
+
+ interface CustomMatcherFactory {
+ (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher;
+ }
+
+ interface CustomMatcherFactories {
+ [index: string]: CustomMatcherFactory;
+ }
+
+ interface CustomMatcherResult {
+ pass: boolean;
+ message?: string;
+ }
+
+ interface MatchersUtil {
+ equals(a: any, b: any, customTesters?: Array): boolean;
+ contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean;
+ buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string;
+ }
+
+ interface Env {
+ setTimeout: any;
+ clearTimeout: void;
+ setInterval: any;
+ clearInterval: void;
+ updateInterval: number;
+
+ currentSpec: Spec;
+
+ matchersClass: Matchers;
+
+ version(): any;
+ versionString(): string;
+ nextSpecId(): number;
+ addReporter(reporter: Reporter): void;
+ execute(): void;
+ describe(description: string, specDefinitions: () => void): Suite;
+ // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these
+ beforeEach(beforeEachFunction: () => void): void;
+ beforeAll(beforeAllFunction: () => void): void;
+ currentRunner(): Runner;
+ afterEach(afterEachFunction: () => void): void;
+ afterAll(afterAllFunction: () => void): void;
+ xdescribe(desc: string, specDefinitions: () => void): XSuite;
+ it(description: string, func: () => void): Spec;
+ // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these
+ xit(desc: string, func: () => void): XSpec;
+ compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
+ compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
+ equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
+ contains_(haystack: any, needle: any): boolean;
+ addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
+ addMatchers(matchers: CustomMatcherFactories): void;
+ specFilter(spec: Spec): boolean;
+ }
+
+ interface FakeTimer {
+
+ new (): any;
+
+ reset(): void;
+ tick(millis: number): void;
+ runFunctionsWithinRange(oldMillis: number, nowMillis: number): void;
+ scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void;
+ }
+
+ interface HtmlReporter {
+ new (): any;
+ }
+
+ interface HtmlSpecFilter {
+ new (): any;
+ }
+
+ interface Result {
+ type: string;
+ }
+
+ interface NestedResults extends Result {
+ description: string;
+
+ totalCount: number;
+ passedCount: number;
+ failedCount: number;
+
+ skipped: boolean;
+
+ rollupCounts(result: NestedResults): void;
+ log(values: any): void;
+ getItems(): Result[];
+ addResult(result: Result): void;
+ passed(): boolean;
+ }
+
+ interface MessageResult extends Result {
+ values: any;
+ trace: Trace;
+ }
+
+ interface ExpectationResult extends Result {
+ matcherName: string;
+ passed(): boolean;
+ expected: any;
+ actual: any;
+ message: string;
+ trace: Trace;
+ }
+
+ interface Trace {
+ name: string;
+ message: string;
+ stack: any;
+ }
+
+ interface PrettyPrinter {
+
+ new (): any;
+
+ format(value: any): void;
+ iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void;
+ emitScalar(value: any): void;
+ emitString(value: string): void;
+ emitArray(array: any[]): void;
+ emitObject(obj: any): void;
+ append(value: any): void;
+ }
+
+ interface StringPrettyPrinter extends PrettyPrinter {
+ }
+
+ interface Queue {
+
+ new (env: any): any;
+
+ env: Env;
+ ensured: boolean[];
+ blocks: Block[];
+ running: boolean;
+ index: number;
+ offset: number;
+ abort: boolean;
+
+ addBefore(block: Block, ensure?: boolean): void;
+ add(block: any, ensure?: boolean): void;
+ insertNext(block: any, ensure?: boolean): void;
+ start(onComplete?: () => void): void;
+ isRunning(): boolean;
+ next_(): void;
+ results(): NestedResults;
+ }
+
+ interface Matchers {
+
+ new (env: Env, actual: any, spec: Env, isNot?: boolean): any;
+
+ env: Env;
+ actual: any;
+ spec: Env;
+ isNot?: boolean;
+ message(): any;
+
+ toBe(expected: any, expectationFailOutput?: any): boolean;
+ toEqual(expected: any, expectationFailOutput?: any): boolean;
+ toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean;
+ toBeDefined(expectationFailOutput?: any): boolean;
+ toBeUndefined(expectationFailOutput?: any): boolean;
+ toBeNull(expectationFailOutput?: any): boolean;
+ toBeNaN(): boolean;
+ toBeTruthy(expectationFailOutput?: any): boolean;
+ toBeFalsy(expectationFailOutput?: any): boolean;
+ toHaveBeenCalled(): boolean;
+ toHaveBeenCalledWith(...params: any[]): boolean;
+ toHaveBeenCalledTimes(expected: number): boolean;
+ toContain(expected: any, expectationFailOutput?: any): boolean;
+ toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
+ toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
+ toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean;
+ toThrow(expected?: any): boolean;
+ toThrowError(message?: string | RegExp): boolean;
+ toThrowError(expected?: Error, message?: string | RegExp): boolean;
+ not: Matchers;
+
+ Any: Any;
+ }
+
+ interface Reporter {
+ reportRunnerStarting(runner: Runner): void;
+ reportRunnerResults(runner: Runner): void;
+ reportSuiteResults(suite: Suite): void;
+ reportSpecStarting(spec: Spec): void;
+ reportSpecResults(spec: Spec): void;
+ log(str: string): void;
+ }
+
+ interface MultiReporter extends Reporter {
+ addReporter(reporter: Reporter): void;
+ }
+
+ interface Runner {
+
+ new (env: Env): any;
+
+ execute(): void;
+ beforeEach(beforeEachFunction: SpecFunction): void;
+ afterEach(afterEachFunction: SpecFunction): void;
+ beforeAll(beforeAllFunction: SpecFunction): void;
+ afterAll(afterAllFunction: SpecFunction): void;
+ finishCallback(): void;
+ addSuite(suite: Suite): void;
+ add(block: Block): void;
+ specs(): Spec[];
+ suites(): Suite[];
+ topLevelSuites(): Suite[];
+ results(): NestedResults;
+ }
+
+ interface SpecFunction {
+ (spec?: Spec): void;
+ }
+
+ interface SuiteOrSpec {
+ id: number;
+ env: Env;
+ description: string;
+ queue: Queue;
+ }
+
+ interface Spec extends SuiteOrSpec {
+
+ new (env: Env, suite: Suite, description: string): any;
+
+ suite: Suite;
+
+ afterCallbacks: SpecFunction[];
+ spies_: Spy[];
+
+ results_: NestedResults;
+ matchersClass: Matchers;
+
+ getFullName(): string;
+ results(): NestedResults;
+ log(arguments: any): any;
+ runs(func: SpecFunction): Spec;
+ addToQueue(block: Block): void;
+ addMatcherResult(result: Result): void;
+ expect(actual: any): any;
+ waits(timeout: number): Spec;
+ waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
+ fail(e?: any): void;
+ getMatchersClass_(): Matchers;
+ addMatchers(matchersPrototype: CustomMatcherFactories): void;
+ finishCallback(): void;
+ finish(onComplete?: () => void): void;
+ after(doAfter: SpecFunction): void;
+ execute(onComplete?: () => void): any;
+ addBeforesAndAftersToQueue(): void;
+ explodes(): void;
+ spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy;
+ removeAllSpies(): void;
+ }
+
+ interface XSpec {
+ id: number;
+ runs(): void;
+ }
+
+ interface Suite extends SuiteOrSpec {
+
+ new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any;
+
+ parentSuite: Suite;
+
+ getFullName(): string;
+ finish(onComplete?: () => void): void;
+ beforeEach(beforeEachFunction: SpecFunction): void;
+ afterEach(afterEachFunction: SpecFunction): void;
+ beforeAll(beforeAllFunction: SpecFunction): void;
+ afterAll(afterAllFunction: SpecFunction): void;
+ results(): NestedResults;
+ add(suiteOrSpec: SuiteOrSpec): void;
+ specs(): Spec[];
+ suites(): Suite[];
+ children(): any[];
+ execute(onComplete?: () => void): void;
+ }
+
+ interface XSuite {
+ execute(): void;
+ }
+
+ interface Spy {
+ (...params: any[]): any;
+
+ identity: string;
+ and: SpyAnd;
+ calls: Calls;
+ mostRecentCall: { args: any[]; };
+ argsForCall: any[];
+ wasCalled: boolean;
+ }
+
+ interface SpyAnd {
+ /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
+ callThrough(): Spy;
+ /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
+ returnValue(val: any): Spy;
+ /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
+ callFake(fn: Function): Spy;
+ /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
+ throwError(msg: string): Spy;
+ /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
+ stub(): Spy;
+ }
+
+ interface Calls {
+ /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/
+ any(): boolean;
+ /** By chaining the spy with calls.count(), will return the number of times the spy was called **/
+ count(): number;
+ /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/
+ argsFor(index: number): any[];
+ /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/
+ allArgs(): any[];
+ /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/
+ all(): CallInfo[];
+ /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/
+ mostRecent(): CallInfo;
+ /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/
+ first(): CallInfo;
+ /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
+ reset(): void;
+ }
+
+ interface CallInfo {
+ /** The context (the this) for the call */
+ object: any;
+ /** All arguments passed to the call */
+ args: any[];
+ }
+
+ interface Util {
+ inherit(childClass: Function, parentClass: Function): any;
+ formatException(e: any): any;
+ htmlEscape(str: string): string;
+ argsToArray(args: any): any;
+ extend(destination: any, source: any): any;
+ }
+
+ interface JsApiReporter extends Reporter {
+
+ started: boolean;
+ finished: boolean;
+ result: any;
+ messages: any;
+
+ new (): any;
+
+ suites(): Suite[];
+ summarize_(suiteOrSpec: SuiteOrSpec): any;
+ results(): any;
+ resultsForSpec(specId: any): any;
+ log(str: any): any;
+ resultsForSpecs(specIds: any): any;
+ summarizeResult_(result: any): any;
+ }
+
+ interface Jasmine {
+ Spec: Spec;
+ clock: Clock;
+ util: Util;
+ }
+
+ export var HtmlReporter: HtmlReporter;
+ export var HtmlSpecFilter: HtmlSpecFilter;
+ export var DEFAULT_TIMEOUT_INTERVAL: number;
+}
diff --git a/knockout.mapping/knockout.mapping-tests.ts b/knockout.mapping/knockout.mapping-tests.ts
index 85e37a4a5..bac7aac00 100644
--- a/knockout.mapping/knockout.mapping-tests.ts
+++ b/knockout.mapping/knockout.mapping-tests.ts
@@ -57,7 +57,7 @@ mapping.fromJS(inputJSON, {
return mapping.fromJS(options.data);
},
update: (options: KnockoutMappingUpdateOptions) => {
- return mapping.fromJS(options.data, options.target);
+ return mapping.fromJS(options.data, options.target);
}
}
});
diff --git a/knockout.mapping/knockout.mapping.d.ts b/knockout.mapping/knockout.mapping.d.ts
index d1a35d3ee..78127570d 100644
--- a/knockout.mapping/knockout.mapping.d.ts
+++ b/knockout.mapping/knockout.mapping.d.ts
@@ -1,68 +1,68 @@
-// Type definitions for Knockout.Mapping 2.0
-// Project: https://github.com/SteveSanderson/knockout.mapping
-// Definitions by: Boris Yankov
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-///
-
-interface KnockoutMappingCreateOptions {
- data: any;
- parent: any;
-}
-
-interface KnockoutMappingUpdateOptions {
- data: any;
- parent: any;
- target: any;
- observable?: KnockoutObservable;
-}
-
-interface KnockoutMappingOptions {
- ignore?: string[];
- include?: string[];
- copy?: string[];
- mappedProperties?: string[];
- deferEvaluation?: boolean;
- create?: (options: KnockoutMappingCreateOptions) => void;
- update?: (options: KnockoutMappingUpdateOptions) => void;
- key?: (data: any) => any;
-}
-
-interface KnockoutMapping {
- isMapped(viewModel: any): boolean;
- fromJS(jsObject: any): any;
- fromJS(jsObject: any, targetOrOptions: any): any;
- fromJS(jsObject: any, inputOptions: any, target: any): any;
- fromJSON(jsonString: string): any;
- fromJSON(jsonString: string, targetOrOptions: any): any;
- fromJSON(jsonString: string, inputOptions: any, target: any): any;
- toJS(rootObject: any, options?: KnockoutMappingOptions): any;
- toJSON(rootObject: any, options?: KnockoutMappingOptions): any;
- defaultOptions(): KnockoutMappingOptions;
- resetDefaultOptions(): void;
- getType(x: any): any;
- visitModel(rootObject: any, callback: Function, options?: { visitedObjects?: any; parentName?: string; ignore?: string[]; copy?: string[]; include?: string[]; }): any;
-}
-
-interface KnockoutObservableArrayFunctions {
- mappedCreate(item: T): T;
-
- mappedRemove(item: T): T[];
- mappedRemove(removeFunction: (item: T) => boolean): T[];
- mappedRemoveAll(items: T[]): T[];
- mappedRemoveAll(): T[];
-
- mappedDestroy(item: T): void;
- mappedDestroy(destroyFunction: (item: T) => boolean): void;
- mappedDestroyAll(items: T[]): void;
- mappedDestroyAll(): void;
-}
-
-interface KnockoutStatic {
- mapping: KnockoutMapping;
-}
-
-declare module "knockout.mapping" {
- export = mapping;
-}
-declare var mapping: KnockoutMapping;
+// Type definitions for Knockout.Mapping 2.0
+// Project: https://github.com/SteveSanderson/knockout.mapping
+// Definitions by: Boris Yankov
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+interface KnockoutMappingCreateOptions {
+ data: any;
+ parent: any;
+}
+
+interface KnockoutMappingUpdateOptions {
+ data: any;
+ parent: any;
+ target: any;
+ observable?: KnockoutObservable;
+}
+
+interface KnockoutMappingOptions {
+ ignore?: string[];
+ include?: string[];
+ copy?: string[];
+ mappedProperties?: string[];
+ deferEvaluation?: boolean;
+ create?: (options: KnockoutMappingCreateOptions) => void;
+ update?: (options: KnockoutMappingUpdateOptions) => void;
+ key?: (data: any) => any;
+}
+
+interface KnockoutMapping {
+ isMapped(viewModel: any): boolean;
+ fromJS(jsObject: any): any;
+ fromJS(jsObject: any, targetOrOptions: any): any;
+ fromJS(jsObject: any, inputOptions: any, target: any): any;
+ fromJSON(jsonString: string): any;
+ fromJSON(jsonString: string, targetOrOptions: any): any;
+ fromJSON(jsonString: string, inputOptions: any, target: any): any;
+ toJS(rootObject: any, options?: KnockoutMappingOptions): any;
+ toJSON(rootObject: any, options?: KnockoutMappingOptions): any;
+ defaultOptions(): KnockoutMappingOptions;
+ resetDefaultOptions(): void;
+ getType(x: any): any;
+ visitModel(rootObject: any, callback: Function, options?: { visitedObjects?: any; parentName?: string; ignore?: string[]; copy?: string[]; include?: string[]; }): any;
+}
+
+interface KnockoutObservableArrayFunctions {
+ mappedCreate(item: T): T;
+
+ mappedRemove(item: T): T[];
+ mappedRemove(removeFunction: (item: T) => boolean): T[];
+ mappedRemoveAll(items: T[]): T[];
+ mappedRemoveAll(): T[];
+
+ mappedDestroy(item: T): void;
+ mappedDestroy(destroyFunction: (item: T) => boolean): void;
+ mappedDestroyAll(items: T[]): void;
+ mappedDestroyAll(): void;
+}
+
+interface KnockoutStatic {
+ mapping: KnockoutMapping;
+}
+
+declare module "knockout.mapping" {
+ export = mapping;
+}
+declare var mapping: KnockoutMapping;
diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts
index ef02c29d2..fd696b2a5 100755
--- a/leaflet/leaflet.d.ts
+++ b/leaflet/leaflet.d.ts
@@ -1,4356 +1,4356 @@
-// Type definitions for Leaflet.js 0.7.3
-// Project: https://github.com/Leaflet/Leaflet
-// Definitions by: Vladimir Zotov
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-declare module L {
- type LatLngExpression = LatLng | number[] | ({ lat: number; lng: number })
- type LatLngBoundsExpression = LatLngBounds | LatLngExpression[];
-}
-
-declare module L {
-
- export interface AttributionOptions {
-
- /**
- * The position of the control (one of the map corners). See control positions.
- * Default value: 'bottomright'.
- */
- position?: string;
-
- /**
- * The HTML text shown before the attributions. Pass false to disable.
- * Default value: 'Powered by Leaflet'.
- */
- prefix?: string;
-
- }
-}
-
-declare module L {
-
- /**
- * Creates a Bounds object from two coordinates (usually top-left and bottom-right
- * corners).
- */
- export function bounds(topLeft: Point, bottomRight: Point): Bounds;
-
- /**
- * Creates a Bounds object defined by the points it contains.
- */
- export function bounds(points: Point[]): Bounds;
-
-
- export interface BoundsStatic {
- /**
- * Creates a Bounds object from two coordinates (usually top-left and bottom-right
- * corners).
- */
- new(topLeft: Point, bottomRight: Point): Bounds;
-
- /**
- * Creates a Bounds object defined by the points it contains.
- */
- new(points: Point[]): Bounds;
- }
- export var Bounds: BoundsStatic;
-
- export interface Bounds {
- /**
- * Extends the bounds to contain the given point.
- */
- extend(point: Point): void;
-
- /**
- * Returns the center point of the bounds.
- */
- getCenter(): Point;
-
- /**
- * Returns true if the rectangle contains the given one.
- */
- contains(otherBounds: Bounds): boolean;
-
- /**
- * Returns true if the rectangle contains the given point.
- */
- contains(point: Point): boolean;
-
- /**
- * Returns true if the rectangle intersects the given bounds.
- */
- intersects(otherBounds: Bounds): boolean;
-
- /**
- * Returns true if the bounds are properly initialized.
- */
- isValid(): boolean;
-
- /**
- * Returns the size of the given bounds.
- */
- getSize(): Point;
-
- /**
- * The top left corner of the rectangle.
- */
- min: Point;
-
- /**
- * The bottom right corner of the rectangle.
- */
- max: Point;
- }
-}
-
-declare module L {
-
- module Browser {
-
- /**
- * true for all Internet Explorer versions.
- */
- export var ie: boolean;
-
- /**
- * true for Internet Explorer 6.
- */
- export var ie6: boolean;
-
- /**
- * true for Internet Explorer 6.
- */
- export var ie7: boolean;
-
- /**
- * true for webkit-based browsers like Chrome and Safari (including mobile
- * versions).
- */
- export var webkit: boolean;
-
- /**
- * true for webkit-based browsers that support CSS 3D transformations.
- */
- export var webkit3d: boolean;
-
- /**
- * true for Android mobile browser.
- */
- export var android: boolean;
-
- /**
- * true for old Android stock browsers (2 and 3).
- */
- export var android23: boolean;
-
- /**
- * true for modern mobile browsers (including iOS Safari and different Android
- * browsers).
- */
- export var mobile: boolean;
-
- /**
- * true for mobile webkit-based browsers.
- */
- export var mobileWebkit: boolean;
-
- /**
- * true for mobile Opera.
- */
- export var mobileOpera: boolean;
-
- /**
- * true for all browsers on touch devices.
- */
- export var touch: boolean;
-
- /**
- * true for browsers with Microsoft touch model (e.g. IE10).
- */
- export var msTouch: boolean;
-
- /**
- * true for devices with Retina screens.
- */
- export var retina: boolean;
-
- }
-}
-
-
-declare module L {
-
- /**
- * Instantiates a circle object given a geographical point, a radius in meters
- * and optionally an options object.
- */
- function circle(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle;
-
- export interface CircleStatic extends ClassStatic {
- /**
- * Instantiates a circle object given a geographical point, a radius in meters
- * and optionally an options object.
- */
- new(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle;
- }
- export var Circle: CircleStatic;
-
- export interface Circle extends Path {
- /**
- * Returns the current geographical position of the circle.
- */
- getLatLng(): LatLng;
-
- /**
- * Returns the current radius of a circle. Units are in meters.
- */
- getRadius(): number;
-
- /**
- * Sets the position of a circle to a new location.
- */
- setLatLng(latlng: LatLngExpression): Circle;
-
- /**
- * Sets the radius of a circle. Units are in meters.
- */
- setRadius(radius: number): Circle;
-
- /**
- * Returns a GeoJSON representation of the circle (GeoJSON Point Feature).
- */
- toGeoJSON(): any;
-
- }
-}
-
-declare module L {
-
- /**
- * Instantiates a circle marker given a geographical point and optionally
- * an options object. The default radius is 10 and can be altered by passing a
- * "radius" member in the path options object.
- */
- function circleMarker(latlng: LatLngExpression, options?: PathOptions): CircleMarker;
-
-
- export interface CircleMarkerStatic extends ClassStatic {
- /**
- * Instantiates a circle marker given a geographical point and optionally
- * an options object. The default radius is 10 and can be altered by passing a
- * "radius" member in the path options object.
- */
- new(latlng: LatLngExpression, options?: PathOptions): CircleMarker;
- }
- export var CircleMarker: CircleMarkerStatic;
-
- export interface CircleMarker extends Circle {
- /**
- * Sets the position of a circle marker to a new location.
- */
- setLatLng(latlng: LatLngExpression): CircleMarker;
-
- /**
- * Sets the radius of a circle marker. Units are in pixels.
- */
- setRadius(radius: number): CircleMarker;
-
- /**
- * Returns a GeoJSON representation of the circle marker (GeoJSON Point Feature).
- */
- toGeoJSON(): any;
- }
-}
-
-declare module L {
- export interface ClassExtendOptions {
- /**
- * Your class's constructor function, meaning that it gets called when you do 'new MyClass(...)'.
- */
- initialize?: Function;
-
- /**
- * options is a special property that unlike other objects that you pass
- * to extend will be merged with the parent one instead of overriding it
- * completely, which makes managing configuration of objects and default
- * values convenient.
- */
- options?: any;
-
- /**
- * includes is a special class property that merges all specified objects
- * into the class (such objects are called mixins). A good example of this
- * is L.Mixin.Events that event-related methods like on, off and fire
- * to the class.
- */
- includes?: any;
-
- /**
- * statics is just a convenience property that injects specified object
- * properties as the static properties of the class, useful for defining
- * constants.
- */
- static?: any;
-
- [prop: string]: any;
- }
-
- export interface ClassStatic {
- /**
- * You use L.Class.extend to define new classes, but you can use the
- * same method on any class to inherit from it.
- */
- extend(options: ClassExtendOptions): any;
- extend(options: ClassExtendOptions): { new(options?: Options): NewClass };
-
- /**
- * You can also use the following shortcut when you just need to make
- * one additional method call.
- */
- addInitHook(methodName: string, ...args: any[]): void;
- }
-
-
- /**
- * L.Class powers the OOP facilities of Leaflet and is used to create
- * almost all of the Leaflet classes documented.
- */
- module Class {
- /**
- * You use L.Class.extend to define new classes, but you can use the
- * same method on any class to inherit from it.
- */
- function extend(options: ClassExtendOptions): any;
- }
-
-}
-
-declare module L {
- export interface ControlStatic extends ClassStatic {
- /**
- * Creates a control with the given options.
- */
- new(options?: ControlOptions): Control;
-
- Zoom: Control.ZoomStatic;
- Attribution: Control.AttributionStatic;
- Layers: Control.LayersStatic;
- Scale: Control.ScaleStatic;
- }
- export var Control: ControlStatic;
-
- export interface Control extends IControl {
- /**
- * Sets the position of the control. See control positions.
- */
- setPosition(position: string): Control;
-
- /**
- * Returns the current position of the control.
- */
- getPosition(): string;
-
- /**
- * Adds the control to the map.
- */
- addTo(map: Map): Control;
-
- /**
- * Removes the control from the map.
- */
- removeFrom(map: Map): Control;
-
- /**
- * Returns the HTML container of the control.
- */
- getContainer(): HTMLElement;
-
- // IControl members
-
- /**
- * Should contain code that creates all the neccessary DOM elements for the
- * control, adds listeners on relevant map events, and returns the element
- * containing the control. Called on map.addControl(control) or control.addTo(map).
- */
- onAdd(map: Map): HTMLElement;
-
- /**
- * Optional, should contain all clean up code (e.g. removes control's event
- * listeners). Called on map.removeControl(control) or control.removeFrom(map).
- * The control's DOM container is removed automatically.
- */
- onRemove(map: Map): void;
- }
-
- namespace Control {
- export interface ZoomStatic extends ClassStatic {
- /**
- * Creates a zoom control.
- */
- new (options?: ZoomOptions): Zoom;
- }
-
- export interface Zoom extends L.Control {
- }
-
- export interface ZoomOptions {
- /**
- * The position of the control (one of the map corners).
- * Can be 'topleft', 'topright', 'bottomleft', or 'bottomright'.
- *
- * Default value: 'topright'.
- */
- position?: string; // 'topleft' | 'topright' | 'bottomleft' | 'bottomright'
-
- /**
- * The text set on the zoom in button.
- *
- * Default value: '+'
- */
- zoomInText?: string;
-
- /**
- * The text set on the zoom out button.
- *
- * Default value: '-'
- */
- zoomOutText?: string;
-
- /**
- * The title set on the zoom in button.
- *
- * Default value: 'Zoom in'
- */
- zoomInTitle?: string;
-
- /**
- * The title set on the zoom out button.
- *
- * Default value: 'Zoom out'
- */
- zoomOutTitle?: string;
- }
-
- export interface AttributionStatic extends ClassStatic {
- /**
- * Creates an attribution control.
- */
- new(options?: AttributionOptions): Attribution;
- }
-
- export interface Attribution extends L.Control {
- /**
- * Sets the text before the attributions.
- */
- setPrefix(prefix: string): Attribution;
-
- /**
- * Adds an attribution text (e.g. 'Vector data © CloudMade').
- */
- addAttribution(text: string): Attribution;
-
- /**
- * Removes an attribution text.
- */
- removeAttribution(text: string): Attribution;
-
- }
-
- export interface LayersStatic extends ClassStatic {
- /**
- * Creates an attribution control with the given layers. Base layers will be
- * switched with radio buttons, while overlays will be switched with checkboxes.
- */
- new(baseLayers?: any, overlays?: any, options?: LayersOptions): Layers;
- }
-
- export interface Layers extends L.Control, IEventPowered {
- /**
- * Adds a base layer (radio button entry) with the given name to the control.
- */
- addBaseLayer(layer: ILayer, name: string): Layers;
-
- /**
- * Adds an overlay (checkbox entry) with the given name to the control.
- */
- addOverlay(layer: ILayer, name: string): Layers;
-
- /**
- * Remove the given layer from the control.
- */
- removeLayer(layer: ILayer): Layers;
-
- ////////////////
- ////////////////
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
- hasEventListeners(type: string): boolean;
- fireEvent(type: string, data?: any): Layers;
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
- fire(type: string, data?: any): Layers;
- addEventListener(eventMap: any, context?: any): Layers;
- removeEventListener(eventMap?: any, context?: any): Layers;
- clearAllEventListeners(): Layers;
- on(eventMap: any, context?: any): Layers;
- off(eventMap?: any, context?: any): Layers;
- }
-
- export interface ScaleStatic extends ClassStatic {
- /**
- * Creates an scale control with the given options.
- */
- new(options?: ScaleOptions): Scale;
- }
-
- export interface Scale extends L.Control {
- }
- }
-
- export interface control {
- /**
- * Creates a control with the given options.
- */
- (options?: ControlOptions): Control;
- }
-
- export namespace control {
-
- /**
- * Creates a zoom control.
- */
- export function zoom(options?: Control.ZoomOptions): L.Control.Zoom;
-
- /**
- * Creates an attribution control.
- */
- export function attribution(options?: AttributionOptions): L.Control.Attribution;
-
- /**
- * Creates an attribution control with the given layers. Base layers will be
- * switched with radio buttons, while overlays will be switched with checkboxes.
- */
- export function layers(baseLayers?: any, overlays?: any, options?: LayersOptions): L.Control.Layers;
-
- /**
- * Creates an scale control with the given options.
- */
- export function scale(options?: ScaleOptions): L.Control.Scale;
- }
-}
-
-declare namespace L {
-
- export interface ControlOptions {
-
- /**
- * The initial position of the control (one of the map corners). See control
- * positions.
- * Default value: 'topright'.
- */
- position?: string;
-
- }
-}
-
-declare namespace L {
-
- namespace CRS {
-
- /**
- * The most common CRS for online maps, used by almost all free and commercial
- * tile providers. Uses Spherical Mercator projection. Set in by default in
- * Map's crs option.
- */
- export var EPSG3857: ICRS;
-
- /**
- * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
- */
- export var EPSG4326: ICRS;
-
- /**
- * Rarely used by some commercial tile providers. Uses Elliptical Mercator
- * projection.
- */
- export var EPSG3395: ICRS;
-
- /**
- * A simple CRS that maps longitude and latitude into x and y directly. May be
- * used for maps of flat surfaces (e.g. game maps). Note that the y axis should
- * still be inverted (going from bottom to top).
- */
- export var Simple: ICRS;
-
- }
-}
-
-declare namespace L {
-
- /**
- * Creates a div icon instance with the given options.
- */
- function divIcon(options: DivIconOptions): DivIcon;
-
- export interface DivIconStatic extends ClassStatic {
- /**
- * Creates a div icon instance with the given options.
- */
- new(options: DivIconOptions): DivIcon;
- }
- export var DivIcon: DivIconStatic;
-
- export interface DivIcon extends Icon {
- }
-}
-
-declare namespace L {
-
- export interface DivIconOptions {
-
- /**
- * Size of the icon in pixels. Can be also set through CSS.
- */
- iconSize?: Point;
-
- /**
- * The coordinates of the "tip" of the icon (relative to its top left corner).
- * The icon will be aligned so that this point is at the marker's geographical
- * location. Centered by default if size is specified, also can be set in CSS
- * with negative margins.
- */
- iconAnchor?: Point;
-
- /**
- * A custom class name to assign to the icon.
- *
- * Default value: 'leaflet-div-icon'.
- */
- className?: string;
-
- /**
- * A custom HTML code to put inside the div element.
- *
- * Default value: ''.
- */
- html?: string;
-
- }
-}
-
-declare namespace L {
-
- export interface DomEvent {
-
- /**
- * Adds a listener fn to the element's DOM event of the specified type. this keyword
- * inside the listener will point to context, or to the element if not specified.
- */
- addListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
- on(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
-
- /**
- * Removes an event listener from the element.
- */
- removeListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
- off(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
-
- /**
- * Stop the given event from propagation to parent elements. Used inside the
- * listener functions:
- * L.DomEvent.addListener(div, 'click', function
- * (e) {
- * L.DomEvent.stopPropagation(e);
- * });
- */
- stopPropagation(e: Event): DomEvent;
-
- /**
- * Prevents the default action of the event from happening (such as following
- * a link in the href of the a element, or doing a POST request with page reload
- * when form is submitted). Use it inside listener functions.
- */
- preventDefault(e: Event): DomEvent;
-
- /**
- * Does stopPropagation and preventDefault at the same time.
- */
- stop(e: Event): DomEvent;
-
- /**
- * Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown'
- * and 'touchstart' events.
- */
- disableClickPropagation(el: HTMLElement): DomEvent;
-
- /**
- * Gets normalized mouse position from a DOM event relative to the container
- * or to the whole page if not specified.
- */
- getMousePosition(e: Event, container?: HTMLElement): Point;
-
- /**
- * Gets normalized wheel delta from a mousewheel DOM event.
- */
- getWheelDelta(e: Event): number;
-
- }
-
- export var DomEvent: DomEvent;
-}
-
-declare namespace L {
-
- namespace DomUtil {
-
- /**
- * Returns an element with the given id if a string was passed, or just returns
- * the element if it was passed directly.
- */
- export function get(id: string): HTMLElement;
-
- /**
- * Returns the value for a certain style attribute on an element, including
- * computed values or values set through CSS.
- */
- export function getStyle(el: HTMLElement, style: string): string;
-
- /**
- * Returns the offset to the viewport for the requested element.
- */
- export function getViewportOffset(el: HTMLElement): Point;
-
- /**
- * Creates an element with tagName, sets the className, and optionally appends
- * it to container element.
- */
- export function create(tagName: string, className: string, container?: HTMLElement): HTMLElement;
-
- /**
- * Makes sure text cannot be selected, for example during dragging.
- */
- export function disableTextSelection(): void;
-
- /**
- * Makes text selection possible again.
- */
- export function enableTextSelection(): void;
-
- /**
- * Returns true if the element class attribute contains name.
- */
- export function hasClass(el: HTMLElement, name: string): boolean;
-
- /**
- * Adds name to the element's class attribute.
- */
- export function addClass(el: HTMLElement, name: string): void;
-
- /**
- * Removes name from the element's class attribute.
- */
- export function removeClass(el: HTMLElement, name: string): void;
-
- /**
- * Set the opacity of an element (including old IE support). Value must be from
- * 0 to 1.
- */
- export function setOpacity(el: HTMLElement, value: number): void;
-
- /**
- * Goes through the array of style names and returns the first name that is a valid
- * style name for an element. If no such name is found, it returns false. Useful
- * for vendor-prefixed styles like transform.
- */
- export function testProp(props: string[]): any;
-
- /**
- * Returns a CSS transform string to move an element by the offset provided in
- * the given point. Uses 3D translate on WebKit for hardware-accelerated transforms
- * and 2D on other browsers.
- */
- export function getTranslateString(point: Point): string;
-
- /**
- * Returns a CSS transform string to scale an element (with the given scale origin).
- */
- export function getScaleString(scale: number, origin: Point): string;
-
- /**
- * Sets the position of an element to coordinates specified by point, using
- * CSS translate or top/left positioning depending on the browser (used by
- * Leaflet internally to position its layers). Forces top/left positioning
- * if disable3D is true.
- */
- export function setPosition(el: HTMLElement, point: Point, disable3D?: boolean): void;
-
- /**
- * Returns the coordinates of an element previously positioned with setPosition.
- */
- export function getPosition(el: HTMLElement): Point;
-
- /**
- * Vendor-prefixed transition style name (e.g. 'webkitTransition' for WebKit).
- */
- export var TRANSITION: string;
-
- /**
- * Vendor-prefixed transform style name.
- */
- export var TRANSFORM: string;
-
- }
-}
-
-declare namespace L {
- export interface DraggableStatic extends ClassStatic {
- /**
- * Creates a Draggable object for moving the given element when you start dragging
- * the dragHandle element (equals the element itself by default).
- */
- new(element: HTMLElement, dragHandle?: HTMLElement): Draggable;
- }
- export var Draggable: DraggableStatic;
-
-
- export interface Draggable extends IEventPowered {
- /**
- * Enables the dragging ability.
- */
- enable(): void;
-
- /**
- * Disables the dragging ability.
- */
- disable(): void;
-
- ////////////////
- ////////////////
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): Draggable;
- hasEventListeners(type: string): boolean;
- fireEvent(type: string, data?: any): Draggable;
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Draggable;
- fire(type: string, data?: any): Draggable;
- addEventListener(eventMap: any, context?: any): Draggable;
- removeEventListener(eventMap?: any, context?: any): Draggable;
- clearAllEventListeners(): Draggable;
- on(eventMap: any, context?: any): Draggable;
- off(eventMap?: any, context?: any): Draggable;
- }
-}
-
-
-
-declare namespace L {
-
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- function featureGroup(layers?: T[]): FeatureGroup;
-
-
- export interface FeatureGroupStatic extends ClassStatic {
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- new(layers?: T[]): FeatureGroup;
- }
- export var FeatureGroup: FeatureGroupStatic;
-
- export interface FeatureGroup extends LayerGroup, ILayer, IEventPowered> {
- /**
- * Binds a popup with a particular HTML content to a click on any layer from the
- * group that has a bindPopup method.
- */
- bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup;
-
- /**
- * Returns the LatLngBounds of the Feature Group (created from bounds and coordinates
- * of its children).
- */
- getBounds(): LatLngBounds;
-
- /**
- * Sets the given path options to each layer of the group that has a setStyle method.
- */
- setStyle(style: PathOptions): FeatureGroup;
-
- /**
- * Brings the layer group to the top of all other layers.
- */
- bringToFront(): FeatureGroup;
-
- /**
- * Brings the layer group to the bottom of all other layers.
- */
- bringToBack(): FeatureGroup;
-
- ////////////
- ////////////
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
-
- ////////////////
- ////////////////
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- hasEventListeners(type: string): boolean;
- fireEvent(type: string, data?: any): FeatureGroup;
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup;
- fire(type: string, data?: any): FeatureGroup;
- addEventListener(eventMap: any, context?: any): FeatureGroup;
- removeEventListener(eventMap?: any, context?: any): FeatureGroup;
- clearAllEventListeners(): FeatureGroup;
- on(eventMap: any, context?: any): FeatureGroup;
- off(eventMap?: any, context?: any): FeatureGroup;
- }
-}
-
-declare namespace L {
-
- /**
- * Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
- * to display on the map (you can alternatively add it later with addData method)
- * and an options object.
- */
- function geoJson(geojson?: any, options?: GeoJSONOptions): GeoJSON;
-
- export interface GeoJSONStatic extends ClassStatic {
- /**
- * Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
- * to display on the map (you can alternatively add it later with addData method)
- * and an options object.
- */
- new(geojson?: any, options?: GeoJSONOptions): GeoJSON;
-
- /**
- * Creates a layer from a given GeoJSON feature.
- */
- geometryToLayer(featureData: GeoJSON, pointToLayer?: (featureData: any, latlng: LatLng) => ILayer): ILayer;
-
- /**
- * Creates a LatLng object from an array of 2 numbers (latitude, longitude)
- * used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted
- * as (longitude, latitude).
- */
- coordsToLatLng(coords: number[], reverse?: boolean): LatLng;
-
- /**
- * Creates a multidimensional array of LatLng objects from a GeoJSON coordinates
- * array. levelsDeep specifies the nesting level (0 is for an array of points,
- * 1 for an array of arrays of points, etc., 0 by default). If reverse is set to
- * true, the numbers will be interpreted as (longitude, latitude).
- */
- coordsToLatLngs(coords: any[], levelsDeep?: number, reverse?: boolean): any[];
- }
- export var GeoJSON: GeoJSONStatic;
-
- export interface GeoJSON extends FeatureGroup {
- /**
- * Adds a GeoJSON object to the layer.
- */
- addData(data: any): boolean;
-
- /**
- * Changes styles of GeoJSON vector layers with the given style function.
- */
- setStyle(style: (featureData: any) => any): GeoJSON;
-
- /**
- * Changes styles of GeoJSON vector layers with the given style options.
- */
- setStyle(style: PathOptions): GeoJSON;
-
- /**
- * Resets the the given vector layer's style to the original GeoJSON style,
- * useful for resetting style after hover events.
- */
- resetStyle(layer: Path): GeoJSON;
- }
-}
-
-declare namespace L {
- export interface GeoJSONOptions {
- /**
- * Function that will be used for creating layers for GeoJSON points (if not
- * specified, simple markers will be created).
- */
- pointToLayer?: (featureData: any, latlng: LatLng) => ILayer;
-
- /**
- * Function that will be used to get style options for vector layers created
- * for GeoJSON features.
- */
- style?: (featureData: any) => any;
-
- /**
- * Function that will be called on each created feature layer. Useful for attaching
- * events and popups to features.
- */
- onEachFeature?: (featureData: any, layer: ILayer) => void;
-
- /**
- * Function that will be used to decide whether to show a feature or not.
- */
- filter?: (featureData: any, layer: ILayer) => boolean;
-
- /**
- * Function that will be used for converting GeoJSON coordinates to LatLng points
- * (if not specified, coords will be assumed to be WGS84 � standard[longitude, latitude]
- * values in degrees).
- */
- coordsToLatLng?: (coords: any[]) => LatLng[];
- }
-}
-
-
-
-
-declare namespace L {
-
- /**
- * Creates an icon instance with the given options.
- */
- function icon(options: IconOptions): Icon;
-
- export interface IconStatic extends ClassStatic {
- /**
- * Creates an icon instance with the given options.
- */
- new(options: IconOptions): Icon;
-
- Default: {
- /**
- * Creates a default icon instance with the given options.
- */
- new(options?: IconOptions): Icon.Default;
-
- imagePath: string;
- };
- }
- export var Icon: IconStatic;
-
- export interface Icon {
- }
-
- namespace Icon {
- /**
- * L.Icon.Default extends L.Icon and is the blue icon Leaflet uses
- * for markers by default.
- */
- export interface Default extends Icon {
- }
- }
-}
-
-declare namespace L {
-
- export interface IconOptions {
-
- /**
- * (required) The URL to the icon image (absolute or relative to your script
- * path).
- */
- iconUrl?: string;
-
- /**
- * The URL to a retina sized version of the icon image (absolute or relative to
- * your script path). Used for Retina screen devices.
- */
- iconRetinaUrl?: string;
-
- /**
- * Size of the icon image in pixels.
- */
- iconSize?: Point|[number, number];
-
- /**
- * The coordinates of the "tip" of the icon (relative to its top left corner).
- * The icon will be aligned so that this point is at the marker's geographical
- * location. Centered by default if size is specified, also can be set in CSS
- * with negative margins.
- */
- iconAnchor?: Point|[number, number];
-
- /**
- * The URL to the icon shadow image. If not specified, no shadow image will be
- * created.
- */
- shadowUrl?: string;
-
- /**
- * The URL to the retina sized version of the icon shadow image. If not specified,
- * no shadow image will be created. Used for Retina screen devices.
- */
- shadowRetinaUrl?: string;
-
- /**
- * Size of the shadow image in pixels.
- */
- shadowSize?: Point|[number, number];
-
- /**
- * The coordinates of the "tip" of the shadow (relative to its top left corner)
- * (the same as iconAnchor if not specified).
- */
- shadowAnchor?: Point|[number, number];
-
- /**
- * The coordinates of the point from which popups will "open", relative to the
- * icon anchor.
- */
- popupAnchor?: Point|[number, number];
-
- /**
- * A custom class name to assign to both icon and shadow images. Empty by default.
- */
- className?: string;
- }
-}
-
-declare namespace L {
-
- export interface IControl {
-
- /**
- * Should contain code that creates all the neccessary DOM elements for the
- * control, adds listeners on relevant map events, and returns the element
- * containing the control. Called on map.addControl(control) or control.addTo(map).
- */
- onAdd(map: Map): HTMLElement;
-
- /**
- * Optional, should contain all clean up code (e.g. removes control's event
- * listeners). Called on map.removeControl(control) or control.removeFrom(map).
- * The control's DOM container is removed automatically.
- */
- onRemove(map: Map): void;
- }
-}
-
-declare namespace L {
-
- export interface ICRS {
-
- /**
- * Projection that this CRS uses.
- */
- projection: IProjection;
-
- /**
- * Transformation that this CRS uses to turn projected coordinates into screen
- * coordinates for a particular tile service.
- */
- transformation: Transformation;
-
- /**
- * Standard code name of the CRS passed into WMS services (e.g. 'EPSG:3857').
- */
- code: string;
-
- /**
- * Projects geographical coordinates on a given zoom into pixel coordinates.
- */
- latLngToPoint(latlng: LatLng, zoom: number): Point;
-
- /**
- * The inverse of latLngToPoint. Projects pixel coordinates on a given zoom
- * into geographical coordinates.
- */
- pointToLatLng(point: Point, zoom: number): LatLng;
-
- /**
- * Projects geographical coordinates into coordinates in units accepted
- * for this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
- */
- project(latlng: LatLng): Point;
-
- /**
- * Returns the scale used when transforming projected coordinates into pixel
- * coordinates for a particular zoom. For example, it returns 256 * 2^zoom for
- * Mercator-based CRS.
- */
- scale(zoom: number): number;
-
- /**
- * Returns the size of the world in pixels for a particular zoom.
- */
- getSize(zoom: number): Point;
-
- }
-}
-
-declare namespace L {
-
- export interface IEventPowered {
-
- /**
- * Adds a listener function (fn) to a particular event type of the object. You
- * can optionally specify the context of the listener (object the this keyword
- * will point to). You can also pass several space-separated types (e.g. 'click
- * dblclick').
- */
- addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * The same as above except the listener will only get fired once and then removed.
- */
- addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
- /**
- * Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
- */
- addEventListener(eventMap: any, context?: any): T;
-
- /**
- * Removes a previously added listener function. If no function is specified,
- * it will remove all the listeners of that particular event from the object.
- */
- removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Removes a set of type/listener pairs.
- */
- removeEventListener(eventMap?: any, context?: any): T;
-
- /**
- * Returns true if a particular event type has some listeners attached to it.
- */
- hasEventListeners(type: string): boolean;
-
- /**
- * Fires an event of the specified type. You can optionally provide an data object
- * — the first argument of the listener function will contain its properties.
- */
- fireEvent(type: string, data?: any): T;
-
- /**
- * Removes all listeners to all events on the object.
- */
- clearAllEventListeners(): T;
-
- /**
- * Alias to addEventListener.
- */
- on(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Alias to addEventListener.
- */
- on(eventMap: any, context?: any): T;
-
- /**
- * Alias to addOneTimeEventListener.
- */
- once(type: string, fn: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Alias to removeEventListener.
- */
- off(type: string, fn?: (e: LeafletEvent) => void, context?: any): T;
-
- /**
- * Alias to removeEventListener.
- */
- off(eventMap?: any, context?: any): T;
-
- /**
- * Alias to fireEvent.
- */
- fire(type: string, data?: any): T;
- }
-}
-
-declare namespace L {
-
- export interface IHandler {
-
- /**
- * Enables the handler.
- */
- enable(): void;
-
- /**
- * Disables the handler.
- */
- disable(): void;
-
- /**
- * Returns true if the handler is enabled.
- */
- enabled(): boolean;
- }
-
- export interface Handler {
- initialize(map: Map): void;
- }
-}
-
-declare namespace L {
-
- export interface ILayer {
-
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
- }
-}
-
-declare namespace L {
- namespace Mixin {
- export interface LeafletMixinEvents extends IEventPowered {
- }
-
- export var Events: LeafletMixinEvents;
- }
-}
-
-declare namespace L {
-
- /**
- * Instantiates an image overlay object given the URL of the image and the geographical
- * bounds it is tied to.
- */
- function imageOverlay(imageUrl: string, bounds: LatLngBounds, options?: ImageOverlayOptions): ImageOverlay;
-
- export interface ImageOverlayStatic extends ClassStatic {
- /**
- * Instantiates an image overlay object given the URL of the image and the geographical
- * bounds it is tied to.
- */
- new(imageUrl: string, bounds: LatLngBounds, options?: ImageOverlayOptions): ImageOverlay;
- }
- export var ImageOverlay: ImageOverlayStatic;
-
- export interface ImageOverlay extends ILayer {
- /**
- * Adds the overlay to the map.
- */
- addTo(map: Map): ImageOverlay;
-
- /**
- * Sets the opacity of the overlay.
- */
- setOpacity(opacity: number): ImageOverlay;
-
- /**
- * Changes the URL of the image.
- */
- setUrl(imageUrl: string): ImageOverlay;
-
- /**
- * Brings the layer to the top of all overlays.
- */
- bringToFront(): ImageOverlay;
-
- /**
- * Brings the layer to the bottom of all overlays.
- */
- bringToBack(): ImageOverlay;
-
- ////////////
- ////////////
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
- }
-}
-
-declare namespace L {
-
- export interface ImageOverlayOptions {
-
- /**
- * The opacity of the image overlay.
- */
- opacity?: number;
- }
-}
-
-declare namespace L {
-
- export interface IProjection {
-
- /**
- * Projects geographical coordinates into a 2D point.
- */
- project(latlng: LatLng): Point;
-
- /**
- * The inverse of project. Projects a 2D point into geographical location.
- */
- unproject(point: Point): LatLng;
- }
-}
-
-declare namespace L {
-
- /**
- * A constant that represents the Leaflet version in use.
- */
- export var version: string;
-
- /**
- * This method restores the L global variale to the original value it had
- * before Leaflet inclusion, and returns the real Leaflet namespace.
- */
- export function noConflict(): typeof L;
-}
-
-declare namespace L {
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- function latLng(latitude: number, longitude: number): LatLng;
-
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- function latLng(coords: LatLngExpression): LatLng;
-
- export interface LatLngStatic {
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- new(latitude: number, longitude: number): LatLng;
-
- /**
- * Creates an object representing a geographical point with the given latitude
- * and longitude.
- */
- new(coords: LatLngExpression): LatLng;
-
- /**
- * A multiplier for converting degrees into radians.
- *
- * Value: Math.PI / 180.
- */
- DEG_TO_RAD: number;
-
- /**
- * A multiplier for converting radians into degrees.
- *
- * Value: 180 / Math.PI.
- */
- RAD_TO_DEG: number;
-
- /**
- * Max margin of error for the equality check.
- *
- * Value: 1.0E-9.
- */
- MAX_MARGIN: number;
- }
- export var LatLng: LatLngStatic;
-
- export interface LatLng {
- /**
- * Returns the distance (in meters) to the given LatLng calculated using the
- * Haversine formula. See description on wikipedia
- */
- distanceTo(otherLatlng: LatLngExpression): number;
-
- /**
- * Returns true if the given LatLng point is at the same position (within a small
- * margin of error).
- */
- equals(otherLatlng: LatLngExpression): boolean;
-
- /**
- * Returns a string representation of the point (for debugging purposes).
- */
- toString(): string;
-
- /**
- * Returns a new LatLng object with the longitude wrapped around left and right
- * boundaries (-180 to 180 by default).
- */
- wrap(left: number, right: number): LatLng;
-
- /**
- * Latitude in degrees.
- */
- lat: number;
-
- /**
- * Longitude in degrees.
- */
- lng: number;
- }
-}
-
-declare namespace L {
-
- /**
- * Creates a LatLngBounds object by defining south-west and north-east corners
- * of the rectangle.
- */
- function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
-
- /**
- * Creates a LatLngBounds object defined by the geographical points it contains.
- * Very useful for zooming the map to fit a particular set of locations with fitBounds.
- */
- function latLngBounds(latlngs: LatLngBoundsExpression): LatLngBounds;
-
- export interface LatLngBoundsStatic {
- /**
- * Creates a LatLngBounds object by defining south-west and north-east corners
- * of the rectangle.
- */
- new(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
-
- /**
- * Creates a LatLngBounds object defined by the geographical points it contains.
- * Very useful for zooming the map to fit a particular set of locations with fitBounds.
- */
- new(latlngs: LatLngBoundsExpression): LatLngBounds;
- }
- export var LatLngBounds: LatLngBoundsStatic;
-
- export interface LatLngBounds {
- /**
- * Extends the bounds to contain the given point.
- */
- extend(latlng: LatLngExpression): LatLngBounds;
-
- /**
- * Extends the bounds to contain the given bounds.
- */
- extend(latlng: LatLngBoundsExpression): LatLngBounds;
-
- /**
- * Returns the south-west point of the bounds.
- */
- getSouthWest(): LatLng;
-
- /**
- * Returns the north-east point of the bounds.
- */
- getNorthEast(): LatLng;
-
- /**
- * Returns the north-west point of the bounds.
- */
- getNorthWest(): LatLng;
-
- /**
- * Returns the south-east point of the bounds.
- */
- getSouthEast(): LatLng;
-
- /**
- * Returns the west longitude in degrees of the bounds.
- */
- getWest(): number;
-
- /**
- * Returns the east longitude in degrees of the bounds.
- */
- getEast(): number;
-
- /**
- * Returns the north latitude in degrees of the bounds.
- */
- getNorth(): number;
-
- /**
- * Returns the south latitude in degrees of the bounds.
- */
- getSouth(): number;
-
- /**
- * Returns the center point of the bounds.
- */
- getCenter(): LatLng;
-
- /**
- * Returns true if the rectangle contains the given one.
- */
- contains(otherBounds: LatLngBoundsExpression): boolean;
-
- /**
- * Returns true if the rectangle contains the given point.
- */
- contains(latlng: LatLngExpression): boolean;
-
- /**
- * Returns true if the rectangle intersects the given bounds.
- */
- intersects(otherBounds: LatLngBoundsExpression): boolean;
-
- /**
- * Returns true if the rectangle is equivalent (within a small margin of error)
- * to the given bounds.
- */
- equals(otherBounds: LatLngBoundsExpression): boolean;
-
- /**
- * Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat'
- * format. Useful for sending requests to web services that return geo data.
- */
- toBBoxString(): string;
-
- /**
- * Returns bigger bounds created by extending the current bounds by a given
- * percentage in each direction.
- */
- pad(bufferRatio: number): LatLngBounds;
-
- /**
- * Returns true if the bounds are properly initialized.
- */
- isValid(): boolean;
-
- }
-}
-
-declare namespace L {
-
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- function layerGroup(layers?: T[]): LayerGroup;
-
-
- export interface LayerGroupStatic extends ClassStatic {
- /**
- * Create a layer group, optionally given an initial set of layers.
- */
- new(layers?: T[]): LayerGroup;
- }
- export var LayerGroup: LayerGroupStatic;
-
- export interface LayerGroup extends ILayer {
- /**
- * Adds the group of layers to the map.
- */
- addTo(map: Map): LayerGroup;
-
- /**
- * Adds a given layer to the group.
- */
- addLayer(layer: T): LayerGroup;
-
- /**
- * Removes a given layer from the group.
- */
- removeLayer(layer: T): LayerGroup;
-
- /**
- * Removes a given layer of the given id from the group.
- */
- removeLayer(id: string): LayerGroup;
-
- /**
- * Returns true if the given layer is currently added to the group.
- */
- hasLayer(layer: T): boolean;
-
- /**
- * Returns the layer with the given id.
- */
- getLayer(id: string): T;
-
- /**
- * Returns an array of all the layers added to the group.
- */
- getLayers(): T[];
-
- /**
- * Removes all the layers from the group.
- */
- clearLayers(): LayerGroup;
-
- /**
- * Iterates over the layers of the group, optionally specifying context of
- * the iterator function.
- */
- eachLayer(fn: (layer: T) => void, context?: any): LayerGroup;
-
- /**
- * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection).
- */
- toGeoJSON(): any;
-
- ////////////
- ////////////
- /**
- * Should contain code that creates DOM elements for the overlay, adds them
- * to map panes where they should belong and puts listeners on relevant map events.
- * Called on map.addLayer(layer).
- */
- onAdd(map: Map): void;
-
- /**
- * Should contain all clean up code that removes the overlay's elements from
- * the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
- */
- onRemove(map: Map): void;
- }
-}
-
-
-declare namespace L {
-
- export interface LayersOptions {
-
- /**
- * The position of the control (one of the map corners). See control positions.
- *
- * Default value: 'topright'.
- */
- position?: string;
-
- /**
- * If true, the control will be collapsed into an icon and expanded on mouse hover
- * or touch.
- *
- * Default value: true.
- */
- collapsed?: boolean;
-
- /**
- * If true, the control will assign zIndexes in increasing order to all of its
- * layers so that the order is preserved when switching them on/off.
- *
- * Default value: true.
- */
- autoZIndex?: boolean;
-
- }
-}
-
-declare namespace L {
-
- export interface LeafletErrorEvent extends LeafletEvent {
-
- /**
- * Error message.
- */
- message: string;
-
- /**
- * Error code (if applicable).
- */
- code: number;
- }
-}
-
-declare namespace L {
-
- export interface LeafletEvent {
-
- /**
- * The event type (e.g. 'click').
- */
- type: string;
-
- /**
- * The object that fired the event.
- */
- target: any;
- }
-}
-
-declare namespace L {
-
- export interface LeafletGeoJSONEvent extends LeafletEvent {
-
- /**
- * The layer for the GeoJSON feature that is being added to the map.
- */
- layer: ILayer;
-
- /**
- * GeoJSON properties of the feature.
- */
- properties: any;
-
- /**
- * GeoJSON geometry type of the feature.
- */
- geometryType: string;
-
- /**
- * GeoJSON ID of the feature (if present).
- */
- id: string;
- }
-}
-
-declare namespace L {
-
- export interface LeafletLayerEvent extends LeafletEvent {
-
- /**
- * The layer that was added or removed.
- */
- layer: ILayer;
- }
-}
-
-declare namespace L {
-
- export interface LeafletLayersControlEvent extends LeafletEvent {
-
- /**
- * The layer that was added or removed.
- */
- layer: ILayer;
-
- /**
- * The name of the layer that was added or removed.
- */
- name: string;
- }
-}
-
-declare module L {
-
- export interface LeafletLocationEvent extends LeafletEvent {
-
- /**
- * Detected geographical location of the user.
- */
- latlng: LatLng;
-
- /**
- * Geographical bounds of the area user is located in (with respect to the accuracy
- * of location).
- */
- bounds: LatLngBounds;
-
- /**
- * Accuracy of location in meters.
- */
- accuracy: number;
-
- /**
- * Height of the position above the WGS84 ellipsoid in meters.
- */
- altitude: number;
-
- /**
- * Accuracy of altitude in meters.
- */
- altitudeAccuracy: number;
-
- /**
- * The direction of travel in degrees counting clockwise from true North.
- */
- heading: number;
-
- /**
- * Current velocity in meters per second.
- */
- speed: number;
-
- /**
- * The time when the position was acquired.
- */
- timestamp: number;
-
- }
-}
-
-declare namespace L {
-
- export interface LeafletMouseEvent extends LeafletEvent {
-
- /**
- * The geographical point where the mouse event occured.
- */
- latlng: LatLng;
-
- /**
- * Pixel coordinates of the point where the mouse event occured relative to
- * the map layer.
- */
- layerPoint: Point;
-
- /**
- * Pixel coordinates of the point where the mouse event occured relative to
- * the map сontainer.
- */
- containerPoint: Point;
-
- /**
- * The original DOM mouse event fired by the browser.
- */
- originalEvent: MouseEvent;
- }
-}
-
-declare namespace L {
-
- export interface LeafletPopupEvent extends LeafletEvent {
-
- /**
- * The popup that was opened or closed.
- */
- popup: Popup;
- }
-}
-
-declare namespace L {
-
- export interface LeafletDragEndEvent extends LeafletEvent {
-
- /**
- * The distance in pixels the draggable element was moved by.
- */
- distance: number;
- }
-}
-
-declare namespace L {
-
- export interface LeafletResizeEvent extends LeafletEvent {
-
- /**
- * The old size before resize event.
- */
- oldSize: Point;
-
- /**
- * The new size after the resize event.
- */
- newSize: Point;
- }
-}
-
-declare namespace L {
-
- export interface LeafletTileEvent extends LeafletEvent {
-
- /**
- * The tile element (image).
- */
- tile: HTMLElement;
-
- /**
- * The source URL of the tile.
- */
- url: string;
- }
-}
-
-declare namespace L {
-
- namespace LineUtil {
-
- /**
- * Dramatically reduces the number of points in a polyline while retaining
- * its shape and returns a new array of simplified points. Used for a huge performance
- * boost when processing/displaying Leaflet polylines for each zoom level
- * and also reducing visual noise. tolerance affects the amount of simplification
- * (lesser value means higher quality but slower and with more points). Also
- * released as a separated micro-library Simplify.js.
- */
- export function simplify(points: Point[], tolerance: number): Point[];
-
- /**
- * Returns the distance between point p and segment p1 to p2.
- */
- export function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
-
- /**
- * Returns the closest point from a point p on a segment p1 to p2.
- */
- export function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
-
- /**
- * Clips the segment a to b by rectangular bounds (modifying the segment points
- * directly!). Used by Leaflet to only show polyline points that are on the screen
- * or near, increasing performance.
- */
- export function clipSegment(a: Point, b: Point, bounds: Bounds): void;
-
- }
-}
-
-declare namespace L {
-
- export interface LocateOptions {
-
- /**
- * If true, starts continous watching of location changes (instead of detecting
- * it once) using W3C watchPosition method. You can later stop watching using
- * map.stopLocate() method.
- *
- * Default value: false.
- */
- watch?: boolean;
-
- /**
- * If true, automatically sets the map view to the user location with respect
- * to detection accuracy, or to world view if geolocation failed.
- *
- * Default value: false.
- */
- setView?: boolean;
-
- /**
- * The maximum zoom for automatic view setting when using `setView` option.
- *
- * Default value: Infinity.
- */
- maxZoom?: number;
-
- /**
- * Number of millisecond to wait for a response from geolocation before firing
- * a locationerror event.
- *
- * Default value: 10000.
- */
- timeout?: number;
-
- /**
- * Maximum age of detected location. If less than this amount of milliseconds
- * passed since last geolocation response, locate will return a cached location.
- *
- * Default value: 0.
- */
- maximumAge?: number;
-
- /**
- * Enables high accuracy, see description in the W3C spec.
- *
- * Default value: false.
- */
- enableHighAccuracy?: boolean;
- }
-}
-
-declare namespace L {
-
- /**
- * Instantiates a map object given a div element and optionally an
- * object literal with map options described below.
- */
- function map(id: HTMLElement, options?: Map.MapOptions): Map;
-
- /**
- * Instantiates a map object given a div element id and optionally an
- * object literal with map options described below.
- */
- function map(id: string, options?: Map.MapOptions): Map;
-
-
- export interface MapStatic extends ClassStatic {
- /**
- * Instantiates a map object given a div element and optionally an
- * object literal with map options described below.
- *
- * @constructor
- */
- new(id: HTMLElement, options?: Map.MapOptions): Map;
-
- /**
- * Instantiates a map object given a div element id and optionally an
- * object literal with map options described below.
- *
- * @constructor
- */
- new(id: string, options?: Map.MapOptions): Map;
- }
- export var Map: MapStatic;
-
- export interface Map extends IEventPowered