diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index a9ae498738..4078b4808b 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,5 +1,5 @@ -- [ ] I tried using the latest `xxxx/xxxx.d.ts` file in this repo and had problems. +- [ ] I tried using the `@types/xxxx` package and had problems. - [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript - [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/). (Please ask any appropriate questions there). -- [ ] I want to talk about `xxxx/xxxx.d.ts`. - - The authors of that type definition are cc/ @.... +- [ ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see `Definitions by:` in `index.d.ts`) so they can respond. + - Authors: @.... diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 4d9a7aab6f..1fc8897d23 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -3,8 +3,8 @@ Please fill in this template. - [ ] Make your PR against the `master` branch. - [ ] Use a meaningful title for the pull request. Include the name of the package modified. - [ ] Test the change in your own code. (Compile and run.) -- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request). -- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes). +- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). +- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [ ] Run `tsc` without errors. - [ ] Run `npm run lint package-name` if a `tslint.json` is present. diff --git a/accepts/index.d.ts b/accepts/index.d.ts index ff6a9d0995..a12dcaf5c9 100644 --- a/accepts/index.d.ts +++ b/accepts/index.d.ts @@ -3,29 +3,60 @@ // Definitions by: Stefan Reichel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -import { IncomingMessage } from "http"; - declare namespace accepts { + export interface Headers { + [key: string]: string | string[]; + } + export interface Accepts { - charset(charsets: string[]): string | string[] | boolean; - charset(...charsets: string[]): string | string[] | boolean; + /** + * Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned. + */ + charset(charsets: string[]): string | false; + charset(...charsets: string[]): string | false; + + /** + * Return the charsets that the request accepts, in the order of the client's preference (most preferred first). + */ charsets(): string[]; - encoding(encodings: string[]): string | string[] | boolean; - encoding(...encodings: string[]): string | string[] | boolean; + /** + * Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned. + */ + encoding(encodings: string[]): string | false; + encoding(...encodings: string[]): string | false; + + /** + * Return the encodings that the request accepts, in the order of the client's preference (most preferred first). + */ encodings(): string[]; - language(languages: string[]): string | string[] | boolean; - language(...languages: string[]): string | string[] | boolean; + /** + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + */ + language(languages: string[]): string | false; + language(...languages: string[]): string | false; + + /** + * Return the languages that the request accepts, in the order of the client's preference (most preferred first). + */ languages(): string[]; - type(types: string[]): string | string[] | boolean; - type(...types: string[]): string | string[] | boolean; + /** + * Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned. + * + * The `types` array can contain full MIME types or file extensions. Any value that is not a full MIME types is passed to `require('mime-types').lookup`. + */ + type(types: string[]): string | false; + type(...types: string[]): string | false; + + /** + * Return the types that the request accepts, in the order of the client's preference (most preferred first). + */ types(): string[]; } } -declare function accepts(req: IncomingMessage): accepts.Accepts; +declare function accepts(req: { headers: accepts.Headers }): accepts.Accepts; export = accepts; diff --git a/angular-gridster/index.d.ts b/angular-gridster/index.d.ts index de60d6377b..fc0e990d41 100644 --- a/angular-gridster/index.d.ts +++ b/angular-gridster/index.d.ts @@ -32,7 +32,7 @@ declare module "angular" { // width of grid columns. "auto" will divide the width of the grid evenly among the columns colWidth?: string; - // height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels, + // height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels, // '/2' is half the column width, '*5' is five times the column width, etc. rowHeight?: string; @@ -84,7 +84,7 @@ declare module "angular" { // options to pass to resizable handler resizable?: { - // whether the items are resizable + // whether the items are resizable enabled?: boolean; // location of the resize handles @@ -104,7 +104,7 @@ declare module "angular" { // options to pass to draggable handler draggable?: { - // whether the items are resizable + // whether the items are resizable enabled?: boolean; // Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer @@ -142,4 +142,4 @@ declare module "angular" { col: number; } } -} \ No newline at end of file +} diff --git a/angular-mocks/angular-mocks-tests.ts b/angular-mocks/angular-mocks-tests.ts index 8ea42e4122..cabbf7c578 100644 --- a/angular-mocks/angular-mocks-tests.ts +++ b/angular-mocks/angular-mocks-tests.ts @@ -118,6 +118,7 @@ httpBackendService.flush(); httpBackendService.flush(1234); httpBackendService.resetExpectations(); httpBackendService.verifyNoOutstandingExpectation(); +httpBackendService.verifyNoOutstandingExpectation(false); httpBackendService.verifyNoOutstandingRequest(); requestHandler = httpBackendService.expect('GET', 'http://test.local'); diff --git a/angular-mocks/index.d.ts b/angular-mocks/index.d.ts index ddded4d0a8..8b94fab445 100644 --- a/angular-mocks/index.d.ts +++ b/angular-mocks/index.d.ts @@ -132,8 +132,9 @@ declare module 'angular' { /** * Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception. + * @param digest Do digest before checking expectation. Pass anything except false to trigger digest. NOTE this flag is purposely undocumented by Angular, which means it's not to be used in normal client code. */ - verifyNoOutstandingExpectation(): void; + verifyNoOutstandingExpectation(digest?: boolean): void; /** * Verifies that there are no outstanding requests that need to be flushed. diff --git a/angular/angular-component-router.d.ts b/angular/angular-component-router.d.ts index 99ae821c72..92458331d6 100644 --- a/angular/angular-component-router.d.ts +++ b/angular/angular-component-router.d.ts @@ -1,9 +1,9 @@ +/* tslint:disable:dt-header variable-name */ // Type definitions for Angular JS 1.5 component router // Project: http://angularjs.org // Definitions by: David Reher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace angular { /** * `Instruction` is a tree of {@link ComponentInstruction}s with all the information needed @@ -263,7 +263,7 @@ declare namespace angular { /** * Subscribe to URL updates from the router */ - subscribe(onNext: (value: any) => void): Object; + subscribe(onNext: (value: any) => void): {}; /** * Removes the contents of this router's outlet and all descendant outlets diff --git a/angular/angular-tests.ts b/angular/angular-tests.ts index c6ee7c7a00..cca4dfc420 100644 --- a/angular/angular-tests.ts +++ b/angular/angular-tests.ts @@ -1,4 +1,3 @@ - // issue: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/369 // https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js /** @@ -7,12 +6,14 @@ * License: MIT */ +/* tslint:disable:no-empty no-shadowed-variable */ + class AuthService { /** * Holds all the requests which failed due to 401 response, * so they can be re-requested in future, once login is completed. */ - buffer: { config: ng.IRequestConfig; deferred: ng.IDeferred; }[] = []; + buffer: Array<{ config: ng.IRequestConfig; deferred: ng.IDeferred; }> = []; /** * Required by HTTP interceptor. @@ -20,34 +21,35 @@ class AuthService { */ pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred) { this.buffer.push({ - config: config, - deferred: deferred + config, + deferred }); - } + }; $get = [ - '$rootScope', '$injector', function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) { - var $http: ng.IHttpService; //initialized later because of circular dependency problem + '$rootScope', '$injector', function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) { + let $http: ng.IHttpService; //initialized later because of circular dependency problem function retry(config: ng.IRequestConfig, deferred: ng.IDeferred) { $http = $http || $injector.get('$http'); - $http(config).then(function (response) { + $http(config).then(function(response) { deferred.resolve(response); }); } function retryAll() { - for (var i = 0; i < this.buffer.length; ++i) { - retry(this.buffer[i].config, this.buffer[i].deferred); + for (const request of this.buffer) { + retry(request.config, request.deferred); } + this.buffer = []; } return { - loginConfirmed: function () { + loginConfirmed() { $rootScope.$broadcast('event:auth-loginConfirmed'); retryAll(); } - } - } + }; + } as any ]; } @@ -59,20 +61,20 @@ angular.module('http-auth-interceptor', []) * $http interceptor. * On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'. */ - .config(['$httpProvider', 'authServiceProvider', function ($httpProvider: ng.IHttpProvider, authServiceProvider: any) { + .config(['$httpProvider', 'authServiceProvider', function($httpProvider: ng.IHttpProvider, authServiceProvider: any) { - $httpProvider.defaults.headers.common = {'Authorization': 'Bearer token'}; + $httpProvider.defaults.headers.common = {Authorization: 'Bearer token'}; $httpProvider.defaults.headers.get['Authorization'] = 'Bearer token'; - $httpProvider.defaults.headers.post['Authorization'] = function (config:ng.IRequestConfig):string { return 'Bearer token'; } + $httpProvider.defaults.headers.post['Authorization'] = function(config: ng.IRequestConfig): string { return 'Bearer token'; }; - var interceptor = ['$rootScope', '$q', function ($rootScope: ng.IScope, $q: ng.IQService) { + const interceptor = ['$rootScope', '$q', function($rootScope: ng.IScope, $q: ng.IQService) { function success(response: ng.IHttpPromiseCallbackArg) { return response; } function error(response: ng.IHttpPromiseCallbackArg) { if (response.status === 401) { - var deferred = $q.defer(); + const deferred = $q.defer(); authServiceProvider.pushToBuffer(response.config, deferred); $rootScope.$broadcast('event:auth-loginRequired'); return deferred.promise; @@ -81,14 +83,13 @@ angular.module('http-auth-interceptor', []) return $q.reject(response); } - return function (promise: ng.IHttpPromise) { + return function(promise: ng.IHttpPromise) { return promise.then(success, error); - } + }; - }]; + } as any]; $httpProvider.interceptors.push(interceptor); - }]); - + } as any]); namespace HttpAndRegularPromiseTests { interface Person { @@ -96,7 +97,7 @@ namespace HttpAndRegularPromiseTests { lastName: string; } - interface ExpectedResponse extends Person { } + type ExpectedResponse = Person; interface SomeControllerScope extends ng.IScope { person: Person; @@ -106,13 +107,13 @@ namespace HttpAndRegularPromiseTests { nothing?: string; } - var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => { - $http.get("http://somewhere/some/resource") + function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) { + $http.get('http://somewhere/some/resource') .success((data: ExpectedResponse) => { $scope.person = data; }); - $http.get("http://somewhere/some/resource") + $http.get('http://somewhere/some/resource') .then((response: ng.IHttpPromiseCallbackArg) => { // typing lost, so something like // var i: number = response.data @@ -120,7 +121,7 @@ namespace HttpAndRegularPromiseTests { $scope.person = response.data; }); - $http.get("http://somewhere/some/resource") + $http.get('http://somewhere/some/resource') .then((response: ng.IHttpPromiseCallbackArg) => { // typing lost, so something like // var i: number = response.data @@ -128,47 +129,48 @@ namespace HttpAndRegularPromiseTests { $scope.person = response.data; }); - var aPromise: ng.IPromise = $q.when({ firstName: "Jack", lastName: "Sparrow" }); + const aPromise: ng.IPromise = $q.when({ firstName: 'Jack', lastName: 'Sparrow' }); aPromise.then((person: Person) => { $scope.person = person; }); - var bPromise: ng.IPromise = $q.when(42); + const bPromise: ng.IPromise = $q.when(42); bPromise.then((answer: number) => { $scope.theAnswer = answer; }); - var cPromise: ng.IPromise = $q.when(["a", "b", "c"]); + const cPromise: ng.IPromise = $q.when(['a', 'b', 'c']); cPromise.then((letters: string[]) => { $scope.letters = letters; }); // When $q.when is passed an IPromise, it returns an IPromise - var dPromise: ng.IPromise = $q.when($q.when("ALBATROSS!")); + const dPromise: ng.IPromise = $q.when($q.when('ALBATROSS!')); dPromise.then((snack: string) => { $scope.snack = snack; }); // $q.when may be called without arguments - var ePromise: ng.IPromise = $q.when(); + const ePromise: ng.IPromise = $q.when(); ePromise.then(() => { - $scope.nothing = "really nothing"; + $scope.nothing = 'really nothing'; }); } - // Test that we can pass around a type-checked success/error Promise Callback - var anotherController: Function = ($scope: SomeControllerScope, $http: - ng.IHttpService, $q: ng.IQService) => { - - var buildFooData: Function = () => 42; - - var doFoo: Function = (callback: ng.IHttpPromiseCallback) => { - $http.get('/foo', buildFooData()) - .success(callback); + // Test that we can pass around a type-checked success/error Promise Callback + function anotherController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) { + function buildFooData(): ng.IRequestShortcutConfig { + return {}; } - doFoo((data: any) => console.log(data)); - } + function doFoo(callback: ng.IHttpPromiseCallback) { + $http + .get('/foo', buildFooData()) + .success(callback); + }; + + doFoo((data: any) => console.log(data)); + }; } // Test for AngularJS Syntax @@ -178,9 +180,9 @@ namespace My.Namespace { } // IModule Registering Test -var mod = angular.module('tests', []); -mod.controller('name', function ($scope: ng.IScope) { }); -mod.controller('name', ['$scope', function ($scope: ng.IScope) { }]); +let mod = angular.module('tests', []); +mod.controller('name', function($scope: ng.IScope) { }); +mod.controller('name', ['$scope', function($scope: ng.IScope) { }]); mod.controller('name', class { // Uncommenting the next line should lead to a type error because this signature isn't compatible // with the signature of the `$onChanges` hook: @@ -188,7 +190,7 @@ mod.controller('name', class { }); mod.controller({ MyCtrl: class{}, - MyCtrl2: function() {}, + MyCtrl2: function() {}, // tslint:disable-line:object-literal-shorthand MyCtrl3: ['$fooService', function($fooService: any) { }] }); mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => { @@ -201,7 +203,7 @@ mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => { scope.$watch(() => foo, () => el.text(foo)); }; }); -mod.directive('myDirectiveB', ['$rootScope', function ($rootScope: ng.IRootScopeService) { +mod.directive('myDirectiveB', ['$rootScope', function($rootScope: ng.IRootScopeService) { return { link(scope, el, attrs) { el.click(e => { @@ -218,38 +220,37 @@ mod.directive({ template: 'my-bar-dir.tpl.html' })] }); -mod.factory('name', function ($scope: ng.IScope) { }) -mod.factory('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.factory('name', function($scope: ng.IScope) { }); +mod.factory('name', ['$scope', function($scope: ng.IScope) { }]); mod.factory({ - name1: function (foo: any) { }, - name2: ['foo', function (foo: any) { }] + name1: function(foo: any) { }, // tslint:disable-line:object-literal-shorthand + name2: ['foo', function(foo: any) { }] }); -mod.filter('name', function ($scope: ng.IScope) { }) -mod.filter('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.filter('name', function($scope: ng.IScope) { }); +mod.filter('name', ['$scope', function($scope: ng.IScope) { }]); mod.filter({ - name1: function (foo: any) { }, - name2: ['foo', function (foo: any) { }] + name1: function(foo: any) { }, // tslint:disable-line:object-literal-shorthand + name2: ['foo', function(foo: any) { }] }); -mod.provider('name', function ($scope: ng.IScope) { return { $get: () => { } } }) +mod.provider('name', function($scope: ng.IScope) { return { $get: () => { } }; }); mod.provider('name', TestProvider); -mod.provider('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.provider('name', ['$scope', function($scope: ng.IScope) { } as any]); mod.provider(My.Namespace); -mod.service('name', function ($scope: ng.IScope) { }) -mod.service('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.service('name', function($scope: ng.IScope) { }); +mod.service('name', ['$scope', function($scope: ng.IScope) { } as any]); mod.service({ MyCtrl: class{}, - MyCtrl2: function() {}, + MyCtrl2: function() {}, // tslint:disable-line:object-literal-shorthand MyCtrl3: ['$fooService', function($fooService: any) { }] }); mod.constant('name', 23); -mod.constant('name', "23"); +mod.constant('name', '23'); mod.constant(My.Namespace); mod.value('name', 23); -mod.value('name', "23"); +mod.value('name', '23'); mod.value(My.Namespace); -mod.decorator('name', function($scope:ng.IScope){ }); -mod.decorator('name', ['$scope', function($scope: ng.IScope){ }]); - +mod.decorator('name', function($scope: ng.IScope) {}); +mod.decorator('name', ['$scope', function($scope: ng.IScope) {} as any]); class TestProvider implements ng.IServiceProvider { constructor(private $scope: ng.IScope) { @@ -261,27 +262,37 @@ class TestProvider implements ng.IServiceProvider { // QProvider tests angular.module('qprovider-test', []) - .config(['$qProvider', function ($qProvider: ng.IQProvider) { + .config(['$qProvider', function($qProvider: ng.IQProvider) { const provider: ng.IQProvider = $qProvider.errorOnUnhandledRejections(false); const currentValue: boolean = $qProvider.errorOnUnhandledRejections(); }]); // Promise signature tests -var foo: ng.IPromise; +let foo: ng.IPromise; foo.then((x) => { // x is inferred to be a number - return "asdf"; + x.toFixed(); + return 'asdf'; }).then((x) => { // x is inferred to be string - x.length; + const len = x.length; return 123; +}, (e) => { + return anyOf2([123], toPromise([123])); // IPromise | T, both are good for the 2nd arg of .then() }).then((x) => { - // x is infered to be a number - x.toFixed(); + // x is infered to be a number or number[] + if (Array.isArray(x)) { + x[0].toFixed(); + } else { + x.toFixed(); + } return; -}).then((x) => { - // x is infered to be void - // Typescript will prevent you to actually use x as a local variable +}).catch(e => { + return foo || 123; // IPromise | T, both are good for .catch() +}).then(x => { + // x is infered to be void | number + x && x.toFixed(); + // Typescript will prevent you to actually use x as a local variable before you check it is not void // Try object: return { a: 123 }; }).then((x) => { @@ -289,7 +300,8 @@ foo.then((x) => { x.a = 123; //Try a promise var y: ng.IPromise; - return y; + var condition: boolean; + return condition ? y : x.a; // IPromise | T, both are good for the 1st arg of .then() }).then((x) => { // x is infered to be a number, which is the resolved value of a promise x.toFixed(); @@ -306,14 +318,22 @@ namespace TestQ { e: number; f: boolean; } + interface TOther { + g: string; + h: number; + } var tResult: TResult; var promiseTResult: angular.IPromise; var tValue: TValue; var promiseTValue: angular.IPromise; + var tOther: TOther; + var promiseTOther: angular.IPromise; var $q: angular.IQService; var promiseAny: angular.IPromise; + const assertPromiseType = (arg: angular.IPromise) => arg; + // $q constructor { let result: angular.IPromise; @@ -336,26 +356,32 @@ namespace TestQ { result = $q.all([promiseAny, promiseAny]); } { - let result: angular.IPromise<{[id: string]: any;}>; + let result: angular.IPromise<{[id: string]: any; }>; result = $q.all({a: promiseAny, b: promiseAny}); } { - let result: angular.IPromise<{a: number; b: string;}>; - result = $q.all<{a: number; b: string;}>({a: promiseAny, b: promiseAny}); + let result: angular.IPromise<{a: number; b: string; }>; + result = $q.all<{a: number; b: string; }>({a: promiseAny, b: promiseAny}); } - // $q.defer { let result: angular.IDeferred; result = $q.defer(); + result.resolve(tResult); + var anyValue: any; + result.reject(anyValue); + result.promise.then(result => { + return $q.resolve(result); + }); } // $q.reject { - let result: angular.IPromise; + let result: angular.IPromise; result = $q.reject(); result = $q.reject(''); + result.catch(() => 5).then(x => x.toFixed()); } // $q.resolve @@ -367,6 +393,8 @@ namespace TestQ { let result: angular.IPromise; result = $q.resolve(tResult); result = $q.resolve(promiseTResult); + result = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); + result = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); } // $q.when @@ -376,6 +404,8 @@ namespace TestQ { } { let result: angular.IPromise; + let resultOther: angular.IPromise; + result = $q.when(tResult); result = $q.when(promiseTResult); @@ -384,24 +414,27 @@ namespace TestQ { result = $q.when(tValue, (result: TValue) => tResult, (any) => any, (any) => any); result = $q.when(promiseTValue, (result: TValue) => tResult); - result = $q.when(promiseTValue, (result: TValue) => tResult, (any) => any); - result = $q.when(promiseTValue, (result: TValue) => tResult, (any) => any, (any) => any); + result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther); + result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any); + result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther); + result = resultOther = $q.when(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any); result = $q.when(tValue, (result: TValue) => promiseTResult); result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any); result = $q.when(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any); result = $q.when(promiseTValue, (result: TValue) => promiseTResult); - result = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => any); - result = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => any, (any) => any); + result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther); + result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any); + result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther); + result = resultOther = $q.when(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any); } } - -var httpFoo: ng.IHttpPromise; +let httpFoo: ng.IHttpPromise; httpFoo.then((x) => { // When returning a promise the generic type must be inferred. - var innerPromise : ng.IPromise; + var innerPromise: ng.IPromise; return innerPromise; }).then((x) => { // must still be number. @@ -409,13 +442,12 @@ httpFoo.then((x) => { }); httpFoo.success((data, status, headers, config) => { - var h = headers("test"); + const h = headers('test'); h.charAt(0); - var hs = headers(); - hs["content-type"].charAt(1); + const hs = headers(); + hs['content-type'].charAt(1); }); - // Deferred signature tests namespace TestDeferred { var any: any; @@ -432,8 +464,8 @@ namespace TestDeferred { // deferred.resolve { let result: void; - result = deferred.resolve(); - result = deferred.resolve(tResult); + result = deferred.resolve() as void; + result = deferred.resolve(tResult) as void; } // deferred.reject @@ -458,7 +490,7 @@ namespace TestDeferred { } namespace TestInjector { - let $injector: angular.auto.IInjectorService; + var $injector: angular.auto.IInjectorService; $injector.strictDi = true; @@ -466,23 +498,28 @@ namespace TestInjector { $injector.annotate(() => {}, true); } - // Promise signature tests namespace TestPromise { - var result: any; var any: any; interface TResult { + kind: 'result'; a: number; b: string; c: boolean; } + interface TOther { + kind: 'other'; d: number; e: string; f: boolean; } + function isTResult(x: TResult | TOther): x is TResult { + return x.kind === 'result'; + } + var tresult: TResult; var tresultPromise: ng.IPromise; var tresultHttpPromise: ng.IHttpPromise; @@ -492,65 +529,101 @@ namespace TestPromise { var totherHttpPromise: ng.IHttpPromise; var promise: angular.IPromise; + var $q: angular.IQService; + + const assertPromiseType = (arg: angular.IPromise) => arg; + const reject = $q.reject(); // promise.then - result = >promise.then((result) => any); - result = >promise.then((result) => any, (any) => any); - result = >promise.then((result) => any, (any) => any, (any) => any); + assertPromiseType(promise.then((result) => any)); + assertPromiseType(promise.then((result) => any, (any) => any)); + assertPromiseType(promise.then((result) => any, (any) => any, (any) => any)); - result = >promise.then((result) => result); - result = >promise.then((result) => result, (any) => any); - result = >promise.then((result) => result, (any) => any, (any) => any); - result = >promise.then((result) => tresultPromise); - result = >promise.then((result) => tresultPromise, (any) => any); - result = >promise.then((result) => tresultPromise, (any) => any, (any) => any); - result = >>promise.then((result) => tresultHttpPromise); - result = >>promise.then((result) => tresultHttpPromise, (any) => any); - result = >>promise.then((result) => tresultHttpPromise, (any) => any, (any) => any); + assertPromiseType(promise.then((result) => reject)); + assertPromiseType(promise.then((result) => reject, (any) => reject)); + assertPromiseType(promise.then((result) => reject, (any) => reject, (any) => any)); - result = >promise.then((result) => tother); - result = >promise.then((result) => tother, (any) => any); - result = >promise.then((result) => tother, (any) => any, (any) => any); - result = >promise.then((result) => totherPromise); - result = >promise.then((result) => totherPromise, (any) => any); - result = >promise.then((result) => totherPromise, (any) => any, (any) => any); - result = >>promise.then((result) => totherHttpPromise); - result = >>promise.then((result) => totherHttpPromise, (any) => any); - result = >>promise.then((result) => totherHttpPromise, (any) => any, (any) => any); + assertPromiseType(promise.then((result) => result)); + assertPromiseType(promise.then((result) => tresult)); + assertPromiseType(promise.then((result) => tresultPromise)); + assertPromiseType(promise.then((result) => result, (any) => any)); + assertPromiseType(promise.then((result) => result, (any) => any, (any) => any)); + assertPromiseType(promise.then((result) => result, (any) => reject, (any) => any)); + + assertPromiseType(promise.then((result) => anyOf2(reject, result))); + assertPromiseType(promise.then((result) => anyOf3(result, tresultPromise, reject))); + assertPromiseType(promise.then( + (result) => anyOf3(reject, result, tresultPromise), + (reason) => anyOf3(reject, tresult, tresultPromise) + )); + + + assertPromiseType>(promise.then((result) => tresultHttpPromise)); + + assertPromiseType(promise.then((result) => result, (any) => tother)); + assertPromiseType(promise.then( + (result) => anyOf3(reject, result, totherPromise), + (reason) => anyOf3(reject, tother, tresultPromise) + )); + + assertPromiseType(promise.then( + (result) => anyOf3(tresultPromise, result, totherPromise) + )); + + assertPromiseType(promise.then((result) => result, (any) => tother, (any) => any)); + assertPromiseType(promise.then((result) => tresultPromise, (any) => totherPromise)); + assertPromiseType(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any)); + assertPromiseType>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise)); + assertPromiseType>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any)); + + assertPromiseType(promise.then((result) => tother)); + assertPromiseType(promise.then((result) => tother, (any) => any)); + assertPromiseType(promise.then((result) => tother, (any) => any, (any) => any)); + assertPromiseType(promise.then((result) => totherPromise)); + assertPromiseType(promise.then((result) => totherPromise, (any) => any)); + assertPromiseType(promise.then((result) => totherPromise, (any) => any, (any) => any)); + assertPromiseType>(promise.then((result) => totherHttpPromise)); + assertPromiseType>(promise.then((result) => totherHttpPromise, (any) => any)); + assertPromiseType>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any)); + + assertPromiseType(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); // promise.catch - result = >promise.catch((err) => any); - result = >promise.catch((err) => tresult); - result = >promise.catch((err) => tresultPromise); - result = >>promise.catch((err) => tresultHttpPromise); - result = >promise.catch((err) => tother); - result = >promise.catch((err) => totherPromise); - result = >>promise.catch((err) => totherHttpPromise); + assertPromiseType(promise.catch((err) => err)); + assertPromiseType(promise.catch((err) => any)); + assertPromiseType(promise.catch((err) => tresult)); + assertPromiseType(promise.catch((err) => anyOf2(tresult, reject))); + assertPromiseType(promise.catch((err) => anyOf3(tresult, tresultPromise, reject))); + assertPromiseType(promise.catch((err) => tresultPromise)); + assertPromiseType>(promise.catch((err) => tresultHttpPromise)); + assertPromiseType(promise.catch((err) => tother)); + assertPromiseType(promise.catch((err) => totherPromise)); + assertPromiseType>(promise.catch((err) => totherHttpPromise)); + + assertPromiseType(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); // promise.finally - result = >promise.finally(() => any); - result = >promise.finally(() => tresult); - result = >promise.finally(() => tother); + assertPromiseType(promise.finally(() => any)); + assertPromiseType(promise.finally(() => tresult)); + assertPromiseType(promise.finally(() => tother)); } - function test_angular_forEach() { - var values: { [key: string]: string } = { name: 'misko', gender: 'male' }; - var log: string[] = []; - angular.forEach(values, function (value, key) { + const values: { [key: string]: string } = { name: 'misko', gender: 'male' }; + const log: string[] = []; + angular.forEach(values, function(value, key) { this.push(key + ': ' + value); }, log); //expect(log).toEqual(['name: misko', 'gender: male']); } // angular.element() tests -var element = angular.element("div.myApp"); -var scope: ng.IScope = element.scope(); -var isolateScope: ng.IScope = element.isolateScope(); +let element = angular.element('div.myApp'); +let scope: ng.IScope = element.scope(); +let isolateScope: ng.IScope = element.isolateScope(); isolateScope = element.find('div.foo').isolateScope(); isolateScope = element.children().isolateScope(); - // $timeout signature tests namespace TestTimeout { interface TResult { @@ -590,25 +663,24 @@ namespace TestTimeout { } } - -function test_IAttributes(attributes: ng.IAttributes){ +function test_IAttributes(attributes: ng.IAttributes) { return attributes; } test_IAttributes({ - $normalize: function (classVal){ return "foo" }, - $addClass: function (classVal){}, - $removeClass: function(classVal){}, - $updateClass: function(newClass, oldClass){}, - $set: function(key, value){}, - $observe: function(name: any, fn: any){ + $normalize(classVal) { return 'foo'; }, + $addClass(classVal) {}, + $removeClass(classVal) {}, + $updateClass(newClass, oldClass) {}, + $set(key, value) {}, + $observe(name: any, fn: any) { return fn; }, $attr: {} }); class SampleDirective implements ng.IDirective { - public restrict = 'A'; + restrict = 'A'; name = 'doh'; compile(templateElement: ng.IAugmentedJQuery) { @@ -617,7 +689,7 @@ class SampleDirective implements ng.IDirective { }; } - static instance():ng.IDirective { + static instance(): ng.IDirective { return new SampleDirective(); } @@ -627,7 +699,7 @@ class SampleDirective implements ng.IDirective { } class SampleDirective2 implements ng.IDirective { - public restrict = 'EAC'; + restrict = 'EAC'; compile(templateElement: ng.IAugmentedJQuery) { return { @@ -635,7 +707,7 @@ class SampleDirective2 implements ng.IDirective { }; } - static instance():ng.IDirective { + static instance(): ng.IDirective { return new SampleDirective2(); } @@ -654,7 +726,7 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo $interpolate('', true)(scope); $interpolate('', true, 'html')(scope); $interpolate('', true, 'html', true)(scope); - var defer = $q.defer(); + const defer = $q.defer(); defer.reject(); defer.resolve(); defer.promise.then(function(d) { @@ -670,7 +742,7 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo .finally((): any => { return null; }); - var promise = new $q((resolve) => { + let promise = new $q((resolve) => { resolve(); }); @@ -785,25 +857,25 @@ angular.module('docsTimeDirective', []) .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) { return { - link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs:ng.IAttributes) { - var format: any, + link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) { + let format: any, timeoutId: any; function updateTime() { element.text(dateFilter(new Date(), format)); } - scope.$watch(attrs['myCurrentTime'], function (value: any) { + scope.$watch(attrs['myCurrentTime'], function(value: any) { format = value; updateTime(); }); - element.on('$destroy', function () { + element.on('$destroy', function() { $interval.cancel(timeoutId); }); // start the UI update process; save the timeoutId for canceling - timeoutId = $interval(function () { + timeoutId = $interval(function() { updateTime(); // update DOM }, 1000); } @@ -832,19 +904,18 @@ angular.module('docsTransclusionExample', []) transclude: true, scope: {}, templateUrl: 'my-dialog.html', - link: function (scope: ng.IScope, element: ng.IAugmentedJQuery) { + link(scope: ng.IScope, element: ng.IAugmentedJQuery) { scope['name'] = 'Jeff'; } }; }); - angular.module('docsIsoFnBindExample', []) .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { $scope.name = 'Tobias'; - $scope.hideDialog = function () { + $scope.hideDialog = function() { $scope.dialogIsHidden = true; - $timeout(function () { + $timeout(function() { $scope.dialogIsHidden = false; }, 2000); }; @@ -854,7 +925,7 @@ angular.module('docsIsoFnBindExample', []) restrict: 'E', transclude: true, scope: { - 'close': '&onClose' + close: '&onClose' }, templateUrl: 'my-dialog-close.html' }; @@ -863,7 +934,7 @@ angular.module('docsIsoFnBindExample', []) angular.module('dragModule', []) .directive('myDraggable', ['$document', function($document: any) { return function(scope: any, element: any, attr: any) { - var startX = 0, startY = 0, x = 0, y = 0; + let startX = 0, startY = 0, x = 0, y = 0; element.css({ position: 'relative', @@ -903,8 +974,8 @@ angular.module('docsTabsExample', []) restrict: 'E', transclude: true, scope: {}, - controller: function($scope: ng.IScope) { - var panes: any = $scope['panes'] = []; + controller($scope: ng.IScope) { + const panes: any = $scope['panes'] = []; $scope['select'] = function(pane: any) { angular.forEach(panes, function(pane: any) { @@ -931,7 +1002,7 @@ angular.module('docsTabsExample', []) scope: { title: '@' }, - link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) { + link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) { tabsCtrl.addPane(scope); }, templateUrl: 'my-pane.html' @@ -945,7 +1016,7 @@ angular.module('multiSlotTranscludeExample', []) button: 'button', list: 'ul', }, - link: function(scope, element, attrs, ctrl, transclude) { + link(scope, element, attrs, ctrl, transclude) { // without scope transclude().appendTo(element); transclude(clone => clone.appendTo(element)); @@ -960,52 +1031,52 @@ angular.module('multiSlotTranscludeExample', []) angular.module('componentExample', []) .component('counter', { - require: {'ctrl': '^ctrl'}, + require: {ctrl: '^ctrl'}, bindings: { count: '=' }, controller: 'CounterCtrl', controllerAs: 'counterCtrl', - template: function () { + template() { return ''; }, transclude: { - 'el': 'target' + el: 'target' } }) .component('anotherCounter', { - controller: function(){}, + controller() {}, require: { - 'parent': '^parentCtrl' + parent: '^parentCtrl' }, template: '', transclude: true }); -interface copyExampleUser { +interface ICopyExampleUser { name?: string; email?: string; gender?: string; } -interface copyExampleScope { +interface ICopyExampleScope { - user: copyExampleUser; - master: copyExampleUser; - update: (copyExampleUser: copyExampleUser) => any; + user: ICopyExampleUser; + master: ICopyExampleUser; + update: (copyExampleUser: ICopyExampleUser) => any; reset: () => any; } angular.module('copyExample', []) - .controller('ExampleController', ['$scope', function ($scope: copyExampleScope) { + .controller('ExampleController', ['$scope', function($scope: ICopyExampleScope) { $scope.master = { }; - $scope.update = function (user) { + $scope.update = function(user) { // Example with 1 argument $scope.master = angular.copy(user); }; - $scope.reset = function () { + $scope.reset = function() { // Example with 2 arguments angular.copy($scope.master, $scope.user); }; @@ -1022,9 +1093,14 @@ namespace locationTests { */ // given url http://example.com/#/some/path?foo=bar&baz=xoxo - var searchObject = $location.search(); + const searchObject = $location.search(); // => {foo: 'bar', baz: 'xoxo'} + function assert(condition: boolean) { + if (!condition) { + throw new Error(); + } + } // set foo to 'yipee' $location.search('foo', 'yipee'); @@ -1041,29 +1117,29 @@ namespace locationTests { // in browser with HTML5 history support: // open http://example.com/#!/a -> rewrite to http://example.com/a // (replacing the http://example.com/#!/a history record) - $location.path() == '/a' + assert($location.path() === '/a'); $location.path('/foo'); - $location.absUrl() == 'http://example.com/foo' + assert($location.absUrl() === 'http://example.com/foo'); - $location.search() == {} + assert($location.search() === {}); $location.search({ a: 'b', c: true }); - $location.absUrl() == 'http://example.com/foo?a=b&c' + assert($location.absUrl() === 'http://example.com/foo?a=b&c'); $location.path('/new').search('x=y'); - $location.url() == 'new?x=y' - $location.absUrl() == 'http://example.com/new?x=y' + assert($location.url() === 'new?x=y'); + assert($location.absUrl() === 'http://example.com/new?x=y'); // in browser without html5 history support: // open http://example.com/new?x=y -> redirect to http://example.com/#!/new?x=y // (again replacing the http://example.com/new?x=y history item) - $location.path() == '/new' - $location.search() == { x: 'y' } + assert($location.path() === '/new'); + assert($location.search() === { x: 'y' }); $location.path('/foo/bar'); - $location.path() == '/foo/bar' - $location.url() == '/foo/bar?x=y' - $location.absUrl() == 'http://example.com/#!/foo/bar?x=y' + assert($location.path() === '/foo/bar'); + assert($location.url() === '/foo/bar?x=y'); + assert($location.absUrl() === 'http://example.com/#!/foo/bar?x=y'); } // NgModelController @@ -1074,7 +1150,7 @@ function NgModelControllerTyping() { // See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators ngModel.$validators['validCharacters'] = function(modelValue, viewValue) { - var value = modelValue || viewValue; + const value = modelValue || viewValue; return /[0-9]+/.test(value) && /[a-z]+/.test(value) && /[A-Z]+/.test(value) && @@ -1082,7 +1158,7 @@ function NgModelControllerTyping() { }; ngModel.$asyncValidators['uniqueUsername'] = function(modelValue, viewValue) { - var value = modelValue || viewValue; + const value = modelValue || viewValue; return $http.get('/api/users/' + value). then(function resolved() { return $q.reject('exists'); @@ -1092,67 +1168,67 @@ function NgModelControllerTyping() { }; } -var $filter: angular.IFilterService; +let $filter: angular.IFilterService; function testFilter() { var items: string[]; - $filter("filter")(items, "test"); - $filter("filter")(items, {name: "test"}); - $filter("filter")(items, (val, index, array) => { + $filter('filter')(items, 'test'); + $filter('filter')(items, {name: 'test'}); + $filter('filter')(items, (val, index, array) => { return true; }); - $filter("filter")(items, (val, index, array) => { + $filter('filter')(items, (val, index, array) => { return true; }, (actual, expected) => { - return actual == expected; + return actual === expected; }); } function testCurrency() { - $filter("currency")(126); - $filter("currency")(126, "$", 2); + $filter('currency')(126); + $filter('currency')(126, '$', 2); } function testNumber() { - $filter("number")(167); - $filter("number")(167, 2); + $filter('number')(167); + $filter('number')(167, 2); } function testDate() { - $filter("date")(new Date()); - $filter("date")(new Date(), 'yyyyMMdd'); - $filter("date")(new Date(), 'yyyyMMdd', '+0430'); + $filter('date')(new Date()); + $filter('date')(new Date(), 'yyyyMMdd'); + $filter('date')(new Date(), 'yyyyMMdd', '+0430'); } function testJson() { - var json: string = $filter("json")({test:true}, 2); + const json: string = $filter('json')({test: true}, 2); } function testLowercase() { - var lower: string = $filter("lowercase")('test'); + const lower: string = $filter('lowercase')('test'); } function testUppercase() { - var lower: string = $filter("uppercase")('test'); + const lower: string = $filter('uppercase')('test'); } function testLimitTo() { - var limitTo = $filter("limitTo"); - var filtered: number[] = $filter("limitTo")([1,2,3], 5); - filtered = $filter("limitTo")([1,2,3], 5, 2); + const limitTo = $filter('limitTo'); + let filtered: number[] = $filter('limitTo')([1, 2, 3], 5); + filtered = $filter('limitTo')([1, 2, 3], 5, 2); - var filteredString: string = $filter("limitTo")("124", 4); - filteredString = $filter("limitTo")(124, 4); + let filteredString: string = $filter('limitTo')('124', 4); + filteredString = $filter('limitTo')(124, 4); } function testOrderBy() { - var filtered: number[] = $filter("orderBy")([1,2,3], "test"); - filtered = $filter("orderBy")([1,2,3], "test", true); - filtered = $filter("orderBy")([1,2,3], ['prop1', 'prop2']); - filtered = $filter("orderBy")([1,2,3], (val: number) => 1); - var filtered2: string[] = $filter("orderBy")(["1","2","3"], (val: string) => 1); - filtered2 = $filter("orderBy")(["1","2","3"], [ + let filtered: number[] = $filter('orderBy')([1, 2, 3], 'test'); + filtered = $filter('orderBy')([1, 2, 3], 'test', true); + filtered = $filter('orderBy')([1, 2, 3], ['prop1', 'prop2']); + filtered = $filter('orderBy')([1, 2, 3], (val: number) => 1); + let filtered2: string[] = $filter('orderBy')(['1', '2', '3'], (val: string) => 1); + filtered2 = $filter('orderBy')(['1', '2', '3'], [ (val: string) => 1, (val: string) => 2 ]); @@ -1160,28 +1236,26 @@ function testOrderBy() { function testDynamicFilter() { // Test with separate variables - var dateFilter = $filter("date"); - var myDate = new Date(); - dateFilter(myDate , "EEE, MMM d"); + const dateFilter = $filter('date'); + const myDate = new Date(); + dateFilter(myDate , 'EEE, MMM d'); // Test with dynamic name - var filterName = 'date'; - var dynDateFilter = $filter(filterName); + const filterName = 'date'; + const dynDateFilter = $filter(filterName); dynDateFilter(new Date()); } -interface MyCustomFilter { - (value: string): string; -} +type MyCustomFilter = (value: string) => string; function testCustomFilter() { - var filterCustom = $filter('custom'); - var filtered: string = filterCustom("test"); + const filterCustom = $filter('custom'); + const filtered: string = filterCustom('test'); } function parseTyping() { var $parse: angular.IParseService; - var compiledExp = $parse('a.b.c'); + const compiledExp = $parse('a.b.c'); if (compiledExp.constant) { return compiledExp({}); } else if (compiledExp.literal) { @@ -1191,8 +1265,8 @@ function parseTyping() { function parseWithParams() { var $parse: angular.IParseService; - var compiledExp = $parse('a.b.c', () => null); - var compiledExp = $parse('a.b.c', null, false); + const compiledExp1 = $parse('a.b.c', () => null); + const compiledExp2 = $parse('a.b.c', null, false); } function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService { @@ -1211,8 +1285,22 @@ function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjector } function testIHttpParamSerializerJQLikeProvider() { - let serializer: angular.IHttpParamSerializer; + var serializer: angular.IHttpParamSerializer; serializer({ - a: "b" + a: 'b' }); } + +function anyOf2(v1: T1, v2: T2) { + return Math.random() < 1/2 ? v1 : v2; +} + +function anyOf3(v1: T1, v2: T2, v3: T3) { + const rnd = Math.random(); + return rnd < 1/3 ? v1 : rnd < 2/3 ? v2 : v3; +} + +function toPromise(val: T): ng.IPromise { + var p: ng.IPromise; + return p; +} diff --git a/angular/index.d.ts b/angular/index.d.ts index f3f9fc87a6..099ac2fc27 100644 --- a/angular/index.d.ts +++ b/angular/index.d.ts @@ -27,7 +27,7 @@ import ng = angular; /////////////////////////////////////////////////////////////////////////////// declare namespace angular { - type Injectable = T | (string | T)[]; + type Injectable = T | Array; // not directly implemented, but ensures that constructed class implements $get interface IServiceProviderClass { @@ -64,7 +64,7 @@ declare namespace angular { * @param config an object for defining configuration options for the application. The following keys are supported: * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. */ - bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService; + bootstrap(element: string|Element|JQuery|Document, modules?: Array, config?: IAngularBootstrapConfig): auto.IInjectorService; /** * Creates a deep copy of source, which should be an object or an array. @@ -122,7 +122,7 @@ declare namespace angular { fromJson(json: string): any; identity(arg?: T): T; injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; - isArray(value: any): value is Array; + isArray(value: any): value is any[]; isDate(value: any): value is Date; isDefined(value: any): boolean; isElement(value: any): boolean; @@ -514,7 +514,7 @@ declare namespace angular { $watchCollection(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; - $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; + $watchGroup(watchExpressions: Array<{ (scope: IScope): any }>, listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; $parent: IScope; $root: IRootScopeService; @@ -662,9 +662,9 @@ declare namespace angular { } interface IFilterOrderByItem { - value: any, - type: string, - index: any + value: any; + type: string; + index: any; } interface IFilterOrderByComparatorFunc { @@ -756,7 +756,7 @@ declare namespace angular { * @param comparator Function used to determine the relative order of value pairs. * @return An array containing the items from the specified collection, ordered by a comparator function based on the values computed using the expression predicate. */ - (array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean, comparator?: IFilterOrderByComparatorFunc): T[]; + (array: T[], expression: string|((value: T) => any)|Array<((value: T) => any)|string>, reverse?: boolean, comparator?: IFilterOrderByComparatorFunc): T[]; } /** @@ -1023,7 +1023,7 @@ declare namespace angular { all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise ]): IPromise<[T1, T2, T3, T4]>; all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise]): IPromise<[T1, T2, T3]>; all(values: [T1 | IPromise, T2 | IPromise]): IPromise<[T1, T2]>; - all(promises: IPromise[]): IPromise; + all(promises: Array>): IPromise; /** * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. * @@ -1044,13 +1044,14 @@ declare namespace angular { * * @param reason Constant, message, exception or an object representing the rejection reason. */ - reject(reason?: any): IPromise; + reject(reason?: any): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. * * @param value Value or a promise */ resolve(value: IPromise|T): IPromise; + resolve(value: IPromise|T2): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. */ @@ -1061,7 +1062,10 @@ declare namespace angular { * @param value Value or a promise */ when(value: IPromise|T): IPromise; - when(value: IPromise|T, successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + when(value: IPromise|T2): IPromise; + when(value: IPromise|T, successCallback: (promiseValue: T) => IPromise|TResult): IPromise; + when(value: T, successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: null | undefined | ((reason: any) => any), notifyCallback?: (state: any) => any): IPromise; + when(value: IPromise, successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: (reason: any) => TResult2 | IPromise, notifyCallback?: (state: any) => any): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. */ @@ -1090,15 +1094,20 @@ declare namespace angular { interface IPromise { /** * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * The successCallBack may return IPromise for when a $q.reject() needs to be returned + * The successCallBack may return IPromise for when a $q.reject() needs to be returned * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. */ - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise; + + then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: (reason: any) => IPromise|TCatch, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback: (reason: any) => IPromise|TCatch2, notifyCallback?: (state: any) => any): IPromise; /** * Shorthand for promise.then(null, errorCallback) */ - catch(onRejected: (reason: any) => IPromise|TResult): IPromise; + catch(onRejected: (reason: any) => IPromise|TCatch): IPromise; + catch(onRejected: (reason: any) => IPromise|TCatch2): IPromise; /** * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. @@ -1245,6 +1254,16 @@ declare namespace angular { debugInfoEnabled(): boolean; debugInfoEnabled(enabled: boolean): ICompileProvider; + /** + * Call this method to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. + * If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. + * If disabled (false), the compiler calls the constructor first before assigning bindings. + * Defaults to false. + * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#preAssignBindingsEnabled + */ + preAssignBindingsEnabled(): boolean; + preAssignBindingsEnabled(enabled: boolean): ICompileProvider; + /** * Sets the number of times $onChanges hooks can trigger new changes before giving up and assuming that the model is unstable. * Increasing the TTL could have performance implications, so you should not change it without proper justification. @@ -1284,11 +1303,11 @@ declare namespace angular { } interface ITemplateLinkingFunctionOptions { - parentBoundTranscludeFn?: ITranscludeFunction, + parentBoundTranscludeFn?: ITranscludeFunction; transcludeControllers?: { [controller: string]: { instance: IController } - }, - futureParentElement?: JQuery + }; + futureParentElement?: JQuery; } /** @@ -1510,7 +1529,9 @@ declare namespace angular { (data: any, headersGetter: IHttpHeadersGetter, status: number): any; } - type HttpHeaderType = {[requestType: string]:string|((config:IRequestConfig) => string)}; + interface HttpHeaderType { + [requestType: string]: string|((config: IRequestConfig) => string); + } interface IHttpRequestConfigHeaders { [requestType: string]: any; @@ -1593,7 +1614,7 @@ declare namespace angular { * Register service factories (names or implementations) for interceptors which are called before and after * each request. */ - interceptors: (string | Injectable)[]; + interceptors: Array>; useApplyAsync(): boolean; useApplyAsync(value: boolean): IHttpProvider; @@ -1603,7 +1624,7 @@ declare namespace angular { * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. * otherwise, returns the current configured value. */ - useLegacyPromiseExtensions(value:boolean) : boolean | IHttpProvider; + useLegacyPromiseExtensions(value: boolean): boolean | IHttpProvider; } /////////////////////////////////////////////////////////////////////////// @@ -1687,16 +1708,15 @@ declare namespace angular { valueOf(value: any): any; } - /////////////////////////////////////////////////////////////////////////// // SCEDelegateProvider // see http://docs.angularjs.org/api/ng.$sceDelegateProvider /////////////////////////////////////////////////////////////////////////// interface ISCEDelegateProvider extends IServiceProvider { - resourceUrlBlacklist(blacklist: any[]): void; - resourceUrlWhitelist(whitelist: any[]): void; resourceUrlBlacklist(): any[]; + resourceUrlBlacklist(blacklist: any[]): void; resourceUrlWhitelist(): any[]; + resourceUrlWhitelist(whitelist: any[]): void; } /** @@ -1936,33 +1956,33 @@ declare namespace angular { annotate(fn: Function, strictDi?: boolean): string[]; annotate(inlineAnnotatedFunction: any[]): string[]; get(name: string, caller?: string): T; - get(name: '$anchorScroll'): IAnchorScrollService - get(name: '$cacheFactory'): ICacheFactoryService - get(name: '$compile'): ICompileService - get(name: '$controller'): IControllerService - get(name: '$document'): IDocumentService - get(name: '$exceptionHandler'): IExceptionHandlerService - get(name: '$filter'): IFilterService - get(name: '$http'): IHttpService - get(name: '$httpBackend'): IHttpBackendService - get(name: '$httpParamSerializer'): IHttpParamSerializer - get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer - get(name: '$interpolate'): IInterpolateService - get(name: '$interval'): IIntervalService - get(name: '$locale'): ILocaleService - get(name: '$location'): ILocationService - get(name: '$log'): ILogService - get(name: '$parse'): IParseService - get(name: '$q'): IQService - get(name: '$rootElement'): IRootElementService - get(name: '$rootScope'): IRootScopeService - get(name: '$sce'): ISCEService - get(name: '$sceDelegate'): ISCEDelegateService - get(name: '$templateCache'): ITemplateCacheService - get(name: '$templateRequest'): ITemplateRequestService - get(name: '$timeout'): ITimeoutService - get(name: '$window'): IWindowService - get(name: '$xhrFactory'): IXhrFactory + get(name: '$anchorScroll'): IAnchorScrollService; + get(name: '$cacheFactory'): ICacheFactoryService; + get(name: '$compile'): ICompileService; + get(name: '$controller'): IControllerService; + get(name: '$document'): IDocumentService; + get(name: '$exceptionHandler'): IExceptionHandlerService; + get(name: '$filter'): IFilterService; + get(name: '$http'): IHttpService; + get(name: '$httpBackend'): IHttpBackendService; + get(name: '$httpParamSerializer'): IHttpParamSerializer; + get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer; + get(name: '$interpolate'): IInterpolateService; + get(name: '$interval'): IIntervalService; + get(name: '$locale'): ILocaleService; + get(name: '$location'): ILocationService; + get(name: '$log'): ILogService; + get(name: '$parse'): IParseService; + get(name: '$q'): IQService; + get(name: '$rootElement'): IRootElementService; + get(name: '$rootScope'): IRootScopeService; + get(name: '$sce'): ISCEService; + get(name: '$sceDelegate'): ISCEDelegateService; + get(name: '$templateCache'): ITemplateCacheService; + get(name: '$templateRequest'): ITemplateRequestService; + get(name: '$timeout'): ITimeoutService; + get(name: '$window'): IWindowService; + get(name: '$xhrFactory'): IXhrFactory; has(name: string): boolean; instantiate(typeConstructor: Function, locals?: any): T; invoke(inlineAnnotatedFunction: any[]): any; diff --git a/angular/tslint.json b/angular/tslint.json new file mode 100644 index 0000000000..75f86620b4 --- /dev/null +++ b/angular/tslint.json @@ -0,0 +1,20 @@ +{ + "extends": "../tslint.json", + "rules": { + "class-name": true, + "curly": true, + "no-consecutive-blank-lines": true, + "no-shadowed-variable": true, + "quotemark": [true, "single"], + "align": true, + "callable-types": false, + "forbidden-types": false, + "indent": [true, "spaces"], + "interface-name": false, + "linebreak-style": [true, "LF"], + "no-empty-interface": false, + "unified-signatures": false, + "variable-name": [true, "check-format"], + "void-return": false + } +} diff --git a/archiver/index.d.ts b/archiver/index.d.ts index ea117239ac..665624143e 100644 --- a/archiver/index.d.ts +++ b/archiver/index.d.ts @@ -31,7 +31,6 @@ declare namespace archiver { } export interface Archiver extends STREAM.Transform { - pipe(writeStream: FS.WriteStream): void; append(source: STREAM.Readable | Buffer | string, name: nameInterface): void; directory(dirpath: string, destpath: nameInterface | string): void; diff --git a/auth0-js/auth0-js-tests.ts b/auth0-js/auth0-js-tests.ts index 197256ddd5..68d4e1797b 100644 --- a/auth0-js/auth0-js-tests.ts +++ b/auth0-js/auth0-js-tests.ts @@ -1,23 +1,151 @@ /// -var auth0 = new Auth0({ +let webAuth = new auth0.WebAuth({ domain: 'mine.auth0.com', - clientID: 'dsa7d77dsa7d7', - callbackURL: 'http://my-app.com/callback', - callbackOnLocationHash: true + clientID: 'dsa7d77dsa7d7' }); -auth0.login({ - connection: 'google-oauth2', - popup: true, - popupOptions: { - width: 450, - height: 800 +webAuth.authorize({ + audience: 'https://mystore.com/api/v2', + scope: 'read:order write:order', + responseType: 'token', + redirectUri: 'https://example.com/auth/callback' +}); + +webAuth.parseHash(window.location.hash, (err, authResult) => { + if (err) { + return console.log(err); } -}, (err, profile, idToken, accessToken, state) => { - if (err) { - alert("something went wrong: " + err.message); - return; - } - alert('hello ' + profile.name); + + // The contents of authResult depend on which authentication parameters were used. + // It can include the following: + // authResult.accessToken - access token for the API specified by `audience` + // authResult.expiresIn - string with the access token's expiration time in seconds + // authResult.idToken - ID token JWT containing user profile information + + webAuth.client.userInfo(authResult.accessToken, (err, user) => { + // Now you have the user's information }); +}); + +webAuth.renewAuth({ + audience: 'https://mystore.com/api/v2', + scope: 'read:order write:order', + redirectUri: 'https://example.com/auth/silent-callback', + + // this will use postMessage to comunicate between the silent callback + // and the SPA. When false the SDK will attempt to parse the url hash + // should ignore the url hash and no extra behaviour is needed. + usePostMessage: true +}, function (err, authResult) { + // Renewed tokens or error +}); + +webAuth.changePassword({connection: 'the_connection', + email: 'me@example.com', + password: '123456' +}, (err) => {}); + +webAuth.passwordlessStart({ + connection: 'the_connection', + email: 'me@example.com', + send: 'code' +}, (err, data) => {}); + +webAuth.signupAndAuthorize({ + connection: 'the_connection', + email: 'me@example.com', + password: '123456', + scope: 'openid' +}, function (err, data) { + +}); + + + +webAuth.client.login({ + ealm: 'Username-Password-Authentication', //connection name or HRD domain + username: 'info@auth0.com', + password: 'areallystrongpassword', + audience: 'https://mystore.com/api/v2', + scope: 'read:order write:order', +}, function(err, authResult) { + // Auth tokens in the result or an error +}); + +let authentication = new auth0.Authentication({ + domain: 'me.auth0.com', + clientID: '...', + redirectUri: 'http://page.com/callback', + responseType: 'code', + _sendTelemetry: false +}); + +authentication.buildAuthorizeUrl({state:'1234'}); +authentication.buildAuthorizeUrl({ + responseType: 'token', + redirectUri: 'http://anotherpage.com/callback2', + prompt: 'none', + state: '1234', + connection_scope: 'scope1,scope2' +}); + +authentication.buildLogoutUrl('asdfasdfds'); +authentication.buildLogoutUrl(); +authentication.userInfo('abcd1234', (err, data) => { + //user info retrieved +}); + +authentication.delegation({ + grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', + refresh_token: 'your_refresh_token', + api_type: 'app' +}, (err, data) => { + +}); + +authentication.loginWithDefaultDirectory({ + username: 'someUsername', + password: '123456' +}, (err, data) => { + +}); + +authentication.oauthToken({ + username: 'someUsername', + password: '123456', + grantType: 'password' +}, (err, data) => { + +}); + +authentication.getUserCountry((err, data) => { + +}); + +authentication.getSSOData(); +authentication.getSSOData(true, (err, data) => {}); + +authentication.dbConnection.signup({connection: 'bla', email: 'blabla', password: '123456'}, () => {}); +authentication.dbConnection.changePassword({connection: 'bla', email: 'blabla', password: '123456'}, () => {}); + +authentication.passwordless.start({ connection: 'bla', send: 'blabla' }, () => {}); +authentication.passwordless.verify({ connection: 'bla', send: 'link', verificationCode: 'asdfasd', email: 'me@example.com' }, () => {}); + +authentication.loginWithResourceOwner({ + username: 'the username', + password: 'the password', + connection: 'the_connection', + scope: 'openid' +}, (err, data) => {}); + +let management = new auth0.Management({ + domain: 'me.auth0.com', + token: 'token' +}); + +management.getUser('asd', (err, user) => {}); + +management.patchUserMetadata('asd', {role: 'admin'}, (err, user) => {}); + +management.linkUser('asd', 'eqwe', (err, user) => {}); diff --git a/auth0-js/index.d.ts b/auth0-js/index.d.ts index bd97fed1cc..0a0e004303 100644 --- a/auth0-js/index.d.ts +++ b/auth0-js/index.d.ts @@ -1,136 +1,456 @@ -// Type definitions for Auth0.js +// Type definitions for Auth0.js v8.1.3 // Project: https://github.com/auth0/auth0.js -// Definitions by: Robert McLaws +// Definitions by: Adrian Chia // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** Extensions to the browser Window object. */ -interface Window { - /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */ - token: string; -} - -/** This is the interface for the main Auth0 client. */ -interface Auth0Static { - - new(options: Auth0ClientOptions): Auth0Static; - changePassword(options: any, callback?: Function): void; - decodeJwt(jwt: string): any; - login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; - loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; - loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void; - loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; - logout(query: string): void; - getConnections(callback?: Function): void; - refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; - getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; - getProfile(id_token: string, callback?: Function): Auth0UserProfile; - getSSOData(withActiveDirectories: any, callback?: Function): void; - parseHash(hash: string): Auth0DecodedHash; - signup(options: Auth0SignupOptions, callback: Function): void; - validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void; -} - -/** Represents constructor options for the Auth0 client. */ -interface Auth0ClientOptions { - clientID: string; - callbackURL: string; - callbackOnLocationHash?: boolean; - responseType?: string; - domain: string; - forceJSONP?: boolean; -} - -/** Represents a normalized UserProfile. */ -interface Auth0UserProfile { - email: string; - email_verified: boolean; - family_name: string; - gender: string; - given_name: string; - locale: string; - name: string; - nickname: string; - picture: string; - user_id: string; - /** Represents one or more Identities that may be associated with the User. */ - identities: Auth0Identity[]; - user_metadata?: any; - app_metadata?: any; -} - -/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */ -interface MicrosoftUserProfile extends Auth0UserProfile { - emails: string[]; -} - -/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */ -interface Office365UserProfile extends Auth0UserProfile { - tenantid: string; - upn: string; -} - -/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */ -interface AdfsUserProfile extends Auth0UserProfile { - issuer: string; -} - -/** Represents multiple identities assigned to a user. */ -interface Auth0Identity { - access_token: string; - connection: string; - isSocial: boolean; - provider: string; - user_id: string; -} - -interface Auth0DecodedHash { - access_token: string; - idToken: string; - profile: Auth0UserProfile; - state: any; - error: string; -} - -interface Auth0PopupOptions { - width: number; - height: number; -} - -interface Auth0LoginOptions { - auto_login?: boolean; - responseType?: string; - connection?: string; - email?: string; - username?: string; - password?: string; - popup?: boolean; - popupOptions?: Auth0PopupOptions; -} - -interface Auth0SignupOptions extends Auth0LoginOptions { - auto_login: boolean; -} - -interface Auth0Error { - code: any; - details: any; - name: string; - message: string; - status: any; -} - -/** Represents the response from an API Token Delegation request. */ -interface Auth0DelegationToken { - /** The length of time in seconds the token is valid for. */ - expires_in: string; - /** The JWT for delegated access. */ - id_token: string; - /** The type of token being returned. Possible values: "Bearer" */ - token_type: string; -} - -declare const Auth0: Auth0Static; - -declare module "auth0-js" { - export = Auth0 +declare namespace auth0 { + + export class Authentication { + constructor(options: AuthOptions); + + passwordless: PasswordlessAuthentication; + dbConnection: DBConnection; + + /** + * Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction + * + * @method buildAuthorizeUrl + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db + */ + buildAuthorizeUrl(options: any): string; + + /** + * Builds and returns the Logout url in order to initialize a new authN/authZ transaction + * + * @method buildLogoutUrl + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout + */ + buildLogoutUrl(options?: any): string; + + /** + * Makes a call to the `oauth/token` endpoint with `password` grant type + * + * @method loginWithDefaultDirectory + * @param {Object} options: https://auth0.com/docs/api-auth/grant/password + * @param {Function} callback + */ + loginWithDefaultDirectory(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Makes a call to the `/ro` endpoint + * @param {any} options + * @param {Function} callback + * @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead. + */ + loginWithResourceOwner(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Makes a call to the `oauth/token` endpoint with `password-realm` grant type + * @param {any} options + * @param {Function} callback + */ + login(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Makes a call to the `oauth/token` endpoint + * @param {any} options + * @param {Function} callback + */ + oauthToken(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Makes a call to the `/ssodata` endpoint + * + * @method getSSOData + * @param {Boolean} withActiveDirectories + * @param {Function} callback + * @deprecated `getSSOData` will be soon deprecated. + */ + getSSOData(callback?: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Makes a call to the `/ssodata` endpoint + * + * @method getSSOData + * @param {Boolean} withActiveDirectories + * @param {Function} callback + * @deprecated `getSSOData` will be soon deprecated. + */ + getSSOData(withActiveDirectories: boolean, callback?: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Makes a call to the `/userinfo` endpoint and returns the user profile + * + * @method userInfo + * @param {String} accessToken + * @param {Function} callback + */ + userInfo(token: string, callback: (error?: Auth0Error, user?: any) => any): void; + + /** + * Makes a call to the `/delegation` endpoint + * + * @method delegation + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation + * @param {Function} callback + * @deprecated `delegation` will be soon deprecated. + */ + delegation(options: any, callback: (error?: Auth0Error, authResult?: Auth0DelegationToken) => any): any; + + /** + * Fetches the user country based on the ip. + * + * @method getUserCountry + * @param {Function} callback + */ + getUserCountry(callback: (error?: Auth0Error, result?: any) => any): void; + } + + export class PasswordlessAuthentication { + constructor(request: any, option: any); + + /** + * Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction + * + * @method buildVerifyUrl + * @param {Object} options + * @param {Function} callback + */ + buildVerifyUrl(options: any): string; + + /** + * Initializes a new passwordless authN/authZ transaction + * + * @method start + * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless + * @param {Function} callback + */ + start(options: PasswordlessStartOptions, callback: any): void; + + /** + * Verifies the passwordless TOTP and returns an error if any. + * + * @method buildVerifyUrl + * @param {Object} options + * @param {Function} callback + */ + verify(options: any, callback: any): void; + } + + export class DBConnection { + constructor(request: any, option: any); + + /** + * Signup a new user + * + * @method signup + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} calback + */ + signup(options: any, callback: any): void; + + /** + * Initializes the change password flow + * + * @method signup + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password + * @param {Function} callback + */ + changePassword(options: ChangePasswordOptions, callback: any): void; + } + + export class Management { + constructor(options: ManagementOptions); + + /** + * Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id + * + * @method getUser + * @param {String} userId + * @param {Function} callback + */ + getUser(userId: string, callback: (error?: Auth0Error, user?: any) => any): void; + + /** + * Updates the user metdata. It will patch the user metdata with the attributes sent. + * https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id + * + * @method patchUserMetadata + * @param {String} userId + * @param {Object} userMetadata + * @param {Function} callback + */ + patchUserMetadata(userId: string, userMetadata: any, callback: (error?: Auth0Error, user?: any) => any): void; + + /** + * Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities + * + * @method linkUser + * @param {String} userId + * @param {String} secondaryUserToken + * @param {Function} callback + */ + linkUser(userId: string, secondaryUserToken: string, callback: (error?: Auth0Error, user?: any) => any): void; + } + + export class WebAuth { + constructor(options: AuthOptions); + client: Authentication; + popup: Popup; + redirect: Redirect; + + /** + * Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction + * + * @method authorize + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db + */ + authorize(options: any): void; + + /** + * Parse the url hash and extract the returned tokens depending on the transaction. + * + * Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed + * by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be + * accepted. + * + * @method parseHash + * @param {Object} options: + * @param {String} options.state [OPTIONAL] to verify the response + * @param {String} options.nonce [OPTIONAL] to verify the id_token + * @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash + * @param {Function} callback: any(err, token_payload) + */ + parseHash(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Decodes the id_token and verifies the nonce. + * + * @method validateToken + * @param {String} token + * @param {String} state + * @param {String} nonce + * @param {Function} callback: function(err, {payload, transaction}) + */ + validateToken(token: string, state: string, nonce: string, callback: any): void; + + /** + * Executes a silent authentication transaction under the hood in order to fetch a new token. + * + * @method renewAuth + * @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint + * @param {Function} callback + */ + renewAuth(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Initialices a change password transaction + * + * @method changePassword + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password + * @param {Function} callback + */ + changePassword(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Signs up a new user + * + * @method signup + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} callback + */ + signup(options: any, callback: any): void; + + /** + * Signs up a new user, automatically logs the user in after the signup and returns the user token. + * The login will be done using /oauth/token with password-realm grant type. + * + * @method signupAndAuthorize + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} callback + */ + signupAndAuthorize(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void; + + /** + * Redirects to the auth0 logout page + * + * @method logout + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout + */ + logout(options: any): void; + + passwordlessStart(options: PasswordlessStartOptions, callback: (error?: Auth0Error, data?: any) => any): void; + + /** + * Verifies the passwordless TOTP and redirects to finish the passwordless transaction + * + * @method passwordlessVerify + * @param {Object} options: + * @param {Object} options.type: `sms` or `email` + * @param {Object} options.phoneNumber: only if type = sms + * @param {Object} options.email: only if type = email + * @param {Object} options.connection: the connection name + * @param {Object} options.verificationCode: the TOTP code + * @param {Function} callback + */ + passwordlessVerify(options: any, callback: any): void; + } + + export class Redirect { + constructor(client: any, options: any); + + /** + * Initializes the legacy Lock login flow in a popup + * + * @method loginWithCredentials + * @param {Object} options + * @param {Function} callback + * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead. + */ + loginWithCredentials(options: any, callback: any): void; + + /** + * Signs up a new user and automatically logs the user in after the signup. + * + * @method signupAndLogin + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} callback + */ + signupAndLogin(options: any, callback: any): void; + } + + export class Popup { + constructor(client: any, options: any); + + /** + * Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser. + * + * @method preload + * @param {Object} options: receives the window height and width and any other window feature to be sent to window.open + */ + preload(options: any): any; + + /** + * Internal use. + * + * @method getPopupHandler + */ + getPopupHandler(options: any, preload: boolean): any; + /** + * Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction + * + * @method authorize + * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db + * @param {Function} callback + */ + authorize(options: any, callback: any): void; + + /** + * Initializes the legacy Lock login flow in a popup + * + * @method loginWithCredentials + * @param {Object} options + * @param {Function} callback + * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead. + */ + loginWithCredentials(options: any, callback: any): void; + + /** + * Verifies the passwordless TOTP and returns the requested token + * + * @method passwordlessVerify + * @param {Object} options: + * @param {Object} options.type: `sms` or `email` + * @param {Object} options.phoneNumber: only if type = sms + * @param {Object} options.email: only if type = email + * @param {Object} options.connection: the connection name + * @param {Object} options.verificationCode: the TOTP code + * @param {Function} callback + */ + passwordlessVerify(options: any, callback: any): void; + + /** + * Signs up a new user and automatically logs the user in after the signup. + * + * @method signupAndLogin + * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {Function} callback + */ + signupAndLogin(options: any, callback: any): void; + } + + interface ManagementOptions { + domain: string; + token: string; + _sendTelemetry?: boolean; + _telemetryInfo?: any; + } + + interface AuthOptions { + domain: string; + clientID: string; + responseType?: string; + responseMode?: string; + redirectUri?: string; + scope?: string; + audience?: string; + leeway?: number; + _disableDeprecationWarnings?: boolean; + _sendTelemetry?: boolean; + _telemetryInfo?: any; + } + + interface PasswordlessAuthOptions { + connection: string; + verificationCode: string; + phoneNumber: string; + email: string; + } + + interface Auth0Error { + error: any; + errorDescription: string + } + + interface Auth0DecodedHash { + accessToken?: string; + idToken?: string; + idTokenPayload?: any; + refreshToken?: string; + state?: string; + expiresIn?: number; + tokenType?: string; + } + + /** Represents the response from an API Token Delegation request. */ + interface Auth0DelegationToken { + /** The length of time in seconds the token is valid for. */ + ExpiresIn: number; + /** The JWT for delegated access. */ + idToken: string; + /** The type of token being returned. Possible values: "Bearer" */ + tokenType: string; + } + + interface ChangePasswordOptions { + connection: string; + email: string; + password?: string; + } + + interface PasswordlessStartOptions { + connection: string; + send: string; + phoneNumber?: string; + email?: string, + authParams?: any; + } + + interface PasswordlessVerifyOptions { + connection: string; + verificationCode: string; + phoneNumber?: string; + email?: string; + } + } diff --git a/auth0-js/v7/auth0-js-tests.ts b/auth0-js/v7/auth0-js-tests.ts new file mode 100644 index 0000000000..d5ca0250d4 --- /dev/null +++ b/auth0-js/v7/auth0-js-tests.ts @@ -0,0 +1,22 @@ +/// +var auth0 = new Auth0({ + domain: 'mine.auth0.com', + clientID: 'dsa7d77dsa7d7', + callbackURL: 'http://my-app.com/callback', + callbackOnLocationHash: true +}); + +auth0.login({ + connection: 'google-oauth2', + popup: true, + popupOptions: { + width: 450, + height: 800 + } +}, (err, profile, idToken, accessToken, state) => { + if (err) { + alert("something went wrong: " + err.message); + return; + } + alert('hello ' + profile.name); + }); diff --git a/auth0-js/v7/index.d.ts b/auth0-js/v7/index.d.ts new file mode 100644 index 0000000000..ee834d5c61 --- /dev/null +++ b/auth0-js/v7/index.d.ts @@ -0,0 +1,136 @@ +// Type definitions for Auth0.js v7.x +// Project: https://github.com/auth0/auth0.js +// Definitions by: Robert McLaws +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** Extensions to the browser Window object. */ +interface Window { + /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */ + token: string; +} + +/** This is the interface for the main Auth0 client. */ +interface Auth0Static { + + new(options: Auth0ClientOptions): Auth0Static; + changePassword(options: any, callback?: Function): void; + decodeJwt(jwt: string): any; + login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; + loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; + loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void; + loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; + logout(query: string): void; + getConnections(callback?: Function): void; + refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; + getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; + getProfile(id_token: string, callback?: Function): Auth0UserProfile; + getSSOData(withActiveDirectories: any, callback?: Function): void; + parseHash(hash: string): Auth0DecodedHash; + signup(options: Auth0SignupOptions, callback: Function): void; + validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void; +} + +/** Represents constructor options for the Auth0 client. */ +interface Auth0ClientOptions { + clientID: string; + callbackURL: string; + callbackOnLocationHash?: boolean; + responseType?: string; + domain: string; + forceJSONP?: boolean; +} + +/** Represents a normalized UserProfile. */ +interface Auth0UserProfile { + email: string; + email_verified: boolean; + family_name: string; + gender: string; + given_name: string; + locale: string; + name: string; + nickname: string; + picture: string; + user_id: string; + /** Represents one or more Identities that may be associated with the User. */ + identities: Auth0Identity[]; + user_metadata?: any; + app_metadata?: any; +} + +/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */ +interface MicrosoftUserProfile extends Auth0UserProfile { + emails: string[]; +} + +/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */ +interface Office365UserProfile extends Auth0UserProfile { + tenantid: string; + upn: string; +} + +/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */ +interface AdfsUserProfile extends Auth0UserProfile { + issuer: string; +} + +/** Represents multiple identities assigned to a user. */ +interface Auth0Identity { + access_token: string; + connection: string; + isSocial: boolean; + provider: string; + user_id: string; +} + +interface Auth0DecodedHash { + access_token: string; + idToken: string; + profile: Auth0UserProfile; + state: any; + error: string; +} + +interface Auth0PopupOptions { + width: number; + height: number; +} + +interface Auth0LoginOptions { + auto_login?: boolean; + responseType?: string; + connection?: string; + email?: string; + username?: string; + password?: string; + popup?: boolean; + popupOptions?: Auth0PopupOptions; +} + +interface Auth0SignupOptions extends Auth0LoginOptions { + auto_login: boolean; +} + +interface Auth0Error { + code: any; + details: any; + name: string; + message: string; + status: any; +} + +/** Represents the response from an API Token Delegation request. */ +interface Auth0DelegationToken { + /** The length of time in seconds the token is valid for. */ + expires_in: string; + /** The JWT for delegated access. */ + id_token: string; + /** The type of token being returned. Possible values: "Bearer" */ + token_type: string; +} + +declare const Auth0: Auth0Static; + +declare module "auth0-js" { + export = Auth0 +} diff --git a/auth0-js/v7/tsconfig.json b/auth0-js/v7/tsconfig.json new file mode 100644 index 0000000000..7413e97f44 --- /dev/null +++ b/auth0-js/v7/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "auth0-js": [ + "auth0-js/v7" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "auth0-js-tests.ts" + ] +} diff --git a/auth0-lock/auth0-lock-tests.ts b/auth0-lock/auth0-lock-tests.ts index deb046f3e7..4b72edcfa1 100644 --- a/auth0-lock/auth0-lock-tests.ts +++ b/auth0-lock/auth0-lock-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID"; diff --git a/auth0-lock/index.d.ts b/auth0-lock/index.d.ts index fc9a047115..09c3f4fedd 100644 --- a/auth0-lock/index.d.ts +++ b/auth0-lock/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Brian Caruso // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface Auth0LockAdditionalSignUpFieldOption { value: string; diff --git a/auth0.widget/auth0.widget-tests.ts b/auth0.widget/auth0.widget-tests.ts index ec5502ca7e..6277d4cc3a 100644 --- a/auth0.widget/auth0.widget-tests.ts +++ b/auth0.widget/auth0.widget-tests.ts @@ -1,4 +1,4 @@ -/// +/// var widget: Auth0WidgetStatic = new Auth0Widget({ diff --git a/auth0.widget/index.d.ts b/auth0.widget/index.d.ts index 1c30d83b6f..cdefd9e0fd 100644 --- a/auth0.widget/index.d.ts +++ b/auth0.widget/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface Auth0WidgetStatic { diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index 0d8d9bd47f..fb09beda8a 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -6,11 +6,48 @@ var anyObj: any = { abc: 123 }; var num: number = 5; var error: Error = new Error(); var b: boolean = true; +var apiGwEvt: AWSLambda.APIGatewayEvent; var clientCtx: AWSLambda.ClientContext; var clientContextEnv: AWSLambda.ClientContextEnv; var clientContextClient: AWSLambda.ClientContextClient; var context: AWSLambda.Context; var identity: AWSLambda.CognitoIdentity; +var proxyResult: AWSLambda.ProxyResult; + +/* API Gateway Event */ +str = apiGwEvt.body; +str = apiGwEvt.headers["example"]; +str = apiGwEvt.httpMethod; +b = apiGwEvt.isBase64Encoded; +str = apiGwEvt.path; +str = apiGwEvt.pathParameters["example"]; +str = apiGwEvt.queryStringParameters["example"]; +str = apiGwEvt.stageVariables["example"]; +str = apiGwEvt.requestContext.accountId; +str = apiGwEvt.requestContext.apiId; +str = apiGwEvt.requestContext.httpMethod; +str = apiGwEvt.requestContext.identity.accessKey; +str = apiGwEvt.requestContext.identity.accountId; +str = apiGwEvt.requestContext.identity.apiKey; +str = apiGwEvt.requestContext.identity.caller; +str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider; +str = apiGwEvt.requestContext.identity.cognitoAuthenticationType; +str = apiGwEvt.requestContext.identity.cognitoIdentityId; +str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId; +str = apiGwEvt.requestContext.identity.sourceIp; +str = apiGwEvt.requestContext.identity.user; +str = apiGwEvt.requestContext.identity.userAgent; +str = apiGwEvt.requestContext.identity.userArn; +str = apiGwEvt.requestContext.stage; +str = apiGwEvt.requestContext.requestId; +str = apiGwEvt.requestContext.resourceId; +str = apiGwEvt.requestContext.resourcePath; +str = apiGwEvt.resource; + +/* Lambda Proxy Result */ +num = proxyResult.statusCode; +str = proxyResult.headers["example"]; +str = proxyResult.body /* Context */ b = context.callbackWaitsForEmptyEventLoop; @@ -54,6 +91,15 @@ function callback(cb: AWSLambda.Callback) { cb(error); cb(null, anyObj); } + +/* Proxy Callback */ +function proxyCallback(cb: AWSLambda.ProxyCallback) { + cb(); + cb(null); + cb(error); + cb(null, proxyResult); +} + /* Compatibility functions */ context.done(); context.done(error); @@ -66,3 +112,4 @@ context.fail(str); /* Handler */ let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; +let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {}; diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts index 1aa41b9e62..e8b70db7bd 100644 --- a/aws-lambda/index.d.ts +++ b/aws-lambda/index.d.ts @@ -1,8 +1,44 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// API Gateway "event" +interface APIGatewayEvent { + body: string | null; + headers: { [name: string]: string }; + httpMethod: string; + isBase64Encoded: boolean; + path: string; + pathParameters: { [name: string]: string } | null; + queryStringParameters: { [name: string]: string } | null; + stageVariables: { [name: string]: string } | null; + requestContext: { + accountId: string; + apiId: string; + httpMethod: string; + identity: { + accessKey: string | null; + accountId: string | null; + apiKey: string | null; + caller: string | null; + cognitoAuthenticationProvider: string | null; + cognitoAuthenticationType: string | null; + cognitoIdentityId: string | null; + cognitoIdentityPoolId: string | null; + sourceIp: string; + user: string | null; + userAgent: string | null; + userArn: string | null; + }, + stage: string; + requestId: string; + resourceId: string; + resourcePath: string; + }; + resource: string; +} + // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { @@ -58,6 +94,14 @@ interface ClientContextEnv { locale: string; } +interface ProxyResult { + statusCode: number; + headers?: { + [header: string]: string; + }, + body: string; +} + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -67,6 +111,7 @@ interface ClientContextEnv { * @param callback – optional callback to return information to the caller, otherwise return value is null. */ export type Handler = (event: any, context: Context, callback?: Callback) => void; +export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void; /** * Optional callback parameter. @@ -76,5 +121,6 @@ export type Handler = (event: any, context: Context, callback?: Callback) => vo * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ export type Callback = (error?: Error, result?: any) => void; +export type ProxyCallback = (error?: Error, result?: ProxyResult) => void; export as namespace AWSLambda; diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts deleted file mode 100644 index eb98e2710c..0000000000 --- a/axios/axios-tests.ts +++ /dev/null @@ -1,107 +0,0 @@ - - -enum HttpMethod { GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH } -enum ResponseType { arraybuffer, blob, document, json, text } - -interface Repository { - id: number; - name: string; -} - -interface Issue { - id: number; - title: string; -} - -axios.interceptors.request.use(config => { - console.log("Method:" + config.method + " Url:" +config.url); - return config; -}); - - -const requestId: number = axios.interceptors.request.use( - (config) => { - console.log("Method:" + config.method + " Url:" +config.url); - return config; - }, - (error: any) => error); - - -axios.interceptors.request.eject(requestId); -axios.interceptors.request.eject(7); - - -axios.interceptors.response.use(config => { - console.log("Status:" + config.status); - return config; -}); - -const responseId: number = axios.interceptors.response.use( - config => { - console.log("Status:" + config.status); - return config; - }, - (error: any) => error); - -axios.interceptors.response.eject(responseId); - -axios.get("https://api.github.com/repos/mzabriskie/axios") - .then(r => console.log(r.config.method)); - -var getRepoDetails = axios({ - url: "https://api.github.com/repos/mzabriskie/axios", - method: HttpMethod[HttpMethod.GET], - headers: {}, -}).then(r => { - console.log("ID:" + r.data.id + " Name: " + r.data.name); - return r; -}); - -axios.post("http://example.com/", {}, { - transformRequest: (data: any) => data -}); - -axios.post("http://example.com/", { - headers: {'X-Custom-Header': 'foobar'} -}, { - transformRequest: [ - (data: any) => data - ] -}); - -var config: Axios.AxiosXHRConfigBase = {headers: {}}; -config.headers['X-Custom-Header'] = 'baz'; -axios.post("http://example.com/", config); - -var getRepoIssue = axios.get("https://api.github.com/repos/mzabriskie/axios/issues/1"); - -var axiosInstance = axios.create({ - baseURL: "https://api.github.com/repos/mzabriskie/axios/", - timeout: 1000 -}); - -axiosInstance.request({url: "issues/1"}).then(res => { - if (res.headers['content-type'].startsWith('application/json')) { - throw new Error('Unexpected content-type'); - } -}); - -axios.all([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => { - var sumIds = repo1.data.id + repo2.data.id; - console.log("Sum ID:" + sumIds); - return sumIds; -}); - -var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR) => { - var sumIds = repo1.data.id + repo2.data.id; - console.log("Sum ID:" + sumIds); - return sumIds; -}; - -axios.all([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum)); - -axios.defaults.baseURL = 'https://api.example.com'; -axios.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; -axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - -axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; \ No newline at end of file diff --git a/axios/index.d.ts b/axios/index.d.ts deleted file mode 100644 index 681fefc806..0000000000 --- a/axios/index.d.ts +++ /dev/null @@ -1,316 +0,0 @@ -// Type definitions for axios 0.9.1 -// Project: https://github.com/mzabriskie/axios -// Definitions by: Marcel Buesing -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace Axios { - - interface IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; - } - - interface IPromise extends IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; - catch(onRejected?: (error: any) => U | IThenable): IPromise; - } - - /** - * HTTP Basic auth details - */ - interface AxiosHttpBasicAuth { - username: string; - password: string; - } - - /** - * Common axios XHR config interface - * - request body data type - */ - interface AxiosXHRConfigBase { - /** - * will be prepended to `url` unless `url` is absolute. - * It can be convenient to set `baseURL` for an instance - * of axios to pass relative URLs to methods of that instance. - */ - baseURL?: string; - - /** - * custom headers to be sent - */ - headers?: {[key: string]: any}; - - /** - * URL parameters to be sent with the request - */ - params?: Object; - - /** - * optional function in charge of serializing `params` - * (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/) - */ - paramsSerializer?: (params: Object) => string; - - /** - * specifies the number of milliseconds before the request times out. - * If the request takes longer than `timeout`, the request will be aborted. - */ - timeout?: number; - - /** - * indicates whether or not cross-site Access-Control requests - * should be made using credentials - */ - withCredentials?: boolean; - - /** - * indicates that HTTP Basic auth should be used, and supplies - * credentials. This will set an `Authorization` header, - * overwriting any existing `Authorization` custom headers you have - * set using `headers`. - */ - auth?: AxiosHttpBasicAuth; - - /** - * indicates the type of data that the server will respond with - * options are 'arraybuffer', 'blob', 'document', 'json', 'text' - */ - responseType?: string; - - /** - * name of the cookie to use as a value for xsrf token - */ - xsrfCookieName?: string; - - /** - * name of the http header that carries the xsrf token value - */ - xsrfHeaderName?: string; - - /** - * Change the request data before it is sent to the server. - * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' - * The last function in the array must return a string or an ArrayBuffer - */ - transformRequest?: ((data: T) => U) | [(data: T) => U]; - - /** - * change the response data to be made before it is passed to then/catch - */ - transformResponse?: (data: T) => U; - - /** - * defines whether to resolve or reject the promise for a given HTTP response status code. - * If returns `true` (or is set to `null` or `undefined`), the promise will be resolved; - * otherwise, the promise will be rejected - */ - validateStatus?: (status: number) => boolean | undefined; - } - - /** - * - request body data type - */ - interface AxiosXHRConfig extends AxiosXHRConfigBase { - /** - * server URL that will be used for the request, options are: - * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH - */ - url: string; - - /** - * request method to be used when making the request - */ - method?: string; - - /** - * data to be sent as the request body - * Only applicable for request methods 'PUT', 'POST', and 'PATCH' - * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash - */ - data?: T; - } - - interface AxiosXHRConfigDefaults extends AxiosXHRConfigBase { - /** - * custom headers to be sent - */ - headers: { - common: {[index: string]: string}; - patch: {[index: string]: string}; - post: {[index: string]: string}; - put: {[index: string]: string}; - }; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosXHR { - /** - * Response that was provided by the server - */ - data: T; - - /** - * HTTP status code from the server response - */ - status: number; - - /** - * HTTP status message from the server response - */ - statusText: string; - - /** - * headers that the server responded with - */ - headers: {[index: string]: any}; - - /** - * config that was provided to `axios` for the request - */ - config: AxiosXHRConfig; - } - - interface Interceptor { - /** - * intercept request before it is sent - */ - request: RequestInterceptor; - - /** - * intercept response of request when it is received. - */ - response: ResponseInterceptor - } - - type InterceptorId = number; - - interface RequestInterceptor { - /** - * - request body data type - */ - - use(fulfilledFn: (config: AxiosXHRConfig) => AxiosXHRConfig): InterceptorId; - - use(fulfilledFn: (config: AxiosXHRConfig) => AxiosXHRConfig, - rejectedFn: (error: any) => any) - : InterceptorId; - - eject(interceptorId: InterceptorId): void; - } - - interface ResponseInterceptor { - /** - * - expected response type - */ - - use(fulfilledFn: (config: Axios.AxiosXHR) => Axios.AxiosXHR): InterceptorId; - - use(fulfilledFn: (config: Axios.AxiosXHR) => Axios.AxiosXHR, - rejectedFn: (error: any) => any) - : InterceptorId; - - eject(interceptorId: InterceptorId): void; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosInstance { - - /** - * Send request as configured - */ - (config: AxiosXHRConfig): IPromise>; - - /** - * Send request as configured - */ - new (config: AxiosXHRConfig): IPromise>; - - /** - * Send request as configured - */ - request(config: AxiosXHRConfig): IPromise>; - - /** - * intercept requests or responses before they are handled by then or catch - */ - interceptors: Interceptor; - - /** - * Config defaults - */ - defaults: AxiosXHRConfigDefaults; - - /** - * equivalent to `Promise.all` - */ - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>, T10 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR]>; - - /** - * spread array parameter to `fn`. - * note: alternative to `spread`, destructuring assignment. - */ - spread(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U; - - /** - * convenience alias, method = GET - */ - get(url: string, config?: AxiosXHRConfigBase): IPromise>; - - - /** - * convenience alias, method = DELETE - */ - delete(url: string, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = HEAD - */ - head(url: string, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = POST - */ - post(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = PUT - */ - put(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = PATCH - */ - patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - } - - /** - * - expected response type, - */ - interface AxiosStatic extends AxiosInstance { - /** - * create a new instance of axios with a custom config - */ - create(config: AxiosXHRConfigBase): AxiosInstance; - } -} - -declare var axios: Axios.AxiosStatic; - -declare module "axios" { - export = axios; -} diff --git a/bintrees/index.d.ts b/bintrees/index.d.ts index 9853be67dc..7a7b2c233e 100644 --- a/bintrees/index.d.ts +++ b/bintrees/index.d.ts @@ -5,7 +5,7 @@ declare module 'bintrees' { - type Callback = (err: Error, item: T) => void; + type Callback = (item: T) => void; type Comparator = (a: T, b: T) => number; class Iterator { diff --git a/bookshelf/index.d.ts b/bookshelf/index.d.ts index 3895ef95a1..56472a3213 100644 --- a/bookshelf/index.d.ts +++ b/bookshelf/index.d.ts @@ -2,6 +2,7 @@ // Project: http://bookshelfjs.org/ // Definitions by: Andrew Schurman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import Knex = require('knex'); import knex = require('knex'); diff --git a/bufferstream/index.d.ts b/bufferstream/index.d.ts index ab048e437f..1d1ffcdb10 100644 --- a/bufferstream/index.d.ts +++ b/bufferstream/index.d.ts @@ -58,7 +58,7 @@ declare class BufferStream extends stream.Duplex { shortcut for buffer.length */ length: number; -} +} // https://github.com/dodo/node-bufferstream/blob/master/src/buffer-stream.coffee#L28 declare namespace BufferStream { export interface Opts { diff --git a/c3/index.d.ts b/c3/index.d.ts index aa960b0b60..5edb096395 100644 --- a/c3/index.d.ts +++ b/c3/index.d.ts @@ -248,6 +248,15 @@ declare namespace c3 { */ width?: number; }; + + spline?: { + interpolation?: { + /** + * Set custom spline interpolation + */ + type?: 'linear' | 'linear-closed' | 'basis' | 'basis-open' | 'basis-closed' | 'bundle' | 'cardinal' | 'cardinal-open' | 'cardinal-closed' | 'monotone'; + }; + }; } interface Data { diff --git a/chai-enzyme/index.d.ts b/chai-enzyme/index.d.ts index 23e9058ef6..6997abd5fe 100644 --- a/chai-enzyme/index.d.ts +++ b/chai-enzyme/index.d.ts @@ -8,6 +8,7 @@ /// /// /// +/// declare namespace Chai { type EnzymeSelector = string | React.StatelessComponent | React.ComponentClass | { [key: string]: any }; @@ -143,9 +144,9 @@ declare namespace Chai { } declare module "chai-enzyme" { - import { ShallowWrapper, ReactWrapper, CheerioWrapper } from "enzyme"; + import { ShallowWrapper, ReactWrapper } from "enzyme"; - type DebugWrapper = ShallowWrapper | CheerioWrapper | ReactWrapper; + type DebugWrapper = ShallowWrapper | Cheerio | ReactWrapper; function chaiEnzyMe(wrapper?: (debugWrapper: DebugWrapper) => string): (chai: any) => void; module chaiEnzyMe { diff --git a/chai-http/index.d.ts b/chai-http/index.d.ts index 567f13e4e7..2e619b6166 100644 --- a/chai-http/index.d.ts +++ b/chai-http/index.d.ts @@ -55,6 +55,7 @@ declare namespace ChaiHttp { send(data: Object): Request; auth(user: string, name: string): Request; field(name: string, val: string): Request; + buffer(): Request; end(callback?: (err: any, res: Response) => void): FinishedRequest; } diff --git a/chai-json-schema/chai-json-schema-tests.ts b/chai-json-schema/chai-json-schema-tests.ts index 8559d3caae..d0c1234e17 100644 --- a/chai-json-schema/chai-json-schema-tests.ts +++ b/chai-json-schema/chai-json-schema-tests.ts @@ -9,19 +9,19 @@ import ChaiJsonSchema = require('chai-json-schema'); chai.use(ChaiJsonSchema); chai.should(); -let goodApple = { +const goodApple = { skin: 'thin', colors: ['red', 'green', 'yellow'], taste: 10 }; -let badApple = { +const badApple = { colors: ['brown'], taste: 0, worms: 2 }; -let fruitSchema = { +const fruitSchema = { title: 'fresh fruit schema v1', type: 'object', required: ['skin', 'colors', 'taste'], @@ -54,3 +54,17 @@ badApple.should.not.be.jsonSchema(fruitSchema); //tdd style assert.jsonSchema(goodApple, fruitSchema); assert.notJsonSchema(badApple, fruitSchema); + +// tv4 +const schema = { + items: { + type: 'boolean' + } +}; + +const data1 = [true, false]; +const data2 = [true, 123]; + +expect(chai.tv4.validate(data1, schema)).to.be.true; +expect(chai.tv4.validate(data2, schema)).to.be.false; + diff --git a/chai-json-schema/index.d.ts b/chai-json-schema/index.d.ts index e66e2c96af..1498510f9f 100644 --- a/chai-json-schema/index.d.ts +++ b/chai-json-schema/index.d.ts @@ -5,6 +5,7 @@ // // +import tv4 = require('tv4'); declare global { namespace Chai { @@ -16,6 +17,10 @@ declare global { export interface LanguageChains { jsonSchema(schema: any, msg?: string): void; } + + export interface ChaiStatic { + tv4: tv4.TV4; + } } } diff --git a/chrome/index.d.ts b/chrome/index.d.ts index 2822dd421e..cd6922f5fb 100644 --- a/chrome/index.d.ts +++ b/chrome/index.d.ts @@ -7267,6 +7267,7 @@ declare namespace chrome.webRequest { interface WebResponseHeadersDetails extends WebResponseDetails { /** Optional. The HTTP response headers that have been received with this response. */ responseHeaders?: HttpHeader[]; + method: string; /** standard HTTP method i.e. GET, POST, PUT, etc. */ } interface WebResponseCacheDetails extends WebResponseHeadersDetails { diff --git a/comment-json/comment-json-tests.ts b/comment-json/comment-json-tests.ts new file mode 100644 index 0000000000..af91ff422f --- /dev/null +++ b/comment-json/comment-json-tests.ts @@ -0,0 +1,16 @@ +import * as commentJson from 'comment-json'; + +const result = commentJson.parse(` +/** + block comment at the top + */ +// comment at the top +{ + // comment for a + // comment line 2 for a + /* block comment */ + "a": 1 // comment at right +} +// comment at the bottom +`); +const str = commentJson.stringify(result); diff --git a/comment-json/index.d.ts b/comment-json/index.d.ts new file mode 100644 index 0000000000..9c2652f34e --- /dev/null +++ b/comment-json/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for comment-json 1.1 +// Project: https://github.com/kaelzhang/node-comment-json +// Definitions by: Jason Dent +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type Reviver = (k: number | string, v: any) => any; +export function parse(json: string, reviver?: Reviver, removes_comments?: boolean): any; +export function stringify(value: any, replacer?: any, space?: string | number): string; diff --git a/comment-json/tsconfig.json b/comment-json/tsconfig.json new file mode 100644 index 0000000000..342694cbb3 --- /dev/null +++ b/comment-json/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "comment-json-tests.ts" + ] +} diff --git a/comment-json/tslint.json b/comment-json/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/comment-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/credit-card-type/index.d.ts b/credit-card-type/index.d.ts index 59886b5e60..8625e5e5f8 100644 --- a/credit-card-type/index.d.ts +++ b/credit-card-type/index.d.ts @@ -10,7 +10,8 @@ declare namespace creditCardType { interface CreditCardTypeInfo { niceType?: string type?: CardBrand - pattern?: RegExp + prefixPattern?: RegExp + exactPattern?: RegExp gaps?: Array lengths?: Array code?: { diff --git a/cron/index.d.ts b/cron/index.d.ts index e962a9eb27..d4fa027c93 100644 --- a/cron/index.d.ts +++ b/cron/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cron 1.0.9 +// Type definitions for cron 1.2 // Project: https://www.npmjs.com/package/cron // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,9 +6,9 @@ interface CronJobStatic { - new (cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any): CronJob; + new (cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean): CronJob; new (options: { - cronTime: string | Date; onTick: () => void; onComplete?: () => void; start?: boolean; timeZone?: string; context?: any + cronTime: string | Date; onTick: () => void; onComplete?: () => void; start?: boolean; timeZone?: string; context?: any; runOnInit?: boolean }): CronJob; } interface CronJob { diff --git a/crypto-js/aes/index.d.ts b/crypto-js/aes/index.d.ts new file mode 100644 index 0000000000..4f435688c5 --- /dev/null +++ b/crypto-js/aes/index.d.ts @@ -0,0 +1,3 @@ +import { AES } from '../index'; + +export = AES; diff --git a/crypto-js/core/index.d.ts b/crypto-js/core/index.d.ts new file mode 100644 index 0000000000..c5d6e00410 --- /dev/null +++ b/crypto-js/core/index.d.ts @@ -0,0 +1,3 @@ +import * as Core from '../index'; + +export = Core; diff --git a/crypto-js/enc-base64/index.d.ts b/crypto-js/enc-base64/index.d.ts new file mode 100644 index 0000000000..55001a7115 --- /dev/null +++ b/crypto-js/enc-base64/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Base64: typeof enc.Base64; +export = Base64; diff --git a/crypto-js/enc-hex/index.d.ts b/crypto-js/enc-hex/index.d.ts new file mode 100644 index 0000000000..3718860123 --- /dev/null +++ b/crypto-js/enc-hex/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Hex: typeof enc.Hex; +export = Hex; diff --git a/crypto-js/enc-latin1/index.d.ts b/crypto-js/enc-latin1/index.d.ts new file mode 100644 index 0000000000..7f27822daf --- /dev/null +++ b/crypto-js/enc-latin1/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Latin1: typeof enc.Latin1; +export = Latin1; diff --git a/crypto-js/enc-utf16/index.d.ts b/crypto-js/enc-utf16/index.d.ts new file mode 100644 index 0000000000..76fa98774a --- /dev/null +++ b/crypto-js/enc-utf16/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Utf16: typeof enc.Utf16; +export = Utf16; diff --git a/crypto-js/enc-utf8/index.d.ts b/crypto-js/enc-utf8/index.d.ts new file mode 100644 index 0000000000..828dcb9391 --- /dev/null +++ b/crypto-js/enc-utf8/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Utf8: typeof enc.Utf8; +export = Utf8; diff --git a/crypto-js/evpkdf/index.d.ts b/crypto-js/evpkdf/index.d.ts new file mode 100644 index 0000000000..8946b9d3a1 --- /dev/null +++ b/crypto-js/evpkdf/index.d.ts @@ -0,0 +1,3 @@ +import { EvpKDF } from '../index'; + +export = EvpKDF; diff --git a/crypto-js/format-hex/index.d.ts b/crypto-js/format-hex/index.d.ts new file mode 100644 index 0000000000..1b0f573824 --- /dev/null +++ b/crypto-js/format-hex/index.d.ts @@ -0,0 +1,4 @@ +import { format } from '../index'; + +declare const Hex: typeof format.Hex; +export = Hex; diff --git a/crypto-js/format-openssl/index.d.ts b/crypto-js/format-openssl/index.d.ts new file mode 100644 index 0000000000..02c35a3688 --- /dev/null +++ b/crypto-js/format-openssl/index.d.ts @@ -0,0 +1,4 @@ +import { format } from '../index'; + +declare const OpenSSL: typeof format.OpenSSL; +export = OpenSSL; diff --git a/crypto-js/hmac-md5/index.d.ts b/crypto-js/hmac-md5/index.d.ts new file mode 100644 index 0000000000..7240576710 --- /dev/null +++ b/crypto-js/hmac-md5/index.d.ts @@ -0,0 +1,3 @@ +import { HmacMD5 } from '../index'; + +export = HmacMD5; diff --git a/crypto-js/hmac-ripemd160/index.d.ts b/crypto-js/hmac-ripemd160/index.d.ts new file mode 100644 index 0000000000..6c371e9435 --- /dev/null +++ b/crypto-js/hmac-ripemd160/index.d.ts @@ -0,0 +1,3 @@ +import { HmacRIPEMD160 } from '../index'; + +export = HmacRIPEMD160; diff --git a/crypto-js/hmac-sha1/index.d.ts b/crypto-js/hmac-sha1/index.d.ts new file mode 100644 index 0000000000..1995cf87f6 --- /dev/null +++ b/crypto-js/hmac-sha1/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA1 } from '../index'; + +export = HmacSHA1; diff --git a/crypto-js/hmac-sha224/index.d.ts b/crypto-js/hmac-sha224/index.d.ts new file mode 100644 index 0000000000..f25334c64c --- /dev/null +++ b/crypto-js/hmac-sha224/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA224 } from '../index'; + +export = HmacSHA224; diff --git a/crypto-js/hmac-sha256/index.d.ts b/crypto-js/hmac-sha256/index.d.ts new file mode 100644 index 0000000000..ca1a1ca267 --- /dev/null +++ b/crypto-js/hmac-sha256/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA256 } from '../index'; + +export = HmacSHA256; diff --git a/crypto-js/hmac-sha3/index.d.ts b/crypto-js/hmac-sha3/index.d.ts new file mode 100644 index 0000000000..0fa0db9321 --- /dev/null +++ b/crypto-js/hmac-sha3/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA3 } from '../index'; + +export = HmacSHA3; diff --git a/crypto-js/hmac-sha384/index.d.ts b/crypto-js/hmac-sha384/index.d.ts new file mode 100644 index 0000000000..2e17420c1b --- /dev/null +++ b/crypto-js/hmac-sha384/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA384 } from '../index'; + +export = HmacSHA384; diff --git a/crypto-js/hmac-sha512/index.d.ts b/crypto-js/hmac-sha512/index.d.ts new file mode 100644 index 0000000000..439b2ffd5e --- /dev/null +++ b/crypto-js/hmac-sha512/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA512 } from '../index'; + +export = HmacSHA512; diff --git a/crypto-js/index.d.ts b/crypto-js/index.d.ts index 5fdf193254..07a8d18dfc 100644 --- a/crypto-js/index.d.ts +++ b/crypto-js/index.d.ts @@ -114,4 +114,3 @@ declare namespace CryptoJS { }; } } - diff --git a/crypto-js/lib-typedarrays/index.d.ts b/crypto-js/lib-typedarrays/index.d.ts new file mode 100644 index 0000000000..761e38b1cd --- /dev/null +++ b/crypto-js/lib-typedarrays/index.d.ts @@ -0,0 +1,2 @@ +declare const LibTypedarrays: any; +export = LibTypedarrays; diff --git a/crypto-js/md5/index.d.ts b/crypto-js/md5/index.d.ts new file mode 100644 index 0000000000..faa064511e --- /dev/null +++ b/crypto-js/md5/index.d.ts @@ -0,0 +1,3 @@ +import { MD5 } from '../index'; + +export = MD5; diff --git a/crypto-js/mode-cfb/index.d.ts b/crypto-js/mode-cfb/index.d.ts new file mode 100644 index 0000000000..74c5c6e3d1 --- /dev/null +++ b/crypto-js/mode-cfb/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const CFB: typeof mode.CFB; +export = CFB; diff --git a/crypto-js/mode-ctr-gladman/index.d.ts b/crypto-js/mode-ctr-gladman/index.d.ts new file mode 100644 index 0000000000..3ca8f8b367 --- /dev/null +++ b/crypto-js/mode-ctr-gladman/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const CTRGladman: typeof mode.CTRGladman; +export = CTRGladman; diff --git a/crypto-js/mode-ctr/index.d.ts b/crypto-js/mode-ctr/index.d.ts new file mode 100644 index 0000000000..6007a4ca88 --- /dev/null +++ b/crypto-js/mode-ctr/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const CTR: typeof mode.CTR; +export = CTR; diff --git a/crypto-js/mode-ecb/index.d.ts b/crypto-js/mode-ecb/index.d.ts new file mode 100644 index 0000000000..569d2b2286 --- /dev/null +++ b/crypto-js/mode-ecb/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const ECB: typeof mode.ECB; +export = ECB; diff --git a/crypto-js/mode-ofb/index.d.ts b/crypto-js/mode-ofb/index.d.ts new file mode 100644 index 0000000000..484406979d --- /dev/null +++ b/crypto-js/mode-ofb/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const OFB: typeof mode.OFB; +export = OFB; diff --git a/crypto-js/pad-ansix923/index.d.ts b/crypto-js/pad-ansix923/index.d.ts new file mode 100644 index 0000000000..2bb6c2dffb --- /dev/null +++ b/crypto-js/pad-ansix923/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const AnsiX923: typeof pad.AnsiX923; +export = AnsiX923; diff --git a/crypto-js/pad-iso10126/index.d.ts b/crypto-js/pad-iso10126/index.d.ts new file mode 100644 index 0000000000..6e52e96197 --- /dev/null +++ b/crypto-js/pad-iso10126/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const Iso10126: typeof pad.Iso10126; +export = Iso10126; diff --git a/crypto-js/pad-iso97971/index.d.ts b/crypto-js/pad-iso97971/index.d.ts new file mode 100644 index 0000000000..0ab1cecbfb --- /dev/null +++ b/crypto-js/pad-iso97971/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const Iso97971: typeof pad.Iso97971; +export = Iso97971; diff --git a/crypto-js/pad-nopadding/index.d.ts b/crypto-js/pad-nopadding/index.d.ts new file mode 100644 index 0000000000..f71bb2de73 --- /dev/null +++ b/crypto-js/pad-nopadding/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const NoPadding: typeof pad.NoPadding; +export = NoPadding; diff --git a/crypto-js/pad-pkcs7/index.d.ts b/crypto-js/pad-pkcs7/index.d.ts new file mode 100644 index 0000000000..1b194673a2 --- /dev/null +++ b/crypto-js/pad-pkcs7/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const Pkcs7: typeof pad.Pkcs7; +export = Pkcs7; diff --git a/crypto-js/pad-zeropadding/index.d.ts b/crypto-js/pad-zeropadding/index.d.ts new file mode 100644 index 0000000000..cf481402ab --- /dev/null +++ b/crypto-js/pad-zeropadding/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const ZeroPadding: typeof pad.ZeroPadding; +export = ZeroPadding; diff --git a/crypto-js/pbkdf2/index.d.ts b/crypto-js/pbkdf2/index.d.ts new file mode 100644 index 0000000000..e242e6fe05 --- /dev/null +++ b/crypto-js/pbkdf2/index.d.ts @@ -0,0 +1,3 @@ +import { PBKDF2 } from '../index'; + +export = PBKDF2; diff --git a/crypto-js/rabbit-legacy/index.d.ts b/crypto-js/rabbit-legacy/index.d.ts new file mode 100644 index 0000000000..6befe37563 --- /dev/null +++ b/crypto-js/rabbit-legacy/index.d.ts @@ -0,0 +1,3 @@ +import { RabbitLegacy } from '../index'; + +export = RabbitLegacy; diff --git a/crypto-js/rabbit/index.d.ts b/crypto-js/rabbit/index.d.ts new file mode 100644 index 0000000000..f708a6f20b --- /dev/null +++ b/crypto-js/rabbit/index.d.ts @@ -0,0 +1,3 @@ +import { Rabbit } from '../index'; + +export = Rabbit; diff --git a/crypto-js/rc4/index.d.ts b/crypto-js/rc4/index.d.ts new file mode 100644 index 0000000000..38a929f490 --- /dev/null +++ b/crypto-js/rc4/index.d.ts @@ -0,0 +1,3 @@ +import { RC4 } from '../index'; + +export = RC4; diff --git a/crypto-js/ripemd160/index.d.ts b/crypto-js/ripemd160/index.d.ts new file mode 100644 index 0000000000..90e3e770ce --- /dev/null +++ b/crypto-js/ripemd160/index.d.ts @@ -0,0 +1,3 @@ +import { RIPEMD160 } from '../index'; + +export = RIPEMD160; diff --git a/crypto-js/sha1/index.d.ts b/crypto-js/sha1/index.d.ts new file mode 100644 index 0000000000..14fb4d2a6b --- /dev/null +++ b/crypto-js/sha1/index.d.ts @@ -0,0 +1,3 @@ +import { SHA1 } from '../index'; + +export = SHA1; diff --git a/crypto-js/sha224/index.d.ts b/crypto-js/sha224/index.d.ts new file mode 100644 index 0000000000..3ff1ff4596 --- /dev/null +++ b/crypto-js/sha224/index.d.ts @@ -0,0 +1,3 @@ +import { SHA224 } from '../index'; + +export = SHA224; diff --git a/crypto-js/sha256/index.d.ts b/crypto-js/sha256/index.d.ts new file mode 100644 index 0000000000..59781b01f3 --- /dev/null +++ b/crypto-js/sha256/index.d.ts @@ -0,0 +1,3 @@ +import { SHA256 } from '../index'; + +export = SHA256; diff --git a/crypto-js/sha3/index.d.ts b/crypto-js/sha3/index.d.ts new file mode 100644 index 0000000000..241574a711 --- /dev/null +++ b/crypto-js/sha3/index.d.ts @@ -0,0 +1,3 @@ +import { SHA3 } from '../index'; + +export = SHA3; diff --git a/crypto-js/sha384/index.d.ts b/crypto-js/sha384/index.d.ts new file mode 100644 index 0000000000..5bad55498a --- /dev/null +++ b/crypto-js/sha384/index.d.ts @@ -0,0 +1,3 @@ +import { SHA384 } from '../index'; + +export = SHA384; diff --git a/crypto-js/sha512/index.d.ts b/crypto-js/sha512/index.d.ts new file mode 100644 index 0000000000..0f764329e2 --- /dev/null +++ b/crypto-js/sha512/index.d.ts @@ -0,0 +1,3 @@ +import { SHA512 } from '../index'; + +export = SHA512; diff --git a/crypto-js/test/submodule-tests.ts b/crypto-js/test/submodule-tests.ts new file mode 100644 index 0000000000..0cfd8cd83f --- /dev/null +++ b/crypto-js/test/submodule-tests.ts @@ -0,0 +1,184 @@ +import Core = require('../core'); +import X64Core = require('../x64-core'); +import LibTypedarrays = require('../lib-typedarrays'); +// --- +import MD5 = require('../md5'); +import SHA1 = require('../sha1'); +import SHA256 = require('../sha256'); +import SHA224 = require('../sha224'); +import SHA512 = require('../sha512'); +import SHA384 = require('../sha384'); +import SHA3 = require('../sha3'); +import RIPEMD160 = require('../ripemd160'); +// --- +import HmacMD5 = require('../hmac-md5'); +import HmacSHA1 = require('../hmac-sha1'); +import HmacSHA256 = require('../hmac-sha256'); +import HmacSHA224 = require('../hmac-sha224'); +import HmacSHA512 = require('../hmac-sha512'); +import HmacSHA384 = require('../hmac-sha384'); +import HmacSHA3 = require('../hmac-sha3'); +import HmacRIPEMD160 = require('../hmac-ripemd160'); +// --- +import PBKDF2 = require('../pbkdf2'); +// --- +import AES = require('../aes'); +import TripleDES = require('../tripledes'); +import RC4 = require('../rc4'); +import Rabbit = require('../rabbit'); +import RabbitLegacy = require('../rabbit-legacy'); +import EvpKDF = require('../evpkdf'); +// --- +import FormatOpenSSL = require('../format-openssl'); +import FormatHex = require('../format-hex'); +// --- +import EncLatin1 = require('../enc-latin1'); +import EncUtf8 = require('../enc-utf8'); +import EncHex = require('../enc-hex'); +import EncUtf16 = require('../enc-utf16'); +import EncBase64 = require('../enc-base64'); +// --- +import ModeCFB = require('../mode-cfb'); +import ModeCTR = require('../mode-ctr'); +import ModeCTRGladman = require('../mode-ctr-gladman'); +import ModeOFB = require('../mode-ofb'); +import ModeECB = require('../mode-ecb'); +// --- +import PadPkcs7 = require('../pad-pkcs7'); +import PadAnsiX923 = require('../pad-ansix923'); +import PadIso10126 = require('../pad-iso10126'); +import PadIso97971 = require('../pad-iso97971'); +import PadZeroPadding = require('../pad-zeropadding'); +import PadNoPadding = require('../pad-nopadding'); + +// Hashers +var str: string; +str = MD5('some message'); +str = MD5('some message', 'some key'); + +str = SHA1('some message'); +str = SHA1('some message', 'some key', { any: true }); + +str = FormatOpenSSL('some message'); +str = FormatOpenSSL('some message', 'some key'); + + +// Ciphers +var encrypted: CryptoJS.WordArray; +var decrypted: CryptoJS.DecryptedMessage; + +encrypted = AES.encrypt("Message", "Secret Passphrase"); +decrypted = AES.decrypt(encrypted, "Secret Passphrase"); + +encrypted = Core.DES.encrypt("Message", "Secret Passphrase"); +decrypted = Core.DES.decrypt(encrypted, "Secret Passphrase"); + +encrypted = TripleDES.encrypt("Message", "Secret Passphrase"); +decrypted = TripleDES.decrypt(encrypted, "Secret Passphrase"); + + +encrypted = Rabbit.encrypt("Message", "Secret Passphrase"); +decrypted = Rabbit.decrypt(encrypted, "Secret Passphrase"); + +encrypted = RC4.encrypt("Message", "Secret Passphrase"); +decrypted = RC4.decrypt(encrypted, "Secret Passphrase"); + +encrypted = Core.RC4Drop.encrypt("Message", "Secret Passphrase"); +encrypted = Core.RC4Drop.encrypt("Message", "Secret Passphrase", { drop: 3072 / 4 }); +decrypted = Core.RC4Drop.decrypt(encrypted, "Secret Passphrase", { drop: 3072 / 4 }); + +var key = EncHex.parse('000102030405060708090a0b0c0d0e0f'); +var iv = EncHex.parse('101112131415161718191a1b1c1d1e1f'); +encrypted = AES.encrypt("Message", key, { iv: iv }); + +encrypted = AES.encrypt("Message", "Secret Passphrase", { + mode: ModeCFB, + padding: PadAnsiX923 +}); + + +// The Cipher Output +encrypted = AES.encrypt("Message", "Secret Passphrase"); +alert(encrypted.key); +// 74eb593087a982e2a6f5dded54ecd96d1fd0f3d44a58728cdcd40c55227522223 +alert(encrypted.iv); +// 7781157e2629b094f0e3dd48c4d786115 +alert(encrypted.salt); +// 7a25f9132ec6a8b34 +alert(encrypted.ciphertext); +// 73e54154a15d1beeb509d9e12f1e462a0 +alert(encrypted); +// U2FsdGVkX1+iX5Ey7GqLND5UFUoV0b7rUJ2eEvHkYqA= + +var JsonFormatter = { + stringify: function(cipherParams: any) { + // create json object with ciphertext + var jsonObj: any = { + ct: cipherParams.ciphertext.toString(EncBase64) + }; + // optionally add iv and salt + if (cipherParams.iv) { + jsonObj.iv = cipherParams.iv.toString(); + } + if (cipherParams.salt) { + jsonObj.s = cipherParams.salt.toString(); + } + // stringify json object + return JSON.stringify(jsonObj); + }, + parse: function (jsonStr: any) { + // parse json string + var jsonObj = JSON.parse(jsonStr); + // extract ciphertext from json object, and create cipher params object + var cipherParams = (Core).lib.CipherParams.create({ + ciphertext: EncBase64.parse(jsonObj.ct) + }); + // optionally extract iv and salt + if (jsonObj.iv) { + cipherParams.iv = EncHex.parse(jsonObj.iv); + } + if (jsonObj.s) { + cipherParams.salt = EncHex.parse(jsonObj.s); + } return cipherParams; + } +}; +encrypted = AES.encrypt("Message", "Secret Passphrase", { + format: JsonFormatter +}); +alert(encrypted); +// {"ct":"tZ4MsEnfbcDOwqau68aOrQ==","iv":"8a8c8fd8fe33743d3638737ea4a00698","s":"ba06373c8f57179c"} +decrypted = AES.decrypt(encrypted, "Secret Passphrase", { + format: JsonFormatter +}); +alert(decrypted.toString(EncUtf8)); // Message + + +// Progressive Ciphering +var key = EncHex.parse('000102030405060708090a0b0c0d0e0f'); +var iv = EncHex.parse('101112131415161718191a1b1c1d1e1f'); +var aesEncryptor = Core.algo.AES.createEncryptor(key, { iv: iv }); +var ciphertextPart1 = aesEncryptor.process("Message Part 1"); +var ciphertextPart2 = aesEncryptor.process("Message Part 2"); +var ciphertextPart3 = aesEncryptor.process("Message Part 3"); +var ciphertextPart4 = aesEncryptor.finalize(); +var aesDecryptor = Core.algo.AES.createDecryptor(key, { iv: iv }); +var plaintextPart1 = aesDecryptor.process(ciphertextPart1); +var plaintextPart2 = aesDecryptor.process(ciphertextPart2); +var plaintextPart3 = aesDecryptor.process(ciphertextPart3); +var plaintextPart4 = aesDecryptor.process(ciphertextPart4); +var plaintextPart5 = aesDecryptor.finalize(); + + +// Encoders +var words = EncBase64.parse('SGVsbG8sIFdvcmxkIQ=='); +var base64 = EncBase64.stringify(words); +var words = EncLatin1.parse('Hello, World!'); +var latin1 = EncLatin1.stringify(words); +var words = EncHex.parse('48656c6c6f2c20576f726c6421'); +var hex = EncHex.stringify(words); +var words = EncUtf8.parse('𤭢'); +var utf8 = EncUtf8.stringify(words); +var words = EncUtf16.parse('Hello, World!'); +var utf16 = EncUtf16.stringify(words); +var words = Core.enc.Utf16LE.parse('Hello, World!'); +var utf16 = Core.enc.Utf16LE.stringify(words); diff --git a/crypto-js/tripledes/index.d.ts b/crypto-js/tripledes/index.d.ts new file mode 100644 index 0000000000..ea22173d98 --- /dev/null +++ b/crypto-js/tripledes/index.d.ts @@ -0,0 +1,3 @@ +import { TripleDES } from '../index'; + +export = TripleDES; diff --git a/crypto-js/tsconfig.json b/crypto-js/tsconfig.json index 94793c83ae..10865613d3 100644 --- a/crypto-js/tsconfig.json +++ b/crypto-js/tsconfig.json @@ -18,6 +18,51 @@ }, "files": [ "index.d.ts", - "crypto-js-tests.ts" + "crypto-js-tests.ts", + "test/submodule-tests.ts", + "core/index.d.ts", + "x64-core/index.d.ts", + "lib-typedarrays/index.d.ts", + "md5/index.d.ts", + "sha1/index.d.ts", + "sha256/index.d.ts", + "sha224/index.d.ts", + "sha512/index.d.ts", + "sha384/index.d.ts", + "sha3/index.d.ts", + "ripemd160/index.d.ts", + "hmac-md5/index.d.ts", + "hmac-sha1/index.d.ts", + "hmac-sha256/index.d.ts", + "hmac-sha224/index.d.ts", + "hmac-sha512/index.d.ts", + "hmac-sha384/index.d.ts", + "hmac-sha3/index.d.ts", + "hmac-ripemd160/index.d.ts", + "pbkdf2/index.d.ts", + "aes/index.d.ts", + "tripledes/index.d.ts", + "rc4/index.d.ts", + "rabbit/index.d.ts", + "rabbit-legacy/index.d.ts", + "evpkdf/index.d.ts", + "format-openssl/index.d.ts", + "format-hex/index.d.ts", + "enc-latin1/index.d.ts", + "enc-utf8/index.d.ts", + "enc-hex/index.d.ts", + "enc-utf16/index.d.ts", + "enc-base64/index.d.ts", + "mode-cfb/index.d.ts", + "mode-ctr/index.d.ts", + "mode-ctr-gladman/index.d.ts", + "mode-ofb/index.d.ts", + "mode-ecb/index.d.ts", + "pad-pkcs7/index.d.ts", + "pad-ansix923/index.d.ts", + "pad-iso10126/index.d.ts", + "pad-iso97971/index.d.ts", + "pad-zeropadding/index.d.ts", + "pad-nopadding/index.d.ts" ] -} \ No newline at end of file +} diff --git a/crypto-js/x64-core/index.d.ts b/crypto-js/x64-core/index.d.ts new file mode 100644 index 0000000000..1ef7a67477 --- /dev/null +++ b/crypto-js/x64-core/index.d.ts @@ -0,0 +1,3 @@ +import * as X64Core from '../index'; + +export = X64Core; diff --git a/d3-hierarchy/d3-hierarchy-tests.ts b/d3-hierarchy/d3-hierarchy-tests.ts index ce7354afe3..7079fae827 100644 --- a/d3-hierarchy/d3-hierarchy-tests.ts +++ b/d3-hierarchy/d3-hierarchy-tests.ts @@ -125,6 +125,13 @@ hierarchyRootNode = hierarchyRootNode.sum(function (d) { return d.val; }); num = hierarchyRootNode.value; +// count() and value ---------------------------------------------------------- + +hierarchyRootNode = hierarchyRootNode.count(); + +num = hierarchyRootNode.value; + + // sort --------------------------------------------------------------------- hierarchyRootNode = hierarchyRootNode.sort(function (a, b) { @@ -307,6 +314,12 @@ clusterRootNode = clusterRootNode.sum(function (d) { return d.val; }); num = clusterRootNode.value; +// count() and value ---------------------------------------------------------- + +clusterRootNode = clusterRootNode.count(); + +num = clusterRootNode.value; + // sort --------------------------------------------------------------------- clusterRootNode = clusterRootNode.sort(function (a, b) { @@ -584,6 +597,11 @@ treemapRootNode = treemapRootNode.sum(function (d) { return d.val; }); num = treemapRootNode.value; +// count() and value ---------------------------------------------------------- + +treemapRootNode = treemapRootNode.count(); + +num = treemapRootNode.value; // sort --------------------------------------------------------------------- treemapRootNode = treemapRootNode.sort(function (a, b) { @@ -766,6 +784,11 @@ packRootNode = packRootNode.sum(function (d) { return d.val; }); num = packRootNode.value; +// count() and value ---------------------------------------------------------- + +packRootNode = packRootNode.count(); + +num = packRootNode.value; // sort --------------------------------------------------------------------- packRootNode = packRootNode.sort(function (a, b) { diff --git a/d3-hierarchy/index.d.ts b/d3-hierarchy/index.d.ts index 7eef444875..bfe750b31e 100644 --- a/d3-hierarchy/index.d.ts +++ b/d3-hierarchy/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-hierarchy module v1.0.2 +// Type definitions for D3JS d3-hierarchy module 1.1 // Project: https://github.com/d3/d3-hierarchy/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.1.1 + // ----------------------------------------------------------------------- // Hierarchy // ----------------------------------------------------------------------- @@ -20,7 +22,7 @@ export interface HierarchyNode { parent: HierarchyNode | null; children?: Array>; /** - * Aggregated numeric value as calculated by sum(value), + * Aggregated numeric value as calculated by sum(value) or count(), * if previously invoked. */ readonly value?: number; @@ -35,6 +37,7 @@ export interface HierarchyNode { path(target: HierarchyNode): Array>; links(): Array>; sum(value: (d: Datum) => number): this; + count(): this; sort(compare: (a: HierarchyNode, b: HierarchyNode) => number): this; each(func: (node: HierarchyNode) => void): this; eachAfter(func: (node: HierarchyNode) => void): this; @@ -43,7 +46,7 @@ export interface HierarchyNode { } -export function hierarchy(data: Datum, children?: (d: Datum) => (Array | null)): HierarchyNode; +export function hierarchy(data: Datum, children?: (d: Datum) => (Datum[] | null)): HierarchyNode; // ----------------------------------------------------------------------- // Stratify @@ -53,11 +56,11 @@ export function hierarchy(data: Datum, children?: (d: Datum) => (Array { - (data: Array): HierarchyNode; - id(): (d: Datum, i: number, data: Array) => (string | null | '' | undefined); - id(id: (d: Datum, i?: number, data?: Array) => (string | null | '' | undefined)): this; - parentId(): (d: Datum, i: number, data: Array) => (string | null | '' | undefined); - parentId(parentId: (d: Datum, i?: number, data?: Array) => (string | null | '' | undefined)): this; + (data: Datum[]): HierarchyNode; + id(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined); + id(id: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this; + parentId(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined); + parentId(parentId: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this; } export function stratify(): StratifyOperator; @@ -80,7 +83,7 @@ export interface HierarchyPointNode { parent: HierarchyPointNode | null; children?: Array>; /** - * Aggregated numeric value as calculated by sum(value), + * Aggregated numeric value as calculated by sum(value) or count(), * if previously invoked. */ readonly value?: number; @@ -95,6 +98,7 @@ export interface HierarchyPointNode { path(target: HierarchyPointNode): Array>; links(): Array>; sum(value: (d: Datum) => number): this; + count(): this; sort(compare: (a: HierarchyPointNode, b: HierarchyPointNode) => number): this; each(func: (node: HierarchyPointNode) => void): this; eachAfter(func: (node: HierarchyPointNode) => void): this; @@ -150,7 +154,7 @@ export interface HierarchyRectangularNode { parent: HierarchyRectangularNode | null; children?: Array>; /** - * Aggregated numeric value as calculated by sum(value), + * Aggregated numeric value as calculated by sum(value) or count(), * if previously invoked. */ readonly value?: number; @@ -165,6 +169,7 @@ export interface HierarchyRectangularNode { path(target: HierarchyRectangularNode): Array>; links(): Array>; sum(value: (d: Datum) => number): this; + count(): this; sort(compare: (a: HierarchyRectangularNode, b: HierarchyRectangularNode) => number): this; each(func: (node: HierarchyRectangularNode) => void): this; eachAfter(func: (node: HierarchyRectangularNode) => void): this; @@ -258,7 +263,7 @@ export interface HierarchyCircularNode { parent: HierarchyCircularNode | null; children?: Array>; /** - * Aggregated numeric value as calculated by sum(value), + * Aggregated numeric value as calculated by sum(value) or count(), * if previously invoked. */ readonly value?: number; @@ -273,6 +278,7 @@ export interface HierarchyCircularNode { path(target: HierarchyCircularNode): Array>; links(): Array>; sum(value: (d: Datum) => number): this; + count(): this; sort(compare: (a: HierarchyCircularNode, b: HierarchyCircularNode) => number): this; each(func: (node: HierarchyCircularNode) => void): this; eachAfter(func: (node: HierarchyCircularNode) => void): this; @@ -310,6 +316,6 @@ export interface PackCircle { // For invocation of packEnclose the x and y coordinates are mandatory. It seems easier to just comment // on the mandatory nature, then to create separate interfaces and having to deal with recasting. -export function packSiblings(circles: Array): Array; +export function packSiblings(circles: Datum[]): Datum[]; -export function packEnclose(circles: Array): { r: number, x: number, y: number }; +export function packEnclose(circles: Datum[]): { r: number, x: number, y: number }; diff --git a/d3/index.d.ts b/d3/index.d.ts index 61953fe148..bf7fa8e6b6 100644 --- a/d3/index.d.ts +++ b/d3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3 standard bundle 4.4 +// Type definitions for D3JS d3 standard bundle 4.5 // Project: https://github.com/d3/d3 // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/dockerode/dockerode-tests.ts b/dockerode/dockerode-tests.ts new file mode 100644 index 0000000000..e1533e91f7 --- /dev/null +++ b/dockerode/dockerode-tests.ts @@ -0,0 +1,58 @@ +import * as Docker from 'dockerode'; + +// Code samples from Dockerode 'Getting started' +const docker = new Docker(); +const docker1 = new Docker({ socketPath: '/var/run/docker.sock' }); +const docker2 = new Docker({ host: 'http://192.168.1.10', port: 3000 }); +const docker3 = new Docker({ protocol: 'http', host: '127.0.0.1', port: 3000 }); +const docker4 = new Docker({ host: '127.0.0.1', port: 3000 }); + +const docker5 = new Docker({ + host: '192.168.1.10', + port: process.env.DOCKER_PORT || 2375, + ca: 'ca', + cert: 'cert', + key: 'key' +}); + +const docker6 = new Docker({ + protocol: 'https', //you can enforce a protocol + host: '192.168.1.10', + port: process.env.DOCKER_PORT || 2375, + ca: 'ca', + cert: 'cert', + key: 'key' +}); + +const container = docker.getContainer('container-id'); +container.inspect((err, data) => { + // NOOP +}); + +container.start((err, data) => { + // NOOP +}); + +container.remove((err, data) => { + // NOOP +}); + +docker.listContainers((err, containers) => { + containers.forEach(container => { + docker + .getContainer(container.Id) + .stop((err, data) => { + // NOOP + }); + }); +}); + +docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => { + // NOOP +}); + +docker.createContainer({ Tty: true }, (err, container) => { + container.start((err, data) => { + // NOOP + }); +}); \ No newline at end of file diff --git a/dockerode/index.d.ts b/dockerode/index.d.ts new file mode 100644 index 0000000000..2c5caaf9cc --- /dev/null +++ b/dockerode/index.d.ts @@ -0,0 +1,643 @@ +// Type definitions for dockerode 2.3 +// Project: https://github.com/apocas/dockerode +// Definitions by: Carl Winkler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from 'stream'; +import * as events from 'events'; + + +declare namespace Dockerode { + interface Container { + inspect(options: {}, callback: Callback): void; + inspect(callback: Callback): void; + inspect(options?: {}): { id: string }; + + rename(options: {}, callback: Callback): void; + + update(options: {}, callback: Callback): void; + + top(options: {}, callback: Callback): void; + top(callback: Callback): void; + + changes(callback: Callback): void; + + export(callback: Callback): void; + + start(options: {}, callback: Callback): void; + start(callback: Callback): void; + + pause(options: {}, callback: Callback): void; + pause(callback: Callback): void; + + unpause(options: {}, callback: Callback): void; + unpause(callback: Callback): void; + + exec(options: {}, callback: Callback): void; + + commit(options: {}, callback: Callback): void; + commit(callback: Callback): void; + + stop(options: {}, callback: Callback): void; + stop(callback: Callback): void; + + restart(options: {}, callback: Callback): void; + restart(callback: Callback): void; + + kill(options: {}, callback: Callback): void; + kill(callback: Callback): void; + + resize(options: {}, callback: Callback): void; + resize(callback: Callback): void; + + wait(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + /** Deprecated since RAPI v1.20 */ + copy(options: {}, callback: Callback): void; + /** Deprecated since RAPI v1.20 */ + copy(callback: Callback): void; + + getArchive(options: {}, callback: Callback): void; + + infoArchive(options: {}, callback: Callback): void; + + /** @param file Filename (will read synchronously), Buffer or stream */ + putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback): void; + + logs(options: { stdout?: boolean, stderr?: boolean, follow?: boolean, since?: number, details?: boolean, tail?: number, timestamps?: boolean }, callback: Callback): void; + logs(callback: Callback): void; + + stats(options: {}, callback: Callback): void; + stats(callback: Callback): void; + + attach(options: {}, callback: Callback): void; + + modem: any; + id?: string; + } + + interface Image { + inspect(callback: Callback): void; + + history(callback: Callback): void; + + get(callback: Callback): void; + + push(options: {}, callback: Callback): void; + push(callback: Callback): void; + + tag(options: {}, callback: Callback): void; + tag(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + modem: any; + id?: string; + } + + interface Volume { + inspect(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + modem: any; + name?: string; + } + + interface Service { + inspect(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + update(options: {}, callback: Callback): void; + + modem: any; + id?: string; + } + + interface Task { + inspect(callback: Callback): void; + + modem: any; + id?: string; + } + + interface Node { + inspect(callback: Callback): void; + + modem: any; + id?: string; + } + + interface Network { + inspect(callback: Callback): void; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + + connect(options: {}, callback: Callback): void; + connect(callback: Callback): void; + + disconnect(options: {}, callback: Callback): void; + disconnect(callback: Callback): void; + + modem: any; + id?: string; + } + + interface Exec { + inspect(callback: Callback): void; + + start(options: {}, callback: Callback): void; + + resize(options: {}, callback: Callback): void; + + modem: any; + id?: string; + } + + interface ImageInfo { + Id: string; + ParentId: string; + RepoTags: string[]; + RepoDigests?: string[]; + Created: number; + Size: number; + VirtualSize: number; + Labels: { [label: string]: string }; + } + + interface ContainerInfo { + Id: string; + Names: string[]; + Image: string; + ImageID: string; + Command: string; + Created: number; + Ports: Port[]; + Labels: { [label: string]: string }; + Status: string; + HostConfig: { + NetworkMode: string; + }; + NetworkSettings: { + Networks: { [networkType: string]: NetworkInfo } + }; + } + + interface Port { + IP: string; + PrivatePort: number; + PublicPort: number; + Type: string; + } + + interface NetworkInfo { + IPAMConfig?: any; + Links?: any; + Aliases?: any; + NetworkID: string; + EndpointID: string; + Gateway: string; + IPAddress: string; + IPPrefixLen: number; + IPv6Gateway: string; + GlobalIPv6Address: string; + GlobalIPv6PrefixLen: number; + MacAddress: string; + } + + interface ContainerInspectInfo { + Id: string; + Created: string; + Path: string; + Args: string[]; + State: { + Status: string; + Running: boolean; + Paused: boolean; + Restarting: boolean; + OOMKilled: boolean; + Dead: boolean; + Pid: number; + ExitCode: number; + Error: string; + StartedAt: string; + FinishedAt: string; + }; + Image: string; + ResolvConfPath: string; + HostnamePath: string; + HostsPath: string; + LogPath: string; + Name: string; + RestartCount: number; + Driver: string; + MountLabel: string; + ProcessLabel: string; + AppArmorProfile: string; + ExecIDs?: any; + HostConfig: HostConfig; + GraphDriver: { + Name: string; + Data: { + DeviceId: string; + DeviceName: string; + DeviceSize: string; + } + }; + Mounts: Array<{ + Source: string; + Destination: string; + Mode: string; + RW: boolean; + Propagation: string; + }>; + Config: { + Hostname: string; + Domainname: string; + User: string; + AttachStdin: boolean; + AttachStdout: boolean; + AttachStderr: boolean; + ExposedPorts: { [portAndProtocol: string]: {} }; + Tty: boolean; + OpenStdin: boolean; + StdinOnce: boolean; + Env: string[]; + Cmd: string[]; + Image: string; + Volumes: { [volume: string]: {} }; + WorkingDir: string; + Entrypoint?: any; + OnBuild?: any; + Labels: { [label: string]: string } + }; + NetworkSettings: { + Bridge: string; + SandboxID: string; + HairpinMode: boolean; + LinkLocalIPv6Address: string; + LinkLocalIPv6PrefixLen: number; + Ports: { + [portAndProtocol: string]: { + HostIp: string; + HostPort: string; + } + }; + SandboxKey: string; + SecondaryIPAddresses?: any; + SecondaryIPv6Addresses?: any; + EndpointID: string; + Gateway: string; + GlobalIPv6Address: string; + GlobalIPv6PrefixLen: number; + IPAddress: string; + IPPrefixLen: number; + IPv6Gateway: string; + MacAddress: string; + Networks: { + [type: string]: { + IPAMConfig?: any; + Links?: any; + Aliases?: any; + NetworkID: string; + EndpointID: string; + Gateway: string; + IPAddress: string; + IPPrefixLen: number; + IPv6Gateway: string; + GlobalIPv6Address: string; + GlobalIPv6PrefixLen: number; + MacAddress: string; + } + } + }; + } + + interface HostConfig { + Binds: string[]; + ContainerIDFile: string; + LogConfig: { + Type: string; + Config: any; + }; + NetworkMode: string; + PortBindings?: any; + RestartPolicy: { + Name: string; + MaximumRetryCount: number; + }; + VolumeDriver: string; + VolumesFrom?: any; + CapAdd?: any; + CapDrop?: any; + Dns: any[]; + DnsOptions: any[]; + DnsSearch: any[]; + ExtraHosts?: any; + IpcMode: string; + Links?: any; + OomScoreAdj: number; + PidMode: string; + Privileged: boolean; + PublishAllPorts: boolean; + ReadonlyRootfs: boolean; + SecurityOpt?: any; + UTSMode: string; + ShmSize: number; + ConsoleSize: number[]; + Isolation: string; + CpuShares: number; + CgroupParent: string; + BlkioWeight: number; + BlkioWeightDevice?: any; + BlkioDeviceReadBps?: any; + BlkioDeviceWriteBps?: any; + BlkioDeviceReadIOps?: any; + BlkioDeviceWriteIOps?: any; + CpuPeriod: number; + CpuQuota: number; + CpusetCpus: string; + CpusetMems: string; + Devices?: any; + KernelMemory: number; + Memory: number; + MemoryReservation: number; + MemorySwap: number; + MemorySwappiness: number; + OomKillDisable: boolean; + PidsLimit: number; + Ulimits?: any; + } + + interface ImageInspectInfo { + Id: string; + RepoTags: string[]; + RepoDigests: string[]; + Parent: string; + Comment: string; + Created: string; + Container: string; + ContainerConfig: + { + Hostname: string; + Domainname: string; + User: string; + AttachStdin: boolean; + AttachStdout: boolean; + AttachStderr: boolean; + ExposedPorts: { [portAndProtocol: string]: {} }; + Tty: boolean; + OpenStdin: boolean; + StdinOnce: boolean; + Env: string[]; + Cmd: string[]; + ArgsEscaped: boolean; + Image: string; + Volumes: { [path: string]: {} }, + WorkingDir: string; + Entrypoint?: any; + OnBuild?: any[]; + Labels: { [label: string]: string } + }; + DockerVersion: string; + Author: string; + Config: + { + Hostname: string; + Domainname: string; + User: string; + AttachStdin: boolean; + AttachStdout: boolean; + AttachStderr: boolean; + ExposedPorts: { [portAndProtocol: string]: {} } + Tty: boolean; + OpenStdin: boolean; + StdinOnce: boolean; + Env: string[]; + Cmd: string[]; + ArgsEscaped: boolean; + Image: string; + Volumes: { [path: string]: {} }, + WorkingDir: string; + Entrypoint?: any; + OnBuild: any[]; + Labels: { [label: string]: string } + }; + Architecture: string; + Os: string; + Size: number; + VirtualSize: number; + GraphDriver: + { + Name: string; + Data: + { + DeviceId: string; + DeviceName: string; + DeviceSize: string; + } + }; + } + + interface ContainerCreateOptions { + name?: string; + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + AttachStdout?: boolean; + AttachStderr?: boolean; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + Env?: string[]; + Cmd?: string[]; + Entrypoint?: string; + Image?: string; + Labels?: { [label: string]: string }; + Volumes?: { [volume: string]: {} }; + WorkingDir?: string; + NetworkDisabled?: boolean; + MacAddress?: boolean; + ExposedPorts?: { [port: string]: {} }; + StopSignal?: string; + HostConfig?: { + Binds?: string[]; + Links?: string[]; + Memory?: number; + MemorySwap?: number; + MemoryReservation?: number; + KernelMemory?: number; + CpuPercent?: number; + CpuShares?: number; + CpuPeriod?: number; + CpuQuota?: number; + CpusetMems?: string; + MaximumIOps?: number; + MaxmimumIOBps?: number; + BlkioWeightDevice?: Array<{}>; + BlkioDeviceReadBps?: Array<{}>; + BlkioDeviceReadIOps?: Array<{}>; + BlkioDeviceWriteBps?: Array<{}>; + BlkioDeviceWriteIOps?: Array<{}>; + MemorySwappiness?: number; + OomKillDisable?: boolean; + OomScoreAdj?: number; + PidMode?: string; + PidsLimit?: number; + PortBindings?: { [portAndProtocol: string]: Array<{ [index: string]: string }> }; + PublishAllPorts?: boolean; + Privileged?: boolean; + ReadonlyRootfs?: boolean; + Dns?: string[]; + DnsOptions?: string[]; + DnsSearch?: string[]; + ExtraHosts?: any; + VolumesFrom?: string[]; + CapAdd?: string[]; + CapDrop?: string[]; + GroupAdd?: string[]; + RestartPolicy?: { [index: string]: number | string }; + NetworkMode?: string; + Devices?: any[]; + Sysctls?: { [index: string]: string }; + Ulimits?: Array<{}>; + LogConfig?: { [index: string]: string | {} }; + SecurityOpt?: { [index: string]: any }; + CgroupParent?: string; + VolumeDriver?: string; + ShmSize?: number; + }; + NetworkingConfig?: { + EndpointsConfig?: { + [index: string]: any; + isolated_nw?: { + [index: string]: any; + IPAMConfig?: { + IPv4Address?: string; + IPv6Adress?: string; + LinkLocalIPs?: string[]; + } + Links?: string[]; + Aliases?: string[]; + } + } + }; + } + + interface DockerOptions { + socketPath?: string; + host?: string; + port?: number; + ca?: string; + cert?: string; + key?: string; + protocol?: "https" | "http"; + timeout?: number; + } +} + +type Callback = (error?: any, result?: T) => void; + +declare class Dockerode { + constructor(options?: Dockerode.DockerOptions); + + createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback): void; + + createImage(options: {}, callback: Callback): void; + createImage(auth: any, options: {}, callback: Callback): void; + + loadImage(file: string, options: {}, callback: Callback): void; + loadImage(file: string, callback: Callback): void; + + importImage(file: string, options: {}, callback: Callback): void; + importImage(file: string, callback: Callback): void; + + checkAuth(options: any, callback: Callback): void; + + buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; + buildImage(file: string | NodeJS.ReadableStream, callback: Callback): void; + + getContainer(id: string): Dockerode.Container; + + getImage(name: string): Dockerode.Image; + + getVolume(name: string): Dockerode.Volume; + + getService(id: string): Dockerode.Service; + + getTask(id: string): Dockerode.Task; + + getNode(id: string): Node; + + getNetwork(id: string): Dockerode.Network; + + getExec(id: string): Dockerode.Exec; + + listContainers(options: {}, callback: Callback): void; + listContainers(callback: Callback): void; + + listImages(options: {}, callback: Callback): void; + listImages(callback: Callback): void; + + listServices(options: {}, callback: Callback): void; + listServices(callback: Callback): void; + + listNodes(options: {}, callback: Callback): void; + listNodes(callback: Callback): void; + + listTasks(options: {}, callback: Callback): void; + listTasks(callback: Callback): void; + + listVolumes(options: {}, callback: Callback): void; + listVolumes(callback: Callback): void; + + listNetworks(options: {}, callback: Callback): void; + listNetworks(callback: Callback): void; + + createVolume(options: {}, callback: Callback): void; + + createService(options: {}, callback: Callback): void; + + createNetwork(options: {}, callback: Callback): void; + + searchImages(options: {}, callback: Callback): void; + + info(callback: Callback): void; + + version(callback: Callback): void; + + ping(callback: Callback): void; + + getEvents(options: {}, callback: Callback): void; + getEvents(callback: Callback): void; + + pull(repoTag: string, options: {}, callback: Callback, auth?: {}): Dockerode.Image; + + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, startOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, startOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, callback: Callback): events.EventEmitter; + + swarmInit(options: {}, callback: Callback): void; + + swarmJoin(options: {}, callback: Callback): void; + + swarmLeave(options: {}, callback: Callback): void; + + swarmUpdate(options: {}, callback: Callback): void; + + modem: any; +} + +export = Dockerode; \ No newline at end of file diff --git a/dockerode/tsconfig.json b/dockerode/tsconfig.json new file mode 100644 index 0000000000..a077f02e3c --- /dev/null +++ b/dockerode/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dockerode-tests.ts" + ] +} \ No newline at end of file diff --git a/dockerode/tslint.json b/dockerode/tslint.json new file mode 100644 index 0000000000..785a601162 --- /dev/null +++ b/dockerode/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} \ No newline at end of file diff --git a/dot-object/index.d.ts b/dot-object/index.d.ts index 176e1c0daf..8bb7d0657c 100644 --- a/dot-object/index.d.ts +++ b/dot-object/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Dot-Object v1.4.2 +// Type definitions for Dot-Object v1.5 // Project: https://github.com/rhalff/dot-object // Definitions by: Niko Kovačič // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -109,7 +109,7 @@ declare namespace DotObject { * @param {Object} obj * @param {Boolean} remove */ - pick(path: string, obj: any, remove?: boolean): void; + pick(path: string, obj: any, remove?: boolean): any; /** * * Remove value from an object using dot notation. diff --git a/draft-js/index.d.ts b/draft-js/index.d.ts index e02044a006..1805a17ab0 100644 --- a/draft-js/index.d.ts +++ b/draft-js/index.d.ts @@ -458,7 +458,7 @@ declare namespace Draft { entityMap: { [key: string]: RawDraftEntity }; } - function convertFromHTMLtoContentBlocks(html: string, DOMBuilder: Function, blockRenderMap?: DraftBlockRenderMap): Array; + function convertFromHTMLtoContentBlocks(html: string, DOMBuilder?: Function, blockRenderMap?: DraftBlockRenderMap): Array; function convertFromRawToDraftState(rawState: RawDraftContentState): ContentState; function convertFromDraftStateToRaw(contentState: ContentState): RawDraftContentState; } diff --git a/dragster/dragster-tests.ts b/dragster/dragster-tests.ts new file mode 100644 index 0000000000..a05d06e1dd --- /dev/null +++ b/dragster/dragster-tests.ts @@ -0,0 +1,7 @@ +import Dragster = require("dragster"); + +var dropzone = document.getElementById("my-dropzone") as HTMLElement; +var dragster = new Dragster(dropzone); + +dragster.removeListeners(); +dragster.reset(); \ No newline at end of file diff --git a/dragster/index.d.ts b/dragster/index.d.ts new file mode 100644 index 0000000000..d60892244e --- /dev/null +++ b/dragster/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for dragster 0.1 +// Project: https://github.com/bensmithett/dragster +// Definitions by: Zsolt Kovacs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Dragster { + constructor(elem: HTMLElement); + removeListeners(): void; + reset(): void; +} + +export = Dragster; \ No newline at end of file diff --git a/axios/tsconfig.json b/dragster/tsconfig.json similarity index 86% rename from axios/tsconfig.json rename to dragster/tsconfig.json index 4300cfb925..9740d729a0 100644 --- a/axios/tsconfig.json +++ b/dragster/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "axios-tests.ts" + "dragster-tests.ts" ] } \ No newline at end of file diff --git a/dragster/tslint.json b/dragster/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/dragster/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/elastic.js/elastic.js-tests.ts b/elastic.js/elastic.js-tests.ts index e7bd65ea16..b683559490 100644 --- a/elastic.js/elastic.js-tests.ts +++ b/elastic.js/elastic.js-tests.ts @@ -1,6 +1,13 @@ import * as elasticjs from 'elastic.js'; -let body = new elasticjs.Request({}) +new elasticjs.Request({}) .query(new elasticjs.MatchQuery('title_field', 'testQuery')) .facet(new elasticjs.TermsFacet('tags').field('tags')) .toJSON(); + +new elasticjs.Request({}) + .query(new elasticjs.MatchAllQuery()) + .filter(new elasticjs.BoolFilter().must([ + new elasticjs.TermFilter('a', 'b'), + new elasticjs.TermFilter('c', 'd')])) + .toJSON(); diff --git a/elastic.js/index.d.ts b/elastic.js/index.d.ts index adb0db6950..e8b57c5cb7 100644 --- a/elastic.js/index.d.ts +++ b/elastic.js/index.d.ts @@ -6765,7 +6765,7 @@ declare module elasticjs { /* Allows you to set a specified filter on this request object. */ - filter(filter: Object): Request; + filter(filter: Filter): Request; /* A search result set could be very large (think Google). Setting the diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 035f0dfcd7..82a8dc9822 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -1,48 +1,44 @@ -import { shallow, mount, render, describeWithDOM, spyLifecycle } from "enzyme"; import * as React from "react"; -import {Component, ReactElement, HTMLAttributes} from "react"; -import {ShallowWrapper, ReactWrapper, CheerioWrapper} from "enzyme"; +import {shallow, mount, render, ShallowWrapper, ReactWrapper} from "enzyme"; +import {Component, ReactElement, HTMLAttributes, ComponentClass, StatelessComponent} from "react"; // Help classes/interfaces interface MyComponentProps { - propsProperty: any; + stringProp: string; numberProp?: number; } interface StatelessProps { - stateless: any; + stateless: string; } interface MyComponentState { - stateProperty: any; + stateProperty: string; } class MyComponent extends Component { setState(...args: any[]) { + console.log(args); } } const MyStatelessComponent = (props: StatelessProps) => ; -// API -namespace SpyLifecycleTest { - spyLifecycle(MyComponent); -} - // ShallowWrapper namespace ShallowWrapperTest { var shallowWrapper: ShallowWrapper = - shallow(); + shallow(); var reactElement: ReactElement, - objectVal: Object, - boolVal: Boolean, - stringVal: String, + objectVal: {}, + boolVal: boolean, + stringVal: string, numOrStringVal: number | string, - elementWrapper: ShallowWrapper, {}> + elementWrapper: ShallowWrapper, {}>, + statelessWrapper: ShallowWrapper; function test_shallow_options() { - shallow(, { + shallow(, { context: { test: "a", }, @@ -51,11 +47,10 @@ namespace ShallowWrapperTest { } function test_find() { - elementWrapper = shallowWrapper.find('.selector'); shallowWrapper = shallowWrapper.find(MyComponent); - shallowWrapper.find(MyStatelessComponent).props().stateless; - shallowWrapper.find(MyStatelessComponent).shallow(); - shallowWrapper.find({ prop: 'value' }); + statelessWrapper = shallowWrapper.find(MyStatelessComponent); + shallowWrapper = shallowWrapper.find({ prop: 'value' }); + elementWrapper = shallowWrapper.find('.selector'); } function test_findWhere() { @@ -64,15 +59,16 @@ namespace ShallowWrapperTest { } function test_filter() { + shallowWrapper = shallowWrapper.filter(MyComponent); + statelessWrapper = statelessWrapper.filter(MyStatelessComponent); + shallowWrapper = shallowWrapper.filter({ numberProp: 12 }); elementWrapper = shallowWrapper.filter('.selector'); - shallowWrapper = shallowWrapper.filter(MyComponent).shallow(); - shallowWrapper.filter({ prop: 'val' }); } function test_filterWhere() { shallowWrapper = shallowWrapper.filterWhere(wrapper => { - wrapper.props().propsProperty; + wrapper.props().stringProp; return true; }); } @@ -95,11 +91,11 @@ namespace ShallowWrapperTest { function test_dive() { interface TmpProps { - foo: any + foo: any; } interface TmpState { - bar: any + bar: any; } const diveWrapper: ShallowWrapper = shallowWrapper.dive({ context: { foobar: 'barfoo' }}); @@ -122,11 +118,11 @@ namespace ShallowWrapperTest { } function test_isEmpty() { - boolVal = shallowWrapper.isEmpty() + boolVal = shallowWrapper.isEmpty(); } function test_exists() { - boolVal = shallowWrapper.exists() + boolVal = shallowWrapper.exists(); } function test_not() { @@ -135,19 +131,21 @@ namespace ShallowWrapperTest { function test_children() { shallowWrapper = shallowWrapper.children(); - shallowWrapper.children(MyStatelessComponent).props().stateless; - shallowWrapper.children({ prop: 'myprop' }); + shallowWrapper = shallowWrapper.children(MyComponent); + statelessWrapper = shallowWrapper.children(MyStatelessComponent); + shallowWrapper = shallowWrapper.children({ prop: 'value' }); + elementWrapper = shallowWrapper.children('.selector'); } function test_childAt() { const childWrapper: ShallowWrapper = shallowWrapper.childAt(0); interface TmpType1 { - foo: any + foo: any; } interface TmpType2 { - bar: any + bar: any; } const childWrapper2: ShallowWrapper = shallowWrapper.childAt(0); @@ -155,6 +153,10 @@ namespace ShallowWrapperTest { function test_parents() { shallowWrapper = shallowWrapper.parents(); + shallowWrapper = shallowWrapper.parents(MyComponent); + statelessWrapper = shallowWrapper.parents(MyStatelessComponent); + shallowWrapper = shallowWrapper.parents({ prop: 'myprop' }); + elementWrapper = shallowWrapper.parents('.selector'); } function test_parent() { @@ -162,9 +164,10 @@ namespace ShallowWrapperTest { } function test_closest() { - elementWrapper = shallowWrapper.closest('.selector'); shallowWrapper = shallowWrapper.closest(MyComponent); + statelessWrapper = shallowWrapper.closest(MyStatelessComponent); shallowWrapper = shallowWrapper.closest({ prop: 'myprop' }); + elementWrapper = shallowWrapper.closest('.selector'); } function test_shallow() { @@ -175,15 +178,10 @@ namespace ShallowWrapperTest { shallowWrapper = shallowWrapper.unmount(); } - function test_render() { - var cheerioWrapper: CheerioWrapper = shallowWrapper.render(); - } - function test_text() { stringVal = shallowWrapper.text(); } - function test_html() { stringVal = shallowWrapper.html(); } @@ -206,23 +204,28 @@ namespace ShallowWrapperTest { function test_state() { const state: MyComponentState = shallowWrapper.state(); - shallowWrapper.state('key'); - const tmp: String = shallowWrapper.state('key'); + const prop: string = shallowWrapper.state('stateProperty'); + const prop2: number = shallowWrapper.state('key'); + const prop3 = shallowWrapper.state('key'); } function test_context() { shallowWrapper.context(); shallowWrapper.context('key'); - const tmp: String = shallowWrapper.context('key'); + const tmp: string = shallowWrapper.context('key'); } function test_props() { - objectVal = shallowWrapper.props(); + const props: MyComponentProps = shallowWrapper.props(); + const props2: MyComponentProps = shallowWrapper.find(MyComponent).props(); + const props3: StatelessProps = shallowWrapper.find(MyStatelessComponent).props(); + const props4: HTMLAttributes = shallowWrapper.find('.selector').props(); } function test_prop() { - shallowWrapper.prop('key'); - const tmp: String = shallowWrapper.prop('key'); + const tmp: number = shallowWrapper.prop('numberProp'); + const tmp2: string = shallowWrapper.prop('key'); + const tmp3 = shallowWrapper.prop('key'); } function test_key() { @@ -239,7 +242,7 @@ namespace ShallowWrapperTest { } function test_setProps() { - shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' }, () => console.log('props updated')); + shallowWrapper = shallowWrapper.setProps({ stringProp: 'foo' }); } function test_setContext() { @@ -259,20 +262,20 @@ namespace ShallowWrapperTest { } function test_type() { - var stringOrFunction: String | Function = shallowWrapper.type(); + const type: string | StatelessComponent | ComponentClass = shallowWrapper.type(); } function test_name() { - var str: String = shallowWrapper.name(); + stringVal = shallowWrapper.name(); } function test_forEach() { shallowWrapper = - shallowWrapper.forEach(wrapper => wrapper.shallow().props().propsProperty); + shallowWrapper.forEach(wrapper => wrapper.shallow().props().stringProp); } function test_map() { - var arrayNumbers: Array = + var arrayNumbers: number[] = shallowWrapper.map(wrapper => wrapper.props().numberProp); } @@ -286,13 +289,15 @@ namespace ShallowWrapperTest { function test_reduceRight() { const total: number = shallowWrapper.reduceRight( - (amount: number, n: ShallowWrapper) => amount + n.prop('amount') + (amount: number, n: ShallowWrapper) => amount + n.prop('numberProp') ); } function test_some() { - boolVal = shallowWrapper.some('.selector'); boolVal = shallowWrapper.some(MyComponent); + boolVal = shallowWrapper.some(MyStatelessComponent); + boolVal = shallowWrapper.some({ prop: 'myprop' }); + boolVal = shallowWrapper.some('.selector'); } function test_someWhere() { @@ -300,8 +305,10 @@ namespace ShallowWrapperTest { } function test_every() { - boolVal = shallowWrapper.every('.selector'); boolVal = shallowWrapper.every(MyComponent); + boolVal = shallowWrapper.every(MyStatelessComponent); + boolVal = shallowWrapper.every({ prop: 'myprop' }); + boolVal = shallowWrapper.every('.selector'); } function test_everyWhere() { @@ -321,13 +328,14 @@ namespace ShallowWrapperTest { // ReactWrapper namespace ReactWrapperTest { var reactWrapper: ReactWrapper = - mount(); + mount(); var reactElement: ReactElement, - objectVal: Object, - boolVal: Boolean, - stringVal: String, - elementWrapper: ReactWrapper, {}> + objectVal: {}, + boolVal: boolean, + stringVal: string, + elementWrapper: ReactWrapper, {}>, + statelessWrapper: ReactWrapper; function test_unmount() { reactWrapper = reactWrapper.unmount(); @@ -336,7 +344,7 @@ namespace ReactWrapperTest { function test_mount() { reactWrapper = reactWrapper.mount(); - mount(, { + mount(, { attachTo: document.getElementById('test'), context: { a: "b" @@ -348,11 +356,11 @@ namespace ReactWrapperTest { reactWrapper = reactWrapper.ref('refName'); interface TmpType1 { - foo: string + foo: string; } interface TmpType2 { - bar: string + bar: string; } const tmp: ReactWrapper = reactWrapper.ref('refName'); @@ -365,8 +373,8 @@ namespace ReactWrapperTest { function test_find() { elementWrapper = reactWrapper.find('.selector'); reactWrapper = reactWrapper.find(MyComponent); - reactWrapper.find(MyStatelessComponent).props().stateless; - reactWrapper.find({ prop: 'myprop' }); + statelessWrapper = reactWrapper.find(MyStatelessComponent); + reactWrapper = reactWrapper.find({ prop: 'myprop' }); } function test_findWhere() { @@ -375,15 +383,16 @@ namespace ReactWrapperTest { } function test_filter() { - elementWrapper = reactWrapper.filter('.selector'); reactWrapper = reactWrapper.filter(MyComponent); - reactWrapper = reactWrapper.filter({ prop: 'myprop' }); + statelessWrapper = statelessWrapper.filter(MyStatelessComponent); + reactWrapper = reactWrapper.filter({ numberProp: 12 }); + elementWrapper = reactWrapper.filter('.selector'); } function test_filterWhere() { reactWrapper = reactWrapper.filterWhere(wrapper => { - wrapper.props().propsProperty; + wrapper.props().stringProp; return true; }); } @@ -421,7 +430,7 @@ namespace ReactWrapperTest { } function test_isEmpty() { - boolVal = reactWrapper.isEmpty() + boolVal = reactWrapper.isEmpty(); } function test_not() { @@ -430,17 +439,21 @@ namespace ReactWrapperTest { function test_children() { reactWrapper = reactWrapper.children(); + reactWrapper = reactWrapper.children(MyComponent); + statelessWrapper = reactWrapper.children(MyStatelessComponent); + reactWrapper = reactWrapper.children({ prop: 'myprop' }); + elementWrapper = reactWrapper.children('.selector'); } function test_childAt() { const childWrapper: ReactWrapper = reactWrapper.childAt(0); interface TmpType1 { - foo: any + foo: any; } interface TmpType2 { - bar: any + bar: any; } const childWrapper2: ReactWrapper = reactWrapper.childAt(0); @@ -448,6 +461,10 @@ namespace ReactWrapperTest { function test_parents() { reactWrapper = reactWrapper.parents(); + reactWrapper = reactWrapper.parents(MyComponent); + statelessWrapper = reactWrapper.parents(MyStatelessComponent); + reactWrapper = reactWrapper.parents({ prop: 'myprop' }); + elementWrapper = reactWrapper.parents('.selector'); } function test_parent() { @@ -455,9 +472,10 @@ namespace ReactWrapperTest { } function test_closest() { - elementWrapper = reactWrapper.closest('.selector'); reactWrapper = reactWrapper.closest(MyComponent); + statelessWrapper = reactWrapper.closest(MyStatelessComponent); reactWrapper = reactWrapper.closest({ prop: 'myprop' }); + elementWrapper = reactWrapper.closest('.selector'); } function test_text() { @@ -485,24 +503,29 @@ namespace ReactWrapperTest { } function test_state() { - reactWrapper.state(); - reactWrapper.state('key'); - const tmp: String = reactWrapper.state('key'); + const state: MyComponentState = reactWrapper.state(); + const prop: string = reactWrapper.state('stateProperty'); + const prop2: number = reactWrapper.state('key'); + const prop3 = reactWrapper.state('key'); } function test_context() { reactWrapper.context(); reactWrapper.context('key'); - const tmp: String = reactWrapper.context('key'); + const tmp: string = reactWrapper.context('key'); } function test_props() { - objectVal = reactWrapper.props(); + const props: MyComponentProps = reactWrapper.props(); + const props2: MyComponentProps = reactWrapper.find(MyComponent).props(); + const props3: StatelessProps = reactWrapper.find(MyStatelessComponent).props(); + const props4: HTMLAttributes = reactWrapper.find('.selector').props(); } function test_prop() { - reactWrapper.prop('key'); - const tmp: String = reactWrapper.prop('key'); + const tmp: number = reactWrapper.prop('numberProp'); + const tmp2: string = reactWrapper.prop('key'); + const tmp3 = reactWrapper.prop('key'); } function test_key() { @@ -519,7 +542,7 @@ namespace ReactWrapperTest { } function test_setProps() { - reactWrapper = reactWrapper.setProps({ propsProperty: 'foo' }); + reactWrapper = reactWrapper.setProps({ stringProp: 'foo' }); } function test_setContext() { @@ -539,40 +562,42 @@ namespace ReactWrapperTest { } function test_type() { - var stringOrFunction: String | Function = reactWrapper.type(); + const type: string | StatelessComponent | ComponentClass = reactWrapper.type(); } function test_name() { - var str: String = reactWrapper.name(); + stringVal = reactWrapper.name(); } function test_forEach() { reactWrapper = - reactWrapper.forEach(wrapper => wrapper.props().propsProperty); + reactWrapper.forEach(wrapper => wrapper.props().stringProp); } function test_map() { - var arrayNumbers: Array = + var arrayNumbers: number[] = reactWrapper.map(wrapper => wrapper.props().numberProp); } function test_reduce() { const total: number = reactWrapper.reduce( - (amount: number, n: ReactWrapper) => amount + n.prop('amount') + (amount: number, n: ReactWrapper) => amount + n.prop('numberProp') ); } function test_reduceRight() { const total: number = reactWrapper.reduceRight( - (amount: number, n: ReactWrapper) => amount + n.prop('amount') + (amount: number, n: ReactWrapper) => amount + n.prop('numberProp') ); } function test_some() { - boolVal = reactWrapper.some('.selector'); boolVal = reactWrapper.some(MyComponent); + boolVal = reactWrapper.some(MyStatelessComponent); + boolVal = reactWrapper.some({ prop: 'myprop' }); + boolVal = reactWrapper.some('.selector'); } function test_someWhere() { @@ -580,8 +605,10 @@ namespace ReactWrapperTest { } function test_every() { - boolVal = reactWrapper.every('.selector'); boolVal = reactWrapper.every(MyComponent); + boolVal = reactWrapper.every(MyStatelessComponent); + boolVal = reactWrapper.every({ prop: 'myprop' }); + boolVal = reactWrapper.every('.selector'); } function test_everyWhere() { @@ -594,239 +621,9 @@ namespace ReactWrapperTest { // CheerioWrapper namespace CheerioWrapperTest { - var cheerioWrapper: CheerioWrapper = - render(); + const wrapper: Cheerio = + shallow(
).render() || + mount(
).render(); - var reactElement: ReactElement, - objectVal: Object, - boolVal: Boolean, - stringVal: String, - elementWrapper: CheerioWrapper, {}> - - function test_find() { - elementWrapper = cheerioWrapper.find('.selector'); - cheerioWrapper = cheerioWrapper.find(MyComponent); - cheerioWrapper.find(MyStatelessComponent).props().stateless; - cheerioWrapper.find({ prop: 'myprop' }); - } - - function test_findWhere() { - cheerioWrapper = - cheerioWrapper.findWhere((aCheerioWrapper: CheerioWrapper) => true); - } - - function test_filter() { - elementWrapper = cheerioWrapper.filter('.selector'); - cheerioWrapper = cheerioWrapper.filter(MyComponent); - cheerioWrapper = cheerioWrapper.filter({ prop: 'myprop' }); - } - - function test_filterWhere() { - cheerioWrapper = - cheerioWrapper.filterWhere(wrapper => { - wrapper.props().propsProperty; - return true; - }); - } - - function test_contains() { - boolVal = cheerioWrapper.contains(
); - } - - function test_containsMatchingElement() { - boolVal = cheerioWrapper.contains(
); - } - - function test_containsAllMatchingElements() { - boolVal = cheerioWrapper.containsAllMatchingElements([
]); - } - - function test_containsAnyMatchingElement() { - boolVal = cheerioWrapper.containsAnyMatchingElements([
]); - } - - function test_equals() { - boolVal = cheerioWrapper.equals(
); - } - - function test_matchesElement() { - boolVal = cheerioWrapper.matchesElement(
); - } - - function test_hasClass() { - boolVal = cheerioWrapper.find('.my-button').hasClass('disabled'); - } - - function test_is() { - boolVal = cheerioWrapper.is('.some-class'); - } - - function test_isEmpty() { - boolVal = cheerioWrapper.isEmpty() - } - - function test_not() { - elementWrapper = cheerioWrapper.find('.foo').not('.bar'); - } - - function test_children() { - cheerioWrapper = cheerioWrapper.children(); - } - - function test_childAt() { - const childWrapper: CheerioWrapper = cheerioWrapper.childAt(0); - - interface TmpType1 { - foo: any - } - - interface TmpType2 { - bar: any - } - - const childWrapper2: CheerioWrapper = cheerioWrapper.childAt(0); - } - - function test_parents() { - cheerioWrapper = cheerioWrapper.parents(); - } - - function test_parent() { - cheerioWrapper = cheerioWrapper.parent(); - } - - function test_closest() { - elementWrapper = cheerioWrapper.closest('.selector'); - cheerioWrapper = cheerioWrapper.closest(MyComponent); - cheerioWrapper = cheerioWrapper.closest({ prop: 'myprop' }); - } - - function test_text() { - stringVal = cheerioWrapper.text(); - } - - function test_html() { - stringVal = cheerioWrapper.html(); - } - - function test_get() { - reactElement = cheerioWrapper.get(1); - } - - function test_at() { - cheerioWrapper = cheerioWrapper.at(1); - } - - function test_first() { - cheerioWrapper = cheerioWrapper.first(); - } - - function test_last() { - cheerioWrapper = cheerioWrapper.last(); - } - - function test_state() { - cheerioWrapper.state(); - cheerioWrapper.state('key'); - const tmp: String = cheerioWrapper.state('key'); - } - - function test_context() { - cheerioWrapper.context(); - cheerioWrapper.context('key'); - const tmp: String = cheerioWrapper.context('key'); - } - - function test_props() { - objectVal = cheerioWrapper.props(); - } - - function test_prop() { - cheerioWrapper.prop('key'); - const tmp: String = cheerioWrapper.prop('key'); - } - - function test_key() { - stringVal = cheerioWrapper.key(); - } - - function test_simulate(...args: any[]) { - cheerioWrapper.simulate('click'); - cheerioWrapper.simulate('click', args); - } - - function test_setState() { - cheerioWrapper = cheerioWrapper.setState({ stateProperty: 'state' }); - } - - function test_setProps() { - cheerioWrapper = cheerioWrapper.setProps({ propsProperty: 'foo' }); - } - - function test_setContext() { - cheerioWrapper = cheerioWrapper.setContext({ name: 'baz' }); - } - - function test_instance() { - var myComponent: MyComponent = cheerioWrapper.instance(); - } - - function test_update() { - cheerioWrapper = cheerioWrapper.update(); - } - - function test_debug() { - stringVal = cheerioWrapper.debug(); - } - - function test_type() { - var stringOrFunction: String | Function = cheerioWrapper.type(); - } - - function test_name() { - var str: String = cheerioWrapper.name(); - } - - function test_forEach() { - cheerioWrapper = - cheerioWrapper.forEach((aCheerioWrapper: CheerioWrapper) => { - }); - } - - function test_map() { - var arrayNumbers: Array = - cheerioWrapper.map(wrapper => wrapper.props().numberProp); - } - - function test_reduce() { - const total: number = - cheerioWrapper.reduce( - (amount: number, n: CheerioWrapper) => amount + n.prop('amount') - ); - } - - function test_reduceRight() { - const total: number = - cheerioWrapper.reduceRight( - (amount: number, n: CheerioWrapper) => amount + n.prop('amount') - ); - } - - function test_some() { - boolVal = cheerioWrapper.some('.selector'); - boolVal = cheerioWrapper.some(MyComponent); - } - - function test_someWhere() { - boolVal = cheerioWrapper.someWhere((aCheerioWrapper: CheerioWrapper) => true); - } - - function test_every() { - boolVal = cheerioWrapper.every('.selector'); - boolVal = cheerioWrapper.every(MyComponent); - } - - function test_everyWhere() { - boolVal = cheerioWrapper.everyWhere((aCheerioWrapper: CheerioWrapper) => true); - } + wrapper.toggleClass('className'); } diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index 5502b0eb85..66c86d1166 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -1,16 +1,27 @@ -// Type definitions for Enzyme v2.7.0 +// Type definitions for Enzyme 2.7 // Project: https://github.com/airbnb/enzyme -// Definitions by: Marian Palkus , Cap3 , Ivo Stratev , Tom Crockett +// Definitions by: Marian Palkus , Cap3 , Ivo Stratev , Tom Crockett , jwbay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react"; +/// +import { ReactElement, Component, HTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react"; type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>; export class ElementClass extends Component { } +/* These are purposefully stripped down versions of React.ComponentClass and React.StatelessComponent. + * The optional static properties on them break overload ordering for wrapper methods if they're not + * all specified in the implementation. TS chooses the EnzymePropSelector overload and loses the generics + */ +interface ComponentClass { + new(props?: Props, context?: any): Component; +} + +type StatelessComponent = (props: Props, context?: any) => JSX.Element; + /** * Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the * following three categories: @@ -21,34 +32,12 @@ export class ElementClass extends Component { * 4. A React Stateless component * 5. A React component property map */ -export type EnzymeSelector = string | StatelessComponent | ComponentClass | { [key: string]: any }; -export type EnzymePropSelector = { [key: string]: any }; +export interface EnzymePropSelector { + [key: string]: any; +} +export type EnzymeSelector = string | StatelessComponent | ComponentClass | EnzymePropSelector; interface CommonWrapper { - /** - * Find every node in the render tree that matches the provided selector. - * @param selector The selector to match. - */ - find(component: ComponentClass): CommonWrapper; - find(statelessComponent: StatelessComponent): CommonWrapper; - find(props: EnzymePropSelector): CommonWrapper; - find(selector: string): CommonWrapper; - - /** - * Finds every node in the render tree that returns true for the provided predicate function. - * @param predicate - */ - findWhere(predicate: (wrapper: CommonWrapper) => boolean): CommonWrapper; - - /** - * Removes nodes in the current wrapper that do not match the provided selector. - * @param selector The selector to match. - */ - filter(component: ComponentClass): CommonWrapper; - filter(statelessComponent: StatelessComponent): CommonWrapper; - filter(props: EnzymePropSelector): CommonWrapper; - filter(selector: string): CommonWrapper; - /** * Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true. * @param predicate @@ -71,13 +60,13 @@ interface CommonWrapper { * Returns whether or not all the given react elements exists in the shallow render tree * @param nodes */ - containsAllMatchingElements(nodes: ReactElement[]): boolean; + containsAllMatchingElements(nodes: Array>): boolean; /** * Returns whether or not one of the given react elements exists in the shallow render tree. * @param nodes */ - containsAnyMatchingElements(nodes: ReactElement[]): boolean; + containsAnyMatchingElements(nodes: Array>): boolean; /** * Returns whether or not the current render tree is equal to the given node, based on the expected value. @@ -118,54 +107,6 @@ interface CommonWrapper { */ not(selector: EnzymeSelector): this; - /** - * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector - * can be provided and it will filter the children by this selector. - * @param [selector] - */ - children(component: ComponentClass): CommonWrapper; - children(statelessComponent: StatelessComponent): CommonWrapper; - children(props: EnzymePropSelector): CommonWrapper; - children(selector: string): CommonWrapper; - children(): CommonWrapper; - - /** - * Returns a new wrapper with child at the specified index. - * @param index - */ - childAt(index: number): CommonWrapper; - childAt(index: number): CommonWrapper; - - /** - * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the - * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector. - * - * Note: can only be called on a wrapper of a single node. - * @param [selector] - */ - parents(component: ComponentClass): CommonWrapper; - parents(statelessComponent: StatelessComponent): CommonWrapper; - parents(props: EnzymePropSelector): CommonWrapper; - parents(selector: string): CommonWrapper; - parents(): CommonWrapper; - - /** - * Returns a wrapper with the direct parent of the node in the current wrapper. - */ - parent(): CommonWrapper; - - /** - * Returns a wrapper of the first element that matches the selector by traversing up through the current node's - * ancestors in the tree, starting with itself. - * - * Note: can only be called on a wrapper of a single node. - * @param selector - */ - closest(component: ComponentClass): CommonWrapper; - closest(statelessComponent: StatelessComponent): CommonWrapper; - closest(props: EnzymePropSelector): CommonWrapper; - closest(selector: string): CommonWrapper; - /** * Returns a string of the rendered text of the current render tree. This function should be looked at with * skepticism if being used to test what the actual HTML output of the component will be. If that is what you @@ -209,14 +150,14 @@ interface CommonWrapper { * @param [key] */ state(): S; - state(key: string): any; + state(key: K): S[K]; state(key: string): T; /** * Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. */ - context(key?: string): any; - context(key?: string): T; + context(): any; + context(key: string): T; /** * Returns the props hash for the current node of the wrapper. @@ -231,7 +172,7 @@ interface CommonWrapper { * NOTE: can only be called on a wrapper of a single node. * @param key */ - prop(key: string): any; + prop(key: K): P[K]; prop(key: string): T; /** @@ -260,7 +201,7 @@ interface CommonWrapper { * @param state * @param [callback] */ - setState(state: S, callback?: () => void): this; + setState(state: Pick, callback?: () => void): this; /** * A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test @@ -274,7 +215,7 @@ interface CommonWrapper { * @param props * @param [callback] */ - setProps(props: P, callback?: () => void): this; + setProps(props: Pick): this; /** * A method that sets the context of the root component, and re-renders. Useful for when you are wanting to @@ -284,7 +225,7 @@ interface CommonWrapper { * NOTE: can only be called on a wrapper instance that is also the root instance. * @param state */ - setContext(context: Object): this; + setContext(context: any): this; /** * Gets the instance of the component being rendered as the root node passed into shallow(). @@ -308,14 +249,6 @@ interface CommonWrapper { */ debug(): string; - /** - * Returns the type of the current node of this wrapper. If it's a composite component, this will be the - * component constructor. If it's native DOM node, it will be a string of the tag name. - * - * Note: can only be called on a wrapper of a single node. - */ - type(): string | Function; - /** * Returns the name of the current node of the wrapper. */ @@ -329,7 +262,7 @@ interface CommonWrapper { * @param fn A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first * argument, and will be run with a context of the original instance. */ - forEach(fn: (wrapper: this) => any): this; + forEach(fn: (wrapper: this, index: number) => any): this; /** * Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map @@ -339,7 +272,7 @@ interface CommonWrapper { * to the returned array. Should expect a ShallowWrapper as the first argument, and will be run * with a context of the original instance. */ - map(fn: (wrapper: this) => V): V[]; + map(fn: (wrapper: this, index: number) => V): V[]; /** * Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node @@ -381,12 +314,29 @@ interface CommonWrapper { */ everyWhere(fn: (wrapper: this) => boolean): boolean; + /** + * Returns true if renderer returned null + */ + isEmptyRender(): boolean; + + /** + * Renders the component to static markup and returns a Cheerio wrapper around the result. + */ + render(): Cheerio; + + /** + * Returns the type of the current node of this wrapper. If it's a composite component, this will be the + * component constructor. If it's native DOM node, it will be a string of the tag name. + * + * Note: can only be called on a wrapper of a single node. + */ + type(): string | ComponentClass

| StatelessComponent

; + length: number; } export interface ShallowWrapper extends CommonWrapper { shallow(): ShallowWrapper; - render(): CheerioWrapper; unmount(): ShallowWrapper; /** @@ -394,7 +344,7 @@ export interface ShallowWrapper extends CommonWrapper { * @param selector The selector to match. */ find(component: ComponentClass): ShallowWrapper; - find(statelessComponent: (props: P2) => JSX.Element): ShallowWrapper; + find(statelessComponent: StatelessComponent): ShallowWrapper; find(props: EnzymePropSelector): ShallowWrapper; find(selector: string): ShallowWrapper; @@ -402,16 +352,15 @@ export interface ShallowWrapper extends CommonWrapper { * Removes nodes in the current wrapper that do not match the provided selector. * @param selector The selector to match. */ - filter(component: ComponentClass): ShallowWrapper; - filter(statelessComponent: StatelessComponent): ShallowWrapper; - filter(props: EnzymePropSelector): ShallowWrapper; - filter(selector: string): ShallowWrapper; + filter(component: ComponentClass | StatelessComponent): this; + filter(props: Partial

): this; + filter(selector: string): this; /** * Finds every node in the render tree that returns true for the provided predicate function. * @param predicate */ - findWhere(predicate: (wrapper: CommonWrapper) => boolean): ShallowWrapper; + findWhere(predicate: (wrapper: ShallowWrapper) => boolean): ShallowWrapper; /** * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector @@ -419,10 +368,9 @@ export interface ShallowWrapper extends CommonWrapper { * @param [selector] */ children(component: ComponentClass): ShallowWrapper; - children(statelessComponent: StatelessComponent): ShallowWrapper; - children(props: EnzymePropSelector): ShallowWrapper; + children(statelessComponent: StatelessComponent): ShallowWrapper; children(selector: string): ShallowWrapper; - children(): ShallowWrapper; + children(props?: EnzymePropSelector): ShallowWrapper; /** * Returns a new wrapper with child at the specified index. @@ -432,13 +380,13 @@ export interface ShallowWrapper extends CommonWrapper { childAt(index: number): ShallowWrapper; /** - * Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result. - * NOTE: can only be called on wrapper of a single non-DOM component element node. - * @param [options] - */ - dive(options?: ShallowRendererProps): ShallowWrapper; + * Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result. + * NOTE: can only be called on wrapper of a single non-DOM component element node. + * @param [options] + */ + dive(options?: ShallowRendererProps): ShallowWrapper; - /** + /** * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector. * @@ -446,10 +394,9 @@ export interface ShallowWrapper extends CommonWrapper { * @param [selector] */ parents(component: ComponentClass): ShallowWrapper; - parents(statelessComponent: StatelessComponent): ShallowWrapper; - parents(props: EnzymePropSelector): ShallowWrapper; + parents(statelessComponent: StatelessComponent): ShallowWrapper; parents(selector: string): ShallowWrapper; - parents(): ShallowWrapper; + parents(props?: EnzymePropSelector): ShallowWrapper; /** * Returns a wrapper of the first element that matches the selector by traversing up through the current node's @@ -459,7 +406,7 @@ export interface ShallowWrapper extends CommonWrapper { * @param selector */ closest(component: ComponentClass): ShallowWrapper; - closest(statelessComponent: StatelessComponent): ShallowWrapper; + closest(statelessComponent: StatelessComponent): ShallowWrapper; closest(props: EnzymePropSelector): ShallowWrapper; closest(selector: string): ShallowWrapper; @@ -467,17 +414,11 @@ export interface ShallowWrapper extends CommonWrapper { * Returns a wrapper with the direct parent of the node in the current wrapper. */ parent(): ShallowWrapper; - - /** - * Returns true if renderer returned null - */ - isEmptyRender(): boolean; } export interface ReactWrapper extends CommonWrapper { unmount(): ReactWrapper; mount(): ReactWrapper; - render(): CheerioWrapper; /** * Returns a wrapper of the node that matches the provided reference name. @@ -503,7 +444,7 @@ export interface ReactWrapper extends CommonWrapper { * @param selector The selector to match. */ find(component: ComponentClass): ReactWrapper; - find(statelessComponent: (props: P2) => JSX.Element): ReactWrapper; + find(statelessComponent: StatelessComponent): ReactWrapper; find(props: EnzymePropSelector): ReactWrapper; find(selector: string): ReactWrapper; @@ -511,16 +452,15 @@ export interface ReactWrapper extends CommonWrapper { * Finds every node in the render tree that returns true for the provided predicate function. * @param predicate */ - findWhere(predicate: (wrapper: CommonWrapper) => boolean): ReactWrapper; + findWhere(predicate: (wrapper: ReactWrapper) => boolean): ReactWrapper; /** * Removes nodes in the current wrapper that do not match the provided selector. * @param selector The selector to match. */ - filter(component: ComponentClass): ReactWrapper; - filter(statelessComponent: StatelessComponent): ReactWrapper; - filter(props: EnzymePropSelector): ReactWrapper; - filter(selector: string): ReactWrapper; + filter(component: ComponentClass | StatelessComponent): this; + filter(props: Partial

): this; + filter(selector: string): this; /** * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector @@ -528,10 +468,9 @@ export interface ReactWrapper extends CommonWrapper { * @param [selector] */ children(component: ComponentClass): ReactWrapper; - children(statelessComponent: StatelessComponent): ReactWrapper; - children(props: EnzymePropSelector): ReactWrapper; + children(statelessComponent: StatelessComponent): ReactWrapper; children(selector: string): ReactWrapper; - children(): ReactWrapper; + children(props?: EnzymePropSelector): ReactWrapper; /** * Returns a new wrapper with child at the specified index. @@ -548,10 +487,9 @@ export interface ReactWrapper extends CommonWrapper { * @param [selector] */ parents(component: ComponentClass): ReactWrapper; - parents(statelessComponent: StatelessComponent): ReactWrapper; - parents(props: EnzymePropSelector): ReactWrapper; + parents(statelessComponent: StatelessComponent): ReactWrapper; parents(selector: string): ReactWrapper; - parents(): ReactWrapper; + parents(props?: EnzymePropSelector): ReactWrapper; /** * Returns a wrapper of the first element that matches the selector by traversing up through the current node's @@ -561,7 +499,7 @@ export interface ReactWrapper extends CommonWrapper { * @param selector */ closest(component: ComponentClass): ReactWrapper; - closest(statelessComponent: StatelessComponent): ReactWrapper; + closest(statelessComponent: StatelessComponent): ReactWrapper; closest(props: EnzymePropSelector): ReactWrapper; closest(selector: string): ReactWrapper; @@ -569,15 +507,6 @@ export interface ReactWrapper extends CommonWrapper { * Returns a wrapper with the direct parent of the node in the current wrapper. */ parent(): ReactWrapper; - - /** - * Returns true if renderer returned null - */ - isEmptyRender(): boolean; -} - -export interface CheerioWrapper extends CommonWrapper { - } export interface ShallowRendererProps { @@ -626,8 +555,4 @@ export function mount(node: ReactElement

, options?: MountRendererProps) * @param node * @param [options] */ -export function render(node: ReactElement

, options?: any): CheerioWrapper; - -export function describeWithDOM(description: string, fn: Function): void; - -export function spyLifecycle(component: typeof Component): void; +export function render(node: ReactElement

, options?: any): Cheerio; diff --git a/enzyme/tslint.json b/enzyme/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/enzyme/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/express-jwt/index.d.ts b/express-jwt/index.d.ts index e721094edc..4b6883a258 100644 --- a/express-jwt/index.d.ts +++ b/express-jwt/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for express-jwt // Project: https://www.npmjs.org/package/express-jwt -// Definitions by: Wonshik Kim +// Definitions by: Wonshik Kim , Kacper Polak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import express = require('express'); @@ -37,3 +37,10 @@ declare namespace jwt { unless?: typeof unless; } } +declare global { + namespace Express { + export interface Request { + user?: any + } + } +} diff --git a/express-mysql-session/express-mysql-session-tests.ts b/express-mysql-session/express-mysql-session-tests.ts new file mode 100644 index 0000000000..b69486dd8d --- /dev/null +++ b/express-mysql-session/express-mysql-session-tests.ts @@ -0,0 +1,13 @@ +import MySQLStore = require('express-mysql-session'); + +const options = { + host: 'localhost', + port: 3306, + user: 'root', + password: '', + database: 'session_test' +}; + +const sessionStore = new MySQLStore(options); + +sessionStore.close(); diff --git a/express-mysql-session/index.d.ts b/express-mysql-session/index.d.ts new file mode 100644 index 0000000000..0e86b9b077 --- /dev/null +++ b/express-mysql-session/index.d.ts @@ -0,0 +1,136 @@ +// Type definitions for express-mysql-session 1.2 +// Project: https://github.com/chill117/express-mysql-session#readme +// Definitions by: Akim95 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = MySQLStore; + +declare namespace MySQLStore { + interface Options { + host?: string; + port?: number; + user?: string; + password?: string; + database?: string; + checkExpirationInterval?: number; + expiration?: number; + createDatabaseTable?: boolean; + connectionLimit?: number; + schema?: Schema; + } + interface Schema { + tableName: string; + columnNames: ColumnNames; + } + interface ColumnNames { + session_id: string; + expires: string; + data: string; + } +} + +declare class MySQLStore { + + /** + * @param {MySQLStore.Options} options + * @param {any} connection? + * @param {(error:any)=>void} callback? + */ + constructor(options: MySQLStore.Options, connection?: any, callback?: (error: any) => void); + + /** + * @returns void + */ + setDefaultOptions(): void; + + /** + * @param {(error:any)=>void} callback? + * @returns void + */ + createDatabaseTable(callback?: (error: any) => void): void; + + /** + * @param {string} sessionId + * @param {(error:any,session:any)=>void} callback? + * @returns void + */ + get(sessionId: string, callback?: (error: any, session: any) => void): void; + + /** + * @param {string} sessionId + * @param {any} data + * @param {(error:any)=>void} callback? + * @returns void + */ + set(sessionId: string, data: any, callback?: (error: any) => void): void; + + /** + * @param {string} sessionId + * @param {any} data + * @param {(error:any)=>void} callback? + * @returns void + */ + touch(sessionId: string, data: any, callback?: (error: any) => void): void; + + /** + * @param {string} sessionId + * @param {(error:any)=>void} callback? + * @returns void + */ + destroy(sessionId: string, callback?: (error: any) => void): void; + + /** + * @param {(error:any,count:any)=>void} callback? + * @returns void + */ + length(callback?: (error: any, count: any) => void): void; + + /** + * @param {(error:any)=>void} callback? + * @returns void + */ + clear(callback?: (error: any) => void): void; + + /** + * @param {(error:any)=>void} callback? + * @returns void + */ + clearExpiredSessions(callback?: (error: any) => void): void; + + /** + * @param {number} interval + * @returns void + */ + setExpirationInterval(interval: number): void; + + /** + * @returns void + */ + clearExpirationInterval(): void; + + /** + * @param {()=>void} callback? + * @returns void + */ + close(callback?: () => void): void; + + /** + * @param {any} object + * @param {any} defaultValues + * @param {any} options? + * @returns void + */ + default(object: any, defaultValues: any, options?: any): void; + + /** + * @param {any} object + * @returns void + */ + clone(object: any): void; + + /** + * @param {any} value + * @returns void + */ + isObject(value: any): void; +} diff --git a/express-mysql-session/tsconfig.json b/express-mysql-session/tsconfig.json new file mode 100644 index 0000000000..5af8734c24 --- /dev/null +++ b/express-mysql-session/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-mysql-session-tests.ts" + ] +} diff --git a/express-mysql-session/tslint.json b/express-mysql-session/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/express-mysql-session/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/express-rate-limit/express-rate-limit-tests.ts b/express-rate-limit/express-rate-limit-tests.ts new file mode 100644 index 0000000000..761a6d23f8 --- /dev/null +++ b/express-rate-limit/express-rate-limit-tests.ts @@ -0,0 +1,25 @@ +import RateLimit = require("express-rate-limit"); + +var apiLimiter = new RateLimit({ + windowMs: 15 * 60 * 1000, // 15 minutes + max: 100, + delayMs: 0 // disabled +}); + +var createAccountLimiter = new RateLimit({ + windowMs: 60 * 60 * 1000, // 1 hour window + delayAfter: 1, // begin slowing down responses after the first request + delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request + max: 5, // start blocking after 5 requests + message: "Too many accounts created from this IP, please try again after an hour" +}); + +class SomeStore implements RateLimit.Store { + incr(key: string, cb: RateLimit.StoreIncrementCallback) { } + resetAll() { } + resetKey(key: string) { }; +}; + +var limiterWithStore = new RateLimit({ + store: new SomeStore() +}); diff --git a/express-rate-limit/index.d.ts b/express-rate-limit/index.d.ts new file mode 100644 index 0000000000..38ef8f8b29 --- /dev/null +++ b/express-rate-limit/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for express-rate-limit 2.6 +// Project: https://github.com/nfriedly/express-rate-limit +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import express = require("express"); + +declare namespace RateLimit { + type StoreIncrementCallback = (err?: {}, hits?: number) => void; + + export interface Store { + incr: (key: string, cb: StoreIncrementCallback) => void; + resetAll: () => void; + resetKey: (key: string) => void; + } + + export interface Options { + delayAfter?: number; + delayMs?: number; + handlers?: () => any; + headers?: boolean; + keyGenerator?: () => string; + max?: number; + message?: string; + skip?: () => boolean; + statusCode?: number; + store?: Store; + windowMs?: number; + } +} + +interface RateLimitStatic { + new(options: RateLimit.Options): express.RequestHandler; +} + +declare var RateLimit: RateLimitStatic; +export = RateLimit; diff --git a/express-rate-limit/tsconfig.json b/express-rate-limit/tsconfig.json new file mode 100644 index 0000000000..ca3c32c3bb --- /dev/null +++ b/express-rate-limit/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-rate-limit-tests.ts" + ] +} diff --git a/express-rate-limit/tslint.json b/express-rate-limit/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/express-rate-limit/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts index 62e522a348..63177ebde3 100644 --- a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts +++ b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts @@ -58,7 +58,10 @@ configuration = { configuration = { // ... plugins: [ - new optimize.CommonsChunkPlugin("commons", "commons.js"), + new optimize.CommonsChunkPlugin({ + name: "commons", + filename: "commons.js", + }), new ExtractTextPlugin("[name].css") ] }; diff --git a/forever-monitor/forever-monitor-tests.ts b/forever-monitor/forever-monitor-tests.ts new file mode 100644 index 0000000000..e44a9c35b0 --- /dev/null +++ b/forever-monitor/forever-monitor-tests.ts @@ -0,0 +1,23 @@ +// Test from https://github.com/foreverjs/forever-monitor + +import * as forever from "forever-monitor"; +forever.start('script') + .on("start", () => console.log("started")); + +forever.kill(10, true); + +const child = new (forever.Monitor)('your-filename.js', { + max: 3, + silent: true, + args: [] +}); + +child.on('exit', function() { + console.log('your-filename.js has exited after 3 restarts'); +}); + +child.start() + .on("start", () => console.log("started")) + .restart() + .stop() + .on("exit", () => console.log("STOPPED")) diff --git a/forever-monitor/index.d.ts b/forever-monitor/index.d.ts new file mode 100644 index 0000000000..22fa4b0c61 --- /dev/null +++ b/forever-monitor/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for forever-monitor 1.7 +// Project: https://github.com/nodejitsu/forever-monitor#readme +// Definitions by: Shun Takahashi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +export interface SpawnWith { + customFds: number[]; + setsid: boolean; + uid: number; + gid: number; +} + +export interface Options { + silent?: boolean; + uid?: string; + pidFile?: string; + max?: number; + killTree?: boolean; + minUptime?: number; + spinSleepTime?: number; + command?: string; + args?: string[]; + sourceDir?: string; + watch?: boolean; + watchIgnoreDotFiles?: boolean; + watchIgnorePatters?: string[]; + watchDirectory?: string; + spawnWith?: SpawnWith; + env?: { [envKey: string]: string; }; + cwd?: string; + logFile?: string; + outFile?: string; + errFile?: string; + parser?: (command: string, args: string[]) => { command: string, args: string[] }; +} + +export function start(script: string, options?: Options): Monitor; +export function kill(pid: number, killTree?: boolean, signal?: string, callback?: () => any): void; +export function checkProcess(pid: number): boolean; +export const version: string; + +export class Monitor extends NodeJS.EventEmitter { + + /** + * @param script - Location of the target script to run. + * @param [options] - Configuration for this instance. + */ + constructor(script: string, options?: Options); + + /** + * @description Start the process that this instance is configured for + * @param [restart] - Value indicating whether this is a restart. + */ + start(restart?: boolean): this; + + /** + * @description Tries to spawn the target Forever child process. + */ + trySpawn(): boolean; + + /** + * @description Restarts the target script associated with this instance. + */ + restart(): this; + + /** + * @description Stops the target script associated with this instance. Prevents it from auto-respawning + */ + stop(): this; + + /** + * @description Kills the ChildProcess object associated with this instance + * @param [forceStop] - Value indicating whether short circuit forever auto-restart + */ + kill(forceStop?: boolean): this; + + /** + * @description Sends a message to a forked ChildProcess object associated with this instance + */ + send(msg?: any): this; + + /** + * respond with JSON for this instance + */ + toString(): string; + + /** + * @param command - Command string to parse + * @param args - Additional default arguments + */ + parseCommand(command: string, args?: string[]): (false | { command: string, args?: string[]}); +} diff --git a/forever-monitor/tsconfig.json b/forever-monitor/tsconfig.json new file mode 100644 index 0000000000..8c6d4986b5 --- /dev/null +++ b/forever-monitor/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "forever-monitor-tests.ts" + ] +} diff --git a/forever-monitor/tslint.json b/forever-monitor/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/forever-monitor/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/fusioncharts/fusioncharts-tests.ts b/fusioncharts/fusioncharts-tests.ts index 9bbf640225..77b912ba18 100644 --- a/fusioncharts/fusioncharts-tests.ts +++ b/fusioncharts/fusioncharts-tests.ts @@ -1,3 +1,5 @@ +import * as FusionCharts from "fusioncharts"; + FusionCharts.addEventListener('ready',(eventObject)=>{ eventObject.stopPropagation(); }); diff --git a/fusioncharts/fusioncharts.charts.d.ts b/fusioncharts/fusioncharts.charts.d.ts new file mode 100644 index 0000000000..f06060a054 --- /dev/null +++ b/fusioncharts/fusioncharts.charts.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var charts: (H: FusionChartStatic) => FusionChartStatic; +export = charts; +export as namespace charts; + diff --git a/fusioncharts/fusioncharts.gantt.d.ts b/fusioncharts/fusioncharts.gantt.d.ts new file mode 100644 index 0000000000..d29fa26f78 --- /dev/null +++ b/fusioncharts/fusioncharts.gantt.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var gantt: (H: FusionChartStatic) => FusionChartStatic; +export = gantt; +export as namespace gantt; + diff --git a/fusioncharts/fusioncharts.maps.d.ts b/fusioncharts/fusioncharts.maps.d.ts new file mode 100644 index 0000000000..1894383758 --- /dev/null +++ b/fusioncharts/fusioncharts.maps.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var maps: (H: FusionChartStatic) => FusionChartStatic; +export = maps; +export as namespace maps; + diff --git a/fusioncharts/fusioncharts.powercharts.d.ts b/fusioncharts/fusioncharts.powercharts.d.ts new file mode 100644 index 0000000000..46178c8b8f --- /dev/null +++ b/fusioncharts/fusioncharts.powercharts.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var powercharts: (H: FusionChartStatic) => FusionChartStatic; +export = powercharts; +export as namespace powercharts; + diff --git a/fusioncharts/fusioncharts.ssgrid.d.ts b/fusioncharts/fusioncharts.ssgrid.d.ts new file mode 100644 index 0000000000..b44f5336c1 --- /dev/null +++ b/fusioncharts/fusioncharts.ssgrid.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var ssgrid: (H: FusionChartStatic) => FusionChartStatic; +export = ssgrid; +export as namespace ssgrid; + diff --git a/fusioncharts/fusioncharts.treemap.d.ts b/fusioncharts/fusioncharts.treemap.d.ts new file mode 100644 index 0000000000..c555a627bc --- /dev/null +++ b/fusioncharts/fusioncharts.treemap.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var treemap: (H: FusionChartStatic) => FusionChartStatic; +export = treemap; +export as namespace treemap; + diff --git a/fusioncharts/fusioncharts.widgets.d.ts b/fusioncharts/fusioncharts.widgets.d.ts new file mode 100644 index 0000000000..a4547b99b7 --- /dev/null +++ b/fusioncharts/fusioncharts.widgets.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var widgets: (H: FusionChartStatic) => FusionChartStatic; +export = widgets; +export as namespace widgets; + diff --git a/fusioncharts/fusioncharts.zoomscatter.d.ts b/fusioncharts/fusioncharts.zoomscatter.d.ts new file mode 100644 index 0000000000..106908b6df --- /dev/null +++ b/fusioncharts/fusioncharts.zoomscatter.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var zoomscatter: (H: FusionChartStatic) => FusionChartStatic; +export = zoomscatter; +export as namespace zoomscatter; + diff --git a/fusioncharts/index.d.ts b/fusioncharts/index.d.ts index dc053859b9..9c46955075 100644 --- a/fusioncharts/index.d.ts +++ b/fusioncharts/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for FusionCharts 3.11.2 +// Type definitions for fusioncharts 3.11 // Project: http://www.fusioncharts.com -// Definitions by: Shivaraj KV +// Definitions by: Rohit Kumar , Shivaraj KV // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -136,9 +136,9 @@ declare namespace FusionCharts { outputTo(callback: (message: any) => any): void; - enable(state:any,outputTo?:(message: any) =>any,outputFormat?:any):void + enable(state: any, outputTo?: (message: any) => any, outputFormat?: any): void; - enableFirebugLite():any; + enableFirebugLite(): any; } interface FusionCharts { @@ -154,7 +154,7 @@ declare namespace FusionCharts { configureLink(param: {} | any[], level?: number): void; - setChartAttribute(attributes: ChartObject | String, value?: string): void; + setChartAttribute(attributes: ChartObject | string, value?: string): void; getChartAttribute(attribute?: string | string[]): ChartObject; @@ -273,7 +273,7 @@ declare namespace FusionCharts { formatNumber(num: number, type?: string, config?: {}): Element; - setCurrentRenderer(name: string): void + setCurrentRenderer(name: string): void; getCurrentRenderer(): string; @@ -285,7 +285,7 @@ declare namespace FusionCharts { options: {}; - debugger:Debugger; + debugger: Debugger; } diff --git a/fusioncharts/maps/fusioncharts.usa.d.ts b/fusioncharts/maps/fusioncharts.usa.d.ts new file mode 100644 index 0000000000..16ed0d6c91 --- /dev/null +++ b/fusioncharts/maps/fusioncharts.usa.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var usa: (H: FusionChartStatic) => FusionChartStatic; +export = usa; +export as namespace usa; + diff --git a/fusioncharts/maps/fusioncharts.world.d.ts b/fusioncharts/maps/fusioncharts.world.d.ts new file mode 100644 index 0000000000..3e545e2556 --- /dev/null +++ b/fusioncharts/maps/fusioncharts.world.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var world: (H: FusionChartStatic) => FusionChartStatic; +export = world; +export as namespace world; + diff --git a/fusioncharts/themes/fusioncharts.theme.carbon.d.ts b/fusioncharts/themes/fusioncharts.theme.carbon.d.ts new file mode 100644 index 0000000000..79ba171231 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.carbon.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var carbon: (H: FusionChartStatic) => FusionChartStatic; +export = carbon; +export as namespace carbon; + diff --git a/fusioncharts/themes/fusioncharts.theme.fint.d.ts b/fusioncharts/themes/fusioncharts.theme.fint.d.ts new file mode 100644 index 0000000000..cee08aa6b2 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.fint.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var fint: (H: FusionChartStatic) => FusionChartStatic; +export = fint; +export as namespace fint; + diff --git a/fusioncharts/themes/fusioncharts.theme.ocean.d.ts b/fusioncharts/themes/fusioncharts.theme.ocean.d.ts new file mode 100644 index 0000000000..8b7e3828c0 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.ocean.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var ocean: (H: FusionChartStatic) => FusionChartStatic; +export = ocean; +export as namespace ocean; + diff --git a/fusioncharts/themes/fusioncharts.theme.zune.d.ts b/fusioncharts/themes/fusioncharts.theme.zune.d.ts new file mode 100644 index 0000000000..06ab4c1787 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.zune.d.ts @@ -0,0 +1,7 @@ + +import { FusionChartStatic } from "fusioncharts"; + +declare var zune: (H: FusionChartStatic) => FusionChartStatic; +export = zune; +export as namespace zune; + diff --git a/fusioncharts/tsconfig.json b/fusioncharts/tsconfig.json index dc4436d64c..970238d9a8 100644 --- a/fusioncharts/tsconfig.json +++ b/fusioncharts/tsconfig.json @@ -18,6 +18,20 @@ }, "files": [ "index.d.ts", + "fusioncharts.charts.d.ts", + "fusioncharts.powercharts.d.ts", + "fusioncharts.widgets.d.ts", + "fusioncharts.maps.d.ts", + "fusioncharts.zoomscatter.d.ts", + "fusioncharts.ssgrid.d.ts", + "fusioncharts.gantt.d.ts", + "fusioncharts.treemap.d.ts", + "maps/fusioncharts.usa.d.ts", + "maps/fusioncharts.world.d.ts", + "themes/fusioncharts.theme.carbon.d.ts", + "themes/fusioncharts.theme.fint.d.ts", + "themes/fusioncharts.theme.ocean.d.ts", + "themes/fusioncharts.theme.zune.d.ts", "fusioncharts-tests.ts" ] } \ No newline at end of file diff --git a/fusioncharts/tslint.json b/fusioncharts/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/fusioncharts/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/geojson/geojson-tests.ts b/geojson/geojson-tests.ts index dc3432f48c..fb9ce24a0b 100644 --- a/geojson/geojson-tests.ts +++ b/geojson/geojson-tests.ts @@ -1,26 +1,24 @@ - - -var featureCollection: GeoJSON.FeatureCollection = { +let featureCollection: GeoJSON.FeatureCollection = { type: "FeatureCollection", - features: [ - { + features: [ + { type: "Feature", geometry: { - type: "Point", + type: "Point", coordinates: [102.0, 0.5] }, properties: { prop0: "value0" } }, - { + { type: "Feature", geometry: { type: "LineString", coordinates: [ - [102.0, 0.0], - [103.0, 1.0], - [104.0, 0.0], + [102.0, 0.0], + [103.0, 1.0], + [104.0, 0.0], [105.0, 1.0] ] }, @@ -29,7 +27,7 @@ var featureCollection: GeoJSON.FeatureCollection = { prop1: 0.0 } }, - { + { type: "Feature", geometry: { type: "Polygon", @@ -52,9 +50,9 @@ var featureCollection: GeoJSON.FeatureCollection = { type: "proj4" } } -} +}; -var feature: GeoJSON.Feature = { +let featureWithPolygon: GeoJSON.Feature = { type: "Feature", bbox: [-180.0, -90.0, 180.0, 90.0], geometry: { @@ -67,29 +65,29 @@ var feature: GeoJSON.Feature = { }; -var point: GeoJSON.Point = { +let point: GeoJSON.Point = { type: "Point", coordinates: [100.0, 0.0] }; // This type is commonly used in the turf package -var pointCoordinates: number[] = point.coordinates +let pointCoordinates: number[] = point.coordinates; -var lineString: GeoJSON.LineString = { +let lineString: GeoJSON.LineString = { type: "LineString", coordinates: [ [100.0, 0.0], [101.0, 1.0] ] }; -var polygon: GeoJSON.Polygon = { +let polygon: GeoJSON.Polygon = { type: "Polygon", coordinates: [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }; -var polygonWithHole: GeoJSON.Polygon = { +let polygonWithHole: GeoJSON.Polygon = { type: "Polygon", coordinates: [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], @@ -97,12 +95,12 @@ var polygonWithHole: GeoJSON.Polygon = { ] }; -var multiPoint: GeoJSON.MultiPoint = { +let multiPoint: GeoJSON.MultiPoint = { type: "MultiPoint", coordinates: [ [100.0, 0.0], [101.0, 1.0] ] }; -var multiLineString: GeoJSON.MultiLineString = { +let multiLineString: GeoJSON.MultiLineString = { type: "MultiLineString", coordinates: [ [ [100.0, 0.0], [101.0, 1.0] ], @@ -110,25 +108,103 @@ var multiLineString: GeoJSON.MultiLineString = { ] }; -var multiPolygon: GeoJSON.MultiPolygon = { +let multiPolygon: GeoJSON.MultiPolygon = { type: "MultiPolygon", coordinates: [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] -} +}; -var geometryCollection: GeoJSON.GeometryCollection = { +let geometryCollection: GeoJSON.GeometryCollection = { type: "GeometryCollection", "geometries": [ - { + { type: "Point", coordinates: [100.0, 0.0] }, - { + { type: "LineString", coordinates: [ [101.0, 0.0], [102.0, 1.0] ] } ] -} \ No newline at end of file +}; + +let feature: GeoJSON.Feature = { + type: "Feature", + geometry: lineString, + properties: null +}; +feature = { + type: "Feature", + geometry: polygon, + properties: null +}; +feature = { + type: "Feature", + geometry: polygonWithHole, + properties: null +}; +feature = { + type: "Feature", + geometry: multiPoint, + properties: null +}; +feature = { + type: "Feature", + geometry: multiLineString, + properties: null +}; +feature = { + type: "Feature", + geometry: multiPolygon, + properties: null +}; +feature = { + type: "Feature", + geometry: geometryCollection, + properties: null +}; + +featureCollection = { + type: "FeatureCollection", + features: [ + { + type: "Feature", + geometry: lineString, + properties: {test: 'OK'} + }, { + type: "Feature", + geometry: polygon, + properties: {test: 'OK'} + }, { + type: "Feature", + geometry: polygonWithHole, + properties: {test: 'OK'} + }, { + type: "Feature", + geometry: multiPoint, + properties: {test: 'OK'} + }, { + type: "Feature", + geometry: multiLineString, + properties: {test: 'OK'} + }, { + type: "Feature", + geometry: multiPolygon, + properties: {test: 'OK'} + }, { + type: "Feature", + geometry: geometryCollection, + properties: {test: 'OK'} + } + ], + crs: { + type: "link", + properties: { + href: "http://example.com/crs/42", + type: "proj4" + } + } +}; diff --git a/geojson/index.d.ts b/geojson/index.d.ts index f6261d81fe..7c825d2541 100644 --- a/geojson/index.d.ts +++ b/geojson/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for GeoJSON Format Specification +// Type definitions for GeoJSON Format Specification Revision 1.0 // Project: http://geojson.org/ // Definitions by: Jacob Bruun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,8 +8,7 @@ declare namespace GeoJSON { /*** * http://geojson.org/geojson-spec.html#geojson-objects */ - export interface GeoJsonObject - { + export interface GeoJsonObject { type: string; bbox?: number[]; crs?: CoordinateReferenceSystem; @@ -18,116 +17,107 @@ declare namespace GeoJSON { /*** * http://geojson.org/geojson-spec.html#positions */ - export type Position = number[] + export type Position = number[]; /*** * http://geojson.org/geojson-spec.html#geometry-objects */ - export interface GeometryObject extends GeoJsonObject - { - coordinates: any + interface DirectGeometryObject extends GeoJsonObject { + coordinates: Position[][][] | Position[][] | Position[] | Position; } + /** + * GeometryObject supports geometry collection as well + */ + export type GeometryObject = DirectGeometryObject | GeometryCollection; /*** * http://geojson.org/geojson-spec.html#point */ - export interface Point extends GeometryObject - { - type: 'Point' - coordinates: Position + export interface Point extends DirectGeometryObject { + type: 'Point'; + coordinates: Position; } /*** * http://geojson.org/geojson-spec.html#multipoint */ - export interface MultiPoint extends GeometryObject - { - type: 'MultiPoint' - coordinates: Position[] + export interface MultiPoint extends DirectGeometryObject { + type: 'MultiPoint'; + coordinates: Position[]; } /*** * http://geojson.org/geojson-spec.html#linestring */ - export interface LineString extends GeometryObject - { - type: 'LineString' - coordinates: Position[] + export interface LineString extends DirectGeometryObject { + type: 'LineString'; + coordinates: Position[]; } /*** * http://geojson.org/geojson-spec.html#multilinestring */ - export interface MultiLineString extends GeometryObject - { - type: 'MultiLineString' - coordinates: Position[][] + export interface MultiLineString extends DirectGeometryObject { + type: 'MultiLineString'; + coordinates: Position[][]; } /*** * http://geojson.org/geojson-spec.html#polygon */ - export interface Polygon extends GeometryObject - { - type: 'Polygon' - coordinates: Position[][] + export interface Polygon extends DirectGeometryObject { + type: 'Polygon'; + coordinates: Position[][]; } /*** * http://geojson.org/geojson-spec.html#multipolygon */ - export interface MultiPolygon extends GeometryObject - { - type: 'MultiPolygon' - coordinates: Position[][][] + export interface MultiPolygon extends DirectGeometryObject { + type: 'MultiPolygon'; + coordinates: Position[][][]; } /*** * http://geojson.org/geojson-spec.html#geometry-collection */ - export interface GeometryCollection extends GeoJsonObject - { - type: 'GeometryCollection' + export interface GeometryCollection extends GeoJsonObject { + type: 'GeometryCollection'; geometries: GeometryObject[]; } /*** * http://geojson.org/geojson-spec.html#feature-objects */ - export interface Feature extends GeoJsonObject - { - type: 'Feature' + export interface Feature extends GeoJsonObject { + type: 'Feature'; geometry: T; - properties: any; + properties: {} | null; id?: string; } /*** * http://geojson.org/geojson-spec.html#feature-collection-objects */ - export interface FeatureCollection extends GeoJsonObject - { - type: 'FeatureCollection' - features: Feature[]; + export interface FeatureCollection extends GeoJsonObject { + type: 'FeatureCollection'; + features: Array>; } /*** * http://geojson.org/geojson-spec.html#coordinate-reference-system-objects */ - export interface CoordinateReferenceSystem - { + export interface CoordinateReferenceSystem { type: string; properties: any; } - export interface NamedCoordinateReferenceSystem extends CoordinateReferenceSystem - { - properties: { name: string } + export interface NamedCoordinateReferenceSystem extends CoordinateReferenceSystem { + properties: { name: string }; } - export interface LinkedCoordinateReferenceSystem extends CoordinateReferenceSystem - { - properties: { href: string; type: string } + export interface LinkedCoordinateReferenceSystem extends CoordinateReferenceSystem { + properties: { href: string; type: string }; } } diff --git a/geojson/tslint.json b/geojson/tslint.json new file mode 100644 index 0000000000..0b14fdec0d --- /dev/null +++ b/geojson/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-single-declare-module": false + } +} diff --git a/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts b/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts new file mode 100644 index 0000000000..65bc862e64 --- /dev/null +++ b/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts @@ -0,0 +1,41 @@ +import Hapi = require('hapi'); +import hapiAuthJwt2 = require('hapi-auth-jwt2'); + +var server = new Hapi.Server(); +server.connection({port: 8000}); + +interface User { + id: number; + name: string; +} + +interface Users { + [id: number]: User +} + +var users:Users = { + 1: { + id: 1, + name: 'Test User' + } +}; + +var validate = function(decoded: User, request: Hapi.Request, callback: hapiAuthJwt2.ValidateCallback) { + if (!users[decoded.id]) { + return callback(null, false); + } + + return callback(null, true); +} + +server.register(hapiAuthJwt2, function(err) { + server.auth.strategy('jwt', 'jwt', { + key: 'NeverShareYourSecret', + validateFunc: validate, + verifyOptions: { + algorithms: ['HS256'] + } + }); +}); + +server.start(); diff --git a/hapi-auth-jwt2/index.d.ts b/hapi-auth-jwt2/index.d.ts new file mode 100644 index 0000000000..1bcbbc817e --- /dev/null +++ b/hapi-auth-jwt2/index.d.ts @@ -0,0 +1,126 @@ +// Type definitions for hapi-auth-jwt2 7.0 +// Project: http://github.com/dwyl/hapi-auth-jwt2 +// Definitions by: Warren Seymour +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import {Request, Response} from 'hapi'; + +/** + * A key lookup function + * + * @param decoded the *decoded* but *unverified* JWT received from client + * @param callback the key lookup callback + */ +type KeyLookup = (decoded: any, callback: KeyLookupCallback) => void; + +/** + * Called when key lookup function has completed + * + * @param err an internal error + * @param key the secret key + * @param extraInfo any additional information that you would like + * to use in `validateFunc` which can be accessed via + * `request.plugins['hapi-auth-jwt2'].extraInfo` + */ +type KeyLookupCallback = (err: any, key: string, extraInfo?: any) => void; + +/** + * Called when Validation has completed + * + * @param err an internal error + * @param valid `true` if the JWT was valid, otherwise `false` + * @param credentials alternative credentials to be set instead of `decoded` + */ +type ValidateCallback = (err: any, valid: boolean, credentials?: any) => void; + +/** + * Options passed to `hapi.auth.strategy` when this plugin is used + */ +export interface Options { + /** + * The secret key used to check the signature of the token *or* a *key lookup function* + */ + key?: string | KeyLookup; + + /** + * The function which is run once the Token has been decoded + * + * @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization* + * @param request the original *request* received from the client + * @param callback the validation callback + */ + validateFunc(decoded: {}, request: Request, callback: ValidateCallback): void; + + /** + * Settings to define how tokens are verified by the jsonwebtoken library + */ + verifyOptions?: { + /** + * Ignore expired tokens + */ + ignoreExpiration?: boolean; + + /** + * Do not enforce token audience + */ + audience?: boolean; + + /** + * Do not require the issuer to be valid + */ + issuer?: boolean; + + /** + * List of allowed algorithms + */ + algorithms?: string[]; + }; + + /** + * function called to decorate the response with authentication headers + * before the response headers or payload is written + * + * @param request the Request object + * @param reply is called if an error occurred + */ + responseFunc?(request: Request, reply: (err: any, response: Response) => void): void; + + /** + * If you prefer to pass your token via url, simply add a token url + * parameter to your request or use a custom parameter by setting `urlKey. + * To disable the url parameter set urlKey to `false` or ''. + * @default 'token' + */ + urlKey?: string | boolean; + + /** + * If you prefer to set your own cookie key or your project has a cookie + * called 'token' for another purpose, you can set a custom key for your + * cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies + * set cookieKey to `false` or ''. + * @default 'token' + */ + cookieKey?: string | boolean; + + /** + * If you want to set a custom key for your header token use the + * `headerKey` option. To disable header token set headerKey to `false` or + * ''. + * @default 'authorization' + */ + headerKey?: string | boolean; + + /** + * Allow custom token type, e.g. `Authorization: 12345678` + */ + tokenType?: string; + + /** + * Set to `true` to receive the complete token (`decoded.header`, + * `decoded.payload` and `decoded.signature`) as decoded argument to key + * lookup and `verifyFunc` callbacks (*not `validateFunc`*) + * @default false + */ + complete?: boolean; +} + +export default function hapiAuthJwt2(): void; diff --git a/hapi-auth-jwt2/tsconfig.json b/hapi-auth-jwt2/tsconfig.json new file mode 100644 index 0000000000..764570cbac --- /dev/null +++ b/hapi-auth-jwt2/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "hapi-auth-jwt2-tests.ts" + ] +} diff --git a/hapi-auth-jwt2/tslint.json b/hapi-auth-jwt2/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/hapi-auth-jwt2/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/highcharts-ng/highcharts-ng-tests.ts b/highcharts-ng/highcharts-ng-tests.ts index 0bf559061b..6f79d6e79a 100644 --- a/highcharts-ng/highcharts-ng-tests.ts +++ b/highcharts-ng/highcharts-ng-tests.ts @@ -33,7 +33,8 @@ class AppController { title: { text: 'My Awesome Chart' }, - loading: true + loading: true, + noData: 'No data here' }; constructor($timeout: ng.ITimeoutService) { var vm = this; diff --git a/highcharts-ng/index.d.ts b/highcharts-ng/index.d.ts index 123799e76c..639d21d88e 100644 --- a/highcharts-ng/index.d.ts +++ b/highcharts-ng/index.d.ts @@ -35,6 +35,8 @@ declare global { }; //function (optional) - setup some logic for the chart func?: (chart: ChartObject) => void; + //no data text (optional) to show if all series are empty + noData?: string; } //Instantiated Chart diff --git a/history/v2/history-tests.ts b/history/v2/history-tests.ts index 454b223e09..598d934e8d 100644 --- a/history/v2/history-tests.ts +++ b/history/v2/history-tests.ts @@ -1,4 +1,4 @@ -import { createBrowserHistory, createLocation, useBasename, useBeforeUnload, useQueries } from 'history' +import { createHistory, createLocation, useBasename, useBeforeUnload, useQueries } from 'history' import { getUserConfirmation } from 'history/lib/DOMUtils' @@ -10,7 +10,7 @@ let doSomethingAsync: () => Promise; let input = { value: "" }; { - let history = createBrowserHistory() + let history = createHistory() // Listen for changes to the current location. The // listener is called once immediately. @@ -46,7 +46,7 @@ let input = { value: "" }; } { - let history = createBrowserHistory() + let history = createHistory() // Pushing a path string. history.push('/the/path') @@ -63,7 +63,7 @@ let input = { value: "" }; } { - let history = createBrowserHistory() + let history = createHistory() history.listenBefore(function(location) { if (input.value !== '') return 'Are you sure you want to leave this page?' @@ -75,7 +75,7 @@ let input = { value: "" }; } { - let history = createBrowserHistory({ + let history = createHistory({ getUserConfirmation(message, callback) { callback(window.confirm(message)) // The default behavior } @@ -83,7 +83,7 @@ let input = { value: "" }; } { - let history = useBeforeUnload(createBrowserHistory)() + let history = useBeforeUnload(createHistory)() history.listenBeforeUnload(function() { return 'Are you sure you want to leave this page?' @@ -91,7 +91,7 @@ let input = { value: "" }; } { - let history = useQueries(createBrowserHistory)() + let history = useQueries(createHistory)() history.listen(function(location) { console.log(location.query) @@ -99,7 +99,7 @@ let input = { value: "" }; } { - let history = useQueries(createBrowserHistory)({ + let history = useQueries(createHistory)({ parseQueryString: function(queryString) { // TODO: return a parsed version of queryString return {}; @@ -116,7 +116,7 @@ let input = { value: "" }; { // Run our app under the /base URL. - let history = useBasename(createBrowserHistory)({ + let history = useBasename(createHistory)({ basename: '/base' }) @@ -128,4 +128,4 @@ let input = { value: "" }; history.createPath('/the/path') // /base/the/path history.push('/the/path') // push /base/the/path -} \ No newline at end of file +} diff --git a/history/v2/index.d.ts b/history/v2/index.d.ts index 5f719c2f0b..6b61fa1b77 100644 --- a/history/v2/index.d.ts +++ b/history/v2/index.d.ts @@ -127,7 +127,7 @@ export interface Module { }; } -export { default as createBrowserHistory } from "./lib/createBrowserHistory"; +export { default as createHistory } from "./lib/createBrowserHistory"; export { default as createHashHistory } from "./lib/createHashHistory"; export { default as createMemoryHistory } from "./lib/createMemoryHistory"; export { default as createLocation } from "./lib/createLocation"; diff --git a/howler/index.d.ts b/howler/index.d.ts index 1b6604b1aa..df3f6a363b 100644 --- a/howler/index.d.ts +++ b/howler/index.d.ts @@ -66,7 +66,7 @@ interface Howl { rate(idOrSetRate: number): this | number; rate(rate: number, id: number): this; - seek(seek?: number, id?: number): this; + seek(seek?: number, id?: number): this | number; loop(loop?: boolean, id?: number): this; playing(id?: number): boolean; duration(id?: number): number; diff --git a/html-to-text/index.d.ts b/html-to-text/index.d.ts index ce02e4bfe5..406908a6ce 100644 --- a/html-to-text/index.d.ts +++ b/html-to-text/index.d.ts @@ -39,7 +39,7 @@ interface HtmlToTextOptions { * Defines after how many chars a line break should follow in p elements. * Set to null or false to disable word-wrapping. Default: 80 */ - wordwrap?: number; + wordwrap?: number | false | null; /** * Allows to select certain tables by the class or id attribute from the HTML diff --git a/html-webpack-plugin/html-webpack-plugin-tests.ts b/html-webpack-plugin/html-webpack-plugin-tests.ts index 485f6a81bf..a84d19bea5 100644 --- a/html-webpack-plugin/html-webpack-plugin-tests.ts +++ b/html-webpack-plugin/html-webpack-plugin-tests.ts @@ -1,34 +1,24 @@ -import HtmlWebpackPlugin = require("html-webpack-plugin"); -import { Configuration } from "webpack"; +import * as HtmlWebpackPlugin from 'html-webpack-plugin'; -const a: Configuration = { - plugins: [ - new HtmlWebpackPlugin() - ] -}; +new HtmlWebpackPlugin(); -const b: Configuration = { - plugins: [ - new HtmlWebpackPlugin({ - title: "test" - }) - ] -}; +const optionsArray: HtmlWebpackPlugin.Options[] = [ + { + title: 'test', + }, + { + minify: { + caseSensitive: true, + }, + }, + { + chunksSortMode: function compare(a, b) { + return 1; + }, + }, + { + arbitrary: 'data', + }, +]; -const minify: HtmlWebpackPlugin.MinifyConfig = { - caseSensitive: true -}; - -new HtmlWebpackPlugin({ - minify -}); - -new HtmlWebpackPlugin({ - chunksSortMode: function compare(a, b) { - return 1; - } -}); - -new HtmlWebpackPlugin({ - arbitrary: "data" -}); +const plugins: HtmlWebpackPlugin[] = optionsArray.map(options => new HtmlWebpackPlugin(options)); diff --git a/html-webpack-plugin/index.d.ts b/html-webpack-plugin/index.d.ts index f34d46c8c2..792c7a2dc0 100644 --- a/html-webpack-plugin/index.d.ts +++ b/html-webpack-plugin/index.d.ts @@ -3,106 +3,86 @@ // Definitions by: Simon Hartcher , Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { Plugin, Webpack } from "webpack"; -import { Options } from "html-minifier"; +import { Plugin } from 'webpack'; +import { Options as HtmlMinifierOptions } from 'html-minifier'; export = HtmlWebpackPlugin; -declare class HtmlWebpackPlugin implements Plugin { - constructor(options?: HtmlWebpackPlugin.Config); - apply(thisArg: Webpack, ...args: any[]): void; +declare class HtmlWebpackPlugin extends Plugin { + constructor(options?: HtmlWebpackPlugin.Options); } declare namespace HtmlWebpackPlugin { - export type MinifyConfig = Options; + type MinifyOptions = HtmlMinifierOptions; - /** - * It is assumed that each [chunk] contains at least the properties "id" - * (containing the chunk id) and "parents" (array containing the ids of the - * parent chunks). - */ - export interface Chunk { // TODO: Import from webpack? - id: string; - parents: string[]; - [propName: string]: any; // TODO: Narrow type - } + /** + * It is assumed that each [chunk] contains at least the properties "id" + * (containing the chunk id) and "parents" (array containing the ids of the + * parent chunks). + * + * @todo define in webpack + */ + interface Chunk { + id: string; + parents: string[]; + [propName: string]: any; + } - export type ChunkComparator = (a: Chunk, b: Chunk) => number; + type ChunkComparator = (a: Chunk, b: Chunk) => number; - export interface Config { - /** - * The title to use for the generated HTML document. - */ - title?: string; + interface Options { + /** `true | false` if `true` (default) try to emit the file only if it was changed. */ + cache?: boolean; + /** + * Allows to control how chunks should be sorted before they are included to the html. + * Allowed values: `'none' | 'auto' | 'dependency' | {function}` - default: `'auto'` + */ + chunksSortMode?: 'none' | 'auto' | 'dependency' | ChunkComparator; + /** Allows you to add only some chunks (e.g. only the unit-test chunk) */ + chunks?: string[]; + /** Allows you to skip some chunks (e.g. don't add the unit-test chunk) */ + excludeChunks?: string[]; + /** Adds the given favicon path to the output html. */ + favicon?: string; + /** + * The file to write the HTML to. + * Defaults to index.html. You can specify a subdirectory here too (eg: `assets/admin.html`). + */ + filename?: string; + /** + * `true | false` if `true` then append a unique webpack compilation hash to all included scripts and css files. + * This is useful for cache busting. + */ + hash?: boolean; + /** + * `true | 'head' | 'body' | false` + * Inject all assets into the given template or templateContent. + * When passing true or 'body' all javascript resources will be placed at the bottom of the body element. + * 'head' will place the scripts in the head element. + */ + inject?: 'body' | 'head' | boolean; + /** + * `{...} | false` Pass a html-minifier options object to minify the output. + * https://github.com/kangax/html-minifier#options-quick-reference + */ + minify?: false | MinifyOptions; + /** `true | false` if `true` (default) errors details will be written into the html page. */ + showErrors?: boolean; + /** Webpack require path to the template. Please see the docs for details. */ + template?: string; + /** The title to use for the generated HTML document. */ + title?: string; + /** `true | false` If `true` render the link tags as self-closing, XHTML compliant. Default is `false` */ + xhtml?: boolean; + /** + * In addition to the options actually used by this plugin, you can use this hash to pass arbitrary data through + * to your template. + */ + [option: string]: any; + } - /** - * The file to write the HTML to. Defaults to index.html. You can specify a subdirectory here too (eg: `assets/admin.html`). - */ - filename?: string; - - /** - * Webpack require path to the template. Please see the docs for details. - */ - template?: string; - - /** - * `true | 'head' | 'body' | false` - * - * Inject all assets into the given template or templateContent - When passing true or 'body' all javascript resources will be placed at the bottom of the body element. 'head' will place the scripts in the head element. - */ - inject?: boolean | "head" | "body"; - - /** - * Adds the given favicon path to the output html. - */ - favicon?: string; - - /** - * `{...} | false` Pass a html-minifier options object to minify the output. - * - * https://github.com/kangax/html-minifier#options-quick-reference - */ - minify?: MinifyConfig | false; - - /** - * `true | false` if `true` then append a unique webpack compilation hash to all included scripts and css files. This is useful for cache busting. - */ - hash?: boolean; - - /** - * `true | false` if `true` (default) try to emit the file only if it was changed. - */ - cache?: boolean; - - /** - * `true | false` if `true` (default) errors details will be written into the html page. - */ - showErrors?: boolean; - - /** - * Allows you to add only some chunks (e.g. only the unit-test chunk) - */ - chunks?: string[]; - - /** - * Allows to control how chunks should be sorted before they are included to the html. Allowed values: `'none' | 'auto' | 'dependency' | {function}` - default: `'auto'` - */ - chunksSortMode?: "none" | "auto" | "dependency" | ChunkComparator; - - /** - * Allows you to skip some chunks (e.g. don't add the unit-test chunk) - */ - excludeChunks?: string[]; - - /** - * `true | false` If `true` render the link tags as self-closing, XHTML compliant. Default is `false` - */ - xhtml?: boolean; - - /** - * In addition to the options actually used by this plugin, you can use - * this hash to pass arbitrary data through to your template. - */ - [option: string]: any; - } + /** @deprecated use MinifyOptions */ + type MinifyConfig = MinifyOptions; + /** @deprecated use Options */ + type Config = Options; } diff --git a/html-webpack-template/html-webpack-template-tests.ts b/html-webpack-template/html-webpack-template-tests.ts index c24a9506d3..4407af69eb 100644 --- a/html-webpack-template/html-webpack-template-tests.ts +++ b/html-webpack-template/html-webpack-template-tests.ts @@ -1,65 +1,65 @@ -import HtmlWebpackPlugin = require('html-webpack-plugin'); -import template = require('html-webpack-template'); +import * as HtmlWebpackPlugin from 'html-webpack-plugin'; +import * as template from 'html-webpack-template'; -const configs: Array = [ - { - // Required - inject: false, - template, - // template: 'node_modules/html-webpack-template/index.ejs', +const optionsArray: template.Options[] = [ + { + /** Required */ + inject: false, + template, + // template: 'node_modules/html-webpack-template/index.ejs', - // Optional - appMountId: 'app', - appMountIds: [ - 'root0', - 'root1', - ], - baseHref: 'http://example.com/awesome', - devServer: 'http://localhost:3001', - googleAnalytics: { - trackingId: 'UA-XXXX-XX', - pageViewOnLoad: true, - }, - links: [ - 'https://fonts.googleapis.com/css?family=Roboto', - { - href: '/apple-touch-icon.png', - rel: 'apple-touch-icon', - sizes: '180x180', - }, - { - href: '/favicon-32x32.png', - rel: 'icon', - sizes: '32x32', - type: 'image/png', - }, - ], - meta: [ - { - description: 'A better default template for html-webpack-plugin.', - }, - ], - mobile: true, - inlineManifestWebpackName: 'webpackManifest', - scripts: [ - 'http://example.com/somescript.js', - { - src: '/myModule.js', - type: 'module', - }, - ], - window: { - env: { - apiHost: 'http://myapi.com/api/v1', - }, - }, + /** Optional */ + appMountId: 'app', + appMountIds: [ + 'root0', + 'root1', + ], + baseHref: 'http://example.com/awesome', + devServer: 'http://localhost:3001', + googleAnalytics: { + trackingId: 'UA-XXXX-XX', + pageViewOnLoad: true, + }, + links: [ + 'https://fonts.googleapis.com/css?family=Roboto', + { + href: '/apple-touch-icon.png', + rel: 'apple-touch-icon', + sizes: '180x180', + }, + { + href: '/favicon-32x32.png', + rel: 'icon', + sizes: '32x32', + type: 'image/png', + }, + ], + meta: [ + { + description: 'A better default template for html-webpack-plugin.', + }, + ], + mobile: true, + inlineManifestWebpackName: 'webpackManifest', + scripts: [ + 'http://example.com/somescript.js', + { + src: '/myModule.js', + type: 'module', + }, + ], + window: { + env: { + apiHost: 'http://myapi.com/api/v1', + }, + }, - // And any other config options from html-webpack-plugin: - // https://github.com/ampedandwired/html-webpack-plugin#configuration - title: 'My App', - }, + /** + * And any other config options from html-webpack-plugin: + * https://github.com/ampedandwired/html-webpack-plugin#configuration + */ + title: 'My App', + }, ]; -const plugins: Array = configs.map(config => - new HtmlWebpackPlugin(config) -); +const plugins: HtmlWebpackPlugin[] = optionsArray.map(options => new HtmlWebpackPlugin(options)); diff --git a/html-webpack-template/index.d.ts b/html-webpack-template/index.d.ts index e224e96296..f1b57fa331 100644 --- a/html-webpack-template/index.d.ts +++ b/html-webpack-template/index.d.ts @@ -3,94 +3,74 @@ // Definitions by: Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { Config as HtmlWebpackPluginConfig } from 'html-webpack-plugin'; +import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin'; export = HtmlWebpackTemplate; declare const HtmlWebpackTemplate: string; declare namespace HtmlWebpackTemplate { - export interface GoogleAnalyticsConfig { - trackingId: string; - // Log a pageview event after the analytics code loads. - pageViewOnLoad?: boolean; - } + interface GoogleAnalyticsOptions { + /** Log a pageview event after the analytics code loads. */ + pageViewOnLoad?: boolean; + trackingId: string; + } - export interface Attributes { - [name: string]: any; - } + interface Attributes { + [name: string]: any; + } - type Resource = string | Attributes; + type Resource = string | Attributes; - /** - * string: value is assigned to the href attribute and the rel attribute is - * set to "stylesheet" - * - * object: properties and values are used as the attribute names and values, - * respectively: - */ - export type Link = Resource; + /** + * string: value is assigned to the href attribute and the rel attribute is set to "stylesheet" + * object: properties and values are used as the attribute names and values, respectively. + */ + type Link = Resource; - /** - * string: value is assigned to the src attribute and the type attribute is - * set to "text/javascript"; - * - * object: properties and values are used as the attribute names and values, - * respectively. - */ - export type Script = Resource; + /** + * string: value is assigned to the src attribute and the type attribute is set to "text/javascript". + * object: properties and values are used as the attribute names and values, respectively. + */ + type Script = Resource; - export interface Config extends HtmlWebpackPluginConfig { - /** - * Set to false. Controls asset addition to the template. This template - * takes care of that. - */ - inject: false; + interface Options extends HtmlWebpackPluginOptions { + /** The

element id on which you plan to mount a JavaScript app. */ + appMountId?: string; + /** An array of application element ids. */ + appMountIds?: string[]; + /** + * Adjust the URL for relative URLs in the document (MDN). + * https://developer.mozilla.org/en/docs/Web/HTML/Element/base + */ + baseHref?: string; + /** Insert the webpack-dev-server hot reload script at this host:port/path; e.g., http://localhost:3000. */ + devServer?: string; + /** Track usage of your site via Google Analytics. */ + googleAnalytics?: GoogleAnalyticsOptions; + /** Set to false. Controls asset addition to the template. This template takes care of that. */ + inject: false; + /** + * For use with inline-manifest-webpack-plugin. + * https://github.com/szrenwei/inline-manifest-webpack-plugin + */ + inlineManifestWebpackName?: string; + /** Array of elements. */ + links?: Link[]; + /** Array of objects containing key value pairs to be included as meta tags. */ + meta?: Attributes[]; + /** Sets appropriate meta tag for page scaling. */ + mobile?: boolean; + /** Array of external script imports to include on page. */ + scripts?: Script[]; + /** Specify this module's index.ejs file. */ + template: string; + /** Object that defines data you need to bootstrap a JavaScript app. */ + window?: {}; + } - // Specify this module's index.ejs file. - template: string; - - // The
element id on which you plan to mount a JavaScript app. - appMountId?: string; - - // An array of application element ids. - appMountIds?: string[]; - - /** - * Adjust the URL for relative URLs in the document (MDN). - * https://developer.mozilla.org/en/docs/Web/HTML/Element/base - */ - baseHref?: string; - - /** - * Insert the webpack-dev-server hot reload script at this - * host:port/path; e.g., http://localhost:3000. - */ - devServer?: string; - - // Track usage of your site via Google Analytics. - googleAnalytics?: GoogleAnalyticsConfig; - - // Array of elements. - links?: Link[]; - - // Array of objects containing key value pairs to be included as meta tags. - meta?: Attributes[]; - - // Sets appropriate meta tag for page scaling. - mobile?: boolean; - - /** - * For use with inline-manifest-webpack-plugin. - * - * https://github.com/szrenwei/inline-manifest-webpack-plugin - */ - inlineManifestWebpackName?: string; - - // Array of external script imports to include on page. - scripts?: Script[]; - - // Object that defines data you need to bootstrap a JavaScript app. - window?: {}; - } + /** @deprecated use GoogleAnalyticsOptions */ + type GoogleAnalyticsConfig = GoogleAnalyticsOptions; + /** @deprecated use Options */ + type Config = Options; } diff --git a/jest/index.d.ts b/jest/index.d.ts index f376ea5bcc..9f945ba426 100644 --- a/jest/index.d.ts +++ b/jest/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Jest 16.0.0 +// Type definitions for Jest 18.1.0 // Project: http://facebook.github.io/jest/ -// Definitions by: Asana , Ivo Stratev , jwbay +// Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare var beforeAll: jest.Lifecycle; declare var beforeEach: jest.Lifecycle; @@ -16,7 +17,7 @@ declare var xit: jest.It; declare var test: jest.It; declare var xtest: jest.It; -declare function expect(actual: any): jest.Matchers; +declare const expect: jest.Expect; interface NodeRequire { /** Returns the actual module instead of a mock, bypassing all checks on whether the module should receive a mock implementation or not. */ @@ -26,13 +27,18 @@ interface NodeRequire { } declare namespace jest { + /** Provides a way to add Jasmine-compatible matchers into your Jest context. */ function addMatchers(matchers: jasmine.CustomMatcherFactories): typeof jest; /** Disables automatic mocking in the module loader. */ function autoMockOff(): typeof jest; /** Enables automatic mocking in the module loader. */ function autoMockOn(): typeof jest; - /** Clears the mock.calls and mock.instances properties of all mocks. Equivalent to calling .mockClear() on every mocked function. */ + /** + * @deprecated use resetAllMocks instead + */ function clearAllMocks(): typeof jest; + /** Clears the mock.calls and mock.instances properties of all mocks. Equivalent to calling .mockClear() on every mocked function. */ + function resetAllMocks(): typeof jest; /** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */ function clearAllTimers(): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module, including all of the specificied module's dependencies. */ @@ -46,6 +52,7 @@ declare namespace jest { /** Enables automatic mocking in the module loader. */ function enableAutomock(): typeof jest; /** Creates a mock function. Optionally takes a mock implementation. */ + function fn(implementation: (...args: any[]) => T): Mock; function fn(implementation?: Function): Mock; /** Use the automatic mocking system to generate a mocked version of the given module. */ function genMockFromModule(moduleName: string): T; @@ -98,8 +105,16 @@ declare namespace jest { (fn: ProvidesCallback): any; } + /** Creates a test closure */ interface It { + /** + * Creates a test closure. + * + * @param {string} name The name of your test + * @param {fn?} ProvidesCallback The function for your test + */ (name: string, fn?: ProvidesCallback): void; + /** Only runs this test in the current file. */ only: It; skip: It; concurrent: It; @@ -111,35 +126,113 @@ declare namespace jest { skip: Describe; } + interface MatcherUtils { + readonly isNot: boolean; + utils: { + readonly EXPECTED_COLOR: string; + readonly RECEIVED_COLOR: string; + ensureActualIsNumber(actual: any, matcherName?: string): void; + ensureExpectedIsNumber(actual: any, matcherName?: string): void; + ensureNoExpected(actual: any, matcherName?: string): void; + ensureNumbers(actual: any, expected: any, matcherName?: string): void; + /** get the type of a value with handling of edge cases like `typeof []` and `typeof null` */ + getType(value: any): string; + matcherHint(matcherName: string, received?: string, expected?: string, options?: { secondArgument?: string, isDirectExpectCall?: boolean }): string; + pluralize(word: string, count: number): string; + printExpected(value: any): string; + printReceived(value: any): string; + printWithType(name: string, received: any, print: (value: any) => string): string; + stringify(object: {}, maxDepth?: number): string; + } + } + + interface ExpectExtendMap { + [key: string]: (this: MatcherUtils, received: any, actual: any) => { message: () => string, pass: boolean }; + } + + /** The `expect` function is used every time you want to test a value. You will rarely call `expect` by itself. */ + interface Expect { + /** + * The `expect` function is used every time you want to test a value. You will rarely call `expect` by itself. + * + * @param {any} actual The value to apply matchers against. + */ + (actual: any): Matchers; + anything(): void; + /** Matches anything that was created with the given constructor. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. */ + any(classType: any): void; + /** Matches any array made up entirely of elements in the provided array. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. */ + arrayContaining(arr: any[]): void; + /** Verifies that a certain number of assertions are called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ + assertions(num: number): void; + /** You can use `expect.extend` to add your own matchers to Jest. */ + extend(obj: ExpectExtendMap): void; + /** Matches any object that recursively matches the provided keys. This is often handy in conjunction with other asymmetric matchers. */ + objectContaining(obj: {}): void; + /** Matches any string that contains the exact provided string */ + stringMatching(str: string | RegExp): void; + } + interface Matchers { + /** If you know how to test something, `.not` lets you test its opposite. */ not: Matchers; lastCalledWith(...args: any[]): void; + /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ toBe(expected: any): void; + /** Ensures that a mock function is called. */ toBeCalled(): void; + /** Ensure that a mock function is called with specific arguments. */ toBeCalledWith(...args: any[]): void; - toBeCloseTo(expected: number, delta: number): void; + /** Using exact equality with floating point numbers is a bad idea. Rounding means that intuitive things fail. */ + toBeCloseTo(expected: number, delta?: number): void; + /** Ensure that a variable is not undefined. */ toBeDefined(): void; + /** When you don't care what a value is, you just want to ensure a value is false in a boolean context. */ toBeFalsy(): void; + /** For comparing floating point numbers. */ toBeGreaterThan(expected: number): void; + /** For comparing floating point numbers. */ toBeGreaterThanOrEqual(expected: number): void; + /** Ensure that an object is an instance of a class. This matcher uses `instanceof` underneath. */ toBeInstanceOf(expected: any): void + /** For comparing floating point numbers. */ toBeLessThan(expected: number): void; + /** For comparing floating point numbers. */ toBeLessThanOrEqual(expected: number): void; + /** This is the same as `.toBe(null)` but the error messages are a bit nicer. So use `.toBeNull()` when you want to check that something is null. */ toBeNull(): void; + /** Use when you don't care what a value is, you just want to ensure a value is true in a boolean context. In JavaScript, there are six falsy values: `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. */ toBeTruthy(): void; + /** Used to check that a variable is undefined. */ toBeUndefined(): void; + /** Used when you want to check that an item is in a list. For testing the items in the list, this uses `===`, a strict equality check. */ toContain(expected: any): void; + /** Used when you want to check that an item is in a list. For testing the items in the list, this matcher recursively checks the equality of all fields, rather than checking for object identity. */ toContainEqual(expected: any): void; + /** Used when you want to check that two objects have the same value. This matcher recursively checks the equality of all fields, rather than checking for object identity. */ toEqual(expected: any): void; + /** Ensures that a mock function is called. */ toHaveBeenCalled(): boolean; + /** Ensures that a mock function is called an exact number of times. */ toHaveBeenCalledTimes(expected: number): boolean; + /** Ensure that a mock function is called with specific arguments. */ toHaveBeenCalledWith(...params: any[]): boolean; + /** If you have a mock function, you can use `.toHaveBeenLastCalledWith` to test what arguments it was last called with. */ toHaveBeenLastCalledWith(...params: any[]): boolean; + /** Used to check that an object has a `.length` property and it is set to a certain numeric value. */ + toHaveLength(expected: number): void; + toHaveProperty(propertyPath: string, value?: any): void; + /** Check that a string matches a regular expression. */ toMatch(expected: string | RegExp): void; + /** Used to check that a JavaScript object matches a subset of the properties of an objec */ toMatchObject(expected: {}): void; - toMatchSnapshot(): void; + /** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */ + toMatchSnapshot(snapshotName?: string): void; + /** Used to test that a function throws when it is called. */ toThrow(): void; + /** If you want to test that a specific error is thrown inside a function. */ toThrowError(error?: string | Constructable | RegExp): void; + /** Used to test that a function throws a error matching the most recent snapshot when it is called. */ toThrowErrorMatchingSnapshot(): void; } @@ -147,9 +240,25 @@ declare namespace jest { new (...args: any[]): any } - interface Mock extends Function { + interface Mock extends Function, MockInstance { new (): T; (...args: any[]): any; + } + + /** + * Wrap module with mock definitions + * @example + * jest.mock("../api"); + * import { Api } from "../api"; + * + * const myApi: jest.Mocked = new Api() as any; + * myApi.myApiMethod.mockImplementation(() => "test"); + */ + type Mocked = { + [P in keyof T]: T[P] & MockInstance; + } & T; + + interface MockInstance { mock: MockContext; mockClear(): void; mockReset(): void; diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts index 913a671fa1..a3d84a09e3 100644 --- a/jest/jest-tests.ts +++ b/jest/jest-tests.ts @@ -147,6 +147,10 @@ describe('compartion', function () { it('works sanely with simple decimals', function () { expect(0.2 + 0.1).toBeCloseTo(0.3, 5); }); + + it('works sanely with simple decimals and the default delta', function () { + expect(0.2 + 0.1).toBeCloseTo(0.3); + }); }); describe('toThrow API', function () { @@ -171,6 +175,60 @@ describe('toThrow API', function () { }); }); +describe('Assymetric matchers', function () { + it('works', function () { + expect({ + timestamp: 1480807810388, + text: 'Some text content, but we care only about *this part*' + }).toEqual({ + timestamp: expect.any(Number), + text: expect.stringMatching('*this part*') + }); + + const callback = jest.fn(); + expect(callback).toEqual(expect.any(Function)); + callback(5, "test"); + expect(callback).toBeCalledWith(expect.any(Number), expect.any(String)) + const obj = { + items: [1] + }; + expect(obj).toEqual(expect.objectContaining({ + items: expect.arrayContaining([ + expect.any(Number) + ]) + })); + + expect.assertions(4); + }); +}); + +describe('Extending extend', function () { + it('works', function () { + expect.extend({ + toBeNumber(received: any, actual: any) { + const pass = received === actual; + const message = + () => `expected ${received} ${pass ? 'not ' : ''} to be ${actual}`; + return { message, pass }; + }, + toBeTest(received: any, actual: any) { + this.utils.ensureNoExpected(received); + this.utils.ensureActualIsNumber(received); + this.utils.ensureExpectedIsNumber(actual); + this.utils.ensureNumbers(received, actual); + + return { + message: () => ` + ${this.utils.getType(received).toLowerCase()} \n\n + ${this.utils.matcherHint(".not.toBe")} ${this.utils.printExpected(actual)} ${this.utils.printReceived(received)}\n\n + `, + pass: true + }; + } + }); + }); +}); + describe('missing tests', function () { it('creates closures', function () { class Closure { @@ -208,7 +266,7 @@ describe('missing tests', function () { expect(getFruits()).toContain('Orange'); mock.mockReturnValueOnce(['Apple', 'Plum']); expect(mock()).not.toContain('Orange'); - const myBeverage: any = {delicious: true, sour: false}; + const myBeverage: any = {delicious: true, sour: false}; expect(myBeverage).toContainEqual({delicious: true, sour: false}); mock.mockReturnValue([]); //Deprecated: Use jest.fn(() => value) instead. mock.mockClear(); @@ -248,6 +306,10 @@ describe('toMatchSnapshot', function () { it('compares snapshots', function () { expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot(); }); + + it('can give name to snapshot', function () { + expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot('given name'); + }); }); describe('toThrowErrorMatchingSnapshot', function () { @@ -367,3 +429,58 @@ describe('strictNullChecks', function () { done(); }) }); + +class TestApi { + constructor() { }; + testProp: boolean; + private anotherProp: string; + testMethod(a: number): string { return ""; } +} + +declare function mockedFunc(a: number): string; + +declare function mockedFuncWithApi(api: TestApi): void; + +describe('Mocked type', function () { + it('Works', function () { + const mock: jest.Mocked = new TestApi() as any; + mock.testProp; + mock.testMethod.mockImplementation(() => 'test'); + mock.testMethod(5).toUpperCase(); + + mockedFuncWithApi(mock); + }); +}); + +describe('Mocks', function () { + it('jest.fn() without args is a function type', function () { + const test = jest.fn(); + test(); + new test(); + test.mock.instances[0]; + test.mockImplementation(() => { }); + }); + + it('jest.fn() with returned object infers type', function () { + const testMock = jest.fn(() => ({ a: 5, test: jest.fn() })); + + testMock(5, 5, 'a'); + testMock.mockImplementation(() => { }); + testMock.caller; + + const ins = new testMock(); + ins.a; + ins.test(); + ins.test.mockImplementation(() => 5); + ins.test.mock.calls; + + const anotherMock = jest.fn(() => { + const api: Partial = { + testMethod: jest.fn() + }; + return api; + }); + const anotherIns: jest.Mocked = new anotherMock() as any; + anotherIns.testMethod.mockImplementation(() => 1); + }); +}); diff --git a/jest/v16/index.d.ts b/jest/v16/index.d.ts new file mode 100644 index 0000000000..f376ea5bcc --- /dev/null +++ b/jest/v16/index.d.ts @@ -0,0 +1,303 @@ +// Type definitions for Jest 16.0.0 +// Project: http://facebook.github.io/jest/ +// Definitions by: Asana , Ivo Stratev , jwbay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var beforeAll: jest.Lifecycle; +declare var beforeEach: jest.Lifecycle; +declare var afterAll: jest.Lifecycle; +declare var afterEach: jest.Lifecycle; +declare var describe: jest.Describe; +declare var fdescribe: jest.Describe; +declare var xdescribe: jest.Describe; +declare var it: jest.It; +declare var fit: jest.It; +declare var xit: jest.It; +declare var test: jest.It; +declare var xtest: jest.It; + +declare function expect(actual: any): jest.Matchers; + +interface NodeRequire { + /** Returns the actual module instead of a mock, bypassing all checks on whether the module should receive a mock implementation or not. */ + requireActual(moduleName: string): any; + /** Returns a mock module instead of the actual module, bypassing all checks on whether the module should be required normally or not. */ + requireMock(moduleName: string): any; +} + +declare namespace jest { + function addMatchers(matchers: jasmine.CustomMatcherFactories): typeof jest; + /** Disables automatic mocking in the module loader. */ + function autoMockOff(): typeof jest; + /** Enables automatic mocking in the module loader. */ + function autoMockOn(): typeof jest; + /** Clears the mock.calls and mock.instances properties of all mocks. Equivalent to calling .mockClear() on every mocked function. */ + function clearAllMocks(): typeof jest; + /** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */ + function clearAllTimers(): typeof jest; + /** Indicates that the module system should never return a mocked version of the specified module, including all of the specificied module's dependencies. */ + function deepUnmock(moduleName: string): typeof jest; + /** Disables automatic mocking in the module loader. */ + function disableAutomock(): typeof jest; + /** Mocks a module with an auto-mocked version when it is being required. */ + function doMock(moduleName: string): typeof jest; + /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ + function dontMock(moduleName: string): typeof jest; + /** Enables automatic mocking in the module loader. */ + function enableAutomock(): typeof jest; + /** Creates a mock function. Optionally takes a mock implementation. */ + function fn(implementation?: Function): Mock; + /** Use the automatic mocking system to generate a mocked version of the given module. */ + function genMockFromModule(moduleName: string): T; + /** Returns whether the given function is a mock function. */ + function isMockFunction(fn: any): fn is Mock; + /** Mocks a module with an auto-mocked version when it is being required. */ + function mock(moduleName: string, factory?: any, options?: MockOptions): typeof jest; + /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */ + function resetModuleRegistry(): typeof jest; + /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */ + function resetModules(): typeof jest; + /** Exhausts tasks queued by setImmediate(). */ + function runAllImmediates(): typeof jest; + /** Exhausts the micro-task queue (usually interfaced in node via process.nextTick). */ + function runAllTicks(): typeof jest; + /** Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()). */ + function runAllTimers(): typeof jest; + /** Executes only the macro-tasks that are currently pending (i.e., only the tasks that have been queued by setTimeout() or setInterval() up to this point). + * If any of the currently pending macro-tasks schedule new macro-tasks, those new tasks will not be executed by this call. */ + function runOnlyPendingTimers(): typeof jest; + /** Executes only the macro task queue (i.e. all tasks queued by setTimeout() or setInterval() and setImmediate()). */ + function runTimersToTime(msToRun: number): typeof jest; + /** Explicitly supplies the mock object that the module system should return for the specified module. */ + function setMock(moduleName: string, moduleExports: T): typeof jest; + /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ + function unmock(moduleName: string): typeof jest; + /** Instructs Jest to use fake versions of the standard timer functions. */ + function useFakeTimers(): typeof jest; + /** Instructs Jest to use the real versions of the standard timer functions. */ + function useRealTimers(): typeof jest; + + interface MockOptions { + virtual?: boolean; + } + + interface EmptyFunction { + (): void; + } + + interface DoneCallback { + (...args: any[]): any + fail(error?: string | { message: string }): any; + } + + interface ProvidesCallback { + (cb: DoneCallback): any; + } + + interface Lifecycle { + (fn: ProvidesCallback): any; + } + + interface It { + (name: string, fn?: ProvidesCallback): void; + only: It; + skip: It; + concurrent: It; + } + + interface Describe { + (name: string, fn: EmptyFunction): void + only: Describe; + skip: Describe; + } + + interface Matchers { + not: Matchers; + lastCalledWith(...args: any[]): void; + toBe(expected: any): void; + toBeCalled(): void; + toBeCalledWith(...args: any[]): void; + toBeCloseTo(expected: number, delta: number): void; + toBeDefined(): void; + toBeFalsy(): void; + toBeGreaterThan(expected: number): void; + toBeGreaterThanOrEqual(expected: number): void; + toBeInstanceOf(expected: any): void + toBeLessThan(expected: number): void; + toBeLessThanOrEqual(expected: number): void; + toBeNull(): void; + toBeTruthy(): void; + toBeUndefined(): void; + toContain(expected: any): void; + toContainEqual(expected: any): void; + toEqual(expected: any): void; + toHaveBeenCalled(): boolean; + toHaveBeenCalledTimes(expected: number): boolean; + toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenLastCalledWith(...params: any[]): boolean; + toMatch(expected: string | RegExp): void; + toMatchObject(expected: {}): void; + toMatchSnapshot(): void; + toThrow(): void; + toThrowError(error?: string | Constructable | RegExp): void; + toThrowErrorMatchingSnapshot(): void; + } + + interface Constructable { + new (...args: any[]): any + } + + interface Mock extends Function { + new (): T; + (...args: any[]): any; + mock: MockContext; + mockClear(): void; + mockReset(): void; + mockImplementation(fn: Function): Mock; + mockImplementationOnce(fn: Function): Mock; + mockReturnThis(): Mock; + mockReturnValue(value: any): Mock; + mockReturnValueOnce(value: any): Mock; + } + + interface MockContext { + calls: any[][]; + instances: T[]; + } +} + +//Jest ships with a copy of Jasmine. They monkey-patch its APIs and divergence/deprecation are expected. +//Relevant parts of Jasmine's API are below so they can be changed and removed over time. +//This file can't reference jasmine.d.ts since the globals aren't compatible. + +declare function spyOn(object: any, method: string): jasmine.Spy; +/** 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; +/** Fails a test when called within one. */ +declare function fail(error?: any): void; +declare namespace 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 addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + function addMatchers(matchers: CustomMatcherFactories): void; + function stringMatching(value: string | RegExp): 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 Any { + new (expectedClass: any): any; + jasmineMatches(other: any): boolean; + jasmineToString(): string; + } + + 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 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.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */ + returnValues(...values: 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[]; + /** The return value of the call */ + returnValue: any; + } + + interface CustomMatcherFactories { + [index: string]: CustomMatcherFactory; + } + + interface CustomMatcherFactory { + (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; + } + + 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 CustomEqualityTester { + (first: any, second: any): boolean; + } + + interface CustomMatcher { + compare(actual: T, expected: T): CustomMatcherResult; + compare(actual: any, expected: any): CustomMatcherResult; + } + + interface CustomMatcherResult { + pass: boolean; + message: string | (() => string); + } + + interface ArrayLike { + length: number; + [n: number]: T; + } +} diff --git a/jest/v16/jest-tests.ts b/jest/v16/jest-tests.ts new file mode 100644 index 0000000000..c69eae61a2 --- /dev/null +++ b/jest/v16/jest-tests.ts @@ -0,0 +1,369 @@ +/// + +// Tests based on the Jest website +jest.unmock('../sum'); + +describe('sum', function() { + it('adds 1 + 2 to equal 3', function() { + var sum: (a: number, b: number) => number = require('../sum'); + expect(sum(1, 2)).toBe(3); + }); +}); + +describe('fetchCurrentUser', function() { + it('calls the callback when $.ajax requests are finished', function() { + var $ = require('jquery'); + var fetchCurrentUser = require('../fetchCurrentUser'); + + // Create a mock function for our callback + var callback = jest.fn(); + fetchCurrentUser(callback); + + // Now we emulate the process by which `$.ajax` would execute its own + // callback + $.ajax.mock.calls[0 /*first call*/][0 /*first argument*/].success({ + firstName: 'Bobby', + lastName: '");DROP TABLE Users;--' + }); + + // And finally we assert that this emulated call by `$.ajax` incurred a + // call back into the mock function we provided as a callback + expect(callback.mock.calls[0/*first call*/][0/*first arg*/]).toEqual({ + loggedIn: true, + fullName: 'Bobby ");DROP TABLE Users;--' + }); + }); +}); + +// unmock is the recommended approach for unmocking... +jest.unmock('../displayUser.js') + +describe('displayUser', function() { + it('displays a user after a click', function() { + // Set up our document body + document.body.innerHTML = + '
' + + ' ' + + '
'; + + var displayUser = require.requireActual('../displayUser'); + var $ = require('jquery'); + var fetchCurrentUser = require('../fetchCurrentUser'); + + // Tell the fetchCurrentUser mock function to automatically invoke + // its callback with some data + fetchCurrentUser.mockImplementation(function(cb: Function) { + cb({ + loggedIn: true, + fullName: 'Johnny Cash' + }); + }); + + // Use jquery to emulate a click on our button + $('#button').click(); + + // Assert that the fetchCurrentUser function was called, and that the + // #username span's innter text was updated as we'd it expect. + expect(fetchCurrentUser).toBeCalled(); + expect($('#username').text()).toEqual('Johnny Cash - Logged In'); + }); +}); + +jest.unmock('../CheckboxWithLabel.js'); +describe('CheckboxWithLabel', function() { + it('changes the text after click', function() { + var React = require('react/addons'); + var CheckboxWithLabel = require('../CheckboxWithLabel.js'); + var TestUtils = React.addons.TestUtils; + + // Render a checkbox with label in the document + var checkbox = TestUtils.renderIntoDocument( + CheckboxWithLabel({ + labelOn: "On", + labelOff: "Off" + }) + ); + + // Verify that it's Off by default + var label = TestUtils.findRenderedDOMComponentWithTag( + checkbox, 'label'); + expect(label.getDOMNode().textContent).toEqual('Off'); + + // Simulate a click and verify that it is now On + var input = TestUtils.findRenderedDOMComponentWithTag( + checkbox, 'input'); + TestUtils.Simulate.change(input); + expect(label.getDOMNode().textContent).toEqual('On'); + }); +}); + +jest.runAllTicks(); +xdescribe('Hooks and Suits', function () { + let tested: boolean; + + beforeEach(function () { + tested = false; + }); + + afterEach(function () { + tested = true; + }); + + test('tested', function () { + expect(tested).toBeTruthy(); + expect(tested).not.toBeFalsy(); + }); + + fit('tested', function () { + expect(tested).toBeDefined(); + expect(tested).not.toBeUndefined(); + }); + + xit('expect null to be null', function () { + expect(null).toBeNull(); + }); +}); + +describe('compartion', function () { + var sum: (a: number, b: number) => number = require.requireMock('../sum'); + + it('compares is 7 + 2 greater than 3', function () { + expect(sum(7, 2)).toBeGreaterThan(3); + }); + + it('compares is 2 + 7 greater than or equal to 3', function () { + expect(sum(2, 7)).toBeGreaterThanOrEqual(3); + }); + + it('compares is 3 less than 3 + 4', function () { + expect(3).toBeLessThan(sum(3, 4)); + }); + + it('compares is 3 less than or equal to 4 + 3', function () { + expect(3).toBeLessThanOrEqual(sum(4, 3)); + }); + + it('works sanely with simple decimals', function () { + expect(0.2 + 0.1).toBeCloseTo(0.3, 5); + }); +}); + +describe('toThrow API', function () { + function throwTypeError(): void { + throw new TypeError('toThrow Definition was out of date'); + } + + it('throws', function () { + expect(throwTypeError()).toThrow(); + }); + + it('throws TypeError', function () { + expect(throwTypeError()).toThrowError(TypeError); + }); + + it('throws \'Definition was out of date\'', function () { + expect(throwTypeError()).toThrowError(/Definition was out of date/); + }); + + it('throws \'toThorow Definition was out of date\'', function () { + expect(throwTypeError()).toThrowError('toThrow Definition was out of date'); + }); +}); + +describe('missing tests', function () { + it('creates closures', function () { + class Closure { + private arg: T; + + public constructor(private fn: (arg: T) => void) { + this.fn = fn; + } + + public bind(arg: T): void { + this.arg = arg; + } + + public call(): void { + this.fn(this.arg); + } + } + + type StringClosure = (arg: string) => void; + let spy: jest.Mock = jest.fn(); + let closure: Closure = new Closure(spy); + closure.bind('jest'); + closure.call(); + expect(spy).lastCalledWith('jest'); + expect(spy).toBeCalledWith('jest'); + expect(jest.isMockFunction(spy)).toBeTruthy(); + }); + + it('tests all mising Mocks functionality', function () { + type FruitsGetter = () => Array; + let mock: jest.Mock = jest.fn(); + mock.mockImplementationOnce(() => ['Orange', 'Apple', 'Plum']) + jest.setMock('./../tesks/getFruits', mock); + const getFruits: FruitsGetter = require('./../tesks/getFruits'); + expect(getFruits()).toContain('Orange'); + mock.mockReturnValueOnce(['Apple', 'Plum']); + expect(mock()).not.toContain('Orange'); + const myBeverage: any = {delicious: true, sour: false}; + expect(myBeverage).toContainEqual({delicious: true, sour: false}); + mock.mockReturnValue([]); //Deprecated: Use jest.fn(() => value) instead. + mock.mockClear(); + let thisMock: jest.Mock = jest.fn().mockReturnThis(); + expect(thisMock()).toBe(this); + }); + + it('creates snapshoter', function () { + jest.disableAutomock().mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true }); + const render: () => string = require('./render'); + expect(render()).toMatch(/Link/); + jest.enableAutomock(); + }); + + it('runs only pending timers', function () { + jest.useRealTimers(); + setTimeout(() => expect(1).not.toEqual(0), 3000); + jest.runOnlyPendingTimers().runTimersToTime(300); + }); + + it('runs all timers', function () { + jest.clearAllTimers(); + jest.useFakeTimers(); + setTimeout(() => expect(0).not.toEqual(1), 3000); + jest.runAllTimers(); + }); + + it('cleares cache', function () { + const sum1 = require('../sum'); + jest.resetModules(); + const sum2 = require('../sum'); + expect(sum1).not.toBe(sum2); + }) +}); + +describe('toMatchSnapshot', function () { + it('compares snapshots', function () { + expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot(); + }); +}); + +describe('toThrowErrorMatchingSnapshot', function () { + it('compares snapshots', function () { + expect(() => { throw new Error('descriptiton') }).toThrowErrorMatchingSnapshot(); + }); +}); + +function testInstances() { + var mockFn = jest.fn(); + var a = new mockFn(); + var b = new mockFn(); + + mockFn.mock.instances[0] === a; // true + mockFn.mock.instances[1] === b; // true +} + +function testMockImplementation() { + var mockFn = jest.fn().mockImplementation(function (scalar:number):number { + return 42 + scalar; + }); + + var a = mockFn(0); + var b = mockFn(1); + + a === 42; // true + b === 43; // true + + mockFn.mock.calls[0][0] === 0; // true + mockFn.mock.calls[1][0] === 1; // true +} + +// Test from jest Docs: +describe('genMockFromModule', function () { + // Interfaces: + interface MockFiles { + [index: string]: string; + } + + interface MockedFS { + readdirSync: (dir: string) => string[]; + __setMockFiles: (newMockFiles: MockFiles) => void ; + } + + // ------------------------------------------------------------------------------------ + // FileSummarizer.ts + + const fs = require('fs'); + + function summarizeFilesInDirectorySync(directory: string): string[] { + return fs.readdirSync(directory).map((fileName: string) => ({ + fileName, + directory, + })); + } + + //export default summarizeFilesInDirectorySync; // For sake of compilation + + // ------------------------------------------------------------------------------------ + // __mocks__/fs.js + + const path = require('path'); + + const mockedFS: MockedFS = jest.genMockFromModule('fs'); + + let mockFiles: any = Object.create(null); + function __setMockFiles(newMockFiles: MockFiles): void { + mockFiles = Object.create(null); + for(const file in newMockFiles) { + const dir: string = path.dirname(file); + + if (!mockFiles[dir]) { + mockFiles[dir] = []; + } + mockFiles[dir].push(path.basename(file)); + } + } + + function readdirSync(directoryPath: string): string[] { + return mockFiles[directoryPath] || []; + } + + mockedFS.readdirSync = readdirSync; + mockedFS.__setMockFiles = __setMockFiles; + + //export = mockedFS; // For sake of compilation + // ------------------------------------------------------------------------------------ + // __tests__/FileSummarizer-test.js + + jest.mock('fs'); + + describe('listFilesInDirectorySync', () => { + const MOCK_FILE_INFO: MockFiles = { + '/path/to/file1.js': 'console.log("file1 contents");', + '/path/to/file2.txt': 'file2 contents', + }; + + beforeEach(() => { + // Set up some mocked out file info before each test + (require('fs') as MockedFS).__setMockFiles(MOCK_FILE_INFO); + }); + + it('includes all files in the directory in the summary', () => { + const FileSummarizer: (dir: string) => string[] = require('../FileSummarizer'); + const fileSummary = FileSummarizer('/path/to'); + + expect(fileSummary.length).toBe(2); + }); + }); +}); + +/** + * Pass strictNullChecks + */ +describe('strictNullChecks', function () { + it('does not complain when using done callback', (done) => { + done(); + }) +}); diff --git a/jest/v16/tsconfig.json b/jest/v16/tsconfig.json new file mode 100644 index 0000000000..2e023e1205 --- /dev/null +++ b/jest/v16/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "jest": ["jest/v16"], + "jest/*": ["jest/v16/*"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jest-tests.ts" + ] +} diff --git a/jquery.datatables/index.d.ts b/jquery.datatables/index.d.ts index c7c4bd8682..5d1bbd50c9 100644 --- a/jquery.datatables/index.d.ts +++ b/jquery.datatables/index.d.ts @@ -908,7 +908,7 @@ declare namespace DataTables { * @param d Data to use for the row. */ data(d: any[] | Object): DataTable; - + /** * Get the id of the selected row. Since: 1.10.8 @@ -1456,9 +1456,9 @@ declare namespace DataTables { } export interface AjaxData { - draw: number; - recordsTotal: number; - recordsFiltered: number; + draw?: number; + recordsTotal?: number; + recordsFiltered?: number; data: any; error?: string; } diff --git a/jquery.fileupload/index.d.ts b/jquery.fileupload/index.d.ts index 54ebb89c5c..e113d2733c 100644 --- a/jquery.fileupload/index.d.ts +++ b/jquery.fileupload/index.d.ts @@ -198,7 +198,7 @@ interface JQueryFileInputOptions { * handlers using jQuery's Deferred callbacks: * data.submit().done(func).fail(func).always(func); */ - add?: any; + add?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void; // The plugin options are used as settings object for the ajax calls. // The following are jQuery ajax settings required for the file uploads: @@ -228,7 +228,7 @@ interface JQueryFileInputOptions { // Other callbacks: submit?: Function; done?: (e: JQueryEventObject, data: JQueryFileUploadDone) => void; - fail?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void; + fail?: (e: JQueryEventObject, data: JQueryFileUploadDone) => void; always?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void; progressall?: (e: JQueryEventObject, data: JQueryFileUploadProgressAllObject) => void; start?: (e: JQueryEventObject) => void; @@ -284,6 +284,7 @@ interface JQueryFileUploadXhr { jqXHR: JQueryXHR; result: any; textStatus: string; + errorThrown: any; headers: {[key: string]: any}; } diff --git a/jquery.noty/index.d.ts b/jquery.noty/index.d.ts index 85fc2fca4c..f4bfe4bcb9 100644 --- a/jquery.noty/index.d.ts +++ b/jquery.noty/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for jQuery.noty v2.0 +// Type definitions for jQuery.noty v2.4 // Project: http://needim.github.io/noty/ -// Definitions by: Aaron King +// Definitions by: Aaron King , Tim Helfensdörfer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Project by: Nedim Carter @@ -11,51 +11,60 @@ interface NotyOptions { theme?: string; type?: string; /** Text to show. Can be html or string. */ - text?: string; + text?: string; /** If you want to use queue feature set this true. */ - dismissQueue?: boolean; - /** The note`s optional template like '
' */ - template?: string; - animation?: NotyAnimationOptions; - /** Delay for closing event. Set false for sticky notifications */ - timeout?: any; - /** Adds notification to the beginning of queue when set to true */ - force?: boolean; - modal?: boolean; + dismissQueue?: boolean; + /** adds notification to the beginning of queue when set to true */ + force?: boolean; /** You can set max visible notification for dismissQueue true option */ maxVisible?: number; - /** To close all notifications before show */ + /** The note`s optional template like '
' */ + template?: string; + /** Delay for closing event. Set false for sticky notifications */ + timeout?: any; + /** displays a progress bar */ + progressBar?: boolean; + + animation?: NotyAnimationOptions; + /** backdrop click will close all notifications */ + closeWith?: ('click' | 'button' | 'hover' | 'backdrop')[]; + + /** if true adds an overlay */ + modal?: boolean; + /** if true closes all notifications and shows itself */ killer?: boolean; - closeWith?: any[]; + callback?: NotyCallbackOptions; - /** An array of buttons or false to hide them */ + + /** an array of buttons, for creating confirmation dialogs. */ buttons?: any; } interface NotyAnimationOptions { - open?: any; - close?: any; - easing?: string; - speed?: number; + open?: any; + close?: any; + easing?: string; + speed?: number; } interface NotyCallbackOptions { - onShow?: Function; - afterShow?: Function; - onClose?: Function; - afterClose?: Function; + onShow?: Function; + afterShow?: Function; + onClose?: Function; + afterClose?: Function; + onCloseClick?: Function; } interface NotyStatic { - (notyOptions: NotyOptions); - defaults: NotyOptions; + (notyOptions: NotyOptions); + defaults: NotyOptions; - get(id: any); - close(id: any); - clearQueue(); - closeAll(); - setText(id: any, text: string); - setType(id: any, type: string); + get(id: any); + close(id: any); + clearQueue(); + closeAll(); + setText(id: any, text: string); + setType(id: any, type: string); } interface Noty { @@ -72,7 +81,7 @@ interface Noty { } interface JQueryStatic { - noty: NotyStatic; + noty: NotyStatic; } interface JQuery { diff --git a/jquery.validation/index.d.ts b/jquery.validation/index.d.ts index 953755a065..2bb690c07e 100644 --- a/jquery.validation/index.d.ts +++ b/jquery.validation/index.d.ts @@ -217,6 +217,7 @@ declare namespace JQueryValidation interface Validator { element(element: string|JQuery): boolean; + checkForm(): boolean; /** * Validates the form, returns true if it is valid, false otherwise. */ diff --git a/jquery.validation/jquery.validation-tests.ts b/jquery.validation/jquery.validation-tests.ts index 15bb9f790c..0b2de520f2 100644 --- a/jquery.validation/jquery.validation-tests.ts +++ b/jquery.validation/jquery.validation-tests.ts @@ -208,6 +208,7 @@ function test_methods() { $("#myform").submit(); $("#myinput").attr(rules); }); + $("#myform").validate().checkForm(); $("#myform").validate().form(); $("#myform").validate().element("#myselect"); $("#myform").validate().element($("#myselect")); diff --git a/jquery/index.d.ts b/jquery/index.d.ts index e0bf072983..3a785530aa 100644 --- a/jquery/index.d.ts +++ b/jquery/index.d.ts @@ -786,6 +786,15 @@ interface JQueryStatic { */ ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + /** + * Creates an object that handles the actual transmission of Ajax data. + * + * @param dataType A string identifying the data type to use. + * @param handler A handler to return the new transport object to use with the data type provided in the first argument. + * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} + */ + ajaxTransport(dataType: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + ajaxSettings: JQueryAjaxSettings; /** diff --git a/js-md5/index.d.ts b/js-md5/index.d.ts index 32ef8b30ff..690279bbe4 100644 --- a/js-md5/index.d.ts +++ b/js-md5/index.d.ts @@ -1,36 +1,32 @@ -// Type definitions for js-md5 v0.3.0 +// Type definitions for js-md5 0.4 // Project: https://github.com/emn178/js-md5 -// Definitions by: Roland Greim +// Definitions by: Michael McCarthy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ -/// +declare namespace md5 { + type message = string | any[] | Uint8Array | ArrayBuffer; -interface JQuery { - md5(value: string): string; - md5(value: Array): string; - md5(value: Uint8Array): string; + interface Md5 { + array: () => number[]; + arrayBuffer: () => ArrayBuffer; + buffer: () => ArrayBuffer; + digest: () => number[]; + hex: () => string; + toString: () => string; + update: (message: message) => Md5; + } + + interface md5 { + (message: message): string; + hex: (message: message) => string; + array: (message: message) => number[]; + digest: (message: message) => number[]; + arrayBuffer: (message: message) => ArrayBuffer; + buffer: (message: message) => ArrayBuffer; + create: () => Md5; + update: (message: message) => Md5; + } } -interface JQueryStatic { - md5(value: string): string; - md5(value: Array): string; - md5(value: Uint8Array): string; -} - -interface md5 { - (value: string): string; - (value: Array): string; - (value: Uint8Array): string; -} - -interface String { - md5(value: string): string; - md5(value: Array): string; - md5(value: Uint8Array): string; -} - -declare module "js-md5" { - export = md5; -} - -declare var md5: md5; +declare const md5: md5.md5; +export = md5; diff --git a/js-md5/js-md5-tests.ts b/js-md5/js-md5-tests.ts index 984a919ec3..231b12ebf2 100644 --- a/js-md5/js-md5-tests.ts +++ b/js-md5/js-md5-tests.ts @@ -1,20 +1,29 @@ +import md5 = require("js-md5"); +let str: string = md5.hex('The quick brown fox jumps over the lazy dog'); +str = md5('The quick brown fox jumps over the lazy dog'); +let arr: number[] = md5.digest('The quick brown fox jumps over the lazy dog'); +arr = md5.array('The quick brown fox jumps over the lazy dog'); +let buf: ArrayBuffer = md5.arrayBuffer('The quick brown fox jumps over the lazy dog'); +buf = md5.buffer('The quick brown fox jumps over the lazy dog'); -md5('Message to hash'); -md5(''); -md5('中文'); -md5([]); -md5(new Uint8Array([])); +const hash1 = md5.create(); +hash1.update('The quick brown fox jumps over the lazy dog'); +str = hash1.hex(); +str = hash1.toString(); +arr = hash1.digest(); +arr = hash1.array(); +buf = hash1.arrayBuffer(); +buf = hash1.buffer(); -$.md5('message'); -$.md5('Message to hash'); -$.md5(''); -$.md5('中文'); -$.md5([]); -$.md5(new Uint8Array([])); +const hash2 = md5.update('The quick brown fox jumps over the lazy dog'); +str = hash2.hex(); +str = hash2.toString(); +arr = hash2.digest(); +arr = hash2.array(); +buf = hash2.arrayBuffer(); +buf = hash2.buffer(); -'message'.md5('Message to hash'); -'message'.md5(''); -'message'.md5('中文'); -'message'.md5([]); -'message'.md5(new Uint8Array([])); \ No newline at end of file +str = md5([]); +str = md5(new Uint8Array([])); +str = md5(new ArrayBuffer(0)); diff --git a/js-md5/tsconfig.json b/js-md5/tsconfig.json index eceeb1fb3d..f0ae291e30 100644 --- a/js-md5/tsconfig.json +++ b/js-md5/tsconfig.json @@ -2,12 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +19,4 @@ "index.d.ts", "js-md5-tests.ts" ] -} \ No newline at end of file +} diff --git a/js-md5/tslint.json b/js-md5/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/js-md5/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/knex/index.d.ts b/knex/index.d.ts index 5196f47eb0..3e7dc595f4 100644 --- a/knex/index.d.ts +++ b/knex/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tgriesser/knex // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// @@ -383,6 +384,7 @@ declare namespace Knex { dropForeign(columnNames: string[], foreignKeyName?: string): TableBuilder; dropUnique(columnNames: string[], indexName?: string): TableBuilder; dropPrimary(constraintName?: string): TableBuilder; + dropIndex(columnNames: string[], indexName?: string): TableBuilder; } interface CreateTableBuilder extends TableBuilder { diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index 4112082f54..bf6f9103a1 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Leaflet.js 1.0.2 +// Type definitions for Leaflet.js 1.0 // Project: https://github.com/Leaflet/Leaflet // Definitions by: Alejandro Sánchez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,6 +8,19 @@ type NativeMouseEvent = MouseEvent; type NativeKeyboardEvent = KeyboardEvent; +// Import to avoid conflicts with the GeoJSON class of leaflet +import GeoJSONFeature = GeoJSON.Feature; +import GeoJSONLineString = GeoJSON.LineString; +import GeoJSONMultiLineString = GeoJSON.MultiLineString; +import GeoJSONPolygon = GeoJSON.Polygon; +import GeoJSONMultiPolygon = GeoJSON.MultiPolygon; +import GeoJSONFeatureCollection = GeoJSON.FeatureCollection; +import GeoJSONGeometryObject = GeoJSON.GeometryObject; +import GeoJSONGeometryCollection = GeoJSON.GeometryCollection; +import GeoJSONPoint = GeoJSON.Point; +import GeoJSONMultiPoint = GeoJSON.MultiPoint; +import GeoJSONGeoJsonObject = GeoJSON.GeoJsonObject; + declare namespace L { export class Class { static extend(props: any): any/* how to return constructor of self extended type ? */; @@ -25,43 +38,37 @@ declare namespace L { } export namespace LineUtil { - export function simplify(points: Array, tolerance: number): Array; + export function simplify(points: PointExpression[], tolerance: number): Point[]; - export function simplify(points: Array, tolerance: number): Array; + export function pointToSegmentDistance(p: PointExpression, p1: PointExpression, p2: PointExpression): number; - export function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - - export function pointToSegmentDistance(p: PointTuple, p1: PointTuple, p2: PointTuple): number; - - export function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; - - export function closestPointOnSegment(p: PointTuple, p1: PointTuple, p2: PointTuple): Point; + export function closestPointOnSegment(p: PointExpression, p1: PointExpression, p2: PointExpression): Point; } export namespace PolyUtil { - export function clipPolygon(points: Array, bounds: Bounds, round?: boolean): Array; - - export function clipPolygon(points: Array, bounds: BoundsLiteral, round?: boolean): Array; + export function clipPolygon(points: PointExpression[], bounds: BoundsExpression, round?: boolean): Point[]; } export class DomUtil { - static get(id: string): HTMLElement; - static get(id: HTMLElement): HTMLElement; + /** + * Get Element by its ID or with the given HTML-Element + */ + static get(element: string | HTMLElement): HTMLElement; static getStyle(el: HTMLElement, styleAttrib: string): string; - static create(tagName: String, className?: String, container?: HTMLElement): HTMLElement; - static remove(el: HTMLElement):void; - static empty(el: HTMLElement):void; - static toFront(el: HTMLElement):void; - static toBack(el: HTMLElement):void; - static hasClass(el: HTMLElement, name: String): Boolean; - static addClass(el: HTMLElement, name: String):void; - static removeClass(el: HTMLElement, name: String):void; - static setClass(el: HTMLElement, name: String):void; - static getClass(el: HTMLElement): String; - static setOpacity(el: HTMLElement, opacity: Number):void; - static testProp(props: String[]): String|boolean/*=false*/; - static setTransform(el: HTMLElement, offset: Point, scale?: Number):void; - static setPosition(el: HTMLElement, position: Point):void; + static create(tagName: string, className?: string, container?: HTMLElement): HTMLElement; + static remove(el: HTMLElement): void; + static empty(el: HTMLElement): void; + static toFront(el: HTMLElement): void; + static toBack(el: HTMLElement): void; + static hasClass(el: HTMLElement, name: string): boolean; + static addClass(el: HTMLElement, name: string): void; + static removeClass(el: HTMLElement, name: string): void; + static setClass(el: HTMLElement, name: string): void; + static getClass(el: HTMLElement): string; + static setOpacity(el: HTMLElement, opacity: number): void; + static testProp(props: string[]): string | boolean/*=false*/; + static setTransform(el: HTMLElement, offset: Point, scale?: number): void; + static setPosition(el: HTMLElement, position: Point): void; static getPosition(el: HTMLElement): Point; static disableTextSelection(): void; static enableTextSelection(): void; @@ -71,7 +78,7 @@ declare namespace L { static restoreOutline(): void; } - export interface CRS { + export abstract class CRS { latLngToPoint(latlng: LatLngExpression, zoom: number): Point; pointToLatLng(point: PointExpression, zoom: number): LatLng; project(latlng: LatLngExpression): Point; @@ -109,7 +116,9 @@ declare namespace L { export const SphericalMercator: Projection; } - export interface LatLng { + export class LatLng { + constructor(latitude: number, longitude: number, altitude?: number); + constructor(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number}); equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean; toString(): string; distanceTo(otherLatLng: LatLngExpression): number; @@ -132,17 +141,12 @@ declare namespace L { export function latLng(latitude: number, longitude: number, altitude?: number): LatLng; - export function latLng(coords: LatLngTuple): LatLng; + export function latLng(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number}): LatLng; - export function latLng(coords: [number, number, number]): LatLng; - - export function latLng(coords: LatLngLiteral): LatLng; - - export function latLng(coords: {lat: number, lng: number, alt: number}): LatLng; - - export interface LatLngBounds { - extend(latlng: LatLngExpression): this; - extend(otherBounds: LatLngBoundsExpression): this; + export class LatLngBounds { + constructor(southWest: LatLngExpression, northEast: LatLngExpression); + constructor(latlngs: LatLngBoundsLiteral); + extend(latlngOrBounds: LatLngExpression | LatLngBoundsExpression): this; pad(bufferRatio: number): LatLngBounds; // does this modify the current instance or does it return a new one? getCenter(): LatLng; getSouthWest(): LatLng; @@ -153,8 +157,7 @@ declare namespace L { getSouth(): number; getEast(): number; getNorth(): number; - contains(otherBounds: LatLngBoundsExpression): boolean; - contains(latlng: LatLngExpression): boolean; + contains(otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression): boolean; intersects(otherBounds: LatLngBoundsExpression): boolean; overlaps(otherBounds: BoundsExpression): boolean; // investigate if this is really bounds and not latlngbounds toBBoxString(): string; @@ -162,7 +165,7 @@ declare namespace L { isValid(): boolean; } - export type LatLngBoundsLiteral = Array; + export type LatLngBoundsLiteral = LatLngTuple[]; // Must be [LatLngTuple, LatLngTuple], cant't change because Map.setMaxBounds type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral; @@ -172,7 +175,9 @@ declare namespace L { export type PointTuple = [number, number]; - export interface Point { + export class Point { + constructor(x: number, y: number, round?: boolean); + constructor(coords: PointTuple | {x: number, y: number}); clone(): Point; add(otherPoint: PointExpression): Point; // investigate if this mutates or returns a new instance subtract(otherPoint: PointExpression): Point; @@ -195,20 +200,19 @@ declare namespace L { export function point(x: number, y: number, round?: boolean): Point; - export function point(coords: PointTuple): Point; + export function point(coords: PointTuple | {x: number, y: number}): Point; - export function point(coords: {x: number, y: number}): Point; + export type BoundsLiteral = [PointTuple, PointTuple]; - export type BoundsLiteral = Array; - - export interface Bounds { + export class Bounds { + constructor(topLeft: PointExpression, bottomRight: PointExpression); + constructor(points: Point[] | BoundsLiteral); extend(point: PointExpression): this; getCenter(round?: boolean): Point; getBottomLeft(): Point; getTopRight(): Point; getSize(): Point; - contains(otherBounds: BoundsExpression): boolean; - contains(point: PointExpression): boolean; + contains(pointOrBounds: BoundsExpression | PointExpression): boolean; intersects(otherBounds: BoundsExpression): boolean; overlaps(otherBounds: BoundsExpression): boolean; @@ -220,13 +224,13 @@ declare namespace L { export function bounds(topLeft: PointExpression, bottomRight: PointExpression): Bounds; - export function bounds(points: Array): Bounds; - - export function bounds(points: BoundsLiteral): Bounds; + export function bounds(points: Point[] | BoundsLiteral): Bounds; export type EventHandlerFn = (event: Event) => void; - export type EventHandlerFnMap = {[type: string]: EventHandlerFn}; + export interface EventHandlerFnMap { + [type: string]: EventHandlerFn; + } /** * A set of methods shared between event-powered classes (like Map and Marker). @@ -248,6 +252,7 @@ declare namespace L { */ on(eventMap: EventHandlerFnMap): this; + /* tslint:disable:unified-signatures */ // With an eventMap there are no additional arguments allowed /** * Removes a previously added listener function. If no function is specified, * it will remove all the listeners of that particular event from the object. @@ -260,7 +265,7 @@ declare namespace L { * Removes a set of type/listener pairs. */ off(eventMap: EventHandlerFnMap): this; - + /* tslint:enable */ /** * Removes all listeners to all events on the object. */ @@ -401,35 +406,23 @@ declare namespace L { getPane(name?: string): HTMLElement; // Popup methods - bindPopup(content: string, options?: PopupOptions): this; - bindPopup(content: HTMLElement, options?: PopupOptions): this; - bindPopup(content: (layer: Layer) => Content, options?: PopupOptions): this; - bindPopup(content: Popup): this; + bindPopup(content: (layer: Layer) => Content | Content | Popup, options?: PopupOptions): this; unbindPopup(): this; - openPopup(): this; - openPopup(latlng: LatLngExpression): this; + openPopup(latlng?: LatLngExpression): this; closePopup(): this; togglePopup(): this; isPopupOpen(): boolean; - setPopupContent(content: string): this; - setPopupContent(content: HTMLElement): this; - setPopupContent(content: Popup): this; + setPopupContent(content: Content | Popup): this; getPopup(): Popup; // Tooltip methods - bindTooltip(content: string, options?: TooltipOptions): this; - bindTooltip(content: HTMLElement, options?: TooltipOptions): this; - bindTooltip(content: (layer: Layer) => Content, options?: TooltipOptions): this; - bindTooltip(content: Tooltip, options?: TooltipOptions): this; + bindTooltip(content: (layer: Layer) => Content | Tooltip | Content, options?: TooltipOptions): this; unbindTooltip(): this; - openTooltip(): this; - openTooltip(latlng: LatLngExpression): this; + openTooltip(latlng?: LatLngExpression): this; closeTooltip(): this; toggleTooltip(): this; isTooltipOpen(): boolean; - setTooltipContent(content: string): this; - setTooltipContent(content: HTMLElement): this; - setTooltipContent(content: Tooltip): this; + setTooltipContent(content: Content | Tooltip): this; getTooltip(): Tooltip; // Extension methods @@ -457,7 +450,8 @@ declare namespace L { keepBuffer?: number; } - export interface GridLayer extends Layer { + export class GridLayer extends Layer { + constructor(options?: GridLayerOptions); bringToFront(): this; bringToBack(): this; getAttribution(): string; @@ -475,7 +469,8 @@ declare namespace L { minZoom?: number; maxZoom?: number; maxNativeZoom?: number; - subdomains?: string | Array; + minNativeZoom?: number; + subdomains?: string | string[]; errorTileUrl?: string; zoomOffset?: number; tms?: boolean; @@ -485,12 +480,25 @@ declare namespace L { [name: string]: any; } - export interface TileLayer extends GridLayer { + export class TileLayer extends GridLayer { + constructor(urlTemplate: string, options?: TileLayerOptions); setUrl(url: string, noRedraw?: boolean): this; + + options: TileLayerOptions; } export function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer; + export namespace TileLayer { + export class WMS extends TileLayer { + constructor(baseUrl: string, options: WMSOptions); + setParams(params: WMSParams, noRedraw?: boolean): this; + + wmsParams: WMSParams; + options: WMSOptions; + } + } + export interface WMSOptions extends TileLayerOptions { layers: string; styles?: string; @@ -501,12 +509,20 @@ declare namespace L { uppercase?: boolean; } - export interface WMS extends TileLayer { - setParams(params: any, noRedraw?: boolean): this; + export interface WMSParams { + format?: string; + layers: string; + request?: string; + service?: string; + styles?: string; + version?: string; + transparent?: boolean; + width?: number; + height?: number; } export namespace tileLayer { - export function wms(baseUrl: string, options?: WMSOptions): WMS; + export function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS; } export interface ImageOverlayOptions extends LayerOptions { @@ -517,7 +533,8 @@ declare namespace L { crossOrigin?: boolean; } - export interface ImageOverlay extends Layer { + export class ImageOverlay extends Layer { + constructor(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions); setOpacity(opacity: number): this; bringToFront(): this; bringToBack(): this; @@ -531,6 +548,8 @@ declare namespace L { /** Get the img element that represents the ImageOverlay on the map */ getElement(): HTMLImageElement; + + options: ImageOverlayOptions; } export function imageOverlay(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): ImageOverlay; @@ -558,11 +577,14 @@ declare namespace L { className?: string; } - export interface Path extends Layer { + export abstract class Path extends Layer { redraw(): this; setStyle(style: PathOptions): this; bringToFront(): this; bringToBack(): this; + getElement(): HTMLElement; + + options: PathOptions; } export interface PolylineOptions extends PathOptions { @@ -570,32 +592,37 @@ declare namespace L { noClip?: boolean; } - interface InternalPolyline extends Path { - getLatLngs(): Array; - setLatLngs(latlngs: Array): this; + class InternalPolyline extends Path { + getLatLngs(): LatLng[]; + setLatLngs(latlngs: LatLngExpression[]): this; isEmpty(): boolean; getCenter(): LatLng; getBounds(): LatLngBounds; - addLatLng(latlng: LatLngExpression): this; - addLatLng(latlng: Array): this; // these three overloads aren't explicitly noted in the docs + addLatLng(latlng: LatLngExpression | LatLngExpression[]): this; + + options: PolylineOptions; } - export interface Polyline extends InternalPolyline { - toGeoJSON(): GeoJSON.LineString | GeoJSON.MultiLineString; + export class Polyline extends InternalPolyline { + constructor(latlngs: LatLngExpression[], options?: PolylineOptions); + toGeoJSON(): GeoJSONFeature; + + feature: GeoJSONFeature; } - export function polyline(latlngs: Array, options?: PolylineOptions): Polyline; - export function polyline(latlngs: Array>, options?: PolylineOptions): Polyline; + export function polyline(latlngs: LatLngExpression[], options?: PolylineOptions): Polyline; - export interface Polygon extends InternalPolyline { - toGeoJSON(): GeoJSON.Polygon | GeoJSON.MultiPolygon; + export class Polygon extends InternalPolyline { + constructor(latlngs: LatLngExpression[], options?: PolylineOptions); + toGeoJSON(): GeoJSONFeature; + + feature: GeoJSONFeature; } - export function polygon(latlngs: Array, options?: PolylineOptions): Polygon; + export function polygon(latlngs: LatLngExpression[], options?: PolylineOptions): Polygon; - export function polygon(latlngs: Array>, options?: PolylineOptions): Polygon; - - export interface Rectangle extends Polygon { + export class Rectangle extends Polygon { + constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions); setBounds(latLngBounds: LatLngBoundsExpression): this; } @@ -605,48 +632,50 @@ declare namespace L { radius?: number; } - export interface CircleMarker extends Path { - toGeoJSON(): GeoJSON.Point; + export class CircleMarker extends Path { + constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); + toGeoJSON(): GeoJSONFeature; setLatLng(latLng: LatLngExpression): this; getLatLng(): LatLng; setRadius(radius: number): this; getRadius(): number; + + options: CircleMarkerOptions; + feature: GeoJSONFeature; } export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; - export interface CircleOptions extends PathOptions { - radius?: number; - } - - export interface Circle extends CircleMarker { - setRadius(radius: number): this; - getRadius(): number; + export class Circle extends CircleMarker { + constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); + constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated! getBounds(): LatLngBounds; } - export function circle(latlng: LatLngExpression, options?: CircleOptions): Circle; - export function circle(latlng: LatLngExpression, radius: number, options?: CircleOptions): Circle; + export function circle(latlng: LatLngExpression, options?: CircleMarkerOptions): Circle; + export function circle(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions): Circle; // deprecated! export interface RendererOptions extends LayerOptions { padding?: number; } - export interface Renderer extends Layer {} + export class Renderer extends Layer { + constructor(options?: RendererOptions); - export interface SVG extends Renderer {} + options: RendererOptions; + } + + export class SVG extends Renderer {} export namespace SVG { export function create(name: string): SVGElement; - export function pointsToPath(rings: Array, close: boolean): string; - - export function pointsToPath(rings: Array, close: boolean): string; + export function pointsToPath(rings: PointExpression[], close: boolean): string; } export function svg(options?: RendererOptions): SVG; - export interface Canvas extends Renderer {} + export class Canvas extends Renderer {} export function canvas(options?: RendererOptions): Canvas; @@ -655,11 +684,12 @@ declare namespace L { * If you add it to the map, any layers added or removed from the group will be * added/removed on the map as well. Extends Layer. */ - export interface LayerGroup extends Layer { + export class LayerGroup extends Layer { + constructor(layers: Layer[]); /** - * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection). + * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). */ - toGeoJSON(): GeoJSON.GeometryCollection; + toGeoJSON(): GeoJSONFeatureCollection | GeoJSONFeature; /** * Adds the given layer to the group. @@ -667,14 +697,9 @@ declare namespace L { addLayer(layer: Layer): this; /** - * Removes the given layer from the group. + * Removes the layer with the given internal ID or the given layer from the group. */ - removeLayer(layer: Layer): this; - - /** - * Removes the layer with the given internal ID from the group. - */ - removeLayer(id: number): this; + removeLayer(layer: number | Layer): this; /** * Returns true if the given layer is currently added to the group. @@ -690,7 +715,7 @@ declare namespace L { * Calls methodName on every layer contained in this group, passing any additional parameters. * Has no effect if the layers contained do not implement methodName. */ - invoke(methodName: string, ...params: Array): this; + invoke(methodName: string, ...params: any[]): this; /** * Iterates over the layers of the group, @@ -706,7 +731,7 @@ declare namespace L { /** * Returns an array of all the layers added to the group. */ - getLayers(): Array; + getLayers(): Layer[]; /** * Calls setZIndex on every layer contained in this group, passing the z-index. @@ -717,18 +742,20 @@ declare namespace L { * Returns the internal ID for a layer */ getLayerId(layer: Layer): number; + + feature: GeoJSONFeatureCollection | GeoJSONFeature; } /** * Create a layer group, optionally given an initial set of layers. */ - export function layerGroup(layers: Array): LayerGroup; + export function layerGroup(layers: Layer[]): LayerGroup; /** * Extended LayerGroup that also has mouse events (propagated from * members of the group) and a shared bindPopup method. */ - export interface FeatureGroup extends LayerGroup { + export class FeatureGroup extends LayerGroup { /** * Sets the given path options to each layer of the group that has a setStyle method. */ @@ -754,9 +781,9 @@ declare namespace L { /** * Create a feature group, optionally given an initial set of layers. */ - export function featureGroup(layers?: Array): FeatureGroup; + export function featureGroup(layers?: Layer[]): FeatureGroup; - type StyleFunction = (feature: GeoJSON.Feature) => PathOptions; + type StyleFunction = (feature: GeoJSONFeature) => PathOptions; export interface GeoJSONOptions extends LayerOptions { /** @@ -772,7 +799,7 @@ declare namespace L { * } * ``` */ - pointToLayer?: (geoJsonPoint: GeoJSON.Feature, latlng: LatLng) => Layer; // should import GeoJSON typings + pointToLayer?: (geoJsonPoint: GeoJSONFeature, latlng: LatLng) => Layer; // should import GeoJSON typings /** * A Function defining the Path options for styling GeoJSON lines and polygons, @@ -798,7 +825,7 @@ declare namespace L { * function (feature, layer) {} * ``` */ - onEachFeature?: (feature: GeoJSON.Feature, layer: Layer) => void; + onEachFeature?: (feature: GeoJSONFeature, layer: Layer) => void; /** * A Function that will be used to decide whether to show a feature or not. @@ -811,7 +838,7 @@ declare namespace L { * } * ``` */ - filter?: (geoJsonFeature: GeoJSON.Feature) => boolean; + filter?: (geoJsonFeature: GeoJSONFeature) => boolean; /** * A Function that will be used for converting GeoJSON coordinates to LatLngs. @@ -820,12 +847,16 @@ declare namespace L { coordsToLatLng?: (coords: [number, number] | [number, number, number]) => LatLng; // check if LatLng has an altitude property } - export class GeoJSON { + /** + * Represents a GeoJSON object or an array of GeoJSON objects. + * Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup. + */ + export class GeoJSON extends FeatureGroup { /** * Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer * and/or coordsToLatLng functions if provided as options. */ - static geometryToLayer(featureData: GeoJSON.Feature, options?: GeoJSONOptions): Layer; + static geometryToLayer(featureData: GeoJSONFeature, options?: GeoJSONOptions): Layer; /** * Creates a LatLng object from an array of 2 numbers (longitude, latitude) or @@ -849,7 +880,6 @@ declare namespace L { */ static latLngToCoords(latlng: LatLng): [number, number, number]; // A three tuple can be assigned to a two or three tuple - /** * Reverse of coordsToLatLngs closed determines whether the first point should be * appended to the end of the array to close the feature, only used when levelsDeep is 0. @@ -860,21 +890,13 @@ declare namespace L { /** * Normalize GeoJSON geometries/features into GeoJSON features. */ - static asFeature(geojson: GeoJSON.GeometryObject): GeoJSON.Feature; + static asFeature(geojson: GeoJSONFeature | GeoJSONGeometryObject): GeoJSONFeature; - static asFeature(geojson: GeoJSON.Feature): GeoJSON.Feature; - - } - - /** - * Represents a GeoJSON object or an array of GeoJSON objects. - * Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup. - */ - export interface GeoJSON extends FeatureGroup { + constructor(geojson?: GeoJSONGeoJsonObject, options?: GeoJSONOptions) /** * Adds a GeoJSON object to the layer. */ - addData(data: GeoJSON.GeoJsonObject): Layer; + addData(data: GeoJSONGeoJsonObject): Layer; /** * Resets the given vector layer's style to the original GeoJSON style, @@ -887,6 +909,8 @@ declare namespace L { */ setStyle(style: StyleFunction): this; + options: GeoJSONOptions; + } /** @@ -896,7 +920,7 @@ declare namespace L { * map (you can alternatively add it later with addData method) and * an options object. */ - export function geoJSON(geojson?: GeoJSON.GeoJsonObject, options?: GeoJSONOptions): GeoJSON; + export function geoJSON(geojson?: GeoJSONGeoJsonObject, options?: GeoJSONOptions): GeoJSON; type Zoom = boolean | 'center'; @@ -922,7 +946,7 @@ declare namespace L { zoom?: number; minZoom?: number; maxZoom?: number; - layers?: Array; + layers?: Layer[]; maxBounds?: LatLngBoundsExpression; renderer?: Renderer; @@ -964,7 +988,7 @@ declare namespace L { } export class Control extends Class { - constructor (options?: ControlOptions); + constructor(options?: ControlOptions); getPosition(): ControlPosition; setPosition(position: ControlPosition): this; getContainer(): HTMLElement; @@ -974,6 +998,8 @@ declare namespace L { // Extension methods onAdd(map: Map): HTMLElement; onRemove(map: Map): void; + + options: ControlOptions; } export namespace Control { @@ -984,16 +1010,21 @@ declare namespace L { zoomOutTitle?: string; } - export interface Zoom extends Control {} + export class Zoom extends Control { + constructor(options?: ZoomOptions); + options: ZoomOptions; + } export interface AttributionOptions extends ControlOptions { prefix?: string | boolean; } - export interface Attribution extends Control { + export class Attribution extends Control { + constructor(options?: AttributionOptions); setPrefix(prefix: string): this; addAttribution(text: string): this; removeAttribution(text: string): this; + options: AttributionOptions; } export interface LayersOptions extends ControlOptions { @@ -1002,12 +1033,18 @@ declare namespace L { hideSingleBase?: boolean; } - export interface Layers extends Control { + interface LayersObject { + [name: string]: Layer; + } + + export class Layers extends Control { + constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: Control.LayersOptions); addBaseLayer(layer: Layer, name: string): this; addOverlay(layer: Layer, name: string): this; removeLayer(layer: Layer): this; expand(): this; collapse(): this; + options: LayersOptions; } export interface ScaleOptions extends ControlOptions { @@ -1017,17 +1054,18 @@ declare namespace L { updateWhenIdle?: boolean; } - export interface Scale extends Control {} + export class Scale extends Control { + constructor(options?: Control.ScaleOptions); + options: ScaleOptions; + } } export namespace control { - export function zoom(options: Control.ZoomOptions): Control.Zoom; + export function zoom(options?: Control.ZoomOptions): Control.Zoom; - export function attribution(options: Control.AttributionOptions): Control.Attribution; + export function attribution(options?: Control.AttributionOptions): Control.Attribution; - type LayersObject = {[name: string]: Layer}; - - export function layers(baseLayers?: LayersObject, overlays?: LayersObject, options?: Control.LayersOptions): Control.Layers; + export function layers(baseLayers?: Control.LayersObject, overlays?: Control.LayersObject, options?: Control.LayersOptions): Control.Layers; export function scale(options?: Control.ScaleOptions): Control.Scale; } @@ -1055,19 +1093,20 @@ declare namespace L { type Content = string | HTMLElement; - export interface Popup extends Layer { + export class Popup extends Layer { + constructor(options?: PopupOptions, source?: Layer); getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; getContent(): Content; - setContent(htmlContent: string): this; - setContent(htmlContent: HTMLElement): this; - setContent(htmlContent: (source: Layer) => Content): this; - getElement(): Content; + setContent(htmlContent: (source: Layer) => Content | Content): this; + getElement(): HTMLElement; update(): void; isOpen(): boolean; bringToFront(): this; bringToBack(): this; openOn(map: Map): this; + + options: PopupOptions; } export function popup(options?: PopupOptions, source?: Layer): Popup; @@ -1084,7 +1123,21 @@ declare namespace L { opacity?: number; } - export interface Tooltip extends Layer {} + export class Tooltip extends Layer { + constructor(options?: TooltipOptions, source?: Layer); + setOpacity(val: number): void; + getLatLng(): LatLng; + setLatLng(latlng: LatLngExpression): this; + getContent(): Content; + setContent(htmlContent: (source: Layer) => Content | Content): this; + getElement(): HTMLElement; + update(): void; + isOpen(): boolean; + bringToFront(): this; + bringToBack(): this; + + options: TooltipOptions; + } export function tooltip(options?: TooltipOptions, source?: Layer): Tooltip; @@ -1099,7 +1152,9 @@ declare namespace L { noMoveStart?: boolean; } + /* tslint:disable:no-empty-interface */ // This is not empty, it extends two interfaces into one... export interface ZoomPanOptions extends ZoomOptions, PanOptions {} + /* tslint:enable */ export interface FitBoundsOptions extends ZoomOptions, PanOptions { paddingTopLeft?: PointExpression; @@ -1117,7 +1172,8 @@ declare namespace L { enableHighAccuracy?: boolean; } - export interface Handler { + export class Handler extends Class { + constructor(map: Map); enable(): this; disable(): this; enabled(): boolean; @@ -1207,13 +1263,13 @@ declare namespace L { } export namespace DomEvent { - export function on(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent; + export function on(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - export function on(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent; + export function on(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; - export function off(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent; + export function off(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - export function off(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent; + export function off(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; export function stopPropagation(ev: Event): typeof DomEvent; @@ -1229,13 +1285,13 @@ declare namespace L { export function getWheelDelta(ev: Event): number; - export function addListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent; + export function addListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - export function addListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent; + export function addListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; - export function removeListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent; + export function removeListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - export function removeListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent; + export function removeListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; } interface DefaultMapPanes { @@ -1248,7 +1304,8 @@ declare namespace L { popupPane: HTMLElement; } - export interface Map extends Evented { + export class Map extends Evented { + constructor(element: string | HTMLElement, options?: MapOptions); getRenderer(layer: Path): Renderer; // Methods for layers and controls @@ -1259,12 +1316,10 @@ declare namespace L { hasLayer(layer: Layer): boolean; eachLayer(fn: (layer: Layer) => void, context?: any): this; openPopup(popup: Popup): this; - openPopup(content: string, latlng: LatLngExpression, options?: PopupOptions): this; - openPopup(content: HTMLElement, latlng: LatLngExpression, options?: PopupOptions): this; + openPopup(content: Content, latlng: LatLngExpression, options?: PopupOptions): this; closePopup(popup?: Popup): this; openTooltip(tooltip: Tooltip): this; - openTooltip(content: string, latlng: LatLngExpression, options?: TooltipOptions): this; - openTooltip(content: HTMLElement, latlng: LatLngExpression, options?: TooltipOptions): this; + openTooltip(content: Content, latlng: LatLngExpression, options?: TooltipOptions): this; closeTooltip(tooltip?: Tooltip): this; // Methods for modifying map state @@ -1272,8 +1327,7 @@ declare namespace L { setZoom(zoom: number, options?: ZoomPanOptions): this; zoomIn(delta?: number, options?: ZoomOptions): this; zoomOut(delta?: number, options?: ZoomOptions): this; - setZoomAround(latlng: LatLngExpression, zoom: number, options?: ZoomOptions): this; - setZoomAround(offset: Point, zoom: number, options?: ZoomOptions): this; + setZoomAround(position: Point | LatLngExpression, zoom: number, options?: ZoomOptions): this; fitBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this; fitWorld(options?: FitBoundsOptions): this; panTo(latlng: LatLngExpression, options?: PanOptions): this; @@ -1282,8 +1336,10 @@ declare namespace L { setMinZoom(zoom: number): this; setMaxZoom(zoom: number): this; panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this; - invalidateSize(options: ZoomPanOptions): this; - invalidateSize(animate: boolean): this; + /** + * Boolean for animate or advanced ZoomPanOptions + */ + invalidateSize(options?: boolean | ZoomPanOptions): this; stop(): this; flyTo(latlng: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this; flyToBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this; @@ -1292,8 +1348,10 @@ declare namespace L { addHandler(name: string, HandlerClass: () => Handler): this; // HandlerClass is actually a constructor function, is this the right way? remove(): this; createPane(name: string, container?: HTMLElement): HTMLElement; - getPane(pane: string): HTMLElement; - getPane(pane: HTMLElement): HTMLElement; + /** + * Name of the pane or the pane as HTML-Element + */ + getPane(pane: string | HTMLElement): HTMLElement; getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes; getContainer(): HTMLElement; whenReady(fn: () => void, context?: any): this; @@ -1321,7 +1379,6 @@ declare namespace L { distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number; containerPointToLayerPoint(point: PointExpression): Point; layerPointToContainerPoint(point: PointExpression): Point; - layerPointToContainerPoint(point: PointTuple): Point; latLngToContainerPoint(latlng: LatLngExpression): Point; mouseEventToContainerPoint(ev: MouseEvent): Point; mouseEventToLayerPoint(ev: MouseEvent): Point; @@ -1339,11 +1396,14 @@ declare namespace L { scrollWheelZoom: Handler; tap: Handler; touchZoom: Handler; + + options: MapOptions; } - export function map(id: string, options?: MapOptions): Map; - - export function map(el: HTMLElement, options?: MapOptions): Map; + /** + * ID of a HTML-Element as string or the HTML-ELement itself + */ + export function map(element: string | HTMLElement, options?: MapOptions): Map; export interface IconOptions extends LayerOptions { iconUrl: string; @@ -1358,22 +1418,18 @@ declare namespace L { className?: string; } - export interface Icon extends Layer { - createIcon(oldIcon?: HTMLElement): HTMLElement; - createShadow(oldIcon?: HTMLElement): HTMLElement; - } - - export interface IconDefault extends Icon { - imagePath: string; - } - - export class Icon { + class InternalIcon extends Layer { constructor(options: IconOptions); + createIcon(oldIcon?: HTMLElement): HTMLElement; + } + + export class Icon extends InternalIcon { + createShadow(oldIcon?: HTMLElement): HTMLElement; + options: IconOptions; } export namespace Icon { - export class Default extends Icon { - constructor(options?: IconOptions); + export class Default extends InternalIcon { imagePath: string; } } @@ -1389,8 +1445,9 @@ declare namespace L { className?: string; } - export class DivIcon extends Icon { + export class DivIcon extends InternalIcon { constructor(options?: DivIconOptions); + options: DivIconOptions; } export function divIcon(options?: DivIconOptions): DivIcon; @@ -1406,6 +1463,8 @@ declare namespace L { opacity?: number; riseOnHover?: boolean; riseOffset?: number; + + options: DivIconOptions; } export class Marker extends Layer { @@ -1415,9 +1474,10 @@ declare namespace L { setZIndexOffset(offset: number): this; setIcon(icon: Icon): this; setOpacity(opacity: number): this; - getElement(): Element; + getElement(): HTMLElement; // Properties + options: MarkerOptions; dragging: Handler; } @@ -1452,6 +1512,7 @@ declare namespace L { export const vml: boolean; export const svg: boolean; } + } declare module 'leaflet' { diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index c6dca97f5d..0c1122f6fc 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -11,6 +11,13 @@ latLng = L.latLng({lat: 12, lng: 13, alt: 0}); latLng = L.latLng(latLngTuple); latLng = L.latLng([12, 13, 0]); +latLng = new L.LatLng(12, 13); +latLng = new L.LatLng(12, 13, 0); +latLng = new L.LatLng(latLngLiteral); +latLng = new L.LatLng({lat: 12, lng: 13, alt: 0}); +latLng = new L.LatLng(latLngTuple); +latLng = new L.LatLng([12, 13, 0]); + const latLngBoundsLiteral: L.LatLngBoundsLiteral = [[12, 13], latLngTuple]; let latLngBounds: L.LatLngBounds; @@ -18,6 +25,10 @@ latLngBounds = L.latLngBounds(latLng, latLng); latLngBounds = L.latLngBounds(latLngLiteral, latLngLiteral); latLngBounds = L.latLngBounds(latLngTuple, latLngTuple); +latLngBounds = new L.LatLngBounds(latLng, latLng); +latLngBounds = new L.LatLngBounds(latLngLiteral, latLngLiteral); +latLngBounds = new L.LatLngBounds(latLngTuple, latLngTuple); + const pointTuple: L.PointTuple = [0, 0]; let point: L.Point; @@ -26,6 +37,11 @@ point = L.point(12, 13, true); point = L.point(pointTuple); point = L.point({x: 12, y: 13}); +point = new L.Point(12, 13); +point = new L.Point(12, 13, true); +point = new L.Point(pointTuple); +point = new L.Point({x: 12, y: 13}); + let distance: number; point.distanceTo(point); point.distanceTo(pointTuple); @@ -44,6 +60,11 @@ bounds = L.bounds(pointTuple, pointTuple); bounds = L.bounds([point, point]); bounds = L.bounds(boundsLiteral); +bounds = new L.Bounds(point, point); +bounds = new L.Bounds(pointTuple, pointTuple); +bounds = new L.Bounds([point, point]); +bounds = new L.Bounds(boundsLiteral); + let points: Array; points = L.LineUtil.simplify([point, point], 1); points = L.LineUtil.simplify([pointTuple, pointTuple], 2); @@ -143,6 +164,10 @@ map = L.map('foo', mapOptions); map = L.map(htmlElement); map = L.map(htmlElement, mapOptions); +map = new L.Map('foo', mapOptions); +map = new L.Map(htmlElement); +map = new L.Map(htmlElement, mapOptions); + let doesItHaveLayer: boolean; doesItHaveLayer = map.hasLayer(L.tileLayer('')); @@ -230,6 +255,10 @@ tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); +tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); +tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); + let eventHandler = () => {}; let domEvent: Event = {} as Event; L.DomEvent diff --git a/leaflet/tslint.json b/leaflet/tslint.json new file mode 100644 index 0000000000..0b14fdec0d --- /dev/null +++ b/leaflet/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-single-declare-module": false + } +} diff --git a/lodash-decorators/index.d.ts b/lodash-decorators/index.d.ts index 0e0b8d9e3c..eb05886150 100644 --- a/lodash-decorators/index.d.ts +++ b/lodash-decorators/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/steelsojka/lodash-decorators // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/lodash-es/index.d.ts b/lodash-es/index.d.ts index 71f98587ff..e344736795 100644 --- a/lodash-es/index.d.ts +++ b/lodash-es/index.d.ts @@ -2,3 +2,288 @@ // Project: http://lodash.com/ // Definitions by: Stephen Lautier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export { default as add } from './add'; +export { default as after } from './after'; +export { default as ary } from './ary'; +export { default as assign } from './assign'; +export { default as assignIn } from './assignIn'; +export { default as assignInWith } from './assignInWith'; +export { default as assignWith } from './assignWith'; +export { default as at } from './at'; +export { default as attempt } from './attempt'; +export { default as before } from './before'; +export { default as bind } from './bind'; +export { default as bindAll } from './bindAll'; +export { default as bindKey } from './bindKey'; +export { default as camelCase } from './camelCase'; +export { default as capitalize } from './capitalize'; +export { default as castArray } from './castArray'; +export { default as ceil } from './ceil'; +export { default as chain } from './chain'; +export { default as chunk } from './chunk'; +export { default as clamp } from './clamp'; +export { default as clone } from './clone'; +export { default as cloneDeep } from './cloneDeep'; +export { default as cloneDeepWith } from './cloneDeepWith'; +export { default as cloneWith } from './cloneWith'; +export { default as compact } from './compact'; +export { default as concat } from './concat'; +export { default as constant } from './constant'; +export { default as countBy } from './countBy'; +export { default as create } from './create'; +export { default as curry } from './curry'; +export { default as curryRight } from './curryRight'; +export { default as debounce } from './debounce'; +export { default as deburr } from './deburr'; +export { default as defaults } from './defaults'; +export { default as defaultsDeep } from './defaultsDeep'; +export { default as defer } from './defer'; +export { default as delay } from './delay'; +export { default as difference } from './difference'; +export { default as differenceBy } from './differenceBy'; +export { default as differenceWith } from './differenceWith'; +export { default as drop } from './drop'; +export { default as dropRight } from './dropRight'; +export { default as dropRightWhile } from './dropRightWhile'; +export { default as dropWhile } from './dropWhile'; +export { default as each } from './each'; +export { default as eachRight } from './eachRight'; +export { default as endsWith } from './endsWith'; +export { default as eq } from './eq'; +export { default as escape } from './escape'; +export { default as escapeRegExp } from './escapeRegExp'; +export { default as every } from './every'; +export { default as extend } from './extend'; +export { default as extendWith } from './extendWith'; +export { default as fill } from './fill'; +export { default as filter } from './filter'; +export { default as find } from './find'; +export { default as findIndex } from './findIndex'; +export { default as findKey } from './findKey'; +export { default as findLast } from './findLast'; +export { default as findLastIndex } from './findLastIndex'; +export { default as findLastKey } from './findLastKey'; +export { default as first } from './first'; +export { default as flatMap } from './flatMap'; +export { default as flatten } from './flatten'; +export { default as flattenDeep } from './flattenDeep'; +export { default as flattenDepth } from './flattenDepth'; +export { default as flip } from './flip'; +export { default as floor } from './floor'; +export { default as flow } from './flow'; +export { default as flowRight } from './flowRight'; +export { default as forEach } from './forEach'; +export { default as forEachRight } from './forEachRight'; +export { default as forIn } from './forIn'; +export { default as forInRight } from './forInRight'; +export { default as forOwn } from './forOwn'; +export { default as forOwnRight } from './forOwnRight'; +export { default as fromPairs } from './fromPairs'; +export { default as functions } from './functions'; +export { default as functionsIn } from './functionsIn'; +export { default as get } from './get'; +export { default as groupBy } from './groupBy'; +export { default as gt } from './gt'; +export { default as gte } from './gte'; +export { default as has } from './has'; +export { default as hasIn } from './hasIn'; +export { default as head } from './head'; +export { default as identity } from './identity'; +export { default as inRange } from './inRange'; +export { default as includes } from './includes'; +export { default as indexOf } from './indexOf'; +export { default as initial } from './initial'; +export { default as intersection } from './intersection'; +export { default as intersectionBy } from './intersectionBy'; +export { default as intersectionWith } from './intersectionWith'; +export { default as invert } from './invert'; +export { default as invertBy } from './invertBy'; +export { default as invoke } from './invoke'; +export { default as invokeMap } from './invokeMap'; +export { default as isArguments } from './isArguments'; +export { default as isArray } from './isArray'; +export { default as isArrayBuffer } from './isArrayBuffer'; +export { default as isArrayLike } from './isArrayLike'; +export { default as isArrayLikeObject } from './isArrayLikeObject'; +export { default as isBoolean } from './isBoolean'; +export { default as isBuffer } from './isBuffer'; +export { default as isDate } from './isDate'; +export { default as isElement } from './isElement'; +export { default as isEmpty } from './isEmpty'; +export { default as isEqual } from './isEqual'; +export { default as isEqualWith } from './isEqualWith'; +export { default as isError } from './isError'; +export { default as isFinite } from './isFinite'; +export { default as isFunction } from './isFunction'; +export { default as isInteger } from './isInteger'; +export { default as isLength } from './isLength'; +export { default as isMap } from './isMap'; +export { default as isMatch } from './isMatch'; +export { default as isMatchWith } from './isMatchWith'; +export { default as isNaN } from './isNaN'; +export { default as isNative } from './isNative'; +export { default as isNil } from './isNil'; +export { default as isNull } from './isNull'; +export { default as isNumber } from './isNumber'; +export { default as isObject } from './isObject'; +export { default as isObjectLike } from './isObjectLike'; +export { default as isPlainObject } from './isPlainObject'; +export { default as isRegExp } from './isRegExp'; +export { default as isSafeInteger } from './isSafeInteger'; +export { default as isSet } from './isSet'; +export { default as isString } from './isString'; +export { default as isSymbol } from './isSymbol'; +export { default as isTypedArray } from './isTypedArray'; +export { default as isUndefined } from './isUndefined'; +export { default as isWeakMap } from './isWeakMap'; +export { default as isWeakSet } from './isWeakSet'; +export { default as iteratee } from './iteratee'; +export { default as join } from './join'; +export { default as kebabCase } from './kebabCase'; +export { default as keyBy } from './keyBy'; +export { default as keys } from './keys'; +export { default as keysIn } from './keysIn'; +export { default as last } from './last'; +export { default as lastIndexOf } from './lastIndexOf'; +export { default as lowerCase } from './lowerCase'; +export { default as lowerFirst } from './lowerFirst'; +export { default as lt } from './lt'; +export { default as lte } from './lte'; +export { default as map } from './map'; +export { default as mapKeys } from './mapKeys'; +export { default as mapValues } from './mapValues'; +export { default as matches } from './matches'; +export { default as matchesProperty } from './matchesProperty'; +export { default as max } from './max'; +export { default as maxBy } from './maxBy'; +export { default as mean } from './mean'; +export { default as meanBy } from './meanBy'; +export { default as memoize } from './memoize'; +export { default as merge } from './merge'; +export { default as mergeWith } from './mergeWith'; +export { default as method } from './method'; +export { default as methodOf } from './methodOf'; +export { default as min } from './min'; +export { default as minBy } from './minBy'; +export { default as mixin } from './mixin'; +export { default as negate } from './negate'; +export { default as noop } from './noop'; +export { default as now } from './now'; +export { default as nthArg } from './nthArg'; +export { default as omit } from './omit'; +export { default as omitBy } from './omitBy'; +export { default as once } from './once'; +export { default as orderBy } from './orderBy'; +export { default as over } from './over'; +export { default as overArgs } from './overArgs'; +export { default as overEvery } from './overEvery'; +export { default as overSome } from './overSome'; +export { default as pad } from './pad'; +export { default as padEnd } from './padEnd'; +export { default as padStart } from './padStart'; +export { default as parseInt } from './parseInt'; +export { default as partial } from './partial'; +export { default as partialRight } from './partialRight'; +export { default as partition } from './partition'; +export { default as pick } from './pick'; +export { default as pickBy } from './pickBy'; +export { default as property } from './property'; +export { default as propertyOf } from './propertyOf'; +export { default as pull } from './pull'; +export { default as pullAll } from './pullAll'; +export { default as pullAllBy } from './pullAllBy'; +export { default as pullAt } from './pullAt'; +export { default as random } from './random'; +export { default as range } from './range'; +export { default as rangeRight } from './rangeRight'; +export { default as rearg } from './rearg'; +export { default as reduce } from './reduce'; +export { default as reduceRight } from './reduceRight'; +export { default as reject } from './reject'; +export { default as remove } from './remove'; +export { default as repeat } from './repeat'; +export { default as replace } from './replace'; +export { default as rest } from './rest'; +export { default as result } from './result'; +export { default as reverse } from './reverse'; +export { default as round } from './round'; +export { default as sample } from './sample'; +export { default as sampleSize } from './sampleSize'; +export { default as set } from './set'; +export { default as setWith } from './setWith'; +export { default as shuffle } from './shuffle'; +export { default as size } from './size'; +export { default as slice } from './slice'; +export { default as snakeCase } from './snakeCase'; +export { default as some } from './some'; +export { default as sortBy } from './sortBy'; +export { default as sortedIndex } from './sortedIndex'; +export { default as sortedIndexBy } from './sortedIndexBy'; +export { default as sortedIndexOf } from './sortedIndexOf'; +export { default as sortedLastIndex } from './sortedLastIndex'; +export { default as sortedLastIndexBy } from './sortedLastIndexBy'; +export { default as sortedLastIndexOf } from './sortedLastIndexOf'; +export { default as sortedUniq } from './sortedUniq'; +export { default as sortedUniqBy } from './sortedUniqBy'; +export { default as split } from './split'; +export { default as spread } from './spread'; +export { default as startCase } from './startCase'; +export { default as startsWith } from './startsWith'; +export { default as subtract } from './subtract'; +export { default as sum } from './sum'; +export { default as sumBy } from './sumBy'; +export { default as tail } from './tail'; +export { default as take } from './take'; +export { default as takeRight } from './takeRight'; +export { default as takeRightWhile } from './takeRightWhile'; +export { default as takeWhile } from './takeWhile'; +export { default as tap } from './tap'; +export { default as template } from './template'; +export { default as throttle } from './throttle'; +export { default as thru } from './thru'; +export { default as times } from './times'; +export { default as toArray } from './toArray'; +export { default as toInteger } from './toInteger'; +export { default as toLength } from './toLength'; +export { default as toLower } from './toLower'; +export { default as toNumber } from './toNumber'; +export { default as toPairs } from './toPairs'; +export { default as toPairsIn } from './toPairsIn'; +export { default as toPath } from './toPath'; +export { default as toPlainObject } from './toPlainObject'; +export { default as toSafeInteger } from './toSafeInteger'; +export { default as toString } from './toString'; +export { default as toUpper } from './toUpper'; +export { default as transform } from './transform'; +export { default as trim } from './trim'; +export { default as trimEnd } from './trimEnd'; +export { default as trimStart } from './trimStart'; +export { default as truncate } from './truncate'; +export { default as unary } from './unary'; +export { default as unescape } from './unescape'; +export { default as union } from './union'; +export { default as unionBy } from './unionBy'; +export { default as unionWith } from './unionWith'; +export { default as uniq } from './uniq'; +export { default as uniqBy } from './uniqBy'; +export { default as uniqWith } from './uniqWith'; +export { default as uniqueId } from './uniqueId'; +export { default as unset } from './unset'; +export { default as unzip } from './unzip'; +export { default as unzipWith } from './unzipWith'; +export { default as update } from './update'; +export { default as upperCase } from './upperCase'; +export { default as upperFirst } from './upperFirst'; +export { default as values } from './values'; +export { default as valuesIn } from './valuesIn'; +export { default as without } from './without'; +export { default as words } from './words'; +export { default as wrap } from './wrap'; +export { default as xor } from './xor'; +export { default as xorBy } from './xorBy'; +export { default as xorWith } from './xorWith'; +export { default as zip } from './zip'; +export { default as zipObject } from './zipObject'; +export { default as zipWith } from './zipWith'; diff --git a/lodash-webpack-plugin/index.d.ts b/lodash-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..7b2c3ebe67 --- /dev/null +++ b/lodash-webpack-plugin/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for lodash-webpack-plugin 0.11 +// Project: https://github.com/lodash/lodash-webpack-plugin#readme +// Definitions by: Benjamin Lim +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin } from 'webpack'; + +export = LodashModuleReplacementPlugin; + +declare class LodashModuleReplacementPlugin extends Plugin { + constructor(options?: LodashModuleReplacementPlugin.Options); +} + +declare namespace LodashModuleReplacementPlugin { + interface Options { + caching?: boolean; + chaining?: boolean; + cloning?: boolean; + coercions?: boolean; + collections?: boolean; + currying?: boolean; + deburring?: boolean; + exotics?: boolean; + flattening?: boolean; + guards?: boolean; + memoizing?: boolean; + metadata?: boolean; + paths?: boolean; + placeholders?: boolean; + shorthands?: boolean; + unicode?: boolean; + } +} diff --git a/lodash-webpack-plugin/lodash-webpack-plugin-tests.ts b/lodash-webpack-plugin/lodash-webpack-plugin-tests.ts new file mode 100644 index 0000000000..d6483e3d03 --- /dev/null +++ b/lodash-webpack-plugin/lodash-webpack-plugin-tests.ts @@ -0,0 +1,31 @@ +import * as LodashModuleReplacementPlugin from 'lodash-webpack-plugin'; + +new LodashModuleReplacementPlugin(); + +const optionsArray: LodashModuleReplacementPlugin.Options[] = [ + { + collections: true, + paths: true, + }, + { + caching: true, + chaining: true, + cloning: true, + coercions: true, + collections: true, + currying: true, + deburring: true, + exotics: true, + flattening: true, + guards: true, + memoizing: true, + metadata: true, + paths: true, + placeholders: true, + shorthands: true, + unicode: true, + }, +]; + +const plugins: LodashModuleReplacementPlugin[] = optionsArray + .map(options => new LodashModuleReplacementPlugin(options)); diff --git a/lodash-webpack-plugin/tsconfig.json b/lodash-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..03e491ef78 --- /dev/null +++ b/lodash-webpack-plugin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "lodash-webpack-plugin-tests.ts" + ] +} diff --git a/lodash-webpack-plugin/tslint.json b/lodash-webpack-plugin/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/lodash-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/lodash.add/index.d.ts b/lodash.add/index.d.ts index 0a9aecd185..76c74086e3 100644 --- a/lodash.add/index.d.ts +++ b/lodash.add/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { add } from "lodash"; export = add; diff --git a/lodash.after/index.d.ts b/lodash.after/index.d.ts index 52f5efd8e1..7ba8e38a1a 100644 --- a/lodash.after/index.d.ts +++ b/lodash.after/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { after } from "lodash"; export = after; diff --git a/lodash.ary/index.d.ts b/lodash.ary/index.d.ts index d78cd0c60e..fe902df0d0 100644 --- a/lodash.ary/index.d.ts +++ b/lodash.ary/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ary } from "lodash"; export = ary; diff --git a/lodash.assign/index.d.ts b/lodash.assign/index.d.ts index 0558933c3f..8da5d220bf 100644 --- a/lodash.assign/index.d.ts +++ b/lodash.assign/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { assign } from "lodash"; export = assign; diff --git a/lodash.assignin/index.d.ts b/lodash.assignin/index.d.ts index 7e8740aea3..50551ff9d7 100644 --- a/lodash.assignin/index.d.ts +++ b/lodash.assignin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { assignIn } from "lodash"; export = assignIn; diff --git a/lodash.assigninwith/index.d.ts b/lodash.assigninwith/index.d.ts index 1e1e3189c1..76f3d2dede 100644 --- a/lodash.assigninwith/index.d.ts +++ b/lodash.assigninwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { assignInWith } from "lodash"; export = assignInWith; diff --git a/lodash.assignwith/index.d.ts b/lodash.assignwith/index.d.ts index 02e395824d..a01c36eb29 100644 --- a/lodash.assignwith/index.d.ts +++ b/lodash.assignwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { assignWith } from "lodash"; export = assignWith; diff --git a/lodash.at/index.d.ts b/lodash.at/index.d.ts index 7b237c170b..061d6040b8 100644 --- a/lodash.at/index.d.ts +++ b/lodash.at/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { at } from "lodash"; export = at; diff --git a/lodash.attempt/index.d.ts b/lodash.attempt/index.d.ts index a93d1efb06..52874b4372 100644 --- a/lodash.attempt/index.d.ts +++ b/lodash.attempt/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { attempt } from "lodash"; export = attempt; diff --git a/lodash.before/index.d.ts b/lodash.before/index.d.ts index 50456ca93b..3c211206c0 100644 --- a/lodash.before/index.d.ts +++ b/lodash.before/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { before } from "lodash"; export = before; diff --git a/lodash.bind/index.d.ts b/lodash.bind/index.d.ts index 2ace06a403..eda3868cae 100644 --- a/lodash.bind/index.d.ts +++ b/lodash.bind/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { bind } from "lodash"; export = bind; diff --git a/lodash.bindall/index.d.ts b/lodash.bindall/index.d.ts index 7d5b08e79e..9a80f928cc 100644 --- a/lodash.bindall/index.d.ts +++ b/lodash.bindall/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { bindAll } from "lodash"; export = bindAll; diff --git a/lodash.bindkey/index.d.ts b/lodash.bindkey/index.d.ts index 581f950cc1..a7ecab5dd1 100644 --- a/lodash.bindkey/index.d.ts +++ b/lodash.bindkey/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { bindKey } from "lodash"; export = bindKey; diff --git a/lodash.camelcase/index.d.ts b/lodash.camelcase/index.d.ts index 7e330178df..b489f3f7a5 100644 --- a/lodash.camelcase/index.d.ts +++ b/lodash.camelcase/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { camelCase } from "lodash"; export = camelCase; diff --git a/lodash.capitalize/index.d.ts b/lodash.capitalize/index.d.ts index 5cdfce9f64..06a3f72fd4 100644 --- a/lodash.capitalize/index.d.ts +++ b/lodash.capitalize/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { capitalize } from "lodash"; export = capitalize; diff --git a/lodash.castarray/index.d.ts b/lodash.castarray/index.d.ts index 468ae08464..2d77145a0c 100644 --- a/lodash.castarray/index.d.ts +++ b/lodash.castarray/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { castArray } from "lodash"; export = castArray; diff --git a/lodash.ceil/index.d.ts b/lodash.ceil/index.d.ts index 382e7c6452..4d91e60e65 100644 --- a/lodash.ceil/index.d.ts +++ b/lodash.ceil/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ceil } from "lodash"; export = ceil; diff --git a/lodash.chunk/index.d.ts b/lodash.chunk/index.d.ts index 9fd9a55c59..ffd11b71b2 100644 --- a/lodash.chunk/index.d.ts +++ b/lodash.chunk/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { chunk } from "lodash"; export = chunk; diff --git a/lodash.clamp/index.d.ts b/lodash.clamp/index.d.ts index 58372494cd..0a28f04829 100644 --- a/lodash.clamp/index.d.ts +++ b/lodash.clamp/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { clamp } from "lodash"; export = clamp; diff --git a/lodash.clone/index.d.ts b/lodash.clone/index.d.ts index b9fa987104..a2d6e34490 100644 --- a/lodash.clone/index.d.ts +++ b/lodash.clone/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { clone } from "lodash"; export = clone; diff --git a/lodash.clonedeep/index.d.ts b/lodash.clonedeep/index.d.ts index 4bd178bff0..5e9382e296 100644 --- a/lodash.clonedeep/index.d.ts +++ b/lodash.clonedeep/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { cloneDeep } from "lodash"; export = cloneDeep; diff --git a/lodash.clonedeepwith/index.d.ts b/lodash.clonedeepwith/index.d.ts index e014c80686..80439cef54 100644 --- a/lodash.clonedeepwith/index.d.ts +++ b/lodash.clonedeepwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { cloneDeepWith } from "lodash"; export = cloneDeepWith; diff --git a/lodash.clonewith/index.d.ts b/lodash.clonewith/index.d.ts index cb29709538..bdaa109a3a 100644 --- a/lodash.clonewith/index.d.ts +++ b/lodash.clonewith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { cloneWith } from "lodash"; export = cloneWith; diff --git a/lodash.compact/index.d.ts b/lodash.compact/index.d.ts index d6dc0b2fb8..9af681aeb4 100644 --- a/lodash.compact/index.d.ts +++ b/lodash.compact/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { compact } from "lodash"; export = compact; diff --git a/lodash.concat/index.d.ts b/lodash.concat/index.d.ts index dd6f9bb6e2..692dfa5aab 100644 --- a/lodash.concat/index.d.ts +++ b/lodash.concat/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { concat } from "lodash"; export = concat; diff --git a/lodash.constant/index.d.ts b/lodash.constant/index.d.ts index 92fc209518..1b941af3ad 100644 --- a/lodash.constant/index.d.ts +++ b/lodash.constant/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { constant } from "lodash"; export = constant; diff --git a/lodash.countby/index.d.ts b/lodash.countby/index.d.ts index a3c6d24d93..03940a5e7d 100644 --- a/lodash.countby/index.d.ts +++ b/lodash.countby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { countBy } from "lodash"; export = countBy; diff --git a/lodash.create/index.d.ts b/lodash.create/index.d.ts index 5ca15075eb..e9d553be1c 100644 --- a/lodash.create/index.d.ts +++ b/lodash.create/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { create } from "lodash"; export = create; diff --git a/lodash.curry/index.d.ts b/lodash.curry/index.d.ts index 61f26316fd..a613fce91a 100644 --- a/lodash.curry/index.d.ts +++ b/lodash.curry/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { curry } from "lodash"; export = curry; diff --git a/lodash.curryright/index.d.ts b/lodash.curryright/index.d.ts index caf7dfcfe3..b16fdd5147 100644 --- a/lodash.curryright/index.d.ts +++ b/lodash.curryright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { curryRight } from "lodash"; export = curryRight; diff --git a/lodash.debounce/index.d.ts b/lodash.debounce/index.d.ts index 2bef22974b..4e4e3aec55 100644 --- a/lodash.debounce/index.d.ts +++ b/lodash.debounce/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { debounce } from "lodash"; export = debounce; diff --git a/lodash.deburr/index.d.ts b/lodash.deburr/index.d.ts index 6f92fcbbd4..0caa30be24 100644 --- a/lodash.deburr/index.d.ts +++ b/lodash.deburr/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { deburr } from "lodash"; export = deburr; diff --git a/lodash.defaults/index.d.ts b/lodash.defaults/index.d.ts index 15c8e57184..6c0bb1b47b 100644 --- a/lodash.defaults/index.d.ts +++ b/lodash.defaults/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { defaults } from "lodash"; export = defaults; diff --git a/lodash.defaultsdeep/index.d.ts b/lodash.defaultsdeep/index.d.ts index 22cb0667a3..c552b805ff 100644 --- a/lodash.defaultsdeep/index.d.ts +++ b/lodash.defaultsdeep/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { defaultsDeep } from "lodash"; export = defaultsDeep; diff --git a/lodash.defer/index.d.ts b/lodash.defer/index.d.ts index ad67ed0c82..6c35dd7513 100644 --- a/lodash.defer/index.d.ts +++ b/lodash.defer/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { defer } from "lodash"; export = defer; diff --git a/lodash.delay/index.d.ts b/lodash.delay/index.d.ts index b65bd46abe..bb4922c81c 100644 --- a/lodash.delay/index.d.ts +++ b/lodash.delay/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { delay } from "lodash"; export = delay; diff --git a/lodash.difference/index.d.ts b/lodash.difference/index.d.ts index 38aa798be1..7ad8c6c414 100644 --- a/lodash.difference/index.d.ts +++ b/lodash.difference/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { difference } from "lodash"; export = difference; diff --git a/lodash.differenceby/index.d.ts b/lodash.differenceby/index.d.ts index 2d0c4859f0..50dfcd6a9c 100644 --- a/lodash.differenceby/index.d.ts +++ b/lodash.differenceby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { differenceBy } from "lodash"; export = differenceBy; diff --git a/lodash.differencewith/index.d.ts b/lodash.differencewith/index.d.ts index fff454ca64..9870768137 100644 --- a/lodash.differencewith/index.d.ts +++ b/lodash.differencewith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { differenceWith } from "lodash"; export = differenceWith; diff --git a/lodash.drop/index.d.ts b/lodash.drop/index.d.ts index 0605e176ec..f702675717 100644 --- a/lodash.drop/index.d.ts +++ b/lodash.drop/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { drop } from "lodash"; export = drop; diff --git a/lodash.dropright/index.d.ts b/lodash.dropright/index.d.ts index 1322022901..1385005315 100644 --- a/lodash.dropright/index.d.ts +++ b/lodash.dropright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { dropRight } from "lodash"; export = dropRight; diff --git a/lodash.droprightwhile/index.d.ts b/lodash.droprightwhile/index.d.ts index b5fd1a75d2..02f5d13ac8 100644 --- a/lodash.droprightwhile/index.d.ts +++ b/lodash.droprightwhile/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { dropRightWhile } from "lodash"; export = dropRightWhile; diff --git a/lodash.dropwhile/index.d.ts b/lodash.dropwhile/index.d.ts index e24e46bccc..270e0d0189 100644 --- a/lodash.dropwhile/index.d.ts +++ b/lodash.dropwhile/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { dropWhile } from "lodash"; export = dropWhile; diff --git a/lodash.endswith/index.d.ts b/lodash.endswith/index.d.ts index 191301b21e..3a1c9b314e 100644 --- a/lodash.endswith/index.d.ts +++ b/lodash.endswith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { endsWith } from "lodash"; export = endsWith; diff --git a/lodash.eq/index.d.ts b/lodash.eq/index.d.ts index 87e927aa6d..8af8729bb4 100644 --- a/lodash.eq/index.d.ts +++ b/lodash.eq/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { eq } from "lodash"; export = eq; diff --git a/lodash.escape/index.d.ts b/lodash.escape/index.d.ts index 8e72963f22..a74f554830 100644 --- a/lodash.escape/index.d.ts +++ b/lodash.escape/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { escape } from "lodash"; export = escape; diff --git a/lodash.escaperegexp/index.d.ts b/lodash.escaperegexp/index.d.ts index 19eb0c6807..b80f492f70 100644 --- a/lodash.escaperegexp/index.d.ts +++ b/lodash.escaperegexp/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { escapeRegExp } from "lodash"; export = escapeRegExp; diff --git a/lodash.every/index.d.ts b/lodash.every/index.d.ts index a7ce29ad7a..84fd71115a 100644 --- a/lodash.every/index.d.ts +++ b/lodash.every/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { every } from "lodash"; export = every; diff --git a/lodash.fill/index.d.ts b/lodash.fill/index.d.ts index 1c8c619422..c2b785fbe5 100644 --- a/lodash.fill/index.d.ts +++ b/lodash.fill/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { fill } from "lodash"; export = fill; diff --git a/lodash.filter/index.d.ts b/lodash.filter/index.d.ts index 83dd5a1ddb..4960ebde70 100644 --- a/lodash.filter/index.d.ts +++ b/lodash.filter/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { filter } from "lodash"; export = filter; diff --git a/lodash.find/index.d.ts b/lodash.find/index.d.ts index eda8769f54..f1d736f0c0 100644 --- a/lodash.find/index.d.ts +++ b/lodash.find/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { find } from "lodash"; export = find; diff --git a/lodash.findindex/index.d.ts b/lodash.findindex/index.d.ts index bfb5034785..bc2fee9d18 100644 --- a/lodash.findindex/index.d.ts +++ b/lodash.findindex/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { findIndex } from "lodash"; export = findIndex; diff --git a/lodash.findkey/index.d.ts b/lodash.findkey/index.d.ts index bf5c2a357c..4bca193179 100644 --- a/lodash.findkey/index.d.ts +++ b/lodash.findkey/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { findKey } from "lodash"; export = findKey; diff --git a/lodash.findlast/index.d.ts b/lodash.findlast/index.d.ts index ad5f1d00f9..7ec89440be 100644 --- a/lodash.findlast/index.d.ts +++ b/lodash.findlast/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { findLast } from "lodash"; export = findLast; diff --git a/lodash.findlastindex/index.d.ts b/lodash.findlastindex/index.d.ts index 6e771c3842..37c0ba4567 100644 --- a/lodash.findlastindex/index.d.ts +++ b/lodash.findlastindex/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { findLastIndex } from "lodash"; export = findLastIndex; diff --git a/lodash.findlastkey/index.d.ts b/lodash.findlastkey/index.d.ts index ea09517b83..6e53f08733 100644 --- a/lodash.findlastkey/index.d.ts +++ b/lodash.findlastkey/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { findLastKey } from "lodash"; export = findLastKey; diff --git a/lodash.first/index.d.ts b/lodash.first/index.d.ts index b1e1b84a54..21b7337178 100644 --- a/lodash.first/index.d.ts +++ b/lodash.first/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { first } from "lodash"; export = first; diff --git a/lodash.flatmap/index.d.ts b/lodash.flatmap/index.d.ts index 26d291b7bc..075c3eba57 100644 --- a/lodash.flatmap/index.d.ts +++ b/lodash.flatmap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flatMap } from "lodash"; export = flatMap; diff --git a/lodash.flatten/index.d.ts b/lodash.flatten/index.d.ts index 4c3d68eb5e..b0247fd668 100644 --- a/lodash.flatten/index.d.ts +++ b/lodash.flatten/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flatten } from "lodash"; export = flatten; diff --git a/lodash.flattendeep/index.d.ts b/lodash.flattendeep/index.d.ts index 4e6b573eae..b596ff5fad 100644 --- a/lodash.flattendeep/index.d.ts +++ b/lodash.flattendeep/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flattenDeep } from "lodash"; export = flattenDeep; diff --git a/lodash.flattendepth/index.d.ts b/lodash.flattendepth/index.d.ts index 186641d1bc..d8df8b242b 100644 --- a/lodash.flattendepth/index.d.ts +++ b/lodash.flattendepth/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flattenDepth } from "lodash"; export = flattenDepth; diff --git a/lodash.flip/index.d.ts b/lodash.flip/index.d.ts index d4a69991ab..a87354fe7d 100644 --- a/lodash.flip/index.d.ts +++ b/lodash.flip/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flip } from "lodash"; export = flip; diff --git a/lodash.floor/index.d.ts b/lodash.floor/index.d.ts index 7e43e4335b..ca831b6e0f 100644 --- a/lodash.floor/index.d.ts +++ b/lodash.floor/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { floor } from "lodash"; export = floor; diff --git a/lodash.flow/index.d.ts b/lodash.flow/index.d.ts index 36be0e704f..d2bc98d1ab 100644 --- a/lodash.flow/index.d.ts +++ b/lodash.flow/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flow } from "lodash"; export = flow; diff --git a/lodash.flowright/index.d.ts b/lodash.flowright/index.d.ts index 95189e5684..e1275db957 100644 --- a/lodash.flowright/index.d.ts +++ b/lodash.flowright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { flowRight } from "lodash"; export = flowRight; diff --git a/lodash.foreach/index.d.ts b/lodash.foreach/index.d.ts index d2fd5757b4..9aec8eaf2b 100644 --- a/lodash.foreach/index.d.ts +++ b/lodash.foreach/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { forEach } from "lodash"; export = forEach; diff --git a/lodash.foreachright/index.d.ts b/lodash.foreachright/index.d.ts index cdd20d5fec..147f43d771 100644 --- a/lodash.foreachright/index.d.ts +++ b/lodash.foreachright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { forEachRight } from "lodash"; export = forEachRight; diff --git a/lodash.forin/index.d.ts b/lodash.forin/index.d.ts index e95e69f8b4..af03a8a4e1 100644 --- a/lodash.forin/index.d.ts +++ b/lodash.forin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { forIn } from "lodash"; export = forIn; diff --git a/lodash.forinright/index.d.ts b/lodash.forinright/index.d.ts index 160f182cf9..c79a18f746 100644 --- a/lodash.forinright/index.d.ts +++ b/lodash.forinright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { forInRight } from "lodash"; export = forInRight; diff --git a/lodash.forown/index.d.ts b/lodash.forown/index.d.ts index 20ae037f37..32d2ac758d 100644 --- a/lodash.forown/index.d.ts +++ b/lodash.forown/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { forOwn } from "lodash"; export = forOwn; diff --git a/lodash.forownright/index.d.ts b/lodash.forownright/index.d.ts index 0736346722..1a2ff70788 100644 --- a/lodash.forownright/index.d.ts +++ b/lodash.forownright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { forOwnRight } from "lodash"; export = forOwnRight; diff --git a/lodash.frompairs/index.d.ts b/lodash.frompairs/index.d.ts index db158444d5..b74020f99f 100644 --- a/lodash.frompairs/index.d.ts +++ b/lodash.frompairs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { fromPairs } from "lodash"; export = fromPairs; diff --git a/lodash.functions/index.d.ts b/lodash.functions/index.d.ts index 03ca7febbb..865f3c0c1e 100644 --- a/lodash.functions/index.d.ts +++ b/lodash.functions/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { functions } from "lodash"; export = functions; diff --git a/lodash.functionsin/index.d.ts b/lodash.functionsin/index.d.ts index 93168e67a3..5bfc7a5ca2 100644 --- a/lodash.functionsin/index.d.ts +++ b/lodash.functionsin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { functionsIn } from "lodash"; export = functionsIn; diff --git a/lodash.get/index.d.ts b/lodash.get/index.d.ts index 91e6b74e66..fd7d336a70 100644 --- a/lodash.get/index.d.ts +++ b/lodash.get/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { get } from "lodash"; export = get; diff --git a/lodash.groupby/index.d.ts b/lodash.groupby/index.d.ts index 06156f9b00..c55d2e3db7 100644 --- a/lodash.groupby/index.d.ts +++ b/lodash.groupby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { groupBy } from "lodash"; export = groupBy; diff --git a/lodash.gt/index.d.ts b/lodash.gt/index.d.ts index f541f408a8..cd5aa96019 100644 --- a/lodash.gt/index.d.ts +++ b/lodash.gt/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { gt } from "lodash"; export = gt; diff --git a/lodash.gte/index.d.ts b/lodash.gte/index.d.ts index 4041863b22..0e9eb62a7c 100644 --- a/lodash.gte/index.d.ts +++ b/lodash.gte/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { gte } from "lodash"; export = gte; diff --git a/lodash.has/index.d.ts b/lodash.has/index.d.ts index aaf4c27353..28ee7cd4e9 100644 --- a/lodash.has/index.d.ts +++ b/lodash.has/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { has } from "lodash"; export = has; diff --git a/lodash.hasin/index.d.ts b/lodash.hasin/index.d.ts index 53052f5cc3..09be59f7da 100644 --- a/lodash.hasin/index.d.ts +++ b/lodash.hasin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { hasIn } from "lodash"; export = hasIn; diff --git a/lodash.head/index.d.ts b/lodash.head/index.d.ts index d2e3e06eac..0b3b6da94f 100644 --- a/lodash.head/index.d.ts +++ b/lodash.head/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { head } from "lodash"; export = head; diff --git a/lodash.identity/index.d.ts b/lodash.identity/index.d.ts index 810313857d..0e683ed1c4 100644 --- a/lodash.identity/index.d.ts +++ b/lodash.identity/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { identity } from "lodash"; export = identity; diff --git a/lodash.includes/index.d.ts b/lodash.includes/index.d.ts index dccbc5e3ee..ddb703d38d 100644 --- a/lodash.includes/index.d.ts +++ b/lodash.includes/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { includes } from "lodash"; export = includes; diff --git a/lodash.indexof/index.d.ts b/lodash.indexof/index.d.ts index 0551b9acc6..180fde9e2f 100644 --- a/lodash.indexof/index.d.ts +++ b/lodash.indexof/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { indexOf } from "lodash"; export = indexOf; diff --git a/lodash.initial/index.d.ts b/lodash.initial/index.d.ts index 303d425de1..40fec082f7 100644 --- a/lodash.initial/index.d.ts +++ b/lodash.initial/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { initial } from "lodash"; export = initial; diff --git a/lodash.inrange/index.d.ts b/lodash.inrange/index.d.ts index b65ff730db..8140966ac2 100644 --- a/lodash.inrange/index.d.ts +++ b/lodash.inrange/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { inRange } from "lodash"; export = inRange; diff --git a/lodash.intersection/index.d.ts b/lodash.intersection/index.d.ts index 8bc7dbde4f..149a324277 100644 --- a/lodash.intersection/index.d.ts +++ b/lodash.intersection/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { intersection } from "lodash"; export = intersection; diff --git a/lodash.intersectionby/index.d.ts b/lodash.intersectionby/index.d.ts index 74ae5d4dfc..81c206df48 100644 --- a/lodash.intersectionby/index.d.ts +++ b/lodash.intersectionby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { intersectionBy } from "lodash"; export = intersectionBy; diff --git a/lodash.intersectionwith/index.d.ts b/lodash.intersectionwith/index.d.ts index 73b816b192..e18b9d41ff 100644 --- a/lodash.intersectionwith/index.d.ts +++ b/lodash.intersectionwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { intersectionWith } from "lodash"; export = intersectionWith; diff --git a/lodash.invert/index.d.ts b/lodash.invert/index.d.ts index 99fdb04c76..25fe9ce360 100644 --- a/lodash.invert/index.d.ts +++ b/lodash.invert/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { invert } from "lodash"; export = invert; diff --git a/lodash.invertby/index.d.ts b/lodash.invertby/index.d.ts index c3959934a2..63e5c70405 100644 --- a/lodash.invertby/index.d.ts +++ b/lodash.invertby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { invertBy } from "lodash"; export = invertBy; diff --git a/lodash.invoke/index.d.ts b/lodash.invoke/index.d.ts index 7af1475a29..e16b07d462 100644 --- a/lodash.invoke/index.d.ts +++ b/lodash.invoke/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { invoke } from "lodash"; export = invoke; diff --git a/lodash.invokemap/index.d.ts b/lodash.invokemap/index.d.ts index 4995018391..1365a4f752 100644 --- a/lodash.invokemap/index.d.ts +++ b/lodash.invokemap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { invokeMap } from "lodash"; export = invokeMap; diff --git a/lodash.isarguments/index.d.ts b/lodash.isarguments/index.d.ts index f46218acd9..7eb30e26dd 100644 --- a/lodash.isarguments/index.d.ts +++ b/lodash.isarguments/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isArguments } from "lodash"; export = isArguments; diff --git a/lodash.isarray/index.d.ts b/lodash.isarray/index.d.ts index a777294028..d4df88d8d7 100644 --- a/lodash.isarray/index.d.ts +++ b/lodash.isarray/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isArray } from "lodash"; export = isArray; diff --git a/lodash.isarraybuffer/index.d.ts b/lodash.isarraybuffer/index.d.ts index 827727c372..bb65311721 100644 --- a/lodash.isarraybuffer/index.d.ts +++ b/lodash.isarraybuffer/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isArrayBuffer } from "lodash"; export = isArrayBuffer; diff --git a/lodash.isarraylike/index.d.ts b/lodash.isarraylike/index.d.ts index 44e0da10d2..e722669eb4 100644 --- a/lodash.isarraylike/index.d.ts +++ b/lodash.isarraylike/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isArrayLike } from "lodash"; export = isArrayLike; diff --git a/lodash.isarraylikeobject/index.d.ts b/lodash.isarraylikeobject/index.d.ts index e5a2a5d847..8d094d8261 100644 --- a/lodash.isarraylikeobject/index.d.ts +++ b/lodash.isarraylikeobject/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isArrayLikeObject } from "lodash"; export = isArrayLikeObject; diff --git a/lodash.isboolean/index.d.ts b/lodash.isboolean/index.d.ts index 39ae1338ee..38bcb53406 100644 --- a/lodash.isboolean/index.d.ts +++ b/lodash.isboolean/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isBoolean } from "lodash"; export = isBoolean; diff --git a/lodash.isbuffer/index.d.ts b/lodash.isbuffer/index.d.ts index 985ce28952..0c9d922967 100644 --- a/lodash.isbuffer/index.d.ts +++ b/lodash.isbuffer/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isBuffer } from "lodash"; export = isBuffer; diff --git a/lodash.isdate/index.d.ts b/lodash.isdate/index.d.ts index 0c59a7a05f..bc61921489 100644 --- a/lodash.isdate/index.d.ts +++ b/lodash.isdate/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isDate } from "lodash"; export = isDate; diff --git a/lodash.iselement/index.d.ts b/lodash.iselement/index.d.ts index d4538e9e40..e059b8b1f5 100644 --- a/lodash.iselement/index.d.ts +++ b/lodash.iselement/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isElement } from "lodash"; export = isElement; diff --git a/lodash.isempty/index.d.ts b/lodash.isempty/index.d.ts index dc550a45a3..bff4c499aa 100644 --- a/lodash.isempty/index.d.ts +++ b/lodash.isempty/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isEmpty } from "lodash"; export = isEmpty; diff --git a/lodash.isequal/index.d.ts b/lodash.isequal/index.d.ts index b19d0c04d5..d06f5a2a2a 100644 --- a/lodash.isequal/index.d.ts +++ b/lodash.isequal/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for lodash.isEqual 4.4 +// Type definitions for lodash.isEqual 4.5 // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isEqual } from "lodash"; export = isEqual; diff --git a/lodash.isequalwith/index.d.ts b/lodash.isequalwith/index.d.ts index 1298491bd4..250895312b 100644 --- a/lodash.isequalwith/index.d.ts +++ b/lodash.isequalwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isEqualWith } from "lodash"; export = isEqualWith; diff --git a/lodash.iserror/index.d.ts b/lodash.iserror/index.d.ts index d12d1b7cce..42a2bc0923 100644 --- a/lodash.iserror/index.d.ts +++ b/lodash.iserror/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isError } from "lodash"; export = isError; diff --git a/lodash.isfinite/index.d.ts b/lodash.isfinite/index.d.ts index 8cd096692c..02a28fa204 100644 --- a/lodash.isfinite/index.d.ts +++ b/lodash.isfinite/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isFinite } from "lodash"; export = isFinite; diff --git a/lodash.isfunction/index.d.ts b/lodash.isfunction/index.d.ts index a2276e5633..3253939f6b 100644 --- a/lodash.isfunction/index.d.ts +++ b/lodash.isfunction/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isFunction } from "lodash"; export = isFunction; diff --git a/lodash.isinteger/index.d.ts b/lodash.isinteger/index.d.ts index f2d78c2b1f..7d604a19b6 100644 --- a/lodash.isinteger/index.d.ts +++ b/lodash.isinteger/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isInteger } from "lodash"; export = isInteger; diff --git a/lodash.islength/index.d.ts b/lodash.islength/index.d.ts index abcc89acda..6ed54652e5 100644 --- a/lodash.islength/index.d.ts +++ b/lodash.islength/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isLength } from "lodash"; export = isLength; diff --git a/lodash.ismap/index.d.ts b/lodash.ismap/index.d.ts index 62bde83057..1fc93f3462 100644 --- a/lodash.ismap/index.d.ts +++ b/lodash.ismap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isMap } from "lodash"; export = isMap; diff --git a/lodash.ismatch/index.d.ts b/lodash.ismatch/index.d.ts index 617f6c9bda..3c8de854e8 100644 --- a/lodash.ismatch/index.d.ts +++ b/lodash.ismatch/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isMatch } from "lodash"; export = isMatch; diff --git a/lodash.ismatchwith/index.d.ts b/lodash.ismatchwith/index.d.ts index ed8ff1b11b..c69ae83ea6 100644 --- a/lodash.ismatchwith/index.d.ts +++ b/lodash.ismatchwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isMatchWith } from "lodash"; export = isMatchWith; diff --git a/lodash.isnan/index.d.ts b/lodash.isnan/index.d.ts index 029f8c6e9b..1d95ffe160 100644 --- a/lodash.isnan/index.d.ts +++ b/lodash.isnan/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isNaN } from "lodash"; export = isNaN; diff --git a/lodash.isnative/index.d.ts b/lodash.isnative/index.d.ts index 133f9cea47..29050811ef 100644 --- a/lodash.isnative/index.d.ts +++ b/lodash.isnative/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isNative } from "lodash"; export = isNative; diff --git a/lodash.isnil/index.d.ts b/lodash.isnil/index.d.ts index d3aaa388ee..5199f1657a 100644 --- a/lodash.isnil/index.d.ts +++ b/lodash.isnil/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isNil } from "lodash"; export = isNil; diff --git a/lodash.isnull/index.d.ts b/lodash.isnull/index.d.ts index 87a041d532..117b41f2e5 100644 --- a/lodash.isnull/index.d.ts +++ b/lodash.isnull/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isNull } from "lodash"; export = isNull; diff --git a/lodash.isnumber/index.d.ts b/lodash.isnumber/index.d.ts index 1f88c13582..70e51e9842 100644 --- a/lodash.isnumber/index.d.ts +++ b/lodash.isnumber/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isNumber } from "lodash"; export = isNumber; diff --git a/lodash.isobject/index.d.ts b/lodash.isobject/index.d.ts index 229357175a..6f79f888df 100644 --- a/lodash.isobject/index.d.ts +++ b/lodash.isobject/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isObject } from "lodash"; export = isObject; diff --git a/lodash.isobjectlike/index.d.ts b/lodash.isobjectlike/index.d.ts index 5c5c4bcdb3..8423f18a2a 100644 --- a/lodash.isobjectlike/index.d.ts +++ b/lodash.isobjectlike/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isObjectLike } from "lodash"; export = isObjectLike; diff --git a/lodash.isplainobject/index.d.ts b/lodash.isplainobject/index.d.ts index c5e4af82cd..33e85453d2 100644 --- a/lodash.isplainobject/index.d.ts +++ b/lodash.isplainobject/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isPlainObject } from "lodash"; export = isPlainObject; diff --git a/lodash.isregexp/index.d.ts b/lodash.isregexp/index.d.ts index bb6e4c182b..509c93a365 100644 --- a/lodash.isregexp/index.d.ts +++ b/lodash.isregexp/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isRegExp } from "lodash"; export = isRegExp; diff --git a/lodash.issafeinteger/index.d.ts b/lodash.issafeinteger/index.d.ts index 9c86763ba2..28fe1c868c 100644 --- a/lodash.issafeinteger/index.d.ts +++ b/lodash.issafeinteger/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isSafeInteger } from "lodash"; export = isSafeInteger; diff --git a/lodash.isset/index.d.ts b/lodash.isset/index.d.ts index eb77cabac8..67f643bb74 100644 --- a/lodash.isset/index.d.ts +++ b/lodash.isset/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isSet } from "lodash"; export = isSet; diff --git a/lodash.isstring/index.d.ts b/lodash.isstring/index.d.ts index 67ee27673d..42cca91fee 100644 --- a/lodash.isstring/index.d.ts +++ b/lodash.isstring/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isString } from "lodash"; export = isString; diff --git a/lodash.issymbol/index.d.ts b/lodash.issymbol/index.d.ts index d7be47d922..16468073cc 100644 --- a/lodash.issymbol/index.d.ts +++ b/lodash.issymbol/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isSymbol } from "lodash"; export = isSymbol; diff --git a/lodash.istypedarray/index.d.ts b/lodash.istypedarray/index.d.ts index 138f4baa08..e93a364295 100644 --- a/lodash.istypedarray/index.d.ts +++ b/lodash.istypedarray/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isTypedArray } from "lodash"; export = isTypedArray; diff --git a/lodash.isundefined/index.d.ts b/lodash.isundefined/index.d.ts index 2b112959c9..e9a3553600 100644 --- a/lodash.isundefined/index.d.ts +++ b/lodash.isundefined/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isUndefined } from "lodash"; export = isUndefined; diff --git a/lodash.isweakmap/index.d.ts b/lodash.isweakmap/index.d.ts index a6fbc47986..7e2be4cfb2 100644 --- a/lodash.isweakmap/index.d.ts +++ b/lodash.isweakmap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isWeakMap } from "lodash"; export = isWeakMap; diff --git a/lodash.isweakset/index.d.ts b/lodash.isweakset/index.d.ts index d4b016f106..d7e1a801eb 100644 --- a/lodash.isweakset/index.d.ts +++ b/lodash.isweakset/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { isWeakSet } from "lodash"; export = isWeakSet; diff --git a/lodash.iteratee/index.d.ts b/lodash.iteratee/index.d.ts index 3e494ef2c8..7f6a197f12 100644 --- a/lodash.iteratee/index.d.ts +++ b/lodash.iteratee/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { iteratee } from "lodash"; export = iteratee; diff --git a/lodash.join/index.d.ts b/lodash.join/index.d.ts index 14f26d67ed..a8dd2622a1 100644 --- a/lodash.join/index.d.ts +++ b/lodash.join/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { join } from "lodash"; export = join; diff --git a/lodash.kebabcase/index.d.ts b/lodash.kebabcase/index.d.ts index 0851c7672a..00163a5a33 100644 --- a/lodash.kebabcase/index.d.ts +++ b/lodash.kebabcase/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { kebabCase } from "lodash"; export = kebabCase; diff --git a/lodash.keyby/index.d.ts b/lodash.keyby/index.d.ts index 51aac439ca..8b5700ad76 100644 --- a/lodash.keyby/index.d.ts +++ b/lodash.keyby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { keyBy } from "lodash"; export = keyBy; diff --git a/lodash.keys/index.d.ts b/lodash.keys/index.d.ts index b514c21483..d862fb0541 100644 --- a/lodash.keys/index.d.ts +++ b/lodash.keys/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { keys } from "lodash"; export = keys; diff --git a/lodash.keysin/index.d.ts b/lodash.keysin/index.d.ts index 66a18cdfa7..e15bece518 100644 --- a/lodash.keysin/index.d.ts +++ b/lodash.keysin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { keysIn } from "lodash"; export = keysIn; diff --git a/lodash.last/index.d.ts b/lodash.last/index.d.ts index a06a998d86..29b4ce9c63 100644 --- a/lodash.last/index.d.ts +++ b/lodash.last/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { last } from "lodash"; export = last; diff --git a/lodash.lastindexof/index.d.ts b/lodash.lastindexof/index.d.ts index 5fccab48d0..a9459ada4d 100644 --- a/lodash.lastindexof/index.d.ts +++ b/lodash.lastindexof/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { lastIndexOf } from "lodash"; export = lastIndexOf; diff --git a/lodash.lowercase/index.d.ts b/lodash.lowercase/index.d.ts index 4232be29ad..b9505737bc 100644 --- a/lodash.lowercase/index.d.ts +++ b/lodash.lowercase/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { lowerCase } from "lodash"; export = lowerCase; diff --git a/lodash.lowerfirst/index.d.ts b/lodash.lowerfirst/index.d.ts index c5d0ea1ca6..424d02631b 100644 --- a/lodash.lowerfirst/index.d.ts +++ b/lodash.lowerfirst/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { lowerFirst } from "lodash"; export = lowerFirst; diff --git a/lodash.lt/index.d.ts b/lodash.lt/index.d.ts index 71cc6c1c00..5bad744986 100644 --- a/lodash.lt/index.d.ts +++ b/lodash.lt/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { lt } from "lodash"; export = lt; diff --git a/lodash.lte/index.d.ts b/lodash.lte/index.d.ts index 61ddce98b1..5299138c0f 100644 --- a/lodash.lte/index.d.ts +++ b/lodash.lte/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { lte } from "lodash"; export = lte; diff --git a/lodash.mapkeys/index.d.ts b/lodash.mapkeys/index.d.ts index c56b7647f5..bb32f2862f 100644 --- a/lodash.mapkeys/index.d.ts +++ b/lodash.mapkeys/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { mapKeys } from "lodash"; export = mapKeys; diff --git a/lodash.mapvalues/index.d.ts b/lodash.mapvalues/index.d.ts index 4507f9234e..db516f2de8 100644 --- a/lodash.mapvalues/index.d.ts +++ b/lodash.mapvalues/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { mapValues } from "lodash"; export = mapValues; diff --git a/lodash.matches/index.d.ts b/lodash.matches/index.d.ts index 9179ed074b..f80ba05944 100644 --- a/lodash.matches/index.d.ts +++ b/lodash.matches/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { matches } from "lodash"; export = matches; diff --git a/lodash.matchesproperty/index.d.ts b/lodash.matchesproperty/index.d.ts index afbb8dbfb3..e240a6ebad 100644 --- a/lodash.matchesproperty/index.d.ts +++ b/lodash.matchesproperty/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { matchesProperty } from "lodash"; export = matchesProperty; diff --git a/lodash.max/index.d.ts b/lodash.max/index.d.ts index 55167fee93..dc8297841f 100644 --- a/lodash.max/index.d.ts +++ b/lodash.max/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { max } from "lodash"; export = max; diff --git a/lodash.maxby/index.d.ts b/lodash.maxby/index.d.ts index 2513ce999f..47210f79a7 100644 --- a/lodash.maxby/index.d.ts +++ b/lodash.maxby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { maxBy } from "lodash"; export = maxBy; diff --git a/lodash.mean/index.d.ts b/lodash.mean/index.d.ts index bbf8183e23..dc839ace51 100644 --- a/lodash.mean/index.d.ts +++ b/lodash.mean/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { mean } from "lodash"; export = mean; diff --git a/lodash.meanby/index.d.ts b/lodash.meanby/index.d.ts new file mode 100644 index 0000000000..8973d40ded --- /dev/null +++ b/lodash.meanby/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for lodash.meanBy 4.10 +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { meanBy } from "lodash"; +export = meanBy; diff --git a/lodash.meanby/tsconfig.json b/lodash.meanby/tsconfig.json new file mode 100644 index 0000000000..5692e5627e --- /dev/null +++ b/lodash.meanby/tsconfig.json @@ -0,0 +1,19 @@ +{ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/lodash.meanby/tslint.json b/lodash.meanby/tslint.json new file mode 100644 index 0000000000..192203ab54 --- /dev/null +++ b/lodash.meanby/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} \ No newline at end of file diff --git a/lodash.memoize/index.d.ts b/lodash.memoize/index.d.ts index 6a4c57a197..25002a9086 100644 --- a/lodash.memoize/index.d.ts +++ b/lodash.memoize/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { memoize } from "lodash"; export = memoize; diff --git a/lodash.merge/index.d.ts b/lodash.merge/index.d.ts index f4250afe0a..a5352b8cc9 100644 --- a/lodash.merge/index.d.ts +++ b/lodash.merge/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { merge } from "lodash"; export = merge; diff --git a/lodash.mergewith/index.d.ts b/lodash.mergewith/index.d.ts index d22369299e..85cad973d9 100644 --- a/lodash.mergewith/index.d.ts +++ b/lodash.mergewith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { mergeWith } from "lodash"; export = mergeWith; diff --git a/lodash.method/index.d.ts b/lodash.method/index.d.ts index d890f661e2..cee310ff55 100644 --- a/lodash.method/index.d.ts +++ b/lodash.method/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { method } from "lodash"; export = method; diff --git a/lodash.methodof/index.d.ts b/lodash.methodof/index.d.ts index b464af2fc4..5420de784a 100644 --- a/lodash.methodof/index.d.ts +++ b/lodash.methodof/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { methodOf } from "lodash"; export = methodOf; diff --git a/lodash.min/index.d.ts b/lodash.min/index.d.ts index 5f4dc842dd..87fccd9876 100644 --- a/lodash.min/index.d.ts +++ b/lodash.min/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { min } from "lodash"; export = min; diff --git a/lodash.minby/index.d.ts b/lodash.minby/index.d.ts index 95293a83bf..d46f507c70 100644 --- a/lodash.minby/index.d.ts +++ b/lodash.minby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { minBy } from "lodash"; export = minBy; diff --git a/lodash.mixin/index.d.ts b/lodash.mixin/index.d.ts index 78190227b1..8a4190762b 100644 --- a/lodash.mixin/index.d.ts +++ b/lodash.mixin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { mixin } from "lodash"; export = mixin; diff --git a/lodash.negate/index.d.ts b/lodash.negate/index.d.ts index 48796a3750..a4c8b4b88e 100644 --- a/lodash.negate/index.d.ts +++ b/lodash.negate/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { negate } from "lodash"; export = negate; diff --git a/lodash.noop/index.d.ts b/lodash.noop/index.d.ts index 632d3d1292..04e6cacbb3 100644 --- a/lodash.noop/index.d.ts +++ b/lodash.noop/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { noop } from "lodash"; export = noop; diff --git a/lodash.now/index.d.ts b/lodash.now/index.d.ts index 80e893d018..ecda7f778d 100644 --- a/lodash.now/index.d.ts +++ b/lodash.now/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { now } from "lodash"; export = now; diff --git a/lodash.ntharg/index.d.ts b/lodash.ntharg/index.d.ts index 51eb387c96..0d35cb5772 100644 --- a/lodash.ntharg/index.d.ts +++ b/lodash.ntharg/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { nthArg } from "lodash"; export = nthArg; diff --git a/lodash.omit/index.d.ts b/lodash.omit/index.d.ts index b60f1d503b..491b505016 100644 --- a/lodash.omit/index.d.ts +++ b/lodash.omit/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { omit } from "lodash"; export = omit; diff --git a/lodash.omitby/index.d.ts b/lodash.omitby/index.d.ts index 82c8b6d063..fee479036b 100644 --- a/lodash.omitby/index.d.ts +++ b/lodash.omitby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { omitBy } from "lodash"; export = omitBy; diff --git a/lodash.once/index.d.ts b/lodash.once/index.d.ts index 3089544fe9..3f8622e6a0 100644 --- a/lodash.once/index.d.ts +++ b/lodash.once/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { once } from "lodash"; export = once; diff --git a/lodash.orderby/index.d.ts b/lodash.orderby/index.d.ts index e862a62e96..b348cefebc 100644 --- a/lodash.orderby/index.d.ts +++ b/lodash.orderby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { orderBy } from "lodash"; export = orderBy; diff --git a/lodash.over/index.d.ts b/lodash.over/index.d.ts index 1df6138a41..5715f0a46e 100644 --- a/lodash.over/index.d.ts +++ b/lodash.over/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { over } from "lodash"; export = over; diff --git a/lodash.overargs/index.d.ts b/lodash.overargs/index.d.ts index 1cd9c19126..576ab8588a 100644 --- a/lodash.overargs/index.d.ts +++ b/lodash.overargs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { overArgs } from "lodash"; export = overArgs; diff --git a/lodash.overevery/index.d.ts b/lodash.overevery/index.d.ts index 2211dc569b..68d6cd3639 100644 --- a/lodash.overevery/index.d.ts +++ b/lodash.overevery/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { overEvery } from "lodash"; export = overEvery; diff --git a/lodash.oversome/index.d.ts b/lodash.oversome/index.d.ts index f8ec5329f6..4e4fe4eb5c 100644 --- a/lodash.oversome/index.d.ts +++ b/lodash.oversome/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { overSome } from "lodash"; export = overSome; diff --git a/lodash.pad/index.d.ts b/lodash.pad/index.d.ts index 06a7c7f5ac..259c312381 100644 --- a/lodash.pad/index.d.ts +++ b/lodash.pad/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pad } from "lodash"; export = pad; diff --git a/lodash.padend/index.d.ts b/lodash.padend/index.d.ts index b42ad0ab11..825479dae8 100644 --- a/lodash.padend/index.d.ts +++ b/lodash.padend/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { padEnd } from "lodash"; export = padEnd; diff --git a/lodash.padstart/index.d.ts b/lodash.padstart/index.d.ts index b020c51ee5..b3607d61cc 100644 --- a/lodash.padstart/index.d.ts +++ b/lodash.padstart/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { padStart } from "lodash"; export = padStart; diff --git a/lodash.parseint/index.d.ts b/lodash.parseint/index.d.ts index cafd05c882..4724867112 100644 --- a/lodash.parseint/index.d.ts +++ b/lodash.parseint/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { parseInt } from "lodash"; export = parseInt; diff --git a/lodash.partial/index.d.ts b/lodash.partial/index.d.ts index 4d6dc3c303..8466a32963 100644 --- a/lodash.partial/index.d.ts +++ b/lodash.partial/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { partial } from "lodash"; export = partial; diff --git a/lodash.partialright/index.d.ts b/lodash.partialright/index.d.ts index d24675203d..5f9f7bef4d 100644 --- a/lodash.partialright/index.d.ts +++ b/lodash.partialright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { partialRight } from "lodash"; export = partialRight; diff --git a/lodash.partition/index.d.ts b/lodash.partition/index.d.ts index c79c676a46..d481bae93b 100644 --- a/lodash.partition/index.d.ts +++ b/lodash.partition/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { partition } from "lodash"; export = partition; diff --git a/lodash.pick/index.d.ts b/lodash.pick/index.d.ts index 7fa2ef6e84..f27646190a 100644 --- a/lodash.pick/index.d.ts +++ b/lodash.pick/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pick } from "lodash"; export = pick; diff --git a/lodash.pickby/index.d.ts b/lodash.pickby/index.d.ts index 2c72e96edd..0a77aaedc8 100644 --- a/lodash.pickby/index.d.ts +++ b/lodash.pickby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pickBy } from "lodash"; export = pickBy; diff --git a/lodash.property/index.d.ts b/lodash.property/index.d.ts index e9ea2b894e..90e3eb20b3 100644 --- a/lodash.property/index.d.ts +++ b/lodash.property/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { property } from "lodash"; export = property; diff --git a/lodash.propertyof/index.d.ts b/lodash.propertyof/index.d.ts index d52d898afa..2db1d2461f 100644 --- a/lodash.propertyof/index.d.ts +++ b/lodash.propertyof/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { propertyOf } from "lodash"; export = propertyOf; diff --git a/lodash.pull/index.d.ts b/lodash.pull/index.d.ts index b60aec6f73..7232218789 100644 --- a/lodash.pull/index.d.ts +++ b/lodash.pull/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pull } from "lodash"; export = pull; diff --git a/lodash.pullall/index.d.ts b/lodash.pullall/index.d.ts index 4c55d19fc0..9503a4c6e5 100644 --- a/lodash.pullall/index.d.ts +++ b/lodash.pullall/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pullAll } from "lodash"; export = pullAll; diff --git a/lodash.pullallby/index.d.ts b/lodash.pullallby/index.d.ts index 18bc32f579..4f5c91696f 100644 --- a/lodash.pullallby/index.d.ts +++ b/lodash.pullallby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pullAllBy } from "lodash"; export = pullAllBy; diff --git a/lodash.pullat/index.d.ts b/lodash.pullat/index.d.ts index 4a7c29cb90..2330713675 100644 --- a/lodash.pullat/index.d.ts +++ b/lodash.pullat/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { pullAt } from "lodash"; export = pullAt; diff --git a/lodash.random/index.d.ts b/lodash.random/index.d.ts index 018f4e1c99..87ba37f817 100644 --- a/lodash.random/index.d.ts +++ b/lodash.random/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { random } from "lodash"; export = random; diff --git a/lodash.range/index.d.ts b/lodash.range/index.d.ts index 289101b98a..6e9871a10a 100644 --- a/lodash.range/index.d.ts +++ b/lodash.range/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { range } from "lodash"; export = range; diff --git a/lodash.rangeright/index.d.ts b/lodash.rangeright/index.d.ts index 15d7f8be2b..b7fcfd8b34 100644 --- a/lodash.rangeright/index.d.ts +++ b/lodash.rangeright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { rangeRight } from "lodash"; export = rangeRight; diff --git a/lodash.rearg/index.d.ts b/lodash.rearg/index.d.ts index 987565e162..8c6f912bcd 100644 --- a/lodash.rearg/index.d.ts +++ b/lodash.rearg/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { rearg } from "lodash"; export = rearg; diff --git a/lodash.reduce/index.d.ts b/lodash.reduce/index.d.ts index 44f4007e94..5ef634a93d 100644 --- a/lodash.reduce/index.d.ts +++ b/lodash.reduce/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { reduce } from "lodash"; export = reduce; diff --git a/lodash.reduceright/index.d.ts b/lodash.reduceright/index.d.ts index 3377523e1a..ee3e05ea62 100644 --- a/lodash.reduceright/index.d.ts +++ b/lodash.reduceright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { reduceRight } from "lodash"; export = reduceRight; diff --git a/lodash.reject/index.d.ts b/lodash.reject/index.d.ts index f7e56a60bc..2a7a953403 100644 --- a/lodash.reject/index.d.ts +++ b/lodash.reject/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { reject } from "lodash"; export = reject; diff --git a/lodash.remove/index.d.ts b/lodash.remove/index.d.ts index b6b2871f51..cf3ecdb008 100644 --- a/lodash.remove/index.d.ts +++ b/lodash.remove/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { remove } from "lodash"; export = remove; diff --git a/lodash.repeat/index.d.ts b/lodash.repeat/index.d.ts index a0ab5e77f2..066a9f7741 100644 --- a/lodash.repeat/index.d.ts +++ b/lodash.repeat/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { repeat } from "lodash"; export = repeat; diff --git a/lodash.replace/index.d.ts b/lodash.replace/index.d.ts index d1dc58bad0..deaf6f5925 100644 --- a/lodash.replace/index.d.ts +++ b/lodash.replace/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { replace } from "lodash"; export = replace; diff --git a/lodash.rest/index.d.ts b/lodash.rest/index.d.ts index c8b2728ec5..12d89f07a4 100644 --- a/lodash.rest/index.d.ts +++ b/lodash.rest/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { rest } from "lodash"; export = rest; diff --git a/lodash.result/index.d.ts b/lodash.result/index.d.ts index 344d75766a..ca67b40446 100644 --- a/lodash.result/index.d.ts +++ b/lodash.result/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { result } from "lodash"; export = result; diff --git a/lodash.reverse/index.d.ts b/lodash.reverse/index.d.ts index 8da6b703f7..0486ee3715 100644 --- a/lodash.reverse/index.d.ts +++ b/lodash.reverse/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { reverse } from "lodash"; export = reverse; diff --git a/lodash.round/index.d.ts b/lodash.round/index.d.ts index 828aee5487..5eb7dddb09 100644 --- a/lodash.round/index.d.ts +++ b/lodash.round/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { round } from "lodash"; export = round; diff --git a/lodash.sample/index.d.ts b/lodash.sample/index.d.ts index 2fa651cce8..b5873086e2 100644 --- a/lodash.sample/index.d.ts +++ b/lodash.sample/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sample } from "lodash"; export = sample; diff --git a/lodash.samplesize/index.d.ts b/lodash.samplesize/index.d.ts index 5be09b8960..01a187726b 100644 --- a/lodash.samplesize/index.d.ts +++ b/lodash.samplesize/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sampleSize } from "lodash"; export = sampleSize; diff --git a/lodash.set/index.d.ts b/lodash.set/index.d.ts index 45c51f879a..f76b88790e 100644 --- a/lodash.set/index.d.ts +++ b/lodash.set/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { set } from "lodash"; export = set; diff --git a/lodash.setwith/index.d.ts b/lodash.setwith/index.d.ts index 8c41eb3be6..43502688be 100644 --- a/lodash.setwith/index.d.ts +++ b/lodash.setwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { setWith } from "lodash"; export = setWith; diff --git a/lodash.shuffle/index.d.ts b/lodash.shuffle/index.d.ts index 7b8e65fde0..1283f11844 100644 --- a/lodash.shuffle/index.d.ts +++ b/lodash.shuffle/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { shuffle } from "lodash"; export = shuffle; diff --git a/lodash.size/index.d.ts b/lodash.size/index.d.ts index 6e7201c394..e0aa69d12f 100644 --- a/lodash.size/index.d.ts +++ b/lodash.size/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { size } from "lodash"; export = size; diff --git a/lodash.slice/index.d.ts b/lodash.slice/index.d.ts index b9206644eb..2b53bb2386 100644 --- a/lodash.slice/index.d.ts +++ b/lodash.slice/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { slice } from "lodash"; export = slice; diff --git a/lodash.snakecase/index.d.ts b/lodash.snakecase/index.d.ts index 36fbaec580..db2758999b 100644 --- a/lodash.snakecase/index.d.ts +++ b/lodash.snakecase/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { snakeCase } from "lodash"; export = snakeCase; diff --git a/lodash.some/index.d.ts b/lodash.some/index.d.ts index e722a5ccae..3de45fa161 100644 --- a/lodash.some/index.d.ts +++ b/lodash.some/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { some } from "lodash"; export = some; diff --git a/lodash.sortby/index.d.ts b/lodash.sortby/index.d.ts index 028b50fa20..cc75aa6dca 100644 --- a/lodash.sortby/index.d.ts +++ b/lodash.sortby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortBy } from "lodash"; export = sortBy; diff --git a/lodash.sortedindex/index.d.ts b/lodash.sortedindex/index.d.ts index 9c799fec11..ab6e8eca1f 100644 --- a/lodash.sortedindex/index.d.ts +++ b/lodash.sortedindex/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedIndex } from "lodash"; export = sortedIndex; diff --git a/lodash.sortedindexby/index.d.ts b/lodash.sortedindexby/index.d.ts index 73601c7b4d..1f5d0c15ac 100644 --- a/lodash.sortedindexby/index.d.ts +++ b/lodash.sortedindexby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedIndexBy } from "lodash"; export = sortedIndexBy; diff --git a/lodash.sortedindexof/index.d.ts b/lodash.sortedindexof/index.d.ts index 471e408bb9..814afd3e3c 100644 --- a/lodash.sortedindexof/index.d.ts +++ b/lodash.sortedindexof/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedIndexOf } from "lodash"; export = sortedIndexOf; diff --git a/lodash.sortedlastindex/index.d.ts b/lodash.sortedlastindex/index.d.ts index 95825a983a..5a1c0faa7d 100644 --- a/lodash.sortedlastindex/index.d.ts +++ b/lodash.sortedlastindex/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedLastIndex } from "lodash"; export = sortedLastIndex; diff --git a/lodash.sortedlastindexby/index.d.ts b/lodash.sortedlastindexby/index.d.ts index e5a167a17b..5b939599b2 100644 --- a/lodash.sortedlastindexby/index.d.ts +++ b/lodash.sortedlastindexby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedLastIndexBy } from "lodash"; export = sortedLastIndexBy; diff --git a/lodash.sortedlastindexof/index.d.ts b/lodash.sortedlastindexof/index.d.ts index c908ede67a..9817ef54f5 100644 --- a/lodash.sortedlastindexof/index.d.ts +++ b/lodash.sortedlastindexof/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedLastIndexOf } from "lodash"; export = sortedLastIndexOf; diff --git a/lodash.sorteduniq/index.d.ts b/lodash.sorteduniq/index.d.ts index c9ff4eb4e7..c8b8feea6f 100644 --- a/lodash.sorteduniq/index.d.ts +++ b/lodash.sorteduniq/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedUniq } from "lodash"; export = sortedUniq; diff --git a/lodash.sorteduniqby/index.d.ts b/lodash.sorteduniqby/index.d.ts index 295d3bcaf3..637895af43 100644 --- a/lodash.sorteduniqby/index.d.ts +++ b/lodash.sorteduniqby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sortedUniqBy } from "lodash"; export = sortedUniqBy; diff --git a/lodash.split/index.d.ts b/lodash.split/index.d.ts index 43c187c455..fd5a261917 100644 --- a/lodash.split/index.d.ts +++ b/lodash.split/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { split } from "lodash"; export = split; diff --git a/lodash.spread/index.d.ts b/lodash.spread/index.d.ts index adaec68385..7bbc4e9245 100644 --- a/lodash.spread/index.d.ts +++ b/lodash.spread/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { spread } from "lodash"; export = spread; diff --git a/lodash.startcase/index.d.ts b/lodash.startcase/index.d.ts index 9c550e4a0c..53798256bc 100644 --- a/lodash.startcase/index.d.ts +++ b/lodash.startcase/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { startCase } from "lodash"; export = startCase; diff --git a/lodash.startswith/index.d.ts b/lodash.startswith/index.d.ts index ebb4178ac5..84071e3d10 100644 --- a/lodash.startswith/index.d.ts +++ b/lodash.startswith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { startsWith } from "lodash"; export = startsWith; diff --git a/lodash.subtract/index.d.ts b/lodash.subtract/index.d.ts index 6d148eb796..0b57101cee 100644 --- a/lodash.subtract/index.d.ts +++ b/lodash.subtract/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { subtract } from "lodash"; export = subtract; diff --git a/lodash.sum/index.d.ts b/lodash.sum/index.d.ts index df4194246e..e6aaf24aee 100644 --- a/lodash.sum/index.d.ts +++ b/lodash.sum/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sum } from "lodash"; export = sum; diff --git a/lodash.sumby/index.d.ts b/lodash.sumby/index.d.ts index dad7e3dfa7..e1f21e1454 100644 --- a/lodash.sumby/index.d.ts +++ b/lodash.sumby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { sumBy } from "lodash"; export = sumBy; diff --git a/lodash.tail/index.d.ts b/lodash.tail/index.d.ts index 1edf5423c0..7543f1ae31 100644 --- a/lodash.tail/index.d.ts +++ b/lodash.tail/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { tail } from "lodash"; export = tail; diff --git a/lodash.take/index.d.ts b/lodash.take/index.d.ts index f477178ee3..688eaf7b8d 100644 --- a/lodash.take/index.d.ts +++ b/lodash.take/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { take } from "lodash"; export = take; diff --git a/lodash.takeright/index.d.ts b/lodash.takeright/index.d.ts index f44b5b7a99..9599696c72 100644 --- a/lodash.takeright/index.d.ts +++ b/lodash.takeright/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { takeRight } from "lodash"; export = takeRight; diff --git a/lodash.takerightwhile/index.d.ts b/lodash.takerightwhile/index.d.ts index 1940bdab6a..b0ccc8647f 100644 --- a/lodash.takerightwhile/index.d.ts +++ b/lodash.takerightwhile/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { takeRightWhile } from "lodash"; export = takeRightWhile; diff --git a/lodash.takewhile/index.d.ts b/lodash.takewhile/index.d.ts index b1c7464e21..8e557afdd4 100644 --- a/lodash.takewhile/index.d.ts +++ b/lodash.takewhile/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { takeWhile } from "lodash"; export = takeWhile; diff --git a/lodash.template/index.d.ts b/lodash.template/index.d.ts index af31692e84..a81b832990 100644 --- a/lodash.template/index.d.ts +++ b/lodash.template/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { template } from "lodash"; export = template; diff --git a/lodash.throttle/index.d.ts b/lodash.throttle/index.d.ts index ed74ec008b..0a2903b317 100644 --- a/lodash.throttle/index.d.ts +++ b/lodash.throttle/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { throttle } from "lodash"; export = throttle; diff --git a/lodash.times/index.d.ts b/lodash.times/index.d.ts index adabd498e2..f899aac24e 100644 --- a/lodash.times/index.d.ts +++ b/lodash.times/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { times } from "lodash"; export = times; diff --git a/lodash.toarray/index.d.ts b/lodash.toarray/index.d.ts index 42e878de35..f1cb6ecdea 100644 --- a/lodash.toarray/index.d.ts +++ b/lodash.toarray/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toArray } from "lodash"; export = toArray; diff --git a/lodash.tointeger/index.d.ts b/lodash.tointeger/index.d.ts index 19a97ef2fd..32f5bafbb7 100644 --- a/lodash.tointeger/index.d.ts +++ b/lodash.tointeger/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toInteger } from "lodash"; export = toInteger; diff --git a/lodash.tolength/index.d.ts b/lodash.tolength/index.d.ts index 1170461e93..0af29d75fd 100644 --- a/lodash.tolength/index.d.ts +++ b/lodash.tolength/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toLength } from "lodash"; export = toLength; diff --git a/lodash.tolower/index.d.ts b/lodash.tolower/index.d.ts index 1f350ff005..1403cc4cee 100644 --- a/lodash.tolower/index.d.ts +++ b/lodash.tolower/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toLower } from "lodash"; export = toLower; diff --git a/lodash.tonumber/index.d.ts b/lodash.tonumber/index.d.ts index fd6fe57a0b..aeacc96956 100644 --- a/lodash.tonumber/index.d.ts +++ b/lodash.tonumber/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toNumber } from "lodash"; export = toNumber; diff --git a/lodash.topairs/index.d.ts b/lodash.topairs/index.d.ts index 0623631aac..e5c92897ba 100644 --- a/lodash.topairs/index.d.ts +++ b/lodash.topairs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toPairs } from "lodash"; export = toPairs; diff --git a/lodash.topairsin/index.d.ts b/lodash.topairsin/index.d.ts index 6da8aac997..c4980bf227 100644 --- a/lodash.topairsin/index.d.ts +++ b/lodash.topairsin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toPairsIn } from "lodash"; export = toPairsIn; diff --git a/lodash.topath/index.d.ts b/lodash.topath/index.d.ts index ed9ce7c5a9..5647cbca88 100644 --- a/lodash.topath/index.d.ts +++ b/lodash.topath/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toPath } from "lodash"; export = toPath; diff --git a/lodash.toplainobject/index.d.ts b/lodash.toplainobject/index.d.ts index c1b5793d7d..27de1990bd 100644 --- a/lodash.toplainobject/index.d.ts +++ b/lodash.toplainobject/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toPlainObject } from "lodash"; export = toPlainObject; diff --git a/lodash.tosafeinteger/index.d.ts b/lodash.tosafeinteger/index.d.ts index b126b0188a..c8d7567a70 100644 --- a/lodash.tosafeinteger/index.d.ts +++ b/lodash.tosafeinteger/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toSafeInteger } from "lodash"; export = toSafeInteger; diff --git a/lodash.tostring/index.d.ts b/lodash.tostring/index.d.ts index bf9ed55be9..42f59393f1 100644 --- a/lodash.tostring/index.d.ts +++ b/lodash.tostring/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toString } from "lodash"; export = toString; diff --git a/lodash.toupper/index.d.ts b/lodash.toupper/index.d.ts index 9e26f50c2b..02bef92ae3 100644 --- a/lodash.toupper/index.d.ts +++ b/lodash.toupper/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { toUpper } from "lodash"; export = toUpper; diff --git a/lodash.transform/index.d.ts b/lodash.transform/index.d.ts index 78c4bfdb7c..ac5ee501cf 100644 --- a/lodash.transform/index.d.ts +++ b/lodash.transform/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { transform } from "lodash"; export = transform; diff --git a/lodash.trim/index.d.ts b/lodash.trim/index.d.ts index 4848a6ddbd..7aa6fcc4e6 100644 --- a/lodash.trim/index.d.ts +++ b/lodash.trim/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { trim } from "lodash"; export = trim; diff --git a/lodash.trimend/index.d.ts b/lodash.trimend/index.d.ts index 116f295b06..1e871b2126 100644 --- a/lodash.trimend/index.d.ts +++ b/lodash.trimend/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { trimEnd } from "lodash"; export = trimEnd; diff --git a/lodash.trimstart/index.d.ts b/lodash.trimstart/index.d.ts index 93df2c2483..c525bf5c8e 100644 --- a/lodash.trimstart/index.d.ts +++ b/lodash.trimstart/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { trimStart } from "lodash"; export = trimStart; diff --git a/lodash.truncate/index.d.ts b/lodash.truncate/index.d.ts index b658478894..cb421e8a26 100644 --- a/lodash.truncate/index.d.ts +++ b/lodash.truncate/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { truncate } from "lodash"; export = truncate; diff --git a/lodash.unary/index.d.ts b/lodash.unary/index.d.ts index 55c5e46f1d..12a281f507 100644 --- a/lodash.unary/index.d.ts +++ b/lodash.unary/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unary } from "lodash"; export = unary; diff --git a/lodash.unescape/index.d.ts b/lodash.unescape/index.d.ts index c78fecec34..8340900768 100644 --- a/lodash.unescape/index.d.ts +++ b/lodash.unescape/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unescape } from "lodash"; export = unescape; diff --git a/lodash.union/index.d.ts b/lodash.union/index.d.ts index 386967dec1..cddbaf12aa 100644 --- a/lodash.union/index.d.ts +++ b/lodash.union/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { union } from "lodash"; export = union; diff --git a/lodash.unionby/index.d.ts b/lodash.unionby/index.d.ts index dc0c0f1245..9c64ce9ed8 100644 --- a/lodash.unionby/index.d.ts +++ b/lodash.unionby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unionBy } from "lodash"; export = unionBy; diff --git a/lodash.unionwith/index.d.ts b/lodash.unionwith/index.d.ts index da2cae278a..a3757085ba 100644 --- a/lodash.unionwith/index.d.ts +++ b/lodash.unionwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unionWith } from "lodash"; export = unionWith; diff --git a/lodash.uniq/index.d.ts b/lodash.uniq/index.d.ts index 675b710028..a274db1b67 100644 --- a/lodash.uniq/index.d.ts +++ b/lodash.uniq/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { uniq } from "lodash"; export = uniq; diff --git a/lodash.uniqby/index.d.ts b/lodash.uniqby/index.d.ts index 0eedfb6d3f..c6dcd7c0c1 100644 --- a/lodash.uniqby/index.d.ts +++ b/lodash.uniqby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { uniqBy } from "lodash"; export = uniqBy; diff --git a/lodash.uniqueid/index.d.ts b/lodash.uniqueid/index.d.ts index abd2ebf55c..046d62d775 100644 --- a/lodash.uniqueid/index.d.ts +++ b/lodash.uniqueid/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { uniqueId } from "lodash"; export = uniqueId; diff --git a/lodash.uniqwith/index.d.ts b/lodash.uniqwith/index.d.ts index 6541b4ef03..515bcc2cba 100644 --- a/lodash.uniqwith/index.d.ts +++ b/lodash.uniqwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { uniqWith } from "lodash"; export = uniqWith; diff --git a/lodash.unset/index.d.ts b/lodash.unset/index.d.ts index dcf8e6881a..7662c3fd56 100644 --- a/lodash.unset/index.d.ts +++ b/lodash.unset/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unset } from "lodash"; export = unset; diff --git a/lodash.unzip/index.d.ts b/lodash.unzip/index.d.ts index 6fe3ebc759..60adfd32e9 100644 --- a/lodash.unzip/index.d.ts +++ b/lodash.unzip/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unzip } from "lodash"; export = unzip; diff --git a/lodash.unzipwith/index.d.ts b/lodash.unzipwith/index.d.ts index 64f86e45e7..641d1c1468 100644 --- a/lodash.unzipwith/index.d.ts +++ b/lodash.unzipwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { unzipWith } from "lodash"; export = unzipWith; diff --git a/lodash.update/index.d.ts b/lodash.update/index.d.ts index 27c5499aeb..f861786fd0 100644 --- a/lodash.update/index.d.ts +++ b/lodash.update/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { update } from "lodash"; export = update; diff --git a/lodash.uppercase/index.d.ts b/lodash.uppercase/index.d.ts index 82e3f7af39..152bf80399 100644 --- a/lodash.uppercase/index.d.ts +++ b/lodash.uppercase/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { upperCase } from "lodash"; export = upperCase; diff --git a/lodash.upperfirst/index.d.ts b/lodash.upperfirst/index.d.ts index 27cfc0bdc2..b76d75f8b6 100644 --- a/lodash.upperfirst/index.d.ts +++ b/lodash.upperfirst/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { upperFirst } from "lodash"; export = upperFirst; diff --git a/lodash.values/index.d.ts b/lodash.values/index.d.ts index 633dbed76d..ff22e7ef36 100644 --- a/lodash.values/index.d.ts +++ b/lodash.values/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { values } from "lodash"; export = values; diff --git a/lodash.valuesin/index.d.ts b/lodash.valuesin/index.d.ts index 1cca8a411d..9137156620 100644 --- a/lodash.valuesin/index.d.ts +++ b/lodash.valuesin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { valuesIn } from "lodash"; export = valuesIn; diff --git a/lodash.without/index.d.ts b/lodash.without/index.d.ts index 41a55ad642..88cea94b79 100644 --- a/lodash.without/index.d.ts +++ b/lodash.without/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { without } from "lodash"; export = without; diff --git a/lodash.words/index.d.ts b/lodash.words/index.d.ts index 6b886a190f..8076cee94f 100644 --- a/lodash.words/index.d.ts +++ b/lodash.words/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { words } from "lodash"; export = words; diff --git a/lodash.wrap/index.d.ts b/lodash.wrap/index.d.ts index 18ee43f769..ef1e41cb4c 100644 --- a/lodash.wrap/index.d.ts +++ b/lodash.wrap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { wrap } from "lodash"; export = wrap; diff --git a/lodash.xor/index.d.ts b/lodash.xor/index.d.ts index 6a641cd153..819ad96d72 100644 --- a/lodash.xor/index.d.ts +++ b/lodash.xor/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { xor } from "lodash"; export = xor; diff --git a/lodash.xorby/index.d.ts b/lodash.xorby/index.d.ts index 49ef941467..a60b78d049 100644 --- a/lodash.xorby/index.d.ts +++ b/lodash.xorby/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { xorBy } from "lodash"; export = xorBy; diff --git a/lodash.xorwith/index.d.ts b/lodash.xorwith/index.d.ts index 30b53691f9..ccf6499b89 100644 --- a/lodash.xorwith/index.d.ts +++ b/lodash.xorwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { xorWith } from "lodash"; export = xorWith; diff --git a/lodash.zip/index.d.ts b/lodash.zip/index.d.ts index f4793f82ae..278d7a7cff 100644 --- a/lodash.zip/index.d.ts +++ b/lodash.zip/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { zip } from "lodash"; export = zip; diff --git a/lodash.zipobject/index.d.ts b/lodash.zipobject/index.d.ts index df8d4929f9..63e4661ff6 100644 --- a/lodash.zipobject/index.d.ts +++ b/lodash.zipobject/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { zipObject } from "lodash"; export = zipObject; diff --git a/lodash.zipwith/index.d.ts b/lodash.zipwith/index.d.ts index e5b4a6714a..93c417ca57 100644 --- a/lodash.zipwith/index.d.ts +++ b/lodash.zipwith/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { zipWith } from "lodash"; export = zipWith; diff --git a/lodash/index.d.ts b/lodash/index.d.ts index 678e0c58b9..00de563bbb 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -2,6 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /** ### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) @@ -68,7 +69,7 @@ added 23 array methods: - [x] _.xorBy - [x] _.xorWith -added 18 lang methods: +added 20 lang methods: - [x] _.cloneDeepWith - [x] _.cloneWith - [x] _.eq @@ -87,6 +88,8 @@ added 18 lang methods: - [x] _.toNumber - [x] _.toSafeInteger - [x] _.toString +- [X] _.conforms +- [X] _.conformsTo added 13 object methods: - [x] _.assignIn @@ -225,7 +228,6 @@ Methods: - [ ] _.split - [ ] _.cond -- [ ] _.conforms - [ ] _.nthArg - [ ] _.over - [ ] _.overEvery @@ -241,7 +243,10 @@ export as namespace _; declare var _: _.LoDashStatic; +type PartialObject = Partial; + declare namespace _ { + type Many = T | T[]; interface LoDashStatic { @@ -6558,9 +6563,9 @@ declare namespace _ { /** * @see _.every */ - every( + every( collection: List|Dictionary|NumericDictionary, - predicate?: TObject + predicate?: PartialObject ): boolean; } @@ -6582,8 +6587,8 @@ declare namespace _ { /** * @see _.every */ - every( - predicate?: TObject + every( + predicate?: PartialObject ): boolean; } @@ -6605,8 +6610,8 @@ declare namespace _ { /** * @see _.every */ - every( - predicate?: TObject + every( + predicate?: PartialObject ): boolean; } @@ -6628,8 +6633,8 @@ declare namespace _ { /** * @see _.every */ - every( - predicate?: TObject + every( + predicate?: PartialObject ): LoDashExplicitWrapper; } @@ -6651,8 +6656,8 @@ declare namespace _ { /** * @see _.every */ - every( - predicate?: TObject + every( + predicate?: PartialObject ): LoDashExplicitWrapper; } @@ -6708,9 +6713,9 @@ declare namespace _ { /** * @see _.filter */ - filter( + filter( collection: List|Dictionary, - predicate: W + predicate: PartialObject ): T[]; } @@ -6741,7 +6746,7 @@ declare namespace _ { /** * @see _.filter */ - filter(predicate: W): LoDashImplicitArrayWrapper; + filter(predicate: PartialObject): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { @@ -6762,7 +6767,7 @@ declare namespace _ { /** * @see _.filter */ - filter(predicate: W): LoDashImplicitArrayWrapper; + filter(predicate: PartialObject): LoDashImplicitArrayWrapper; } interface LoDashExplicitWrapper { @@ -6792,7 +6797,7 @@ declare namespace _ { /** * @see _.filter */ - filter(predicate: W): LoDashExplicitArrayWrapper; + filter(predicate: PartialObject): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { @@ -6813,7 +6818,7 @@ declare namespace _ { /** * @see _.filter */ - filter(predicate: W): LoDashExplicitArrayWrapper; + filter(predicate: PartialObject): LoDashExplicitArrayWrapper; } //_.find @@ -6863,9 +6868,9 @@ declare namespace _ { /** * @see _.find */ - find( + find( collection: List|Dictionary, - predicate?: TObject, + predicate?: PartialObject, fromIndex?: number ): T|undefined; } @@ -6890,8 +6895,8 @@ declare namespace _ { /** * @see _.find */ - find( - predicate?: TObject, + find( + predicate?: PartialObject, fromIndex?: number ): T|undefined; } @@ -6916,8 +6921,8 @@ declare namespace _ { /** * @see _.find */ - find( - predicate?: TObject, + find( + predicate?: PartialObject, fromIndex?: number ): TResult|undefined; } @@ -9204,9 +9209,9 @@ declare namespace _ { /** * @see _.some */ - some( + some( collection: List|Dictionary|NumericDictionary, - predicate?: TObject + predicate?: PartialObject ): boolean; /** @@ -9214,15 +9219,15 @@ declare namespace _ { */ some( collection: List|Dictionary|NumericDictionary, - predicate?: Object + predicate?: PartialObject ): boolean; /** * @see _.some */ - some( + some( collection: Object, - predicate?: TObject + predicate?: PartialObject ): boolean; } @@ -9244,8 +9249,8 @@ declare namespace _ { /** * @see _.some */ - some( - predicate?: TObject + some( + predicate?: PartialObject ): boolean; } @@ -9267,8 +9272,8 @@ declare namespace _ { /** * @see _.some */ - some( - predicate?: TObject + some( + predicate?: PartialObject ): boolean; } @@ -9290,8 +9295,8 @@ declare namespace _ { /** * @see _.some */ - some( - predicate?: TObject + some( + predicate?: PartialObject ): LoDashExplicitWrapper; } @@ -9313,8 +9318,8 @@ declare namespace _ { /** * @see _.some */ - some( - predicate?: TObject + some( + predicate?: PartialObject ): LoDashExplicitWrapper; } @@ -11432,6 +11437,33 @@ declare namespace _ { ): LoDashExplicitObjectWrapper; } + /** + * An object containing predicate functions for each property of T + */ + type ConformsPredicateObject = { + [P in keyof T]: (val: T[P]) => boolean; + }; + + //_.conforms + interface LoDashStatic { + /** + * Creates a function that invokes the predicate properties of `source` with the corresponding + * property values of a given object, returning true if all predicates return truthy, else false. + */ + conforms(source: ConformsPredicateObject): (Target: T) => boolean; + } + + //_.conformsTo + interface LoDashStatic { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + conformsTo(object: T, source: ConformsPredicateObject): boolean; + } + //_.eq interface LoDashStatic { /** diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c1a5ca3e64..7d4105df70 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3530,49 +3530,49 @@ namespace TestEvery { result = _.every(array, listIterator); result = _.every(array, 'a'); result = _.every(array, ['a', 42]); - result = _.every<{a: number}, SampleObject>(array, {a: 42}); + result = _.every(array, {a: 42}); result = _.every(list); result = _.every(list, listIterator); result = _.every(list, 'a'); result = _.every(list, ['a', 42]); - result = _.every<{a: number}, SampleObject>(list, {a: 42}); + result = _.every(list, {a: 42}); result = _.every(dictionary); result = _.every(dictionary, dictionaryIterator); result = _.every(dictionary, 'a'); result = _.every(dictionary, ['a', 42]); - result = _.every<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.every(dictionary, {a: 42}); result = _.every(numericDictionary); result = _.every(numericDictionary, numericDictionaryIterator); result = _.every(numericDictionary, 'a'); result = _.every(numericDictionary, ['a', 42]); - result = _.every<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.every(numericDictionary, {a: 42}); result = _(array).every(); result = _(array).every(listIterator); result = _(array).every('a'); result = _(array).every(['a', 42]); - result = _(array).every<{a: number}>({a: 42}); + result = _(array).every({a: 42}); result = _(list).every(); result = _(list).every(listIterator); result = _(list).every('a'); result = _(list).every(['a', 42]); - result = _(list).every<{a: number}>({a: 42}); + result = _(list).every({a: 42}); result = _(dictionary).every(); result = _(dictionary).every(dictionaryIterator); result = _(dictionary).every('a'); result = _(dictionary).every(['a', 42]); - result = _(dictionary).every<{a: number}>({a: 42}); + result = _(dictionary).every({a: 42}); result = _(numericDictionary).every(); result = _(numericDictionary).every(numericDictionaryIterator); result = _(numericDictionary).every('a'); result = _(numericDictionary).every(['a', 42]); - result = _(numericDictionary).every<{a: number}>({a: 42}); + result = _(numericDictionary).every({a: 42}); } { @@ -3582,19 +3582,19 @@ namespace TestEvery { result = _(array).chain().every(listIterator); result = _(array).chain().every('a'); result = _(array).chain().every(['a', 42]); - result = _(array).chain().every<{a: number}>({a: 42}); + result = _(array).chain().every({a: 42}); result = _(list).chain().every(); result = _(list).chain().every(listIterator); result = _(list).chain().every('a'); result = _(list).chain().every(['a', 42]); - result = _(list).chain().every<{a: number}>({a: 42}); + result = _(list).chain().every({a: 42}); result = _(dictionary).chain().every(); result = _(dictionary).chain().every(dictionaryIterator); result = _(dictionary).chain().every('a'); result = _(dictionary).chain().every(['a', 42]); - result = _(dictionary).chain().every<{a: number}>({a: 42}); + result = _(dictionary).chain().every({a: 42}); result = _(numericDictionary).chain().every(); result = _(numericDictionary).chain().every(numericDictionaryIterator); @@ -3625,15 +3625,15 @@ namespace TestFilter { result = _.filter(array, listIterator); result = _.filter(array, ''); - result = _.filter<{a: number}, TResult>(array, {a: 42}); + result = _.filter(array, {a: 42}); result = _.filter(list, listIterator); result = _.filter(list, ''); - result = _.filter<{a: number}, TResult>(list, {a: 42}); + result = _.filter(list, {a: 42}); result = _.filter(dictionary, dictionaryIterator); result = _.filter(dictionary, ''); - result = _.filter<{a: number}, TResult>(dictionary, {a: 42}); + result = _.filter(dictionary, {a: 42}); } { @@ -3647,15 +3647,15 @@ namespace TestFilter { result = _(array).filter(listIterator); result = _(array).filter(''); - result = _(array).filter<{a: number}>({a: 42}); + result = _(array).filter({a: 42}); result = _(list).filter(listIterator); result = _(list).filter(''); - result = _(list).filter<{a: number}, TResult>({a: 42}); + result = _(list).filter({a: 42}); result = _(dictionary).filter(dictionaryIterator); result = _(dictionary).filter(''); - result = _(dictionary).filter<{a: number}, TResult>({a: 42}); + result = _(dictionary).filter({a: 42}); } { @@ -3669,15 +3669,15 @@ namespace TestFilter { result = _(array).chain().filter(listIterator); result = _(array).chain().filter(''); - result = _(array).chain().filter<{a: number}>({a: 42}); + result = _(array).chain().filter({a: 42}); result = _(list).chain().filter(listIterator); result = _(list).chain().filter(''); - result = _(list).chain().filter<{a: number}, TResult>({a: 42}); + result = _(list).chain().filter({a: 42}); result = _(dictionary).chain().filter(dictionaryIterator); result = _(dictionary).chain().filter(''); - result = _(dictionary).chain().filter<{a: number}, TResult>({a: 42}); + result = _(dictionary).chain().filter({a: 42}); } } @@ -3697,48 +3697,48 @@ namespace TestFind { result = _.find(array, listIterator, 1); result = _.find(array, ''); result = _.find(array, '', 1); - result = _.find<{a: number}, TResult>(array, {a: 42}); - result = _.find<{a: number}, TResult>(array, {a: 42}, 1); + result = _.find(array, {a: 42}); + result = _.find(array, {a: 42}, 1); result = _.find(list); result = _.find(list, listIterator); result = _.find(list, listIterator, 1); result = _.find(list, ''); result = _.find(list, '', 1); - result = _.find<{a: number}, TResult>(list, {a: 42}); - result = _.find<{a: number}, TResult>(list, {a: 42}, 1); + result = _.find(list, {a: 42}); + result = _.find(list, {a: 42}, 1); result = _.find(dictionary); result = _.find(dictionary, dictionaryIterator); result = _.find(dictionary, dictionaryIterator, 1); result = _.find(dictionary, ''); result = _.find(dictionary, '', 1); - result = _.find<{a: number}, TResult>(dictionary, {a: 42}); - result = _.find<{a: number}, TResult>(dictionary, {a: 42}, 1); + result = _.find(dictionary, {a: 42}); + result = _.find(dictionary, {a: 42}, 1); result = _(array).find(); result = _(array).find(listIterator); result = _(array).find(listIterator, 1); result = _(array).find(''); result = _(array).find('', 1); - result = _(array).find<{a: number}>({a: 42}); - result = _(array).find<{a: number}>({a: 42}, 1); + result = _(array).find({a: 42}); + result = _(array).find({a: 42}, 1); result = _(list).find(); result = _(list).find(listIterator); result = _(list).find(listIterator, 1); result = _(list).find(''); result = _(list).find('', 1); - result = _(list).find<{a: number}, TResult>({a: 42}); - result = _(list).find<{a: number}, TResult>({a: 42}, 1); + result = _(list).find({a: 42}); + result = _(list).find({a: 42}, 1); result = _(dictionary).find(); result = _(dictionary).find(dictionaryIterator); result = _(dictionary).find(dictionaryIterator, 1); result = _(dictionary).find(''); result = _(dictionary).find('', 1); - result = _(dictionary).find<{a: number}, TResult>({a: 42}); - result = _(dictionary).find<{a: number}, TResult>({a: 42}, 1); + result = _(dictionary).find({a: 42}); + result = _(dictionary).find({a: 42}, 1); } result = _.findLast([1, 2, 3, 4], function (num) { @@ -5014,25 +5014,25 @@ namespace TestSome { result = _.some(array, listIterator); result = _.some(array, 'a'); result = _.some(array, ['a', 42]); - result = _.some<{a: number}, SampleObject>(array, {a: 42}); + result = _.some(array, {a: 42}); result = _.some(list); result = _.some(list, listIterator); result = _.some(list, 'a'); result = _.some(list, ['a', 42]); - result = _.some<{a: number}, SampleObject>(list, {a: 42}); + result = _.some(list, {a: 42}); result = _.some(dictionary); result = _.some(dictionary, dictionaryIterator); result = _.some(dictionary, 'a'); result = _.some(dictionary, ['a', 42]); - result = _.some<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.some(dictionary, {a: 42}); result = _.some(numericDictionary); result = _.some(numericDictionary, numericDictionaryIterator); result = _.some(numericDictionary, 'a'); result = _.some(numericDictionary, ['a', 42]); - result = _.some<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.some(numericDictionary, {a: 42}); result = _.some(sampleObject); result = _.some(sampleObject, objectIterator); @@ -5044,31 +5044,31 @@ namespace TestSome { result = _(array).some(listIterator); result = _(array).some('a'); result = _(array).some(['a', 42]); - result = _(array).some<{a: number}>({a: 42}); + result = _(array).some({a: 42}); result = _(list).some(); result = _(list).some(listIterator); result = _(list).some('a'); result = _(list).some(['a', 42]); - result = _(list).some<{a: number}>({a: 42}); + result = _(list).some({a: 42}); result = _(dictionary).some(); result = _(dictionary).some(dictionaryIterator); result = _(dictionary).some('a'); result = _(dictionary).some(['a', 42]); - result = _(dictionary).some<{a: number}>({a: 42}); + result = _(dictionary).some({a: 42}); result = _(numericDictionary).some(); result = _(numericDictionary).some(numericDictionaryIterator); result = _(numericDictionary).some('a'); result = _(numericDictionary).some(['a', 42]); - result = _(numericDictionary).some<{a: number}>({a: 42}); + result = _(numericDictionary).some({a: 42}); result = _(sampleObject).some(); result = _(sampleObject).some(objectIterator); result = _(sampleObject).some('a'); result = _(sampleObject).some(['a', 42]); - result = _(sampleObject).some<{a: number}>({a: 42}); + result = _(sampleObject).some({a: 42}); } { @@ -5078,31 +5078,31 @@ namespace TestSome { result = _(array).chain().some(listIterator); result = _(array).chain().some('a'); result = _(array).chain().some(['a', 42]); - result = _(array).chain().some<{a: number}>({a: 42}); + result = _(array).chain().some({a: 42}); result = _(list).chain().some(); result = _(list).chain().some(listIterator); result = _(list).chain().some('a'); result = _(list).chain().some(['a', 42]); - result = _(list).chain().some<{a: number}>({a: 42}); + result = _(list).chain().some({a: 42}); result = _(dictionary).chain().some(); result = _(dictionary).chain().some(dictionaryIterator); result = _(dictionary).chain().some('a'); result = _(dictionary).chain().some(['a', 42]); - result = _(dictionary).chain().some<{a: number}>({a: 42}); + result = _(dictionary).chain().some({a: 42}); result = _(numericDictionary).chain().some(); result = _(numericDictionary).chain().some(numericDictionaryIterator); result = _(numericDictionary).chain().some('a'); result = _(numericDictionary).chain().some(['a', 42]); - result = _(numericDictionary).chain().some<{a: number}>({a: 42}); + result = _(numericDictionary).chain().some({a: 42}); result = _(sampleObject).chain().some(); result = _(sampleObject).chain().some(objectIterator); result = _(sampleObject).chain().some('a'); result = _(sampleObject).chain().some(['a', 42]); - result = _(sampleObject).chain().some<{a: number}>({a: 42}); + result = _(sampleObject).chain().some({a: 42}); } } @@ -6488,6 +6488,18 @@ namespace TestCloneWith { } } +// _.conforms +namespace TestConforms { + let result: boolean = _.conforms({foo: (v: string) => false})({foo: "foo"}); + let result2: boolean = _.conforms({})({foo: "foo"}); +} + +// _.conformsTo +namespace TestConformsTo { + let result: boolean = _.conformsTo({foo: "foo"}, {foo: (v: string) => false}); + let result2: boolean = _.conformsTo({}, {foo: (v: string) => false}); +} + // _.eq namespace TestEq { let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; diff --git a/lodash/meanBy/index.d.ts b/lodash/meanBy/index.d.ts index 3004930ef6..e4651a4412 100644 --- a/lodash/meanBy/index.d.ts +++ b/lodash/meanBy/index.d.ts @@ -1,3 +1,2 @@ -import * as _ from "../index"; -declare const meanBy: typeof _.meanBy; -export = meanBy; +import { meanBy } from "../index"; +export = meanBy; \ No newline at end of file diff --git a/lodash/scripts/generate-modules.ts b/lodash/scripts/generate-modules.ts index 127f1f44c6..395bb7ab4d 100644 --- a/lodash/scripts/generate-modules.ts +++ b/lodash/scripts/generate-modules.ts @@ -1,16 +1,124 @@ -// Usage: ts-node generate-modules +// Usage: ts-node generate-modules.ts /// import * as fs from "fs"; +import { get, STATUS_CODES } from "http"; +import * as path from "path"; -for (const module of allModuleNames()) { - if (!fs.existsSync(module)) { - fs.mkdirSync(module); +main().catch(console.error); + +async function main() { + const all = new Set(allModuleNames()); + const notOnNpm = new Set(modulesNotOnNpm()); + for (const n of notOnNpm) { + if (!all.has(n)) { + throw new Error(n); + } + } + + for (const module of all) { + console.log(module); + + // Generate local module + const localDir = path.join("..", module); + ensureDir(localDir); + fs.writeFileSync(path.join(localDir, "index.d.ts"), `import { ${module} } from "../index";\nexport = ${module};`); + + // Generate non-local module + if (!notOnNpm.has(module)) { + const dir = path.join("..", "..", `lodash.${module.toLowerCase()}`); + ensureDir(dir); + fs.writeFileSync(path.join(dir, "index.d.ts"), await globalDefinitionText(module)); + fs.writeFileSync(path.join(dir, "tsconfig.json"), tsconfig()); + fs.writeFileSync(path.join(dir, "tslint.json"), tslint()); + } } - fs.writeFileSync(`${module}/index.d.ts`, `import { ${module} } from "../index";\nexport = ${module};`); } +function ensureDir(dir: string) { + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir); + } +} + +async function globalDefinitionText(moduleName: string): Promise { + const fullName = "lodash." + moduleName; + const url = `http://registry.npmjs.org/${fullName.toLowerCase()}`; + const npmInfo = JSON.parse(await loadString(url)); + const fullVersion = npmInfo["dist-tags"].latest; + const majorMinor = fullVersion.split(".").slice(0, 2).join("."); + + return ` +// Type definitions for ${fullName} ${majorMinor} +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { ${moduleName} } from "lodash"; +export = ${moduleName}; +`.trim() + "\n"; +} + +function tsconfig() { + return JSON.stringify({ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } + }, undefined, 4); +} + +function tslint() { + return JSON.stringify({ + "extends": "../tslint.json" + }, undefined, 4); +} + + +function loadString(url: string): Promise { + return new Promise((resolve, reject) => { + get(url, (res) => { + if (res.statusCode !== 200) { + return reject(new Error(`HTTP Error ${res.statusCode}: ${STATUS_CODES[res.statusCode || 500]} for ${url}`)) + } + let rawData = "" + res.on("data", chunk => rawData += chunk) + res.on("end", () => resolve(rawData)) + }).on("error", e => reject(e)) + }) +} + +function modulesNotOnNpm() { + return [ + "chain", + "each", + "eachRight", + "extend", + "extendWith", + "noConflict", + "runInContext", + "tap", + "thru", + ]; +} + +// Note: "fb" is not a usual module, so it is made by hand. + function allModuleNames() { return [ "add", @@ -66,7 +174,6 @@ function allModuleNames() { "every", "extend", "extendWith", - "fb", "fill", "filter", "find", diff --git a/lodash/scripts/tsconfig.json b/lodash/scripts/tsconfig.json new file mode 100644 index 0000000000..a06b8ed24f --- /dev/null +++ b/lodash/scripts/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es6", + "baseUrl": "../..", + "typeRoots": [ + "../../" + ], + "types": [] + } +} \ No newline at end of file diff --git a/mapbox-gl/index.d.ts b/mapbox-gl/index.d.ts index 360eb1ce33..2e75704dde 100644 --- a/mapbox-gl/index.d.ts +++ b/mapbox-gl/index.d.ts @@ -986,3 +986,7 @@ declare namespace mapboxgl { declare module 'mapbox-gl' { export = mapboxgl; } + +declare module 'mapbox-gl/dist/mapbox-gl' { + export = mapboxgl; +} diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index 665cdc6a24..a8504aee65 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -453,7 +453,10 @@ declare namespace __MaterialUI { var lightBaseTheme: RawTheme; var darkBaseTheme: RawTheme; - export function muiThemeable, P, S>(): (component: TComponent) => TComponent; + export function muiThemeable(): < + TComponent extends React.ComponentClass

| React.StatelessComponent

, + P extends {muiTheme?: MuiTheme} + >(component: TComponent) => TComponent; interface MuiThemeProviderProps { muiTheme?: Styles.MuiTheme; diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 04b8f0ec32..8dcc0fe07e 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -7,6 +7,7 @@ import * as React from 'react'; import {Component, PropTypes} from 'react'; import * as ReactDOM from 'react-dom'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; +import {muiThemeable} from 'material-ui/styles/muiThemeable'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import darkBaseTheme from 'material-ui/styles/baseThemes/darkBaseTheme'; import {MuiTheme} from 'material-ui/styles'; @@ -321,6 +322,35 @@ class DeepDownTheTree extends React.Component<{} & {muiTheme: MuiTheme}, {}> { } +const MuiThemeableFunction = muiThemeable()((props: {label: string, muiTheme?: MuiTheme}) => { + return ( + + Applied the Theme to functional component: {props.label}. + + ); +}); + +@muiThemeable() +class MuiThemeableClass extends React.Component<{label: string} & {muiTheme?: MuiTheme}, {}> { + render() { + return ( + + Applied the Theme to class component decorated: {this.props.label}. + + ); + } +} + +const MuiThemeableContainer = (props: {}) => ( + +

+ + +
+ +); + + // "http://www.material-ui.com/#/customization/inline-styles" const InlineStylesCheckbox = () => ( +// Definitions by: onokums , denis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// interface MetisMenuOptions { toggle?: boolean; - doubleTapToGo?: boolean; activeClass?: string; collapseClass?: string; collapseInClass?: string; collapsingClass?: string; + preventDefault?: boolean; } +type MetisMenuEvents = "show.metisMenu" | "shown.metisMenu" | "hide.metisMenu" | "hidden.metisMenu"; + interface JQuery { - metisMenu(options?: MetisMenuOptions): JQuery; + metisMenu(options?: MetisMenuOptions | "dispose"): JQuery; + on(events: MetisMenuEvents, handler: (eventObject: JQueryEventObject) => any): JQuery; } diff --git a/metismenu/metismenu-tests.ts b/metismenu/metismenu-tests.ts index b2e36f1d53..eb17270021 100644 --- a/metismenu/metismenu-tests.ts +++ b/metismenu/metismenu-tests.ts @@ -1,12 +1,28 @@ /// $('#menu').metisMenu(); + $('.metismenu').metisMenu({toggle: false}); + $('.test').metisMenu({ toggle: false, - doubleTapToGo: true, activeClass: 'active', collapseClass: 'collapse', collapseInClass: 'in', - collapsingClass: 'collapsing' + collapsingClass: 'collapsing', + preventDefault: true }); + +$('.metismenu').metisMenu('dispose'); + +$('.metismenu') + .metisMenu() + .on('show.metisMenu', function(e) { + // empty logic + }).on('shown.metisMenu', function(e) { + // empty logic + }).on('hide.metisMenu', function(e) { + // empty logic + }).on('hidden.metisMenu', function(e) { + // empty logic + }); diff --git a/mocha/index.d.ts b/mocha/index.d.ts index 41d08c685d..40210dc69d 100644 --- a/mocha/index.d.ts +++ b/mocha/index.d.ts @@ -120,6 +120,7 @@ declare namespace Mocha { interface IHookCallbackContext { skip(): void; timeout(ms: number): void; + [index: string]: any; } @@ -128,6 +129,7 @@ declare namespace Mocha { timeout(ms: number): void; retries(n: number): void; slow(ms: number): void; + [index: string]: any; } /** Partial interface for Mocha's `Runnable` class. */ diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index fc17a18221..8e8dc0d938 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -47,6 +47,8 @@ function test_it() { it('does something', () => { }); + it('does something', function () { this['sharedState'] = true; }); + it('does something', (done) => { done(); }); it.only('does something', () => { }); @@ -64,6 +66,8 @@ function test_test() { test('does something', () => { }); + test('does something', function () { this['sharedState'] = true; }); + test('does something', (done) => { done(); }); test.only('does something', () => { }); @@ -81,6 +85,8 @@ function test_specify() { specify('does something', () => { }); + specify('does something', function () { this['sharedState'] = true; }); + specify('does something', (done) => { done(); }); specify.only('does something', () => { }); @@ -97,6 +103,8 @@ function test_specify() { function test_before() { before(() => { }); + before(function () { this['sharedState'] = true; }); + before((done) => { done(); }); before("my description", () => { }); @@ -120,6 +128,17 @@ function test_setup() { string = this.currentTest.state; }); + setup(function() { + this['sharedState'] = true; + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + string = this.currentTest.state; + }); + setup(function (done) { done(); boolean = this.currentTest.async; @@ -135,6 +154,8 @@ function test_setup() { function test_after() { after(() => { }); + after(function () { this['sharedState'] = true; }); + after((done) => { done(); }); after("my description", () => { }); @@ -153,6 +174,17 @@ function test_teardown() { string = this.currentTest.state; }); + teardown(function() { + this['sharedState'] = true; + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + string = this.currentTest.state; + }); + teardown(function(done) { done(); boolean = this.currentTest.async; @@ -176,6 +208,17 @@ function test_beforeEach() { string = this.currentTest.state; }); + beforeEach(function () { + this['sharedState'] = true; + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + string = this.currentTest.state; + }); + beforeEach(function (done) { done(); boolean = this.currentTest.async; @@ -212,6 +255,8 @@ function test_beforeEach() { function test_suiteSetup() { suiteSetup(() => { }); + suiteSetup(function () { this['sharedState'] = true; }); + suiteSetup((done) => { done(); }); } @@ -226,6 +271,17 @@ function test_afterEach() { string = this.currentTest.state; }); + afterEach(function () { + this['sharedState'] = true; + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + string = this.currentTest.state; + }); + afterEach(function (done) { done(); boolean = this.currentTest.async; @@ -263,6 +319,8 @@ function test_afterEach() { function test_suiteTeardown() { suiteTeardown(() => { }); + suiteTeardown(function () { this['sharedState'] = true; }); + suiteTeardown((done) => { done(); }); } diff --git a/moment-round/index.d.ts b/moment-round/index.d.ts new file mode 100644 index 0000000000..441cec3f6f --- /dev/null +++ b/moment-round/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for moment-round 1.0 +// Project: https://github.com/WebDevTmas/moment-round +// Definitions by: Jacob Baskin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as moment from 'moment'; + +export = moment; + +declare module 'moment' { + interface Moment { + round(precision: number, key: string, direction?: 'round' | 'ceil' | 'floor'): Moment; + ceil(precision: number, key: string): Moment; + floor(precision: number, key: string): Moment; + } +} diff --git a/moment-round/moment-round-tests.ts b/moment-round/moment-round-tests.ts new file mode 100644 index 0000000000..063e3cbea4 --- /dev/null +++ b/moment-round/moment-round-tests.ts @@ -0,0 +1,8 @@ +import * as moment from 'moment'; + +var m = moment(); +m.round(5, 'seconds'); +m.ceil(3, 'minutes'); +m.floor(16, 'hours'); +m.ceil(21, 'hours'); +m.ceil(20, 'hours'); diff --git a/moment-round/package.json b/moment-round/package.json new file mode 100644 index 0000000000..4c6d24a445 --- /dev/null +++ b/moment-round/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "moment": ">=2.14.0" + } +} \ No newline at end of file diff --git a/moment-round/tsconfig.json b/moment-round/tsconfig.json new file mode 100644 index 0000000000..7054df992f --- /dev/null +++ b/moment-round/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "moment-round-tests.ts" + ] +} diff --git a/moment-round/tslint.json b/moment-round/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/moment-round/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/mongodb/index.d.ts b/mongodb/index.d.ts index bdf89c32f6..bab845a01d 100644 --- a/mongodb/index.d.ts +++ b/mongodb/index.d.ts @@ -1172,8 +1172,6 @@ export interface Cursor extends Readable { // http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#next next(): Promise; next(callback: MongoCallback): void; - //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#pipe - pipe(destination: Writable, options?: Object): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#project project(value: Object): Cursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#read @@ -1184,8 +1182,6 @@ export interface Cursor extends Readable { rewind(): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setCursorOption setCursorOption(field: string, value: Object): Cursor; - //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setEncoding - setEncoding(encoding: string): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#setReadPreference setReadPreference(readPreference: string | ReadPreference): Cursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#showRecordId @@ -1201,8 +1197,6 @@ export interface Cursor extends Readable { // http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#toArray toArray(): Promise; toArray(callback: MongoCallback): void; - //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#unpipe - unpipe(destination?: Writable): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#unshift unshift(stream: Buffer | string): void; } @@ -1260,8 +1254,6 @@ export interface AggregationCursor extends Readable { next(callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#out out(destination: string): AggregationCursor; - //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#pipe - pipe(destination: Writable, options?: Object): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#project project(document: Object): AggregationCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#read @@ -1271,16 +1263,12 @@ export interface AggregationCursor extends Readable { //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#rewind rewind(): AggregationCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#setEncoding - setEncoding(encoding: string): void; - // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#skip skip(value: number): AggregationCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#sort sort(document: Object): AggregationCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#toArray toArray(): Promise; toArray(callback: MongoCallback): void; - //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unpipe - unpipe(destination?: Writable): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unshift unshift(stream: Buffer | string): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unwind @@ -1305,21 +1293,15 @@ export interface CommandCursor extends Readable { // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#next next(): Promise; next(callback: MongoCallback): void; - //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#pipe - pipe(destination: Writable, options?: Object): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#read read(size: number): string | Buffer | void; //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#rewind rewind(): CommandCursor; - //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#setEncoding - setEncoding(encoding: string): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#setReadPreference setReadPreference(readPreference: string | ReadPreference): CommandCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#toArray toArray(): Promise; toArray(callback: MongoCallback): void; - //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#unpipe - unpipe(destination?: Writable): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#unshift unshift(stream: Buffer | string): void; } diff --git a/mongoose/index.d.ts b/mongoose/index.d.ts index 56ad48e617..2c7361a437 100644 --- a/mongoose/index.d.ts +++ b/mongoose/index.d.ts @@ -1,7 +1,8 @@ // Type definitions for Mongoose 4.7.0 // Project: http://mongoosejs.com/ -// Definitions by: simonxca , horiuchi +// Definitions by: simonxca , horiuchi , sindrenm // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// @@ -994,10 +995,12 @@ declare module "mongoose" { * call execPopulate(). Passing the same path a second time will overwrite * the previous path options. See Model.populate() for explaination of options. * @param path The path to populate or an options object + * @param names The properties to fetch from the populated document * @param callback When passed, population is invoked */ populate(callback: (err: any, res: this) => void): this; populate(path: string, callback?: (err: any, res: this) => void): this; + populate(path: string, names: string, callback?: (err: any, res: this) => void): this; populate(options: ModelPopulateOptions | ModelPopulateOptions[], callback?: (err: any, res: this) => void): this; /** Gets _id(s) used during population of the given path. If the path was not populated, undefined is returned. */ diff --git a/msgpack-lite/index.d.ts b/msgpack-lite/index.d.ts index 400d22b2e7..e451267dbc 100644 --- a/msgpack-lite/index.d.ts +++ b/msgpack-lite/index.d.ts @@ -1,71 +1,153 @@ -// Type definitions for msgpack-lite 0.1.20 +// Type definitions for msgpack-lite 0.1 // Project: https://github.com/kawanet/msgpack-lite -// Definitions by: Endel Dreyer +// Definitions by: Endel Dreyer , Edmund Fokschaner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare module "msgpack-lite" { - import { Transform } from "stream"; +import * as stream from 'stream'; - namespace MsgpackLite { - interface BufferOptions { codec: any; } +/** + * encode from JS Object to MessagePack + */ +export function encode(input: any, options?: EncoderOptions): Buffer; - interface Encoder { - bufferish: any; - maxBufferSize: number; - minBufferSize: number; - offset: number; - start: number; - write: (chunk: any) => void; - fetch: () => void; - flush: () => void; - push: (chunk: any) => void; - pull: () => number; - read: () => number; - reserve: (length: number) => number; - send: (buffer: Buffer) => void; - encode: (chunk: any) => void; - end: (chunk: any) => void; - } +/** + * decode from MessagePack to JS Object + */ +export function decode(input: Buffer | Uint8Array | number[], options?: DecoderOptions): any; - interface Decoder { - bufferish: any; - offset: number; - fetch: () => void; - flush: () => void; - pull: () => number; - read: () => number; - write: (chunk: any) => void; - reserve: (length: number) => number; - decode: (chunk: any) => void; - push: (chunk: any) => void; - end: (chunk: any) => void; - } +/** + * create a stream that encodes from JS Object to MessagePack + */ +export function createEncodeStream(options?: EncoderOptions & stream.TransformOptions ): EncodeStream; - interface EncodeStream extends Transform { - encoder: Encoder; - } - interface DecodeStream extends Transform { - decoder: Decoder; - } +/** + * create a stream that decodes from MessagePack (Buffer) to JS Object + */ +export function createDecodeStream(options?: DecoderOptions & stream.TransformOptions): DecodeStream; - interface Codec { - new (options?: any): Codec; - options: any; - init (): void; - addExtPacker (etype: number, Class: any, packer: (value: any) => any): void; - getExtPacker (value: any): (value: any) => any; - addExtUnpacker (etype: number, unpacker: (value: any) => any): void; - getExtUnpacker (etype: number): (value: any) => any; - } +/** + * Codecs allow for Custom Extension Types + * Register a custom extension type number to serialize/deserialize your own class instances. + * https://github.com/kawanet/msgpack-lite#custom-extension-types-codecs + * If you wish to modify the default built-in codec, you can access it at msgpack.codec.preset + */ +export function createCodec(options?: CodecOptions): Codec; - export function encode(input: any, options?: BufferOptions): any; - export function decode(input: Buffer | Uint8Array | Array, options?: BufferOptions): any; - export function createEncodeStream (): EncodeStream; - export function createDecodeStream (): DecodeStream; - export function createCodec (options?: any): Codec; - export function codec (): { preset: Codec }; - } +/** + * The default built-in codec + */ +export var codec: { + /** + * The default built-in codec + */ + preset: Codec; +}; - export = MsgpackLite; +export interface Codec { + /** + * Register a custom extension to serialize your own class instances + * + * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) + * @param Class the constructor of the type you wish to serialize + * @param packer a function that converts an instance of T to bytes + */ + addExtPacker( + etype: number, + Class: new(...args: any[]) => T, + packer: (t: T) => Buffer | Uint8Array): void; + + /** + * Register a custom extension to deserialize your own class instances + * + * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) + * @param unpacker a function that converts bytes to an instance of T + */ + addExtUnpacker(etype: number, unpacker: (data: Buffer | Uint8Array) => T): void; } + +export interface Encoder { + bufferish: any; + maxBufferSize: number; + minBufferSize: number; + offset: number; + start: number; + write: (chunk: any) => void; + fetch: () => void; + flush: () => void; + push: (chunk: any) => void; + pull: () => number; + read: () => number; + reserve: (length: number) => number; + send: (buffer: Buffer) => void; + encode: (chunk: any) => void; + end: (chunk: any) => void; +} + +export interface Decoder { + bufferish: any; + offset: number; + fetch: () => void; + flush: () => void; + pull: () => number; + read: () => number; + write: (chunk: any) => void; + reserve: (length: number) => number; + decode: (chunk: any) => void; + push: (chunk: any) => void; + end: (chunk: any) => void; +} + +export interface EncodeStream extends stream.Transform { + encoder: Encoder; +} + +export interface DecodeStream extends stream.Transform { + decoder: Decoder; +} + +export interface CodecOptions { + /** + * It includes the preset extensions for JavaScript native objects. + * @see https://github.com/kawanet/msgpack-lite#extension-types + * @default false + */ + preset?: boolean; + /** + * It runs a validation of the value before writing it into buffer. + * This is the default behavior for some old browsers which do not support ArrayBuffer object. + * @default varies + */ + safe?: boolean; + /** + * It uses raw formats instead of bin and str. + * Set true for compatibility with msgpack's old spec. + * @see https://github.com/kawanet/msgpack-lite#compatibility-mode + * @default false + */ + raw?: boolean; + /** + * It decodes msgpack's int64/uint64 formats with int64-buffer object. + * int64-buffer is a cutom integer type with 64 bits of precision instead + * of the built-in IEEE-754 53 bits. See https://github.com/kawanet/int64-buffer + * @default false + */ + int64?: boolean; + /** + * It ties msgpack's bin format with ArrayBuffer object, instead of Buffer object. + * @default false + */ + binarraybuffer?: boolean; + /** + * It returns Uint8Array object when encoding, instead of Buffer object. + */ + uint8array?: boolean; +} + +export interface EncoderOptions { + codec?: Codec; +} + +export interface DecoderOptions { + codec?: Codec; +} \ No newline at end of file diff --git a/msgpack-lite/msgpack-lite-tests.ts b/msgpack-lite/msgpack-lite-tests.ts index f6d8725754..033fde060c 100644 --- a/msgpack-lite/msgpack-lite-tests.ts +++ b/msgpack-lite/msgpack-lite-tests.ts @@ -1,5 +1,74 @@ +import * as msgpack from 'msgpack-lite'; -import * as msgpack from "msgpack-lite"; +// https://github.com/kawanet/msgpack-lite#encoding-and-decoding-messagepack +function encodingAndDecoding() { + // encode from JS Object to MessagePack (Buffer) + var buffer = msgpack.encode({"foo": "bar"}); -var encoded = msgpack.encode(""); -msgpack.decode(encoded); + // decode from MessagePack (Buffer) to JS Object + var data = msgpack.decode(buffer); // => {"foo": "bar"} +} + +// https://github.com/kawanet/msgpack-lite#writing-to-messagepack-stream +function writingToStream() { + var fs = require("fs"); + + var writeStream = fs.createWriteStream("test.msp"); + var encodeStream = msgpack.createEncodeStream(); + encodeStream.pipe(writeStream); + + // send multiple objects to stream + encodeStream.write({foo: "bar"}); + encodeStream.write({baz: "qux"}); + + // call this once you're done writing to the stream. + encodeStream.end(); +} + +// https://github.com/kawanet/msgpack-lite#reading-from-messagepack-stream +function readingFromStream() { + var fs = require("fs"); + + var readStream = fs.createReadStream("test.msp"); + var decodeStream = msgpack.createDecodeStream(); + + // show multiple objects decoded from stream + readStream.pipe(decodeStream).on("data", console.warn); +} + +// https://github.com/kawanet/msgpack-lite#decoding-messagepack-bytes-array +function decodingBytesArray() { + // decode() accepts Buffer instance per default + msgpack.decode(new Buffer([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72])); + + // decode() also accepts Array instance + msgpack.decode([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72]); + + // decode() accepts raw Uint8Array instance as well + msgpack.decode(new Uint8Array([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72])); +} + +// https://github.com/kawanet/msgpack-lite#custom-extension-types-codecs +function customExtensionTypes() { + var codec = msgpack.createCodec(); + codec.addExtPacker(0x3F, MyVector, myVectorPacker); + codec.addExtUnpacker(0x3F, myVectorUnpacker); + + var data = new MyVector(1, 2); + var encoded = msgpack.encode(data, {codec: codec}); + var decoded = msgpack.decode(encoded, {codec: codec}); + + class MyVector { + constructor(public x: number, public y: number) {} + } + + function myVectorPacker(vector: MyVector) { + var array = [vector.x, vector.y]; + return msgpack.encode(array); // return Buffer serialized + } + + function myVectorUnpacker(buffer: Buffer | Uint8Array): MyVector { + var array = msgpack.decode(buffer); + return new MyVector(array[0], array[1]); // return Object deserialized + } +} diff --git a/msgpack-lite/tsconfig.json b/msgpack-lite/tsconfig.json index 9a06c485e9..2547929f61 100644 --- a/msgpack-lite/tsconfig.json +++ b/msgpack-lite/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/msgpack-lite/tslint.json b/msgpack-lite/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/msgpack-lite/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/multer/index.d.ts b/multer/index.d.ts index 2437f498db..53fdcd7add 100644 --- a/multer/index.d.ts +++ b/multer/index.d.ts @@ -48,22 +48,22 @@ declare namespace multer { /** A function used to determine within which folder the uploaded files should be stored. Defaults to the system's default temporary directory. */ destination?: string | ((req: Express.Request, file: Express.Multer.File, callback: (error: Error, destination: string) => void) => void); /** A function used to determine what the file should be named inside the folder. Defaults to a random name with no file extension. */ - filename?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, filename: string) => void) => void; + filename?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error | null, filename: string) => void) => void; } interface Instance { - /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ - single(): express.RequestHandler; - /** Accept a single file with the name fieldname. The single file will be stored in req.file. */ - single(fieldame: string): express.RequestHandler; - /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ - array(): express.RequestHandler; - /** Accept an array of files, all with the name fieldname. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ - array(fieldame: string, maxCount?: number): express.RequestHandler; - /** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */ - fields(fields: Field[]): express.RequestHandler; - /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ - any(): express.RequestHandler; + /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ + single(): express.RequestHandler; + /** Accept a single file with the name fieldname. The single file will be stored in req.file. */ + single(fieldame: string): express.RequestHandler; + /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ + array(): express.RequestHandler; + /** Accept an array of files, all with the name fieldname. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ + array(fieldame: string, maxCount?: number): express.RequestHandler; + /** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */ + fields(fields: Field[]): express.RequestHandler; + /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ + any(): express.RequestHandler; } } diff --git a/needle/index.d.ts b/needle/index.d.ts index 7607fdfc78..8cc61f2a2f 100644 --- a/needle/index.d.ts +++ b/needle/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for needle 0.7.8 +// Type definitions for needle 1.4 // Project: https://github.com/tomas/needle -// Definitions by: San Chen +// Definitions by: San Chen , Niklas Mollenhauer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -8,85 +8,111 @@ declare module "needle" { import * as http from 'http'; import * as Buffer from 'buffer'; - module Needle { + import * as https from 'https'; + namespace Needle { interface NeedleResponse extends http.IncomingMessage { body: any; raw: Buffer; bytes: number; } - interface ReadableStream extends NodeJS.ReadableStream { + type ReadableStream = NodeJS.ReadableStream; + + type NeedleCallback = (error: Error, response: NeedleResponse, body: any) => void; + + interface Cookies { + [name: string]: any; } - interface Callback { - (error: Error, response: NeedleResponse, body: any): void; - } + type NeedleOptions = RequestOptions & ResponseOptions & RedirectOptions & https.RequestOptions; interface RequestOptions { + open_timeout?: number; + read_timeout?: number; + /** + * Alias for open_timeout + */ timeout?: number; - follow?: number; + follow_max?: number; + /** + * Alias for follow_max + */ + follow?: number; + multipart?: boolean; + agent?: http.Agent | boolean; proxy?: string; - agent?: string; - headers?: Object; - auth?: string; // auto | digest | basic (default) + headers?: {}; + auth?: "auto" | "digest" | "basic"; json?: boolean; // These properties are overwritten by those in the 'headers' field + cookies?: Cookies; compressed?: boolean; - cookies?: { [name: string]: any; }; // Overwritten if present in the URI username?: string; password?: string; + accept?: string; + connection?: string; + user_agent?: string; } interface ResponseOptions { + decode_response?: boolean; + /** + * Alias for decode_response + */ decode?: boolean; + parse_response?: boolean; + /** + * Alias for parse_response + */ parse?: boolean; - output?: any; + + parse_cookies?: boolean; + output?: string; } - interface TLSOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: any; - rejectUnauthorized?: boolean; - secureProtocol?: any; + interface RedirectOptions { + follow_set_cookie?: boolean; + follow_set_referer?: boolean; + follow_keep_method?: boolean; + follow_if_same_host?: boolean; + follow_if_same_protocol?: boolean; } + interface KeyValue { + [key: string]: any; + } + + type BodyData = Buffer | KeyValue | NodeJS.ReadableStream | string | null; + interface NeedleStatic { - defaults(options?: any): void; + defaults(options: NeedleOptions): void; - head(url: string): ReadableStream; - head(url: string, callback?: Callback): ReadableStream; - head(url: string, options?: RequestOptions, callback?: Callback): ReadableStream; + head(url: string, callback?: NeedleCallback): ReadableStream; + head(url: string, options?: NeedleOptions, callback?: NeedleCallback): ReadableStream; - get(url: string): ReadableStream; - get(url: string, callback?: Callback): ReadableStream; - get(url: string, options?: RequestOptions, callback?: Callback): ReadableStream; + get(url: string, callback?: NeedleCallback): ReadableStream; + get(url: string, options?: NeedleOptions, callback?: NeedleCallback): ReadableStream; - post(url: string, data: any): ReadableStream; - post(url: string, data: any, callback?: Callback): ReadableStream; - post(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + post(url: string, data: BodyData, callback?: NeedleCallback): ReadableStream; + post(url: string, data: BodyData, options?: NeedleOptions, callback?: NeedleCallback): ReadableStream; - put(url: string, data: any): ReadableStream; - put(url: string, data: any, callback?: Callback): ReadableStream; - put(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + put(url: string, data: BodyData, callback?: NeedleCallback): ReadableStream; + put(url: string, data: BodyData, options?: NeedleOptions, callback?: NeedleCallback): ReadableStream; - delete(url: string, data: any): ReadableStream; - delete(url: string, data: any, callback?: Callback): ReadableStream; - delete(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + patch(url: string, data: BodyData, callback?: NeedleCallback): ReadableStream; + patch(url: string, data: BodyData, options?: NeedleOptions, callback?: NeedleCallback): ReadableStream; - request(method: string, url: string, data: any): ReadableStream; - request(method: string, url: string, data: any, callback?: Callback): ReadableStream; - request(method: string, url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream; + delete(url: string, data: BodyData, callback?: NeedleCallback): ReadableStream; + delete(url: string, data: BodyData, options?: NeedleOptions, callback ?: NeedleCallback): ReadableStream; + + request(method: string, url: string, data: BodyData, callback?: NeedleCallback): ReadableStream; + request(method: string, url: string, data: BodyData, options?: NeedleOptions, callback?: NeedleCallback): ReadableStream; } } - - var needle: Needle.NeedleStatic; + const needle: Needle.NeedleStatic; export = needle; -} \ No newline at end of file +} diff --git a/needle/needle-tests.ts b/needle/needle-tests.ts index 3df14952c3..1c5090027a 100644 --- a/needle/needle-tests.ts +++ b/needle/needle-tests.ts @@ -1,4 +1,5 @@ -import needle = require("needle"); +import * as needle from "needle"; +import * as fs from "fs"; function Usage() { // using callback @@ -14,7 +15,7 @@ function Usage() { function ResponsePipeline() { needle.get('http://stackoverflow.com/feeds', { compressed: true }, function (err, resp) { - console.log(resp.body); // this little guy won't be a Gzipped binary blob + console.log(resp.body); // this little guy won't be a Gzipped binary blob // but a nice object containing all the latest entries }); @@ -24,21 +25,26 @@ function ResponsePipeline() { rejectUnauthorized: true }; - // in this case, we'll ask Needle to follow redirects (disabled by default), + // in this case, we'll ask Needle to follow redirects (disabled by default), // but also to verify their SSL certificates when connecting. var stream = needle.get('https://backend.server.com/everything.html', options); stream.on('readable', function () { var data: any; - while (data = this.read()) { + while (data = stream.read()) { console.log(data.toString()); } }); + + stream.on('end', function(err: any) { + // if our request had an error, our 'end' event will tell us. + if (!err) console.log('Great success!'); + }) } function API_head() { var options = { - timeout: 5000 // if we don't get a response in 5 seconds, boom. + open_timeout: 5000 // if we don't get a response in 5 seconds, boom. }; needle.head('https://my.backend.server.com', function (err, resp) { @@ -93,14 +99,131 @@ function API_delete() { } function API_request() { - var data = { + var params = { q: 'a very smart query', page: 2, - format: 'json' }; - needle.request('get', 'forum.com/search', data, function (err, resp) { + needle.request('get', 'forum.com/search', params, function (err, resp) { if (!err && resp.statusCode == 200) console.log(resp.body); // here you go, mister. }); + + needle.request('get', 'forum.com/search', params, { json: true }, function(err, resp) { + if (resp.statusCode == 200) console.log('It worked!'); + }); +} + +function HttpGetWithBasicAuth() { + needle.get('https://api.server.com', { username: 'you', password: 'secret' }, function(err, resp) { + // used HTTP auth + }); + needle.get('https://username:password@api.server.com', function(err, resp) { + // used HTTP auth from URL + }); +} + +function DigestAuth() { + needle.get('other.server.com', { username: 'you', password: 'secret', auth: 'digest' }, function(err, resp, body) { + // needle prepends 'http://' to your URL, if missing + }); +} + +function CustomAcceptHeaderDeflate() { + var options = { + compressed: true, + follow: 10, + accept: 'application/vnd.github.full+json' + } + + needle.get('api.github.com/users/tomas', options, function(err, resp, body) { + // body will contain a JSON.parse(d) object + // if parsing fails, you'll simply get the original body + }); + +} + +function Various() { + + needle.get('https://news.ycombinator.com/rss', function(err, resp, body) { + // if xml2js is installed, you'll get a nice object containing the nodes in the RSS + }); + needle.get('http://upload.server.com/tux.png', { output: '/tmp/tux.png' }, function(err, resp, body) { + // you can dump any response to a file, not only binaries. + }); + needle.get('http://search.npmjs.org', { proxy: 'http://localhost:1234' }, function(err, resp, body) { + // request passed through proxy + }); + const stream1 = needle.get('http://www.as35662.net/100.log'); + stream1.on('readable', function() { + let chunk: any; + while (chunk = stream1.read()) { + console.log('got data: ', chunk); + } + }); + const stream2 = needle.get('http://jsonplaceholder.typicode.com/db', { parse: true }); + stream2.on('readable', function() { + let node: any; + + // our stream2 will only emit a single JSON root node. + while (node = stream2.read()) { + console.log('got data: ', node); + } + }); + + /* + // Sample omitted, no JSONStream + needle.get('http://jsonplaceholder.typicode.com/db', { parse: true }) + .pipe(new JSONStream.parse('posts.*.title')) + .on('data', function (obj) { + console.log('got post title: %s', obj); + }); + */ +} + +function FileUpload() { + var data = { + foo: 'bar', + image: { file: '/home/tomas/linux.png', content_type: 'image/png' } + }; + + needle.post('http://my.other.app.com', data, { multipart: true }, function(err, resp, body) { + // needle will read the file and include it in the form-data as binary + }); + needle.put('https://api.app.com/v2', fs.createReadStream('myfile.txt'), function(err, resp, body) { + // stream content is uploaded verbatim + }); +} + +function Multipart() { + var buffer = fs.readFileSync('/path/to/package.zip'); + + var data = { + zip_file: { + buffer: buffer, + filename: 'mypackage.zip', + content_type: 'application/octet-stream' + } + } + + needle.post('http://somewhere.com/over/the/rainbow', data, { multipart: true }, function(err, resp, body) { + // if you see, when using buffers we need to pass the filename for the multipart body. + // you can also pass a filename when using the file path method, in case you want to override + // the default filename to be received on the other end. + }); +} + +function MultipartContentType() { + var data = { + token: 'verysecret', + payload: { + value: JSON.stringify({ title: 'test', version: 1 }), + content_type: 'application/json' + } + } + + needle.post('http://test.com/', data, { timeout: 5000, multipart: true }, function(err, resp, body) { + // in this case, if the request takes more than 5 seconds + // the callback will return a [Socket closed] error + }); } diff --git a/needle/tsconfig.json b/needle/tsconfig.json index 5af602dd4f..59f9b2b49e 100644 --- a/needle/tsconfig.json +++ b/needle/tsconfig.json @@ -5,8 +5,8 @@ "es6" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "needle-tests.ts" ] -} \ No newline at end of file +} diff --git a/needle/v0/index.d.ts b/needle/v0/index.d.ts new file mode 100644 index 0000000000..28b5b8119f --- /dev/null +++ b/needle/v0/index.d.ts @@ -0,0 +1,83 @@ +// Type definitions for needle 0.7 +// Project: https://github.com/tomas/needle +// Definitions by: San Chen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "needle" { + import * as http from 'http'; + import * as Buffer from 'buffer'; + namespace Needle { + interface NeedleResponse extends http.IncomingMessage { + body: any; + raw: Buffer; + bytes: number; + } + + type ReadableStream = NodeJS.ReadableStream; + + type NeedleCallback = (error: Error, response: NeedleResponse, body: any) => void; + + interface RequestOptions { + timeout?: number; + follow?: number; + follow_max?: number; + multipart?: boolean; + proxy?: string; + agent?: string; + headers?: {}; + auth?: string; // auto | digest | basic (default) + json?: boolean; + + // These properties are overwritten by those in the 'headers' field + compressed?: boolean; + cookies?: { [name: string]: any; }; + // Overwritten if present in the URI + username?: string; + password?: string; + } + + interface ResponseOptions { + decode?: boolean; + parse?: boolean; + output?: any; + } + + interface TLSOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: any; + rejectUnauthorized?: boolean; + secureProtocol?: any; + } + + interface NeedleStatic { + defaults(options?: any): void; + + head(url: string, callback?: NeedleCallback): ReadableStream; + head(url: string, options?: RequestOptions, callback?: NeedleCallback): ReadableStream; + + get(url: string, callback?: NeedleCallback): ReadableStream; + get(url: string, options?: RequestOptions, callback?: NeedleCallback): ReadableStream; + + post(url: string, data: any, callback?: NeedleCallback): ReadableStream; + post(url: string, data: any, options?: RequestOptions, callback?: NeedleCallback): ReadableStream; + + put(url: string, data: any, callback?: NeedleCallback): ReadableStream; + put(url: string, data: any, options?: RequestOptions, callback?: NeedleCallback): ReadableStream; + + delete(url: string, data: any, callback?: NeedleCallback): ReadableStream; + delete(url: string, data: any, options?: RequestOptions, callback?: NeedleCallback): ReadableStream; + + request(method: string, url: string, data: any, callback?: NeedleCallback): ReadableStream; + request(method: string, url: string, data: any, options?: RequestOptions, callback?: NeedleCallback): ReadableStream; + } + } + + var needle: Needle.NeedleStatic; + export = needle; +} diff --git a/needle/v0/needle-tests.ts b/needle/v0/needle-tests.ts new file mode 100644 index 0000000000..5a849ec204 --- /dev/null +++ b/needle/v0/needle-tests.ts @@ -0,0 +1,106 @@ +import needle = require("needle"); + +function Usage() { + // using callback + needle.get('http://ifconfig.me/all.json', function (error, response) { + if (!error) + console.log(response.body.ip_addr); // JSON decoding magic. :) + }); + + // using streams + var out: any; // = fs.createWriteStream('logo.png'); + needle.get('https://google.com/images/logo.png').pipe(out); +} + +function ResponsePipeline() { + needle.get('http://stackoverflow.com/feeds', { compressed: true }, function (err, resp) { + console.log(resp.body); // this little guy won't be a Gzipped binary blob + // but a nice object containing all the latest entries + }); + + var options = { + compressed: true, + follow: 5, + rejectUnauthorized: true + }; + + // in this case, we'll ask Needle to follow redirects (disabled by default), + // but also to verify their SSL certificates when connecting. + var stream = needle.get('https://backend.server.com/everything.html', options); + + stream.on('readable', function () { + var data: any; + while (data = stream.read()) { + console.log(data.toString()); + } + }); +} + +function API_head() { + var options = { + timeout: 5000 // if we don't get a response in 5 seconds, boom. + }; + + needle.head('https://my.backend.server.com', function (err, resp) { + if (err) { + console.log('Shoot! Something is wrong: ' + err.message); + } + else { + console.log('Yup, still alive.'); + } + }); +} + +function API_get() { + needle.get('google.com/search?q=syd+barrett', function (err, resp) { + // if no http:// is found, Needle will automagically prepend it. + }); +} + +function API_post() { + var options = { + headers: { 'X-Custom-Header': 'Bumbaway atuna' } + }; + + needle.post('https://my.app.com/endpoint', 'foo=bar', options, function (err, resp) { + // you can pass params as a string or as an object. + }); +} + +function API_put() { + var nested = { + params: { + are: { + also: 'supported' + } + } + }; + + needle.put('https://api.app.com/v2', nested, function (err, resp) { + console.log('Got ' + resp.bytes + ' bytes.') // another nice treat from this handsome fella. + }); +} + +function API_delete() { + var options = { + username: 'fidelio', + password: 'x' + }; + + needle.delete('https://api.app.com/messages/123', null, options, function (err, resp) { + // in this case, data may be null, but you need to explicity pass it. + }); +} + +function API_request() { + var data = { + q: 'a very smart query', + page: 2, + format: 'json' + }; + + needle.request('get', 'forum.com/search', data, function (err, resp) { + if (!err && resp.statusCode == 200) + console.log(resp.body); // here you go, mister. + }); +} diff --git a/needle/v0/tsconfig.json b/needle/v0/tsconfig.json new file mode 100644 index 0000000000..44c8b59654 --- /dev/null +++ b/needle/v0/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../../" + ], + "paths": { + "needle": [ + "needle/v0" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "needle-tests.ts" + ] +} diff --git a/ngstorage/index.d.ts b/ngstorage/index.d.ts index b8fcf023c8..15fb3c0481 100644 --- a/ngstorage/index.d.ts +++ b/ngstorage/index.d.ts @@ -1,29 +1,25 @@ -// Type definitions for ngstorage 0.3.10 +// Type definitions for ngstorage 0.3.11 // Project: https://github.com/gsklee/ngStorage // Definitions by: Jakub Pistek // Definitions: https://github.com/kubiq/DefinitelyTyped -import * as angular from 'angular'; +declare module 'ngstorage' { -declare module 'angular' { - export namespace storage { + interface IStorageService { + $default(items: {}): IStorageService; + $reset(items?: {}): IStorageService; + $apply(): void; + $sync(): void; + get(key: string): T; + } - export interface IStorageService { - $default(items: {}): IStorageService; - $reset(items?: {}): IStorageService; - $apply(): void; - $sync(): void; - get(key: string): T; - } + interface IStorageProvider extends angular.IServiceProvider { - export interface IStorageProvider extends angular.IServiceProvider { + get(key: string): T; + set(key: string, value: T): T; - get(key: string): T; - set(key: string, value: T): T; - - setKeyPrefix(prefix: string): void; - setSerializer(serializer: (value: any) => string): void; - setDeserializer(deserializer: (value: string) => any): void; - } + setKeyPrefix(prefix: string): void; + setSerializer(serializer: (value: any) => string): void; + setDeserializer(deserializer: (value: string) => any): void; } } diff --git a/ngstorage/ngstorage-tests.ts b/ngstorage/ngstorage-tests.ts index 924d017a66..abddf19bb7 100644 --- a/ngstorage/ngstorage-tests.ts +++ b/ngstorage/ngstorage-tests.ts @@ -1,9 +1,9 @@ -/// +/// +import {IStorageService, IStorageProvider} from "ngstorage"; var app: any; - -app.controller('LocalCtrl', function ($localStorage: angular.storage.IStorageService) { +app.controller('LocalCtrl', function ($localStorage: IStorageService) { $localStorage.$default({ counter: 1 @@ -12,15 +12,15 @@ app.controller('LocalCtrl', function ($localStorage: angular.storage.IStorageSer $localStorage.$reset({ counter: 1 }); - + $localStorage.$reset(); $localStorage.$apply(); - + $localStorage.$sync(); }); -app.controller('SessionCtrl', function ($sessionStorage: angular.storage.IStorageService) { +app.controller('SessionCtrl', function ($sessionStorage: IStorageService) { $sessionStorage.$default({ counter: 1 @@ -29,50 +29,50 @@ app.controller('SessionCtrl', function ($sessionStorage: angular.storage.IStorag $sessionStorage.$reset({ counter: 1 }); - + $sessionStorage.$reset(); $sessionStorage.$apply(); - + $sessionStorage.$sync(); }); -app.config(['$localStorageProvider', function ($localStorageProvider: angular.storage.IStorageProvider) { +app.config(['$localStorageProvider', function ($localStorageProvider: IStorageProvider) { - $localStorageProvider.setKeyPrefix('NewPrefix'); + $localStorageProvider.setKeyPrefix('NewPrefix'); - $localStorageProvider.get('MyKey'); + $localStorageProvider.get('MyKey'); - $localStorageProvider.set('MyKey', { counter: 'value' }); + $localStorageProvider.set('MyKey', {counter: 'value'}); - var mySerializer = function (value:any):string { - return value.toString(); - }; + var mySerializer = function (value: any): string { + return value.toString(); + }; - var myDeserializer = function (value:string):any { - return value; - }; + var myDeserializer = function (value: string): any { + return value; + }; - $localStorageProvider.setSerializer(mySerializer); - $localStorageProvider.setDeserializer(myDeserializer); - } -]).config(['$sessionStorageProvider', function ($sessionStorageProvider: angular.storage.IStorageProvider) { + $localStorageProvider.setSerializer(mySerializer); + $localStorageProvider.setDeserializer(myDeserializer); +} +]).config(['$sessionStorageProvider', function ($sessionStorageProvider: IStorageProvider) { - $sessionStorageProvider.setKeyPrefix('NewPrefix'); + $sessionStorageProvider.setKeyPrefix('NewPrefix'); - $sessionStorageProvider.get('MyKey'); + $sessionStorageProvider.get('MyKey'); - $sessionStorageProvider.set('MyKey', { counter: 'value' }); + $sessionStorageProvider.set('MyKey', {counter: 'value'}); - var mySerializer = function (value:any):string { - return value.toString(); - }; + var mySerializer = function (value: any): string { + return value.toString(); + }; - var myDeserializer = function (value:string):any { - return value; - }; + var myDeserializer = function (value: string): any { + return value; + }; - $sessionStorageProvider.setSerializer(mySerializer); - $sessionStorageProvider.setDeserializer(myDeserializer); - } + $sessionStorageProvider.setSerializer(mySerializer); + $sessionStorageProvider.setDeserializer(myDeserializer); +} ]); diff --git a/ngstorage/tsconfig.json b/ngstorage/tsconfig.json index 691875db20..a3cdb4a204 100644 --- a/ngstorage/tsconfig.json +++ b/ngstorage/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "ngstorage-tests.ts" ] -} \ No newline at end of file +} diff --git a/node-waves/index.d.ts b/node-waves/index.d.ts new file mode 100644 index 0000000000..ce5c63da2e --- /dev/null +++ b/node-waves/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for node-waves 0.7 +// Project: http://fian.my.id/Waves +// Definitions by: Stephen Lautier +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type ElementTarget = string | Element | Element[]; + +export interface WavesConfig { + /** + * Determines how long the waves effect duration (in milliseconds). + * + */ + duration?: number; + + /** + * Delay amount to show waves effect on touch and hide the effect if user scrolls. + * Set to 0 to disable delay (in milliseconds). + * + */ + delay?: number; +} + +export interface RippleOptions { + + /** + * Specify how long to wait between starting and stopping the ripple. + * + */ + wait?: number | null; + + /** + * Specify the position inside the element. + * + */ + position?: { + x: number; + y: number; + } | null; +} + +/** + * Initializes waves with an optional config. + */ +export function init(config?: WavesConfig): void; + +/** + * Attach ripple effect by adding `.waves-effect` to HTML element. + * Make sure you call `init` to activate the ripple. + * + * @param {ElementTarget} elements elements to target. + * @param {(string | string[])} [classes] classes to add. + */ +export function attach(elements: ElementTarget, classes?: string | string[]): void; + +/** + * Creates a ripple effect in HTML element programmatically. + * @param {ElementTarget} elements elements to target (must have `.waves-effect` already applied, ideally via `attach`). + * @param {RippleOptions} [options] specify how long to wait between starting and stopping the ripple, and it's position inside the element. + */ +export function ripple(elements: ElementTarget, options?: RippleOptions): void; + +/** + * Removes all ripples from inside an element immediately. + * + * @param {ElementTarget} elements elements to remove ripples from. + */ +export function calm(elements: ElementTarget): void; diff --git a/node-waves/node-waves-tests.ts b/node-waves/node-waves-tests.ts new file mode 100644 index 0000000000..adfb59703a --- /dev/null +++ b/node-waves/node-waves-tests.ts @@ -0,0 +1,10 @@ + +import { init, ripple, attach, calm } from "node-waves"; + +init({ delay: 300 }); + +attach("button", "waves-light"); + +ripple(".box", { wait: null }); + +calm(".box"); diff --git a/node-waves/tsconfig.json b/node-waves/tsconfig.json new file mode 100644 index 0000000000..c069824144 --- /dev/null +++ b/node-waves/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-waves-tests.ts" + ] +} diff --git a/node-waves/tslint.json b/node-waves/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/node-waves/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/node-zookeeper-client/index.d.ts b/node-zookeeper-client/index.d.ts new file mode 100644 index 0000000000..227ebd45ad --- /dev/null +++ b/node-zookeeper-client/index.d.ts @@ -0,0 +1,169 @@ +// Type definitions for node-zookeeper-client 0.2 +// Project: https://github.com/alexguan/node-zookeeper-client +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +import * as EventEmitter from "events"; + +export class Id { + scheme: string; + id: string; + constructor(scheme: string, id: string); +} + +export class ACL { + perms: number; + id: Id; + constructor(perms: number, id: Id); +} + +export const Permission: { + READ: number, + WRITE: number, + CREATE: number, + DELETE: number, + ADMIN: number, + ALL: number, +}; + +export interface Stat { + czxid: number; + mzxid: number; + ctime: number; + mtime: number; + version: number; + cversion: number; + aversion: number; + ephemeralOwner: number; + dataLength: number; + numChildren: number; + pzxid: number; +} + +export class State { + static DISCONNECTED: State; + static SYNC_CONNECTED: State; + static AUTH_FAILED: State; + static CONNECTED_READ_ONLY: State; + static SASL_AUTHENTICATED: State; + static EXPIRED: State; + + name: string; + code: number; + constructor(name: string, code: number); + toString(): string; +} + +export class Event { + static NODE_CREATED: number; + static NODE_DELETED: number; + static NODE_DATA_CHANGED: number; + static NODE_CHILDREN_CHANGED: number; + type: string; + name: string; + path: string; + constructor(type: string, name: string, path: string); + toString(): string; + getType(): string; + getName(): string; + getPath(): string; +} + +interface Transaction { + create(path: string, dataOrAclsOrmode1?: Buffer | ACL[] | number, dataOrAclsOrmode2?: Buffer | ACL[] | number, dataOrAclsOrmode3?: Buffer | ACL[] | number): this; + setData(path: string, data: Buffer | null, version?: number): this; + check(path: string, version?: number): this; + remove(path: string, version?: number): this; + commit(callback: (error: Error | Exception, results: any) => void): void; +} + +interface Client extends EventEmitter { + connect(): void; + close(): void; + create(path: string, callback: (error: Error | Exception, path: string) => void): void; + create(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + create(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + create(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, dataOrAclsOrmode3: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + remove(path: string, callback: (error: Error | Exception) => void): void; + remove(path: string, version: number, callback: (error: Error | Exception) => void): void; + exists(path: string, callback: (error: Error | Exception, stat: Stat) => void): void; + exists(path: string, watcher: (event: Event) => void, callback: (error: Error | Exception, stat: Stat) => void): void; + getChildren(path: string, callback: (error: Error | Exception, children: string[], stat: Stat) => void): void; + getChildren(path: string, watcher: (event: Event) => void, callback: (error: Error | Exception, children: string[], stat: Stat) => void): void; + getData(path: string, callback: (error: Error | Exception, data: Buffer, stat: Stat) => void): void; + getData(path: string, watcher: (event: Event) => void, callback: (error: Error | Exception, data: Buffer, stat: Stat) => void): void; + setData(path: string, data: Buffer | null, callback: (error: Error | Exception, stat: Stat) => void): void; + setData(path: string, data: Buffer | null, version: number, callback: (error: Error | Exception, stat: Stat) => void): void; + getACL(path: string, callback: (error: Error | Exception, acls: ACL[], stat: Stat) => void): void; + setACL(path: string, acls: ACL[], callback: (error: Error | Exception, stat: Stat) => void): void; + setACL(path: string, acls: ACL[], version: number, callback: (error: Error | Exception, stat: Stat) => void): void; + transaction(): Transaction; + mkdirp(path: string, callback: (error: Error | Exception, path: string) => void): void; + mkdirp(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + mkdirp(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + mkdirp(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, dataOrAclsOrmode3: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + addAuthInfo(scheme: string, auth: Buffer): void; + getState(): State; + getSessionId(): Buffer; + getSessionPassword(): Buffer; + getSessionTimeout(): number; + + on(event: "state", cb: (state: State) => void): this; + on(event: "connected" | "connectedReadOnly" | "disconnected" | "expired" | "authenticationFailed" | string, cb: () => void): this; + + once(event: "state", cb: (state: State) => void): this; + once(event: "connected" | "connectedReadOnly" | "disconnected" | "expired" | "authenticationFailed" | string, cb: () => void): this; + + addListener(event: "state", cb: (state: State) => void): this; + addListener(event: "connected" | "connectedReadOnly" | "disconnected" | "expired" | "authenticationFailed" | string, cb: () => void): this; +} + +export interface Option { + sessionTimeout: number; + spinDelay: number; + retries: number; +} + +export function createClient(connectionString: string, options?: Partial