diff --git a/types/angular-mocks/angular-mocks-tests.ts b/types/angular-mocks/angular-mocks-tests.ts index cabbf7c578..f04c9a2a30 100644 --- a/types/angular-mocks/angular-mocks-tests.ts +++ b/types/angular-mocks/angular-mocks-tests.ts @@ -1,70 +1,91 @@ - /////////////////////////////////////// // IAngularStatic /////////////////////////////////////// -var angular: ng.IAngularStatic; -var mock: ng.IMockStatic; +let angular: ng.IAngularStatic; +let mock: ng.IMockStatic; mock = angular.mock; - /////////////////////////////////////// // IMockStatic /////////////////////////////////////// -var date: Date; +let date: Date; mock.dump({ key: 'value' }); mock.inject( - function () { return 1; }, - function () { return 2; } - ); + function() { + return 1; + }, + function() { + return 2; + } +); -mock.inject( - ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }]); +mock.inject([ + '$rootScope', + function($rootScope: ng.IRootScopeService) { + return 1; + } +]); // This overload is not documented on the website, but flows from // how the injector works. mock.inject( - ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }], - ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 2; }]); + [ + '$rootScope', + function($rootScope: ng.IRootScopeService) { + return 1; + } + ], + [ + '$rootScope', + function($rootScope: ng.IRootScopeService) { + return 2; + } + ] +); mock.module('module1', 'module2'); mock.module( - function () { return 1; }, - function () { return 2; } - ); -mock.module({ module1: function () { return 1; } }); + function() { + return 1; + }, + function() { + return 2; + } +); +mock.module({ + module1: () => { + return 1; + } +}); mock.module.sharedInjector(); date = mock.TzDate(-7, '2013-1-1T15:00:00Z'); date = mock.TzDate(-8, 12345678); - /////////////////////////////////////// // IExceptionHandlerProvider /////////////////////////////////////// -var exceptionHandlerProvider: ng.IExceptionHandlerProvider; +let exceptionHandlerProvider: ng.IExceptionHandlerProvider; exceptionHandlerProvider.mode('log'); - /////////////////////////////////////// // ITimeoutService /////////////////////////////////////// -var timeoutService: ng.ITimeoutService; +let timeoutService: ng.ITimeoutService; timeoutService.flush(); timeoutService.flush(1234); -timeoutService.flushNext(); -timeoutService.flushNext(1234); timeoutService.verifyNoPendingTasks(); //////////////////////////////////////// // IIntervalService //////////////////////////////////////// -var intervalService: ng.IIntervalService; -var intervalServiceTimeActuallyAdvanced: number; +let intervalService: ng.IIntervalService; +let intervalServiceTimeActuallyAdvanced: number; intervalServiceTimeActuallyAdvanced = intervalService.flush(); intervalServiceTimeActuallyAdvanced = intervalService.flush(1234); @@ -72,9 +93,9 @@ intervalServiceTimeActuallyAdvanced = intervalService.flush(1234); /////////////////////////////////////// // ILogService, ILogCall /////////////////////////////////////// -var logService: ng.ILogService; -var logCall: ng.ILogCall; -var logs: string[]; +let logService: ng.ILogService; +let logCall: ng.ILogCall; +let logs: string[]; logService.assertEmpty(); logService.reset(); @@ -90,29 +111,31 @@ logs = logCall.logs; /////////////////////////////////////// // ControllerService mock /////////////////////////////////////// -var $controller: ng.IControllerService; -$controller(class TestController {}, {}, {myBinding: 'works!'}); -$controller(function TestController() {}, {someLocal: 42}, {myBinding: 'works!'}); -$controller('TestController', {}, {myBinding: 'works!'}); - +let $controller: ng.IControllerService; +$controller(class TestController {}, {}, { myBinding: 'works!' }); +$controller(function TestController() {}, { someLocal: 42 }, { myBinding: 'works!' }); +$controller('TestController', {}, { myBinding: 'works!' }); /////////////////////////////////////// // IComponentControllerService /////////////////////////////////////// -var $componentController: ng.IComponentControllerService; -$componentController<{}, {}>('Test controller', { $scope: {} }); -$componentController<{}, {}>('Test controller', { $scope: {}, test: true }); -$componentController<{}, { test: boolean }>('Test controller', { $scope: {} }, { test: true}); -$componentController<{}, { test?: boolean }>('Test controller', { $scope: {} }, {}); -$componentController<{}, {}>('Test controller', { $scope: {} }, {}, 'identity'); -$componentController<{ cb: () => void }, {}>('Test controller', { $scope: {} }); -$componentController<{}, { test: {name: string} }>('Test controller', { test: {name: 'Test Local'} }); +let $componentController: ng.IComponentControllerService; +let $scope: ng.IScope; +$componentController<{}, {}>('Test controller', { $scope }); +$componentController<{}, {}>('Test controller', { $scope, test: true }); +$componentController<{}, { test: boolean }>('Test controller', { $scope }, { test: true }); +$componentController<{}, { test?: boolean }>('Test controller', { $scope }, {}); +$componentController<{}, {}>('Test controller', { $scope }, {}, 'identity'); +$componentController<{ cb: () => void }, {}>('Test controller', { $scope }); +$componentController<{}, { test: { name: string } }>('Test controller', { + test: { name: 'Test Local' } +}); /////////////////////////////////////// // IHttpBackendService /////////////////////////////////////// -var httpBackendService: ng.IHttpBackendService; -var requestHandler: ng.mock.IRequestHandler; +let httpBackendService: ng.IHttpBackendService; +let requestHandler: ng.mock.IRequestHandler; httpBackendService.flush(); httpBackendService.flush(1234); @@ -123,342 +146,1362 @@ httpBackendService.verifyNoOutstandingRequest(); requestHandler = httpBackendService.expect('GET', 'http://test.local'); requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data'); -requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { + header: 'value' +}); +requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function( + headers: object +): boolean { + return true; +}); requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/); -requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.expect('GET', 'http://test.local', function( + data: string +): boolean { + return true; +}); +requestHandler = httpBackendService.expect( + 'GET', + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + 'http://test.local', + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + } +); requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect( + 'GET', + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function( + headers: object +): boolean { + return true; +}); requestHandler = httpBackendService.expect('GET', /test.local/); requestHandler = httpBackendService.expect('GET', /test.local/, 'response data'); -requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']); +requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { + header: 'value' +}); +requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.expect( + 'GET', + /test.local\/(\d+)/, + 'response data', + function(headers: object): boolean { + return true; + }, + ['id'] +); requestHandler = httpBackendService.expect('GET', /test.local/, /response data/); -requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']); -requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']); +requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.expect( + 'GET', + /test.local\/(\d+)/, + /response data/, + function(headers: object): boolean { + return true; + }, + ['id'] +); +requestHandler = httpBackendService.expect('GET', /test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.expect( + 'GET', + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + /test.local/, + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.expect( + 'GET', + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + }, + ['id'] +); requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect( + 'GET', + /test.local/, + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.expect( + 'GET', + /test.local\/(\d+)/, + { key: 'value' }, + function(headers: object): boolean { + return true; + }, + ['id'] +); +requestHandler = httpBackendService.expect('GET', (url: string) => { + return true; +}); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + 'response data' +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + 'response data', + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + /response data/ +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + /response data/, + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.expect( + 'GET', + (url: string) => { + return true; + }, + { key: 'value' }, + function(headers: object): boolean { + return true; + } +); requestHandler = httpBackendService.expectDELETE('http://test.local'); requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' }); requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' }); requestHandler = httpBackendService.expectDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectDELETE((url: string) => { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectDELETE( + (url: string) => { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectGET('http://test.local'); requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' }); requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' }); requestHandler = httpBackendService.expectGET(/test.local\/(\d+)/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectGET((url: string) => { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectGET( + (url: string) => { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectHEAD('http://test.local'); requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' }); requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' }); requestHandler = httpBackendService.expectHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectHEAD((url: string) => { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectHEAD( + (url: string) => { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectJSONP('http://test.local'); requestHandler = httpBackendService.expectJSONP(/test.local/); requestHandler = httpBackendService.expectJSONP(/test.local\/(\d+)/, ['id']); -requestHandler = httpBackendService.expectJSONP((url: string) => { return true; }); +requestHandler = httpBackendService.expectJSONP((url: string) => { + return true; +}); requestHandler = httpBackendService.expectPATCH('http://test.local'); requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data'); -requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { + header: 'value' +}); requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/); -requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.expectPATCH('http://test.local', function( + data: string +): boolean { + return true; +}); +requestHandler = httpBackendService.expectPATCH( + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH( + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.expectPATCH(/test.local/); requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data'); requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); +requestHandler = httpBackendService.expectPATCH( + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/); requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']); +requestHandler = httpBackendService.expectPATCH(/test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.expectPATCH( + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expectPATCH( + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH( + /test.local/, + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.expectPATCH( + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.expectPATCH((url: string) => { + return true; +}); +requestHandler = httpBackendService.expectPATCH((url: string) => { + return true; +}, 'response data'); +requestHandler = httpBackendService.expectPATCH( + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.expectPATCH((url: string) => { + return true; +}, /response data/); +requestHandler = httpBackendService.expectPATCH( + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.expectPATCH( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.expectPATCH( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expectPATCH( + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.expectPATCH( + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.expectPOST('http://test.local'); requestHandler = httpBackendService.expectPOST('http://test.local', 'response data'); -requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { + header: 'value' +}); requestHandler = httpBackendService.expectPOST('http://test.local', /response data/); -requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.expectPOST('http://test.local', function( + data: string +): boolean { + return true; +}); +requestHandler = httpBackendService.expectPOST( + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST( + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.expectPOST(/test.local/); requestHandler = httpBackendService.expectPOST(/test.local/, 'response data'); requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); +requestHandler = httpBackendService.expectPOST( + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.expectPOST(/test.local/, /response data/); requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST( + /test.local\/(\d+)/, + /response data/, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.expectPOST(/test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.expectPOST( + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }); requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST( + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.expectPOST((url: string) => { + return true; +}); +requestHandler = httpBackendService.expectPOST((url: string) => { + return true; +}, 'response data'); +requestHandler = httpBackendService.expectPOST( + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.expectPOST((url: string) => { + return true; +}, /response data/); +requestHandler = httpBackendService.expectPOST( + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.expectPOST( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.expectPOST( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expectPOST( + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.expectPOST( + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.expectPUT('http://test.local'); requestHandler = httpBackendService.expectPUT('http://test.local', 'response data'); -requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { + header: 'value' +}); requestHandler = httpBackendService.expectPUT('http://test.local', /response data/); -requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.expectPUT('http://test.local', function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.expectPUT( + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPUT( + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.expectPUT(/test.local/); requestHandler = httpBackendService.expectPUT(/test.local/, 'response data'); requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); +requestHandler = httpBackendService.expectPUT( + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.expectPUT(/test.local/, /response data/); requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']); +requestHandler = httpBackendService.expectPUT( + /test.local\/(\d+)/, + /response data/, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.expectPUT(/test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.expectPUT( + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expectPUT( + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }); requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPUT( + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.expectPUT((url: string) => { + return true; +}); +requestHandler = httpBackendService.expectPUT((url: string) => { + return true; +}, 'response data'); +requestHandler = httpBackendService.expectPUT( + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.expectPUT((url: string) => { + return true; +}, /response data/); +requestHandler = httpBackendService.expectPUT( + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.expectPUT( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.expectPUT( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.expectPUT( + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.expectPUT( + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.when('GET', 'http://test.local'); requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data'); -requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { + header: 'value' +}); +requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function( + headers: object +): boolean { + return true; +}); requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/); -requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.when('GET', 'http://test.local', function( + data: string +): boolean { + return true; +}); +requestHandler = httpBackendService.when( + 'GET', + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + 'http://test.local', + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + } +); requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when( + 'GET', + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function( + headers: object +): boolean { + return true; +}); requestHandler = httpBackendService.when('GET', /test.local/); requestHandler = httpBackendService.when('GET', /test.local/, 'response data'); requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); -requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + 'response data', + function(headers: object): boolean { + return true; + }, + ['id'] +); requestHandler = httpBackendService.when('GET', /test.local/, /response data/); requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']); -requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + /response data/, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + /response data/, + function(headers: object): boolean { + return true; + }, + ['id'] +); +requestHandler = httpBackendService.when('GET', /test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.when( + 'GET', + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.when( + 'GET', + /test.local/, + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + }, + ['id'] +); requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when( + 'GET', + /test.local/, + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function( + headers: object +): boolean { + return true; +}); +requestHandler = httpBackendService.when( + 'GET', + /test.local\/(\d+)/, + { key: 'value' }, + function(headers: object): boolean { + return true; + }, + ['id'] +); +requestHandler = httpBackendService.when('GET', (url: string) => { + return true; +}); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + 'response data' +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + 'response data', + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + /response data/ +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + /response data/, + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + function(headers: object): boolean { + return true; + } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); +requestHandler = httpBackendService.when( + 'GET', + (url: string) => { + return true; + }, + { key: 'value' }, + function(headers: object): boolean { + return true; + } +); requestHandler = httpBackendService.whenDELETE('http://test.local'); requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' }); requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' }); requestHandler = httpBackendService.whenDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenDELETE((url: string) => { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenDELETE( + (url: string) => { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.whenGET('http://test.local'); requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' }); requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' }); requestHandler = httpBackendService.whenGET(/test.local\/(\d+)/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenGET((url: string) => { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenGET( + (url: string) => { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.whenHEAD('http://test.local'); requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' }); requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' }); requestHandler = httpBackendService.whenHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenHEAD((url: string) => { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenHEAD( + (url: string) => { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.whenJSONP('http://test.local'); requestHandler = httpBackendService.whenJSONP(/test.local/); requestHandler = httpBackendService.whenJSONP(/test.local\/(\d+)/, ['id']); -requestHandler = httpBackendService.whenJSONP((url: string) => { return true; }); +requestHandler = httpBackendService.whenJSONP((url: string) => { + return true; +}); requestHandler = httpBackendService.whenPATCH('http://test.local'); requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data'); -requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { + header: 'value' +}); requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/); -requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.whenPATCH('http://test.local', function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.whenPATCH( + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH( + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.whenPATCH(/test.local/); requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data'); requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); +requestHandler = httpBackendService.whenPATCH( + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/); requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']); +requestHandler = httpBackendService.whenPATCH( + /test.local\/(\d+)/, + /response data/, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.whenPATCH(/test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.whenPATCH( + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.whenPATCH( + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }); requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH( + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.whenPATCH((url: string) => { + return true; +}); +requestHandler = httpBackendService.whenPATCH((url: string) => { + return true; +}, 'response data'); +requestHandler = httpBackendService.whenPATCH( + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.whenPATCH((url: string) => { + return true; +}, /response data/); +requestHandler = httpBackendService.whenPATCH( + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.whenPATCH( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.whenPATCH( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.whenPATCH( + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.whenPATCH( + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.whenPOST('http://test.local'); requestHandler = httpBackendService.whenPOST('http://test.local', 'response data'); -requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { + header: 'value' +}); requestHandler = httpBackendService.whenPOST('http://test.local', /response data/); -requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.whenPOST('http://test.local', function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.whenPOST( + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPOST( + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.whenPOST(/test.local/); requestHandler = httpBackendService.whenPOST(/test.local/, 'response data'); requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); +requestHandler = httpBackendService.whenPOST( + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.whenPOST(/test.local/, /response data/); requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']); +requestHandler = httpBackendService.whenPOST( + /test.local\/(\d+)/, + /response data/, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.whenPOST(/test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.whenPOST( + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.whenPOST( + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }); requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPOST( + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.whenPOST((url: string) => { + return true; +}); +requestHandler = httpBackendService.whenPOST((url: string) => { + return true; +}, 'response data'); +requestHandler = httpBackendService.whenPOST( + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.whenPOST((url: string) => { + return true; +}, /response data/); +requestHandler = httpBackendService.whenPOST( + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.whenPOST( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.whenPOST( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.whenPOST( + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.whenPOST( + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.whenPUT('http://test.local'); requestHandler = httpBackendService.whenPUT('http://test.local', 'response data'); -requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { + header: 'value' +}); requestHandler = httpBackendService.whenPUT('http://test.local', /response data/); -requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { + header: 'value' +}); +requestHandler = httpBackendService.whenPUT('http://test.local', function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.whenPUT( + 'http://test.local', + function(data: string): boolean { + return true; + }, + { header: 'value' } +); requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPUT( + 'http://test.local', + { key: 'value' }, + { header: 'value' } +); requestHandler = httpBackendService.whenPUT(/test.local/); requestHandler = httpBackendService.whenPUT(/test.local/, 'response data'); requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']); +requestHandler = httpBackendService.whenPUT( + /test.local\/(\d+)/, + 'response data', + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.whenPUT(/test.local/, /response data/); requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']); +requestHandler = httpBackendService.whenPUT( + /test.local\/(\d+)/, + /response data/, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.whenPUT(/test.local/, function(data: string): boolean { + return true; +}); +requestHandler = httpBackendService.whenPUT( + /test.local/, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.whenPUT( + /test.local\/(\d+)/, + function(data: string): boolean { + return true; + }, + { header: 'value' }, + ['id'] +); requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }); requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data'); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, /response data/); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, { key: 'value' }); -requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, { key: 'value' }, { header: 'value' }); - +requestHandler = httpBackendService.whenPUT( + /test.local\/(\d+)/, + { key: 'value' }, + { header: 'value' }, + ['id'] +); +requestHandler = httpBackendService.whenPUT((url: string) => { + return true; +}); +requestHandler = httpBackendService.whenPUT((url: string) => { + return true; +}, 'response data'); +requestHandler = httpBackendService.whenPUT( + (url: string) => { + return true; + }, + 'response data', + { header: 'value' } +); +requestHandler = httpBackendService.whenPUT((url: string) => { + return true; +}, /response data/); +requestHandler = httpBackendService.whenPUT( + (url: string) => { + return true; + }, + /response data/, + { header: 'value' } +); +requestHandler = httpBackendService.whenPUT( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + } +); +requestHandler = httpBackendService.whenPUT( + (url: string) => { + return true; + }, + function(data: string): boolean { + return true; + }, + { header: 'value' } +); +requestHandler = httpBackendService.whenPUT( + (url: string) => { + return true; + }, + { key: 'value' } +); +requestHandler = httpBackendService.whenPUT( + (url: string) => { + return true; + }, + { key: 'value' }, + { header: 'value' } +); /////////////////////////////////////// // IRequestHandler /////////////////////////////////////// -var expectedData = { key: 'value'}; +let expectedData = { key: 'value' }; requestHandler.passThrough(); requestHandler.passThrough().passThrough(); -requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']); -requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({}); -requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; }); +requestHandler.respond((method, url, data, headers) => [ + 404, + 'data', + { header: 'value' }, + 'responseText' +]); +requestHandler + .respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']) + .respond({}); +requestHandler.respond((method, url, data, headers) => { + return [404, { key: 'value' }, { header: 'value' }, 'responseText']; +}); requestHandler.respond((method, url, data, headers, params) => { - if(params.id === 1) { - return [200, { key: 'value'}, { header: 'value'}, 'responseText']; - } else { - return [404, { key: 'value' }, { header: 'value' }, 'responseText']; - } + if (params.id === '1') { + return [200, { key: 'value' }, { header: 'value' }, 'responseText']; + } else { + return [404, { key: 'value' }, { header: 'value' }, 'responseText']; + } }); requestHandler.respond('data'); requestHandler.respond('data').respond({}); @@ -471,3 +1514,7 @@ requestHandler.respond(404, 'data').respond({}); requestHandler.respond(404, { key: 'value' }); requestHandler.respond(404, { key: 'value' }, { header: 'value' }); requestHandler.respond(404, { key: 'value' }, { header: 'value' }, 'responseText'); + +browserTrigger(document.body, 'click'); +browserTrigger(angular.element(document.body), 'click'); +browserTrigger(angular.element(document.body), 'click', { which: 1, keys: ['ctrl'] }); diff --git a/types/angular-mocks/index.d.ts b/types/angular-mocks/index.d.ts index 051539e2ac..c652443eac 100644 --- a/types/angular-mocks/index.d.ts +++ b/types/angular-mocks/index.d.ts @@ -1,10 +1,9 @@ -// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5 +// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.6 // Project: http://angularjs.org // Definitions by: Diego Vilar , Tony Curtis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 -/// /// import * as angular from 'angular'; @@ -13,7 +12,6 @@ import * as angular from 'angular'; // ngMock module (angular-mocks.js) /////////////////////////////////////////////////////////////////////////////// declare module 'angular' { - /////////////////////////////////////////////////////////////////////////// // AngularStatic // We reopen it to add the MockStatic definition @@ -23,27 +21,27 @@ declare module 'angular' { } // see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject + // Depending on context, it might return a function, however having `void | (() => void)` + // as a return type seems to be not useful. E.g. it requires type assertions in `beforeEach(inject(...))`. interface IInjectStatic { - (...fns: Function[]): any; - (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works - strictDi(val?: boolean): void; + (...fns: Array void>>): any; // void | (() => void); + strictDi(val?: boolean): any; // void | (() => void); } interface IMockStatic { // see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump dump(obj: any): string; - inject: IInjectStatic + inject: IInjectStatic; // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module module: { (...modules: any[]): any; sharedInjector(): void; - } + }; // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate - TzDate(offset: number, timestamp: number): Date; - TzDate(offset: number, timestamp: string): Date; + TzDate(offset: number, timestamp: number | string): Date; } /////////////////////////////////////////////////////////////////////////// @@ -62,7 +60,6 @@ declare module 'angular' { /////////////////////////////////////////////////////////////////////////// interface ITimeoutService { flush(delay?: number): void; - flushNext(expectedDelay?: number): void; verifyNoPendingTasks(): void; } @@ -96,9 +93,11 @@ declare module 'angular' { /////////////////////////////////////////////////////////////////////////// interface IControllerService { // Although the documentation doesn't state this, locals are optional - (controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T; - (controllerConstructor: (...args: any[]) => T, locals?: any, bindings?: any): T; - (controllerName: string, locals?: any, bindings?: any): T; + ( + controllerConstructor: (new (...args: any[]) => T) | ((...args: any[]) => T) | string, + locals?: any, + bindings?: any + ): T; } /////////////////////////////////////////////////////////////////////////// @@ -108,268 +107,473 @@ declare module 'angular' { interface IComponentControllerService { // TBinding is an interface exposed by a component as per John Papa's style guide // https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top - (componentName: string, locals: { $scope?: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T; + ( + componentName: string, + locals: { $scope?: IScope; [key: string]: any }, + bindings?: TBinding, + ident?: string + ): T; } - /////////////////////////////////////////////////////////////////////////// // HttpBackendService // see https://docs.angularjs.org/api/ngMock/service/$httpBackend /////////////////////////////////////////////////////////////////////////// interface IHttpBackendService { /** - * Flushes pending requests using the trained responses. Requests are flushed in the order they were made, but it is also possible to skip one or more requests (for example to have them flushed later). This is useful for simulating scenarios where responses arrive from the server in any order. - * - * If there are no pending requests to flush when the method is called, an exception is thrown (as this is typically a sign of programming error). - * @param count Number of responses to flush. If undefined/null, all pending requests (starting after `skip`) will be flushed. - * @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_ - */ + * Flushes pending requests using the trained responses. Requests are flushed in the order they + * were made, but it is also possible to skip one or more requests (for example to have them + * flushed later). This is useful for simulating scenarios where responses arrive from the server + * in any order. + * + * If there are no pending requests to flush when the method is called, an exception is thrown (as + * this is typically a sign of programming error). + * + * @param count Number of responses to flush. If undefined/null, all pending requests (starting + * after `skip`) will be flushed. + * @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_ + */ flush(count?: number, skip?: number): void; /** - * Resets all request expectations, but preserves all backend definitions. - */ + * Resets all request expectations, but preserves all backend definitions. + */ resetExpectations(): void; /** - * 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. - */ + * 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(digest?: boolean): void; /** - * Verifies that there are no outstanding requests that need to be flushed. - */ + * Verifies that there are no outstanding requests that need to be flushed. + */ verifyNoOutstandingRequest(): void; - /** - * Creates a new request expectation. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param method HTTP method. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param method HTTP method. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expect( + method: string, + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for DELETE requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation for DELETE requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expectDELETE( + url: string | RegExp | ((url: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for GET requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation for GET requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expectGET( + url: string | RegExp | ((url: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for HEAD requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - * @param keys Array of keys to assign to regex matches in the request url. - */ + /** + * Creates a new request expectation for HEAD requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ - expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler; + expectHEAD( + url: string | RegExp | ((url: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for JSONP requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation for JSONP requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expectJSONP( + url: string | RegExp | ((url: string) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for PATCH requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation for PATCH requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expectPATCH( + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for POST requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation for POST requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expectPOST( + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new request expectation for PUT requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation for PUT requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + expectPUT( + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition. - * Returns an object with respond method that controls how a matched request is handled. - * @param method HTTP method. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new request expectation that compares only with the requested route. + * This method offers colon delimited matching of the url path, ignoring the query string. + * This allows declarations similar to how application routes are configured with `$routeProvider`. + * As this method converts the definition url to regex, declaration order is important. + * @param method HTTP method + * @param url HTTP url string that supports colon param matching + */ + expectRoute(method: string, url: string): mock.IRequestHandler; - /** - * Creates a new backend definition for DELETE requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition. + * Returns an object with respond method that controls how a matched request is handled. + * @param method HTTP method. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + when( + method: string, + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition for GET requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in request url described above - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition for DELETE requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenDELETE( + url: string | RegExp | ((url: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition for HEAD requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition for GET requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in request url described above + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenGET( + url: string | RegExp | ((url: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition for JSONP requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition for HEAD requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenHEAD( + url: string | RegExp | ((url: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition for PATCH requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition for JSONP requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenJSONP( + url: string | RegExp | ((url: string) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition for POST requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition for PATCH requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenPATCH( + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; - /** - * Creates a new backend definition for PUT requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - * @param keys Array of keys to assign to regex matches in the request url. - */ - whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; + /** + * Creates a new backend definition for POST requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true + * if the url matches the current definition. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenPOST( + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; + + /** + * Creates a new backend definition for PUT requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true + * if the url matches the current definition. + * @param data HTTP request body or function that receives data string and returns true if the data + * is as expected. + * @param headers HTTP headers or function that receives http header object and returns true if the + * headers match the current definition. + * @param keys Array of keys to assign to regex matches in the request url. + */ + whenPUT( + url: string | RegExp | ((url: string) => boolean), + data?: string | RegExp | object | ((data: string) => boolean), + headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean), + keys?: string[] + ): mock.IRequestHandler; + + /** + * Creates a new backend definition that compares only with the requested route. + * This method offers colon delimited matching of the url path, ignoring the query string. + * This allows declarations similar to how application routes are configured with `$routeProvider`. + * As this method converts the definition url to regex, declaration order is important. + * @param method HTTP method. + * @param url HTTP url string that supports colon param matching. + */ + whenRoute(method: string, url: string): mock.IRequestHandler; } /////////////////////////////////////////////////////////////////////////// // AnimateService // see https://docs.angularjs.org/api/ngMock/service/$animate /////////////////////////////////////////////////////////////////////////// - module animate { + namespace animate { interface IAnimateService { - /** - * This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks. + * This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining + * animation frames and/or callbacks. */ closeAndFlush(): void; /** - * This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see `closeAndFlush()` for that). + * This method is used to flush the pending callbacks and animation frames to either start + * an animation or conclude an animation. Note that this will not actually close an + * actively running animation (see `closeAndFlush()`} for that). */ flush(): void; } } - export module mock { - // returned interface by the the mocked HttpBackendService expect/when methods + namespace mock { + /** Object returned by the the mocked HttpBackendService expect/when methods */ interface IRequestHandler { - - /** - * Controls the response for a matched request using a function to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text. - */ - respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler; - - /** - * Controls the response for a matched request using supplied static data to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param status HTTP status code to add to the response. - * @param data Data to add to the response. - * @param headers Headers object to add to the response. - * @param responseText Response text to add to the response. - */ - respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler; - - /** - * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param data Data to add to the response. - * @param headers Headers object to add to the response. - * @param responseText Response text to add to the response. - */ - respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler; - - // Available when ngMockE2E is loaded /** - * Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.) - */ + * Controls the response for a matched request using a function to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param func Function that receives the request HTTP method, url, data, headers, and an array of keys + * to regex matches in the request url and returns an array containing response status (number), data, + * headers, and status text. + */ + respond( + func: (( + method: string, + url: string, + data: string | object, + headers: IHttpHeaders, + params: { [key: string]: string } + ) => [number, string | object, IHttpHeaders, string]) + ): IRequestHandler; + + /** + * Controls the response for a matched request using supplied static data to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param status HTTP status code to add to the response. + * @param data Data to add to the response. + * @param headers Headers object to add to the response. + * @param responseText Response text to add to the response. + */ + respond( + status: number, + data: string | object, + headers?: IHttpHeaders, + responseText?: string + ): IRequestHandler; + + /** + * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param data Data to add to the response. + * @param headers Headers object to add to the response. + * @param responseText Response text to add to the response. + */ + respond( + data: string | object, + headers?: IHttpHeaders, + responseText?: string + ): IRequestHandler; + + /** + * Any request matching a backend definition or expectation with passThrough handler will be + * passed through to the real backend (an XHR request will be made to the server.) + * Available when ngMockE2E is loaded + */ passThrough(): IRequestHandler; } + interface IHttpHeaders { + [headerName: string]: any; + } + + /** + * Contains additional event data used by the `browserTrigger` function when creating an event. + */ + interface IBrowserTriggerEventData { + /** + * [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles). + * Not applicable to all events. + */ + bubbles?: boolean; + /** + * [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable). + * Not applicable to all events. + */ + cancelable?: boolean; + /** + * [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode) + * for keyboard events (keydown, keypress, and keyup). + */ + charcode?: number; + /** + * The elapsedTime for + * [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent) + * and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent). + */ + elapsedTime?: number; + /** + * [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode) + * for keyboard events (keydown, keypress, and keyup). + */ + keycode?: number; + /** + * An array of possible modifier keys (ctrl, alt, shift, meta) for + * [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and + * keyboard events (keydown, keypress, and keyup). + */ + keys?: Array<'ctrl' | 'alt' | 'shift' | 'meta'>; + /** + * The [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget) + * for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent). + */ + relatedTarget?: Node; + /** + * [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which) + * for keyboard events (keydown, keypress, and keyup). + */ + which?: number; + /** + * x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) + * and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent). + */ + x?: number; + /** + * y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) + * and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent). + */ + y?: number; + } } } /////////////////////////////////////////////////////////////////////////////// // functions attached to global object (window) /////////////////////////////////////////////////////////////////////////////// -//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs. -//declare var module: (...modules: any[]) => any; +// Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs. +// declare var module: (...modules: any[]) => any; declare global { - export var inject: angular.IInjectStatic; + const inject: angular.IInjectStatic; + + /** + * This is a global (window) function that is only available when the `ngMock` module is included. + * It can be used to trigger a native browser event on an element, which is useful for unit testing. + * + * @param element Either a wrapped jQuery/jqLite node or a DOM element + * @param eventType Optional event type. If none is specified, the function tries to determine + * the right event type for the element, e.g. `change` for `input[text]`. + * @param eventData An optional object which contains additional event data used when creating the event. + */ + function browserTrigger( + element: JQuery | Element, + eventType?: string, + eventData?: angular.mock.IBrowserTriggerEventData + ): void; } diff --git a/types/angular-mocks/mocks.d.ts b/types/angular-mocks/mocks.d.ts index 17c077008c..e8cc13c0a8 100644 --- a/types/angular-mocks/mocks.d.ts +++ b/types/angular-mocks/mocks.d.ts @@ -1,14 +1,14 @@ declare module "angular-mocks/ngMock" { - var _: string; + const _: string; export = _; } declare module "angular-mocks/ngMockE2E" { - var _: string; + const _: string; export = _; } declare module "angular-mocks/ngAnimateMock" { - var _: string; + const _: string; export = _; -} \ No newline at end of file +} diff --git a/types/angular-mocks/tslint.json b/types/angular-mocks/tslint.json index a41bf5d19a..e91317558b 100644 --- a/types/angular-mocks/tslint.json +++ b/types/angular-mocks/tslint.json @@ -1,79 +1,10 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json", + "rules": { + "callable-types": false, + "interface-name": false, + "no-declare-current-package": false, + "no-unnecessary-generics": false, + "only-arrow-functions": false + } } diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index 47068c3481..c464c4bc3f 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -772,7 +772,7 @@ export interface VoidTypeAnnotation extends Node { export interface JSXAttribute extends Node { type: "JSXAttribute"; name: JSXIdentifier | JSXNamespacedName; - value: JSXElement | StringLiteral | JSXExpressionContainer; + value: JSXElement | StringLiteral | JSXExpressionContainer | null; } export interface JSXClosingElement extends Node { @@ -1424,7 +1424,7 @@ export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation) export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier; export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation; export function voidTypeAnnotation(): VoidTypeAnnotation; -export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute; +export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer | null): JSXAttribute; export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement; export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array, selfClosing?: boolean): JSXElement; export function jSXEmptyExpression(): JSXEmptyExpression; diff --git a/types/bardjs/index.d.ts b/types/bardjs/index.d.ts index 5f2a5a1863..f701d4c368 100644 --- a/types/bardjs/index.d.ts +++ b/types/bardjs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/wardbell/bardjs // Definitions by: Andrew Archibald // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// /// diff --git a/types/blockies/index.d.ts b/types/blockies/index.d.ts index f2de8b2c53..2a8cc526ad 100644 --- a/types/blockies/index.d.ts +++ b/types/blockies/index.d.ts @@ -3,12 +3,16 @@ // Definitions by: Leonid Logvinov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface BlockiesIcon { - toDataURL(): string; -} -interface BlockiesConfig { - seed: string; -} -declare function blockies(config: BlockiesConfig): BlockiesIcon; - +declare function blockies(config?: blockies.BlockiesConfig): HTMLCanvasElement; export = blockies; + +declare namespace blockies { + interface BlockiesConfig { + size?: number; + scale?: number; + seed?: string; + color?: string; + bgcolor?: string; + spotcolor?: string; + } +} diff --git a/types/blockies/tsconfig.json b/types/blockies/tsconfig.json index f190f0b0c9..db5851dcbb 100644 --- a/types/blockies/tsconfig.json +++ b/types/blockies/tsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictFunctionTypes": true, diff --git a/types/bootstrap/index.d.ts b/types/bootstrap/index.d.ts index 2f43555a73..bba7b71c59 100755 --- a/types/bootstrap/index.d.ts +++ b/types/bootstrap/index.d.ts @@ -354,7 +354,7 @@ export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.too // -------------------------------------------------------------------------------------- declare global { - interface JQuery extends Iterable { + interface JQuery { alert(action?: "close" | "dispose"): this; button(action: "toggle" | "dispose"): this; diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 3b0feb0113..4d30097478 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -182,7 +182,7 @@ export class ObjectID { * @param {number} time optional parameter allowing to pass in a second based timestamp. * @return {string} return the 12 byte id binary string. */ - generate(time?: number): string; + generate(time?: number): Buffer; /** * Returns the generation date (accurate up to the second) that this ID was generated. * @return {date} the generation date diff --git a/types/chai-spies/chai-spies-tests.ts b/types/chai-spies/chai-spies-tests.ts index f5247ba13f..7bc9530164 100644 --- a/types/chai-spies/chai-spies-tests.ts +++ b/types/chai-spies/chai-spies-tests.ts @@ -24,7 +24,12 @@ let array = [ 1, 2, 3 ]; chai.spy.on(array, 'push'); // or you can track multiple object's methods -chai.spy.on(array, 'push', 'pop'); +chai.spy.on(array, ['push', 'pop']); + +// or you can track multiple object's methods +chai.spy.on(array, 'push', function(item) { + array.push(item); +}); array.push(5); @@ -149,4 +154,20 @@ spy.should.not.have.been.called.above(3); expect(spy).to.have.been.called.below(3); expect(spy).to.not.have.been.called.lt(3); spy.should.have.been.called.lt(3); -spy.should.not.have.been.called.below(3); \ No newline at end of file +spy.should.not.have.been.called.below(3); + +// You can also create sandbox +let sb = chai.spy.sandbox(); + +sb.on(array, 'pop', () => { + return 1; +}) + +let one = array.pop(); +expect(one).to.equal(1); + +// Can restore methods in sandbox +sb.restore(); +array.push(2); +let two = array.pop(); +expect(two).to.equal(2); diff --git a/types/chai-spies/index.d.ts b/types/chai-spies/index.d.ts index 75f702ca37..bb37fa8cd4 100644 --- a/types/chai-spies/index.d.ts +++ b/types/chai-spies/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for chai-spies +// Type definitions for chai-spies 1.0.0 // Project: https://github.com/chaijs/chai-spies // Definitions by: Ilya Kuznetsov +// Harm van der Werf +// Jouni Suorsa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -21,7 +23,7 @@ declare namespace Chai { * ```ts * expect(spy).to.be.spy; * spy.should.be.spy; - * ``` + * ``` */ spy: Assertion; @@ -32,7 +34,7 @@ declare namespace Chai { * expect(spy).to.have.been.called(); * spy.should.have.been.called(); * ``` - * Note that ```called``` can be used as a chainable method. + * Note that ```called``` can be used as a chainable method. */ called: ChaiSpies.Called; @@ -61,7 +63,32 @@ declare namespace Chai { } declare namespace ChaiSpies { + interface Sandbox { + /** + * #### chai.spy.on (function) + * + * Wraps an object method into spy. All calls will pass through to the original function. + * + * @param {Object} object + * @param {String} methodNames names to spy on + * @param {function} fn replacement function + * @returns function to actually call + */ + on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any; + /** + * #### chai.spy.restore (function) + * + * Restores previously wrapped object's method. + * Restores all spied objects of a sandbox if called without parameters. + * + * @function + * @param {Object} [object] + * @param {String|String[]} [methods] name or names + * @return {Sandbox} Sandbox instance + */ + restore(object?: Object, methodNames?: string | string[]): void; + } interface Spy { /** * #### chai.spy (function) @@ -72,9 +99,9 @@ declare namespace ChaiSpies { * var spy = chai.spy(original) * , e_spy = chai.spy(); * ``` - * @param fn function to spy on. @default ```function () {}``` + * @param fn function to spy on. @default ```function () {}``` * @returns function to actually call - */ + */ (): SpyFunc0Proxy; (fn: SpyFunc0): SpyFunc0Proxy; (fn: SpyFunc1): SpyFunc1Proxy; @@ -107,10 +134,11 @@ declare namespace ChaiSpies { * var spy = chai.spy.on(Array, 'isArray'); * ``` * @param {Object} object - * @param {String} method name to spy on + * @param {String} method names to spy on + * @param {function} fn replacement function * @returns function to actually call - */ - on(object: Object, ...methodNames: string[]): any; + */ + on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any; /** * #### chai.spy.object (function) @@ -123,10 +151,24 @@ declare namespace ChaiSpies { * @param {String[]|Object} method names or method definitions * @returns object with spied methods */ - object(name: string, methods: string[]): any; - object(methods: string[]): any; - object(name: string, methods: T): T; - object(methods: T): T; + object(name: string, methods: string[]): any; + object(methods: string[]): any; + object(name: string, methods: T): T; + object(methods: T): T; + + /** + * #### chai.spy.restore (function) + * + * Restores spy assigned to DEFAULT sandbox + * + * Restores previously wrapped object's method. + * Restores all spied objects of a sandbox if called without parameters. + * + * @param {Object} [object] + * @param {String|String[]} [methods] name or names + * @return {Sandbox} Sandbox instance + */ + restore(object?: Object, methodNames?: string | string[]): void; /** * #### chai.spy.returns (function) @@ -141,6 +183,18 @@ declare namespace ChaiSpies { */ returns(value: T): SpyFunc0Proxy; + + /** + * ### chai.spy.sandbox + * + * Creates a sandbox. + * + * Sandbox is a set of spies. + * Sandbox allows to track methods on objects and restore original methods with on restore call. + * + * @returns {Sandbox} + */ + sandbox(): Sandbox; } interface Called { @@ -158,12 +212,12 @@ declare namespace ChaiSpies { * spy.should.not.have.been.called.once; * ``` */ - once: Chai.Assertion; + once: Chai.Assertion; /** * ####.twice * Assert that a spy has been called exactly twice. - * ```ts + * ```ts * expect(spy).to.have.been.called.twice; * expect(spy).to.not.have.been.called.twice; * spy.should.have.been.called.twice; @@ -215,7 +269,7 @@ declare namespace ChaiSpies { * ```ts * expect(spy).to.have.been.called.above(3); * spy.should.not.have.been.called.above(3); - * ``` + * ``` */ above(n: number): Chai.Assertion; @@ -225,7 +279,7 @@ declare namespace ChaiSpies { * ```ts * expect(spy).to.have.been.called.gt(3); * spy.should.not.have.been.called.gt(3); - * ``` + * ``` */ gt(n: number): Chai.Assertion; @@ -235,7 +289,7 @@ declare namespace ChaiSpies { * ```ts * expect(spy).to.have.been.called.below(3); * spy.should.not.have.been.called.below(3); - * ``` + * ``` */ below(n: number): Chai.Assertion; @@ -245,7 +299,7 @@ declare namespace ChaiSpies { * ```ts * expect(spy).to.have.been.called.lt(3); * spy.should.not.have.been.called.lt(3); - * ``` + * ``` */ lt(n: number): Chai.Assertion; } @@ -301,7 +355,7 @@ declare namespace ChaiSpies { * spy.should.have.been.called.with('foo'); * ``` * Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```. - * If used with multiple arguments, assert that a spy has been called with all the given arguments at least once. + * If used with multiple arguments, assert that a spy has been called with all the given arguments at least once. * ```ts * spy('foo', 'bar', 1); * expect(spy).to.have.been.called.with('bar', 'foo'); @@ -389,7 +443,7 @@ declare namespace ChaiSpies { * * Resets __spy object parameters for instantiation and reuse * @returns proxy spy object - */ + */ reset(): this; } @@ -397,77 +451,77 @@ declare namespace ChaiSpies { (): R; } - interface SpyFunc1 { - (a: A1): R; + interface SpyFunc1 { + (a: A1): R; } - interface SpyFunc2 { - (a: A1, b: A2): R; + interface SpyFunc2 { + (a: A1, b: A2): R; } - interface SpyFunc3 { - (a: A1, b: A2, c: A3): R; + interface SpyFunc3 { + (a: A1, b: A2, c: A3): R; } - interface SpyFunc4 { - (a: A1, b: A2, c: A3, d: A4): R; + interface SpyFunc4 { + (a: A1, b: A2, c: A3, d: A4): R; } - interface SpyFunc5 { - (a: A1, b: A2, c: A3, d: A4, e: A5): R; + interface SpyFunc5 { + (a: A1, b: A2, c: A3, d: A4, e: A5): R; } - interface SpyFunc6 { - (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R; + interface SpyFunc6 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R; } - interface SpyFunc7 { - (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R; + interface SpyFunc7 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R; } - interface SpyFunc8 { - (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R; + interface SpyFunc8 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R; } - - interface SpyFunc9 { - (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R; + + interface SpyFunc9 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R; } - - interface SpyFunc10 { - (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R; + + interface SpyFunc10 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R; } interface SpyFunc0Proxy extends SpyFunc0, Resetable { } - interface SpyFunc1Proxy extends SpyFunc1, Resetable { + interface SpyFunc1Proxy extends SpyFunc1, Resetable { } - interface SpyFunc2Proxy extends SpyFunc2, Resetable { + interface SpyFunc2Proxy extends SpyFunc2, Resetable { } - interface SpyFunc3Proxy extends SpyFunc3, Resetable { + interface SpyFunc3Proxy extends SpyFunc3, Resetable { } - interface SpyFunc4Proxy extends SpyFunc4, Resetable { + interface SpyFunc4Proxy extends SpyFunc4, Resetable { } - interface SpyFunc5Proxy extends SpyFunc5, Resetable { + interface SpyFunc5Proxy extends SpyFunc5, Resetable { } - interface SpyFunc6Proxy extends SpyFunc6, Resetable { + interface SpyFunc6Proxy extends SpyFunc6, Resetable { } - interface SpyFunc7Proxy extends SpyFunc7, Resetable { + interface SpyFunc7Proxy extends SpyFunc7, Resetable { } - interface SpyFunc8Proxy extends SpyFunc8, Resetable { + interface SpyFunc8Proxy extends SpyFunc8, Resetable { } - - interface SpyFunc9Proxy extends SpyFunc9, Resetable { + + interface SpyFunc9Proxy extends SpyFunc9, Resetable { } - - interface SpyFunc10Proxy extends SpyFunc10, Resetable { + + interface SpyFunc10Proxy extends SpyFunc10, Resetable { } } diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts index c477eedb3e..f25337f3d3 100644 --- a/types/cosmiconfig/cosmiconfig-tests.ts +++ b/types/cosmiconfig/cosmiconfig-tests.ts @@ -1,4 +1,5 @@ -import cosmiconfig, { CosmiconfigResult } from "cosmiconfig"; +import cosmiconfig = require("cosmiconfig"); +import { CosmiconfigResult } from "cosmiconfig"; import * as path from "path"; const explorer = cosmiconfig("yourModuleName", { diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts index 16ba1967f3..94e28e9dab 100644 --- a/types/cosmiconfig/index.d.ts +++ b/types/cosmiconfig/index.d.ts @@ -3,57 +3,62 @@ // Definitions by: ozum // szeck87 // saadq +// jinwoo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 /// -export interface Config { - [key: string]: any; +declare function cosmiconfig(moduleName: string, options?: cosmiconfig.ExplorerOptions): cosmiconfig.Explorer; + +declare namespace cosmiconfig { + interface Config { + [key: string]: any; + } + + type CosmiconfigResult = { + config: Config; + filepath: string; + isEmpty?: boolean; + } | null; + + interface LoaderResult { + config: Config | null; + filepath: string; + } + + type SyncLoader = (filepath: string, content: string) => Config | null; + type AsyncLoader = (filepath: string, content: string) => Config | null | Promise; + + interface LoaderEntry { + sync?: SyncLoader; + async?: AsyncLoader; + } + + interface Loaders { + [key: string]: LoaderEntry; + } + + interface Explorer { + search(searchFrom?: string): Promise; + searchSync(searchFrom?: string): null | CosmiconfigResult; + load(loadPath: string): Promise; + loadSync(loadPath: string): CosmiconfigResult; + clearLoadCache(): void; + clearSearchCache(): void; + clearCaches(): void; + } + + // These are the user options with defaults applied. + interface ExplorerOptions { + stopDir?: string; + cache?: boolean; + transform?: (result: CosmiconfigResult) => Promise | CosmiconfigResult; + packageProp?: string; + loaders?: Loaders; + searchPlaces?: string[]; + ignoreEmptySearchPlaces?: boolean; + } } -export type CosmiconfigResult = { - config: Config; - filepath: string; - isEmpty?: boolean; -} | null; - -export interface LoaderResult { - config: Config | null; - filepath: string; -} - -export type SyncLoader = (filepath: string, content: string) => Config | null; -export type AsyncLoader = (filepath: string, content: string) => Config | null | Promise; - -export interface LoaderEntry { - sync?: SyncLoader; - async?: AsyncLoader; -} - -export interface Loaders { - [key: string]: LoaderEntry; -} - -export interface Explorer { - search(searchFrom?: string): Promise; - searchSync(searchFrom?: string): null | CosmiconfigResult; - load(loadPath: string): Promise; - loadSync(loadPath: string): CosmiconfigResult; - clearLoadCache(): void; - clearSearchCache(): void; - clearCaches(): void; -} - -// These are the user options with defaults applied. -export interface ExplorerOptions { - stopDir?: string; - cache?: boolean; - transform?: (result: CosmiconfigResult) => Promise | CosmiconfigResult; - packageProp?: string; - loaders?: Loaders; - searchPlaces?: string[]; - ignoreEmptySearchPlaces?: boolean; -} - -export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer; +export = cosmiconfig; diff --git a/types/dc/dc-tests.ts b/types/dc/dc-tests.ts index 643594276d..7e1a49727e 100644 --- a/types/dc/dc-tests.ts +++ b/types/dc/dc-tests.ts @@ -1,3 +1,8 @@ +import * as CrossFilter from 'crossfilter'; +import * as d3 from "d3"; +import * as dc from "dc"; + + interface IYelpData { city: string; review_count: number; diff --git a/types/dc/index.d.ts b/types/dc/index.d.ts index 4ba0e5e4ab..9100acdc26 100644 --- a/types/dc/index.d.ts +++ b/types/dc/index.d.ts @@ -5,10 +5,6 @@ // matthias jobst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files - -/// - import * as d3 from "d3"; export = dc; diff --git a/types/decompress/decompress-tests.ts b/types/decompress/decompress-tests.ts old mode 100755 new mode 100644 diff --git a/types/decompress/index.d.ts b/types/decompress/index.d.ts old mode 100755 new mode 100644 diff --git a/types/dygraphs/index.d.ts b/types/dygraphs/index.d.ts index 4a4a9f0492..1e075d7ba9 100644 --- a/types/dygraphs/index.d.ts +++ b/types/dygraphs/index.d.ts @@ -21,6 +21,11 @@ declare namespace dygraphs { * A per-series color definition. Used in conjunction with, and overrides, the colors option. */ color?: string; + + /** + * A function which plot data for this series on the chart. + */ + plotter?: any; /** * Draw a small dot at each point, in addition to a line going through the point. This makes diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 56a0879ae5..2c9c3c8b7e 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1173,7 +1173,7 @@ declare module 'ember' { * key. You can pass an optional second argument with the target value. Otherwise * this will match any property that evaluates to false. */ - rejectBy(key: string, value?: string): NativeArray; + rejectBy(key: string, value?: any): NativeArray; /** * Returns the first item in the array for which the callback returns true. * This method works similar to the `filter()` method defined in JavaScript 1.6 diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 048d7b884d..dadfa06f86 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -8,6 +8,7 @@ // Umidbek Karimov // Moshe Feuchtwanger // Michael Prokopchuk +// Tina Roh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -789,11 +790,31 @@ export interface CameraProps extends ViewProps { } export interface CameraConstants { - readonly Type: string; - readonly FlashMode: string; - readonly AutoFocus: string; - readonly WhiteBalance: string; - readonly VideoQuality: string; + readonly Type: { + back: string; + front: string; + }; + readonly FlashMode: { + on: string; + off: string; + auto: string; + torch: string; + }; + readonly AutoFocus: { + on: string; + off: string; + }; + readonly WhiteBalance: { + auto: string; + sunny: string; + cloudy: string; + shadow: string; + fluorescent: string; + incandescent: string; + }; + readonly VideoQuality: { + [videoQuality: string]: number; + }; readonly BarCodeType: { aztec: string; codabar: string; @@ -879,7 +900,7 @@ export namespace Constants { }; appKey?: string; androidStatusBar?: { - barStyle?: 'lignt-content' | 'dark-content', + barStyle?: 'light-content' | 'dark-content', backgroundColor?: string }; androidShowExponentNotificationInShellApp?: boolean; @@ -2201,6 +2222,7 @@ export interface VideoProps { translateY?: number; rotation?: number; ref?: Ref; + style?: StyleProp; } export interface VideoState { diff --git a/types/expo/v26/index.d.ts b/types/expo/v26/index.d.ts index 4e7a0ebdb3..9b65002305 100644 --- a/types/expo/v26/index.d.ts +++ b/types/expo/v26/index.d.ts @@ -6,6 +6,7 @@ // Sergio Sánchez // Fernando Helwanger // Umidbek Karimov +// Tina Roh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -787,11 +788,31 @@ export interface CameraProps extends ViewProps { } export interface CameraConstants { - readonly Type: string; - readonly FlashMode: string; - readonly AutoFocus: string; - readonly WhiteBalance: string; - readonly VideoQuality: string; + readonly Type: { + back: string; + front: string; + }; + readonly FlashMode: { + on: string; + off: string; + auto: string; + torch: string; + }; + readonly AutoFocus: { + on: string; + off: string; + }; + readonly WhiteBalance: { + auto: string; + sunny: string; + cloudy: string; + shadow: string; + fluorescent: string; + incandescent: string; + }; + readonly VideoQuality: { + [videoQuality: string]: number; + }; readonly BarCodeType: { aztec: string; codabar: string; @@ -877,7 +898,7 @@ export namespace Constants { }; appKey?: string; androidStatusBar?: { - barStyle?: 'lignt-content' | 'dark-content', + barStyle?: 'light-content' | 'dark-content', backgroundColor?: string }; androidShowExponentNotificationInShellApp?: boolean; @@ -2181,6 +2202,7 @@ export interface VideoProps { translateY?: number; rotation?: number; ref?: Ref; + style?: StyleProp; } export interface VideoState { diff --git a/types/express-brute/index.d.ts b/types/express-brute/index.d.ts index b7961ea597..8f1b6fbf11 100644 --- a/types/express-brute/index.d.ts +++ b/types/express-brute/index.d.ts @@ -67,19 +67,19 @@ declare namespace ExpressBrute { * @summary Allows you to override the value of failCallback for this middleware. * @type {Function} */ - failCallback: Function; + failCallback?: Function; /** * @summary Disregard IP address when matching requests if set to true. Defaults to false. * @type {boolean} */ - ignoreIP: boolean; + ignoreIP?: boolean; /** * @summary Key. * @type {any} */ - key: any; + key?: any; } /** @@ -156,5 +156,13 @@ declare namespace ExpressBrute { reset(key: string, callback: (error: any) => void): void; } } + +declare module "express-serve-static-core" { + export interface Request { + brute?: { + reset?: (callback?: () => void) => void + }; + } +} export = ExpressBrute; diff --git a/types/express-socket.io-session/express-socket.io-session-tests.ts b/types/express-socket.io-session/express-socket.io-session-tests.ts index 46dd000882..6937952dd6 100644 --- a/types/express-socket.io-session/express-socket.io-session-tests.ts +++ b/types/express-socket.io-session/express-socket.io-session-tests.ts @@ -26,3 +26,19 @@ io.use(sharedsession(session)); io.use(sharedsession(session, { autoSave: true, saveUninitialized: true })); io.use(sharedsession(session, cookieParser)); io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true })); + +io.on('connection', (socket) => { + const sessionID = [ + socket.handshake.sessionID, + socket.handshake.session!.id + ]; + const sessionData = [ + socket.handshake.session!['sessionEntry'], + socket.handshake.session!.anotherSessionEntry + ]; + socket.handshake.session!.touch(() => {}); + socket.handshake.session!.regenerate(() => {}); + socket.handshake.session!.save(() => {}); + socket.handshake.session!.reload(() => {}); + socket.handshake.session!.destroy(() => {}); +}); diff --git a/types/express-socket.io-session/index.d.ts b/types/express-socket.io-session/index.d.ts index 39a1fb4ff6..07acac556a 100644 --- a/types/express-socket.io-session/index.d.ts +++ b/types/express-socket.io-session/index.d.ts @@ -7,6 +7,13 @@ import socketio = require('socket.io'); import express = require('express'); +declare module "socket.io" { + interface Handshake { + session?: Express.Session; + sessionID?: string; + } +} + declare function sharedsession( expressSessionMiddleware: express.RequestHandler, cookieParserMiddleware: express.RequestHandler, diff --git a/types/flight/flight-tests.ts b/types/flight/flight-tests.ts index bd2f22d1c3..dd21f32f48 100644 --- a/types/flight/flight-tests.ts +++ b/types/flight/flight-tests.ts @@ -1,6 +1,6 @@ declare var el: Element; -declare var els: Element[]; +declare var els: HTMLElement[]; declare var mixinFn: Function; function TestComponent() { diff --git a/types/google-adwords-scripts/index.d.ts b/types/google-adwords-scripts/index.d.ts index 3e64730056..adf58cb4a4 100644 --- a/types/google-adwords-scripts/index.d.ts +++ b/types/google-adwords-scripts/index.d.ts @@ -1387,7 +1387,7 @@ interface hasStartAndEndDateBuilder { } interface hasStats { - getStatsFor(dateRange: DayOfWeekString): AdWordsStats; + getStatsFor(dateRange: DateRange): AdWordsStats; getStatsFor(dateFrom: AdWordsDate | string, dateTo: AdWordsDate | string): AdWordsStats; } diff --git a/types/googlemaps/googlemaps-tests.ts b/types/googlemaps/googlemaps-tests.ts index 561e53f91a..99d5902a88 100644 --- a/types/googlemaps/googlemaps-tests.ts +++ b/types/googlemaps/googlemaps-tests.ts @@ -60,6 +60,33 @@ map.fitBounds({ top: 50 }); +/***** Pan map to bounds *****/ +map.panToBounds({ + north: 10, + east: 10, + west: 10, + south: 10 +}) + +map.panToBounds({ + north: 10, + east: 10, + west: 10, + south: 10 +}, 50) + +map.panToBounds({ + east: 10, + north: 10, + south: 10, + west: 10 +}, { + bottom: 100, + left: 150, + right: 150, + top: 50 +}); + /***** Data *****/ diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 9430698fe6..a8de5810ec 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -51,7 +51,7 @@ declare namespace google.maps { getZoom(): number; panBy(x: number, y: number): void; panTo(latLng: LatLng|LatLngLiteral): void; - panToBounds(latLngBounds: LatLngBounds|LatLngBoundsLiteral): void; + panToBounds(latLngBounds: LatLngBounds|LatLngBoundsLiteral, padding?: number|Padding): void; setCenter(latlng: LatLng|LatLngLiteral): void; setHeading(heading: number): void; setMapTypeId(mapTypeId: MapTypeId|string): void; diff --git a/types/grecaptcha/grecaptcha-tests.ts b/types/grecaptcha/grecaptcha-tests.ts index f1da1b35b4..288836d6b3 100644 --- a/types/grecaptcha/grecaptcha-tests.ts +++ b/types/grecaptcha/grecaptcha-tests.ts @@ -4,8 +4,10 @@ const params: ReCaptchaV2.Parameters = { type: "image", size: "normal", tabindex: 5, + isolated: false, callback: (response: string) => { }, "expired-callback": () => { }, + "error-callback": () => { }, }; const size1: ReCaptchaV2.Size = "compact"; @@ -25,6 +27,7 @@ const id1: number = grecaptcha.render("foo"); const id2: number = grecaptcha.render("foo", params); const id3: number = grecaptcha.render(document.getElementById("foo")); const id4: number = grecaptcha.render(document.getElementById("foo"), params); +const id5: number = grecaptcha.render(document.getElementById("foo"), params, true); // response takes a number and returns a string const response1: string = grecaptcha.getResponse(id1); diff --git a/types/grecaptcha/index.d.ts b/types/grecaptcha/index.d.ts index 067139e6c9..c9dedbfb74 100644 --- a/types/grecaptcha/index.d.ts +++ b/types/grecaptcha/index.d.ts @@ -1,19 +1,24 @@ // Type definitions for Google Recaptcha 2.0 // Project: https://www.google.com/recaptcha -// Definitions by: Kristof Mattei , Martin Costello , Ruslan Arkhipau +// Definitions by: Kristof Mattei +// Martin Costello +// Ruslan Arkhipau +// Rafael Tavares // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var grecaptcha: ReCaptchaV2.ReCaptcha; declare namespace ReCaptchaV2 { - class ReCaptcha { + interface ReCaptcha { /** * Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget. * @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself. * @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters. + * @param inherit Invisible reCAPTCHA only. Use existing data-* attributes on the element if the corresponding parameter is not specified. + * The values in parameters will take precedence over the attributes. * @return the ID of the newly created widget. */ - render(container: (string | HTMLElement), parameters?: Parameters): number; + render(container: (string | HTMLElement), parameters?: Parameters, inherit?: boolean): number; /** * Resets the reCAPTCHA widget. * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. @@ -65,11 +70,6 @@ declare namespace ReCaptchaV2 { * If other elements in your page use tabindex, it should be set to make user navigation easier. */ tabindex?: number; - /** - * Optional. Your callback function that's executed when the user submits a successful CAPTCHA response. - * The user's response, g-recaptcha-response, will be the input for your callback function. - */ - callback?(response: string): void; /** * Optional. The badge location for g-recaptcha with size of "invisible". * @@ -77,10 +77,29 @@ declare namespace ReCaptchaV2 { */ badge?: Badge; /** - * Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA. + * Optional. Invisible reCAPTCHA only. For plugin owners to not interfere with existing reCAPTCHA installations on a page. + * If true, this reCAPTCHA instance will be part of a separate ID space. + * + * @default false + */ + isolated?: boolean; + /** + * Optional. Your callback function that's executed when the user submits a successful CAPTCHA response. + * The user's response, g-recaptcha-response, will be the input for your callback function. + */ + callback?(response: string): void; + /** + * Optional. Your callback function that's executed when the reCAPTCHA response expires and the user needs to solve a new CAPTCHA. */ // Notice to the reader // I need to surround this object with quotes, this will however break intellisense in VS 2013. "expired-callback"?(): void; + /** + * Optional. Your callback function that's executed when reCAPTCHA encounters an error (usually network connectivity) and cannot continue until connectivity is restored. + * If you specify this function, you are responsible for informing the user that they should retry. + */ + // Notice to the reader + // I need to surround this object with quotes, this will however break intellisense in VS 2013. + "error-callback"?(): void; } } diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index d9258f7a48..d00c037c71 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -7,6 +7,7 @@ // Jason Dreyzehner // Synarque // Justin Rockwood +// Keith Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -21,6 +22,13 @@ declare namespace inquirer { | Question | ReadonlyArray> | Rx.Observable>; + interface OutputStreamOption { + output: NodeJS.WriteStream + } + interface InputStreamOption { + input: NodeJS.ReadStream + } + type StreamOptions = InputStreamOption | OutputStreamOption | (InputStreamOption & OutputStreamOption); interface Inquirer { restoreDefaultPrompts(): void; @@ -32,8 +40,9 @@ declare namespace inquirer { registerPrompt(name: string, prompt: PromptModule): void; /** * Create a new self-contained prompt module. + * @param opt Object specifying input and output streams for the prompt */ - createPromptModule(): PromptModule; + createPromptModule(opt?: StreamOptions): PromptModule; /** * Public CLI helper interface * @param questions Questions settings array diff --git a/types/inquirer/inquirer-tests.ts b/types/inquirer/inquirer-tests.ts index aa545adae0..85a81d761e 100644 --- a/types/inquirer/inquirer-tests.ts +++ b/types/inquirer/inquirer-tests.ts @@ -626,3 +626,47 @@ async function testAsyncPrompt(): Promise { } testAsyncPrompt(); + +/** + * Different prompt output example + */ + +"use strict"; +//var inquirer = require("../lib/inquirer"); + +var questions = [ + { + type: "input", + name: "first_name", + message: "What's your first name", + prefix: "1 - " + }, + { + type: "input", + name: "last_name", + message: "What's your last name", + default: function() { + return "Doe"; + }, + suffix: "!!" + }, + { + type: "input", + name: "phone", + message: "What's your phone number", + validate: function(value: string): string | boolean { + var pass = value.match( + /^([01]{1})?[\-\.\s]?\(?(\d{3})\)?[\-\.\s]?(\d{3})[\-\.\s]?(\d{4})\s?((?:#|ext\.?\s?|x\.?\s?){1}(?:\d+)?)?$/i + ); + if (pass) { + return true; + } else { + return "Please enter a valid phone number"; + } + } + } +]; + +inquirer.createPromptModule({ output: process.stderr })(questions, function(answers) { + console.log(JSON.stringify(answers, null, " ")); +}); diff --git a/types/intercom-client/Scroll.d.ts b/types/intercom-client/Scroll.d.ts new file mode 100644 index 0000000000..2704a4cfbe --- /dev/null +++ b/types/intercom-client/Scroll.d.ts @@ -0,0 +1,3 @@ +export declare class Scroll { + +} \ No newline at end of file diff --git a/types/intercom-client/User.d.ts b/types/intercom-client/User.d.ts new file mode 100644 index 0000000000..880b8b5681 --- /dev/null +++ b/types/intercom-client/User.d.ts @@ -0,0 +1,85 @@ +import {Company} from "intercom-client"; + +export type UserIdentifier = { "id": string } | { "user_id": string } | { "email": string } + +export interface Avatar { + "type": "avatar", + "image_url": string | null +} + +export interface SocialProfile { + "name": "Twitter", + readonly "id": string | null, + "username": string | null, + "url": string | null +} + +export interface Segment { + readonly "id": string +} + +export interface Tag { + readonly "id": string +} + +export interface LocationData { + "type": "location_data", + "city_name": string | null, + "continent_code": string | null, + "country_code": string | null, + "country_name": string | null, + "latitude": number | null, + "longitude": number | null, + "postal_code": string | null, + "region_name": string | null, + "timezone": string | null +} + +export interface User { + "type": "user" | "contact", + readonly "id": string, + "user_id": string | null, + "email": string | null, + "app_id"?: string, + "phone": string | null, + "name": string | null, + readonly "updated_at": number, + "last_seen_ip": string | null, + "unsubscribed_from_emails": boolean, + "last_request_at": number | null, + "signed_up_at": number | null, + readonly "created_at": number, + "session_count": number, + "user_agent_data": string | null, + "pseudonym": string | null, + "anonymous": boolean, + "custom_attributes": { + [key: string]: any + }, + "avatar": Avatar, + "location_data": LocationData | {}, + "social_profiles": { + "type": "social_profile.list", + "social_profiles": SocialProfile[] + }, + "companies": { + "type": "company.list", + "companies": Company[] + }, + "segments": { + "type": "segment.list", + "segments": Segment[] + + }, + "tags": { + "type": "tag.list", + "tags": Tag[] + } +} + +export interface List { + "type": "user.list", + "total_count": number, + "users": User[], + "pages": { "next"?: string, "page": number, "per_page": number, "total_pages": number } +} \ No newline at end of file diff --git a/types/intercom-client/index.d.ts b/types/intercom-client/index.d.ts index b68dc87e71..4d9e572da0 100644 --- a/types/intercom-client/index.d.ts +++ b/types/intercom-client/index.d.ts @@ -1,7 +1,10 @@ // Type definitions for intercom-client 2.9 // Project: https://github.com/intercom/intercom-node -// Definitions by: Jinesh Shah +// Definitions by: Jinesh Shah , Josef Hornych // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 +import { List as UserList, User, UserIdentifier } from './User'; +import { Scroll } from './Scroll'; export interface IdentityVerificationOptions { secretKey: string; @@ -11,3 +14,32 @@ export interface IdentityVerificationOptions { export const IdentityVerification: { userHash(opts: IdentityVerificationOptions): string; }; + +export class Client { + constructor(auth: { token: string } | { appId: string, appApiKey: string }); + constructor(username: string, password: string); + + users: Users; +} + +export interface Company { + readonly "id": string; +} + +export class Users { + create(user: Partial): Promise; + + update(user: UserIdentifier & Partial): Promise; + + find(identifier: UserIdentifier): Promise; + + list(): Promise; + + listBy(params: {tag_id: string, segment_id: string}): Promise; + + scroll: Scroll; + + archive(): Promise; + + requestPermanentDeletion(): Promise<{id: number}>; +} diff --git a/types/intercom-web/index.d.ts b/types/intercom-web/index.d.ts index 563d241c31..eb2157d7c7 100755 --- a/types/intercom-web/index.d.ts +++ b/types/intercom-web/index.d.ts @@ -21,7 +21,7 @@ declare namespace Intercom_ { activator?: string; }; company?: { - id: string|number, + id: string | number, name: string, created_at: number, plan?: string, @@ -33,16 +33,17 @@ declare namespace Intercom_ { } type IntercomCommand = 'boot' - |'shutdown' - |'update' - |'hide' - |'show' - |'showMessages' - |'showNewMessage' - |'onHide' - |'onShow' - |'onActivatorClick' - |'trackEvent'; + | 'shutdown' + | 'update' + | 'hide' + | 'show' + | 'showMessages' + | 'showNewMessage' + | 'onHide' + | 'onShow' + | 'onUnreadCountChange' + | 'onActivatorClick' + | 'trackEvent'; interface IntercomStatic { (command: 'boot', param: IntercomSettings): void; @@ -51,6 +52,7 @@ declare namespace Intercom_ { (command: 'showNewMessage', param?: string): void; (command: 'onHide' | 'onShow' | 'onActivatorClick', param?: () => void): void; (command: 'trackEvent', tag?: string, metadata?: any): void; + (command: 'onUnreadCountChange', cb: (unreadCount: number) => void): void; (command: IntercomCommand, param1?: any, param2?: any): void; } } diff --git a/types/intercom-web/intercom-web-tests.ts b/types/intercom-web/intercom-web-tests.ts index b07013322d..425aa74be4 100755 --- a/types/intercom-web/intercom-web-tests.ts +++ b/types/intercom-web/intercom-web-tests.ts @@ -23,6 +23,7 @@ Intercom('showMessages'); Intercom('showNewMessage'); Intercom('showNewMessage', 'pre-populated content'); Intercom('onHide', () => { /* Do stuff */ }); +Intercom('onUnreadCountChange', (unreadCount: number) => { /* Do stuff */ }); Intercom('onActivatorClick', () => { /* Do stuff */ }); Intercom('trackEvent', 'invited-friend'); diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 84ca51982a..3ad2f6aeb2 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -16,6 +16,7 @@ /// import Promise = require('bluebird'); +import tls = require('tls'); interface RedisStatic { new(port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis; @@ -827,9 +828,7 @@ declare namespace IORedis { */ autoResendUnfulfilledCommands?: boolean; lazyConnect?: boolean; - tls?: { - ca: Buffer; - }; + tls?: tls.ConnectionOptions; sentinels?: Array<{ host: string; port: number; }>; name?: string; /** diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index e8e32062dc..7dd98879a5 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -29,7 +29,10 @@ new Redis({ password: 'auth', db: 0, retryStrategy() { return false; }, - showFriendlyErrorStack: true + showFriendlyErrorStack: true, + tls: { + servername: 'tlsservername' + } }); const pub = new Redis(); diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 4a2153b218..d11f79df64 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -209,6 +209,14 @@ declare namespace jest { readonly name: string; } + interface Each { + (cases: any[]): (name: string, fn: (...args: any[]) => any) => void; + (strings: TemplateStringsArray, ...placeholders: any[]): ( + name: string, + fn: (arg: any) => any + ) => void; + } + /** * Creates a test closure */ @@ -227,6 +235,7 @@ declare namespace jest { only: It; skip: It; concurrent: It; + each: Each; } interface Describe { @@ -234,6 +243,7 @@ declare namespace jest { (name: number | string | Function | FunctionLike, fn: EmptyFunction): void; only: Describe; skip: Describe; + each: Each; } interface MatcherUtils { diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index cc86e7d577..7d10075262 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -1,784 +1,1058 @@ -// TODO: Avoid requiring things that don't exist. -declare var require: { - (s: string): any; - requireActual(s: string): any; - requireMock(s: string): any; +/* Lifecycle events */ + +beforeAll(() => {}); +beforeAll((done: jest.DoneCallback) => {}); +beforeAll((done: jest.DoneCallback) => done.fail(), 9001); + +beforeEach(() => {}); +beforeEach((done: jest.DoneCallback) => {}); +beforeEach((done: jest.DoneCallback) => done.fail(), 9001); + +afterAll(() => {}); +afterAll((done: jest.DoneCallback) => {}); +afterAll((done: jest.DoneCallback) => done.fail(), 9001); + +afterEach(() => {}); +afterEach((done: jest.DoneCallback) => {}); +afterEach((done: jest.DoneCallback) => done.fail(), 9001); + +/* describe */ + +describe(0, () => {}); +describe("name", () => {}); +describe(() => {}, () => {}); +describe({ name: "name" }, () => {}); + +describe.only(0, () => {}); +describe.only("name", () => {}); +describe.only(() => {}, () => {}); +describe.only({ name: "name" }, () => {}); + +describe.skip(0, () => {}); +describe.skip("name", () => {}); +describe.skip(() => {}, () => {}); +describe.skip({ name: "name" }, () => {}); + +fdescribe(0, () => {}); +fdescribe("name", () => {}); +fdescribe(() => {}, () => {}); +fdescribe({ name: "name" }, () => {}); + +fdescribe.only(0, () => {}); +fdescribe.only("name", () => {}); +fdescribe.only(() => {}, () => {}); +fdescribe.only({ name: "name" }, () => {}); + +fdescribe.skip(0, () => {}); +fdescribe.skip("name", () => {}); +fdescribe.skip(() => {}, () => {}); +fdescribe.skip({ name: "name" }, () => {}); + +xdescribe(0, () => {}); +xdescribe("name", () => {}); +xdescribe(() => {}, () => {}); +xdescribe({ name: "name" }, () => {}); + +xdescribe.only(0, () => {}); +xdescribe.only("name", () => {}); +xdescribe.only(() => {}, () => {}); +xdescribe.only({ name: "name" }, () => {}); + +xdescribe.skip(0, () => {}); +xdescribe.skip("name", () => {}); +xdescribe.skip(() => {}, () => {}); +xdescribe.skip({ name: "name" }, () => {}); + +/* it */ + +it("name", () => {}); +it("name", async () => {}); +it("name", () => {}, 9001); +it("name", async () => {}, 9001); +it("name", (callback: jest.DoneCallback) => {}, 9001); + +it.only("name", () => {}); +it.only("name", async () => {}); +it.only("name", () => {}, 9001); +it.only("name", async () => {}, 9001); +it.only("name", (callback: jest.DoneCallback) => {}, 9001); + +it.skip("name", () => {}); +it.skip("name", async () => {}); +it.skip("name", () => {}, 9001); +it.skip("name", async () => {}, 9001); +it.skip("name", (callback: jest.DoneCallback) => {}, 9001); + +it.concurrent("name", () => {}); +it.concurrent("name", async () => {}); +it.concurrent("name", () => {}, 9001); +it.concurrent("name", async () => {}, 9001); +it.concurrent("name", (callback: jest.DoneCallback) => {}, 9001); + +fit("name", () => {}); +fit("name", async () => {}); +fit("name", () => {}, 9001); +fit("name", async () => {}, 9001); +fit("name", (callback: jest.DoneCallback) => {}, 9001); + +fit.only("name", () => {}); +fit.only("name", async () => {}); +fit.only("name", () => {}, 9001); +fit.only("name", async () => {}, 9001); +fit.only("name", (callback: jest.DoneCallback) => {}, 9001); + +fit.skip("name", () => {}); +fit.skip("name", async () => {}); +fit.skip("name", () => {}, 9001); +fit.skip("name", async () => {}, 9001); +fit.skip("name", (callback: jest.DoneCallback) => {}, 9001); + +fit.concurrent("name", () => {}); +fit.concurrent("name", async () => {}); +fit.concurrent("name", () => {}, 9001); +fit.concurrent("name", async () => {}, 9001); +fit.concurrent("name", (callback: jest.DoneCallback) => {}, 9001); + +xit("name", () => {}); +xit("name", async () => {}); +xit("name", () => {}, 9001); +xit("name", async () => {}, 9001); +xit("name", (callback: jest.DoneCallback) => {}, 9001); + +xit.only("name", () => {}); +xit.only("name", async () => {}); +xit.only("name", () => {}, 9001); +xit.only("name", async () => {}, 9001); +xit.only("name", (callback: jest.DoneCallback) => {}, 9001); + +xit.skip("name", () => {}); +xit.skip("name", async () => {}); +xit.skip("name", () => {}, 9001); +xit.skip("name", async () => {}, 9001); +xit.skip("name", (callback: jest.DoneCallback) => {}, 9001); + +xit.concurrent("name", () => {}); +xit.concurrent("name", async () => {}); +xit.concurrent("name", () => {}, 9001); +xit.concurrent("name", async () => {}, 9001); +xit.concurrent("name", (callback: jest.DoneCallback) => {}, 9001); + +test("name", () => {}); +test("name", async () => {}); +test("name", () => {}, 9001); +test("name", async () => {}, 9001); +test("name", (callback: jest.DoneCallback) => {}, 9001); + +test.only("name", () => {}); +test.only("name", async () => {}); +test.only("name", () => {}, 9001); +test.only("name", async () => {}, 9001); +test.only("name", (callback: jest.DoneCallback) => {}, 9001); + +test.skip("name", () => {}); +test.skip("name", async () => {}); +test.skip("name", () => {}, 9001); +test.skip("name", async () => {}, 9001); +test.skip("name", (callback: jest.DoneCallback) => {}, 9001); + +test.concurrent("name", () => {}); +test.concurrent("name", async () => {}); +test.concurrent("name", () => {}, 9001); +test.concurrent("name", async () => {}, 9001); +test.concurrent("name", (callback: jest.DoneCallback) => {}, 9001); + +xtest("name", () => {}); +xtest("name", async () => {}); +xtest("name", () => {}, 9001); +xtest("name", async () => {}, 9001); +xtest("name", (callback: jest.DoneCallback) => {}, 9001); + +xtest.only("name", () => {}); +xtest.only("name", async () => {}); +xtest.only("name", () => {}, 9001); +xtest.only("name", async () => {}, 9001); +xtest.only("name", (callback: jest.DoneCallback) => {}, 9001); + +xtest.skip("name", () => {}); +xtest.skip("name", async () => {}); +xtest.skip("name", () => {}, 9001); +xtest.skip("name", async () => {}, 9001); +xtest.skip("name", (callback: jest.DoneCallback) => {}, 9001); + +xtest.concurrent("name", () => {}); +xtest.concurrent("name", async () => {}); +xtest.concurrent("name", () => {}, 9001); +xtest.concurrent("name", async () => {}, 9001); +xtest.concurrent("name", (callback: jest.DoneCallback) => {}, 9001); + +/* Done callbacks */ + +describe("", () => { + it("", (callback: jest.DoneCallback): void => { + callback(); + callback(""); + callback("", 3); + callback.fail(); + callback.fail("error"); + callback.fail({ message: "message" }); + }); +}); + +/* NodeRequire interface (require extensions) */ + +declare const nodeRequire: NodeRequire; + +// $ExpectType any +nodeRequire.requireActual("moduleName"); + +// $ExpectType any +nodeRequire.requireMock("moduleName"); + +/* Top-level jest namespace functions */ + +const customMatcherFactories: jasmine.CustomMatcherFactories = {}; + +jest + .addMatchers(customMatcherFactories) + .addMatchers({}) + .addMatchers(customMatcherFactories) + .autoMockOff() + .autoMockOn() + .clearAllMocks() + .clearAllTimers() + .resetAllMocks() + .restoreAllMocks() + .clearAllTimers() + .deepUnmock("moduleName") + .disableAutomock() + .doMock("moduleName") + .doMock("moduleName", jest.fn()) + .doMock("moduleName", jest.fn(), {}) + .doMock("moduleName", jest.fn(), { virtual: true }) + .dontMock("moduleName") + .enableAutomock() + .mock("moduleName") + .mock("moduleName", jest.fn()) + .mock("moduleName", jest.fn(), {}) + .mock("moduleName", jest.fn(), { virtual: true }) + .resetModuleRegistry() + .resetModules() + .runAllImmediates() + .runAllTicks() + .runAllTimers() + .runOnlyPendingTimers() + .runTimersToTime(9001) + .advanceTimersByTime(9001) + .setMock("moduleName", {}) + .setMock<{}>("moduleName", {}) + .setMock<{ a: "b" }>("moduleName", { a: "b" }) + .setTimeout(9001) + .unmock("moduleName") + .useFakeTimers() + .useRealTimers(); + +/* Mocks and spies */ + +const mock1: jest.Mock = jest.fn(); +const mock2: jest.Mock = jest.fn(() => undefined); +const mock3: jest.Mock = jest.fn(() => "abc"); +const mock4: jest.Mock<"abc"> = jest.fn((): "abc" => "abc"); +const mock5: jest.Mock = jest.fn((...args: string[]) => args.join("")); +const mock6: jest.Mock = jest.fn((arg: {}) => arg); + +const genMockModule1: {} = jest.genMockFromModule("moduleName"); +const genMockModule2: { a: "b" } = jest.genMockFromModule<{ a: "b" }>("moduleName"); + +const isStringMock: boolean = jest.isMockFunction("foo"); +const isMockMock: boolean = jest.isMockFunction(mock1); + +const maybeMock = () => {}; +if (jest.isMockFunction(maybeMock)) { + maybeMock.getMockName(); +} + +const mockName: string = jest.fn().getMockName(); +const mockContextVoid: jest.MockContext = jest.fn().mock; +const mockContextString: jest.MockContext = jest.fn(() => "").mock; + +jest.fn().mockClear(); + +jest.fn().mockReset(); + +const spiedTarget = { + returnsVoid(): void { }, + returnsString(): string { + return ""; + } }; -// TODO: use real jquery types? -declare const $: any; -// Tests based on the Jest website -jest.unmock('../sum'); +const spy1 = jest.spyOn(spiedTarget, "returnsVoid"); +const spy2 = jest.spyOn(spiedTarget, "returnsVoid", "get"); +const spy3 = jest.spyOn(spiedTarget, "returnsString", "set"); -class TestClass { } +const spy1Name: string = spy1.getMockName(); -describe(TestClass, () => { }); +const spy2Calls: any[][] = spy2.mock.calls; -describe('sum', () => { - it('adds 1 + 2 to equal 3', () => { - const sum: (a: number, b: number) => number = require('../sum'); - expect(sum(1, 2)).toBe(3); - }); +spy2.mockClear(); +spy2.mockReset(); + +const spy3Mock: jest.Mock<() => string> = spy3 + .mockImplementation(() => "") + .mockImplementation((arg: {}) => arg) + .mockImplementation((...args: string[]) => args.join("")) + .mockName("name") + .mockReturnThis() + .mockReturnValue("value") + .mockReturnValueOnce("value") + .mockResolvedValue("value") + .mockResolvedValueOnce("value") + .mockRejectedValue("value") + .mockRejectedValueOnce("value"); + +/* Snapshot serialization */ + +const snapshotSerializerPlugin: jest.SnapshotSerializerPlugin = { + print: () => "", + test: () => true, +}; + +expect.addSnapshotSerializer(snapshotSerializerPlugin); + +expect.addSnapshotSerializer({ + print: (value: {}) => "", + test: (value: {}) => value === value, }); -describe('restoreAllMocks', () => { - afterEach(() => { - jest.restoreAllMocks(); - }); +expect.addSnapshotSerializer({ + print: ( + value: {}, + serialize: ((val: {}) => string), + indent: ((str: string) => string), + opts: {}, + ) => "", + test: (value: {}) => value === value, }); -describe('fetchCurrentUser', () => { - it('calls the callback when $.ajax requests are finished', () => { - const fetchCurrentUser = require('../fetchCurrentUser'); +expect.addSnapshotSerializer({ + print(value, serialize, indent, opts, colors) { + let result = ""; - // Create a mock function for our callback - const callback = jest.fn(); - fetchCurrentUser(callback); + if (opts.callToJSON !== undefined && opts.callToJSON) { + result += " "; + } - // 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;--' - }); + result += opts.edgeSpacing; + result += opts.spacing; - // 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;--' - }); - }); + if (opts.escapeRegex !== undefined && opts.escapeRegex) { + result += " "; + } + + if (opts.indent !== undefined) { + for (let i = 0; i < opts.indent; i += 1) { + result += "\t"; + } + } + + if (opts.maxDepth !== undefined) { + result = result.substring(0, opts.maxDepth); + } + + if (opts.min !== undefined && opts.min) { + result += " "; + } + + if (opts.plugins !== undefined) { + for (const plugin of opts.plugins) { + expect.addSnapshotSerializer(plugin); + } + } + + if (opts.printFunctionName !== undefined && opts.printFunctionName) { + result += " "; + } + + if (opts.theme) { + if (opts.theme.comment !== undefined) { + result += opts.theme.comment; + } + + if (opts.theme.content !== undefined) { + result += opts.theme.content; + } + + if (opts.theme.prop !== undefined) { + result += opts.theme.prop; + } + + if (opts.theme.tag !== undefined) { + result += opts.theme.tag; + } + + if (opts.theme.value !== undefined) { + result += opts.theme.value; + } + } + + for (const color of [ + colors.comment, + colors.content, + colors.prop, + colors.tag, + colors.value, + ]) { + result += color.open; + result += color.close; + } + + return result; + }, + test: (value: {}) => value === value, }); -// unmock is the recommended approach for unmocking... -jest.unmock('../displayUser.js'); +/* expect extensions */ -describe('displayUser', () => { - it('displays a user after a click', () => { - // Set up our document body - document.body.innerHTML = - '
' + - ' ' + - '
'; +const expectExtendMap: jest.ExpectExtendMap = {}; - const displayUser = require.requireActual('../displayUser'); - const $ = require('jquery'); - const fetchCurrentUser = require('../fetchCurrentUser'); - - // Tell the fetchCurrentUser mock function to automatically invoke - // its callback with some data - fetchCurrentUser.mockImplementation((cb: (...args: any[]) => any) => { - 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', () => { - it('changes the text after click', () => { - const React = require('react/addons'); - const CheckboxWithLabel = require('../CheckboxWithLabel.js'); - const TestUtils = React.addons.TestUtils; - - // Render a checkbox with label in the document - const checkbox = TestUtils.renderIntoDocument( - CheckboxWithLabel({ - labelOn: "On", - labelOff: "Off" - }) - ); - - // Verify that it's Off by default - const label = TestUtils.findRenderedDOMComponentWithTag( - checkbox, 'label'); - expect(label.getDOMNode().textContent).toEqual('Off'); - - // Simulate a click and verify that it is now On - const input = TestUtils.findRenderedDOMComponentWithTag( - checkbox, 'input'); - TestUtils.Simulate.change(input); - expect(label.getDOMNode().textContent).toEqual('On'); - }); -}); - -jest.runAllTicks(); -xdescribe('Hooks and Suits', () => { - let tested: boolean; - - beforeEach(() => { - tested = false; - }); - - afterEach(() => { - tested = true; - }); - - test('tested', () => { - expect(tested).toBeTruthy(); - expect(tested).not.toBeFalsy(); - }); - - fit('tested', () => { - expect(tested).toBeDefined(); - expect(tested).not.toBeUndefined(); - }); - - xit('expect null to be null', () => { - expect(null).toBeNull(); - }); - - xit('expect NaN to be NaN', () => { - expect(NaN).toBeNaN(); - }); -}); - -describe('compartion', () => { - const sum: (a: number, b: number) => number = require.requireMock('../sum'); - - it('compares is 7 + 2 greater than 3', () => { - expect(sum(7, 2)).toBeGreaterThan(3); - }); - - it('compares is 2 + 7 greater than or equal to 3', () => { - expect(sum(2, 7)).toBeGreaterThanOrEqual(3); - }); - - it('compares is 3 less than 3 + 4', () => { - expect(3).toBeLessThan(sum(3, 4)); - }); - - it('compares is 3 less than or equal to 4 + 3', () => { - expect(3).toBeLessThanOrEqual(sum(4, 3)); - }); - - it('works sanely with simple decimals', () => { - expect(0.2 + 0.1).toBeCloseTo(0.3, 5); - }); - - it('works sanely with simple decimals and the default delta', () => { - expect(0.2 + 0.1).toBeCloseTo(0.3); - }); -}); - -describe('toThrow API', () => { - function throwTypeError(): void { - throw new TypeError('toThrow Definition was out of date'); - } - - it('throws', () => { - expect(throwTypeError()).toThrow(); - expect(throwTypeError()).toThrowError(); - }); - - it('throws TypeError', () => { - expect(throwTypeError()).toThrow(TypeError); - expect(throwTypeError()).toThrowError(TypeError); - }); - - it('throws \'Definition was out of date\'', () => { - expect(throwTypeError()).toThrow(/Definition was out of date/); - expect(throwTypeError()).toThrowError(/Definition was out of date/); - }); - - it('throws \'toThorow Definition was out of date\'', () => { - expect(throwTypeError()).toThrow('toThrow Definition was out of date'); - expect(throwTypeError()).toThrowError('toThrow Definition was out of date'); - }); -}); - -describe('Assymetric matchers', () => { - it('works', () => { - expect({ - timestamp: 1480807810388, - text: 'Some text content, but we care only about *this part*', - color: '#bada55', - greeting: 'hello, world!', - }).toEqual({ - timestamp: expect.any(Number), - text: expect.stringMatching('*this part*'), - color: expect.stringMatching(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i), - greeting: expect.stringContaining('hello'), - }); - - expect("foo").toStrictEqual("foo"); - expect({ a: "foo" }).toStrictEqual({ a: "foo" }); - - 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.extend(expectExtendMap); +expect.extend({}); +expect.extend({ + foo(this: jest.MatcherUtils, received: {}, ...actual: Array<{}>) { + return { + message: () => JSON.stringify(received), + pass: false, }; - expect(obj).toEqual(expect.objectContaining({ - items: expect.arrayContaining([ - expect.any(Number) - ]) + } +}); + +/* Basic matchers */ + +describe("", () => { + it("", () => { + expect(jest.fn()).lastCalledWith(); + expect(jest.fn()).lastCalledWith("jest"); + expect(jest.fn()).lastCalledWith({}, {}); + + expect(jest.fn()).lastReturnedWith("jest"); + expect(jest.fn()).lastReturnedWith({}); + + expect(jest.fn()).nthReturnedWith(0, "jest"); + expect(jest.fn()).nthReturnedWith(1, {}); + + expect({}).toBe({}); + expect([]).toBe([]); + expect(10).toBe(10); + + expect(jest.fn()).toBeCalled(); + + expect(jest.fn()).toBeCalledWith(); + expect(jest.fn()).toBeCalledWith("jest"); + expect(jest.fn()).toBeCalledWith({}, {}); + + expect(0).toBeCloseTo(1); + expect(0).toBeCloseTo(1, 2); + + expect(undefined).toBeDefined(); + expect({}).toBeDefined(); + + expect(true).toBeFalsy(); + expect(false).toBeFalsy(); + expect(0).toBeFalsy(); + + expect(0).toBeGreaterThan(1); + + expect(0).toBeGreaterThanOrEqual(1); + + expect(3).toBeInstanceOf(Number); + + expect(0).toBeLessThan(1); + + expect(0).toBeLessThanOrEqual(1); + + expect(null).toBeNull(); + expect(undefined).toBeNull(); + + expect(true).toBeTruthy(); + expect(false).toBeFalsy(); + expect(1).toBeTruthy(); + + expect(undefined).toBeUndefined(); + expect({}).toBeUndefined(); + + expect(NaN).toBeNaN(); + expect(Infinity).toBeNaN(); + + expect([]).toContain({}); + expect(["abc"]).toContain("abc"); + expect(["abc"]).toContain("def"); + + expect([]).toContainEqual({}); + expect(["abc"]).toContainEqual("def"); + + expect([]).toEqual([]); + expect({}).toEqual({}); + + expect(jest.fn()).toHaveBeenCalled(); + + expect(jest.fn()).toHaveBeenCalledTimes(0); + expect(jest.fn()).toHaveBeenCalledTimes(1); + + expect(jest.fn()).toHaveBeenCalledWith(); + expect(jest.fn()).toHaveBeenCalledWith("jest"); + expect(jest.fn()).toHaveBeenCalledWith({}, {}); + + expect(jest.fn()).toHaveBeenCalledWith(0); + expect(jest.fn()).toHaveBeenCalledWith(1, "jest"); + expect(jest.fn()).toHaveBeenCalledWith(2, {}, {}); + + expect(jest.fn()).toHaveBeenLastCalledWith(); + expect(jest.fn()).toHaveBeenLastCalledWith("jest"); + expect(jest.fn()).toHaveBeenLastCalledWith({}, {}); + + expect(jest.fn()).toHaveLastReturnedWith("jest"); + expect(jest.fn()).toHaveLastReturnedWith({}); + + expect([]).toHaveLength(0); + expect("").toHaveLength(1); + + expect(jest.fn()).toHaveNthReturnedWith(0, "jest"); + expect(jest.fn()).toHaveNthReturnedWith(1, {}); + + expect({}).toHaveProperty("property"); + expect({}).toHaveProperty("property", {}); + expect({}).toHaveProperty(["property"]); + expect({}).toHaveProperty(["property"], {}); + expect({}).toHaveProperty(["property", "deep"]); + expect({}).toHaveProperty(["property", "deep"], {}); + + expect(jest.fn()).toHaveReturned(); + + expect(jest.fn()).toHaveReturnedTimes(0); + expect(jest.fn()).toHaveReturnedTimes(1); + + expect(jest.fn()).toHaveReturnedWith("jest"); + expect(jest.fn()).toHaveReturnedWith({}); + + expect("").toMatch(""); + expect("").toMatch(/foo/); + + expect({}).toMatchObject({}); + expect({ abc: "def" }).toMatchObject({ abc: "def" }); + expect({}).toMatchObject([{}, {}]); + expect({ abc: "def" }).toMatchObject([{ abc: "def" }, { invalid: "property" }]); + + expect({}).toMatchSnapshot(); + expect({}).toMatchSnapshot("snapshotName"); + + expect(jest.fn()).toReturn(); + + expect(jest.fn()).toReturnTimes(0); + expect(jest.fn()).toReturnTimes(1); + + expect(jest.fn()).toReturnWith("jest"); + expect(jest.fn()).toReturnWith({}); + + expect(true).toStrictEqual(false); + expect({}).toStrictEqual({}); + + expect(() => {}).toThrow(); + expect(() => { throw new Error(); }).toThrow(""); + expect(jest.fn()).toThrow(Error); + expect(jest.fn(() => { throw new Error(); })).toThrow(/foo/); + + expect(() => {}).toThrowErrorMatchingSnapshot(); + expect(() => { throw new Error(); }).toThrowErrorMatchingSnapshot(); + expect(jest.fn()).toThrowErrorMatchingSnapshot(); + expect(jest.fn(() => { throw new Error(); })).toThrowErrorMatchingSnapshot(); + + /* not */ + + expect({}).not.toEqual({}); + expect([]).not.toStrictEqual([]); + + /* Promise matchers */ + + expect(Promise.reject("jest")).rejects.toEqual("jest"); + expect(Promise.reject({})).rejects.toEqual({}); + expect(Promise.resolve("jest")).rejects.toEqual("jest"); + expect(Promise.resolve({})).rejects.toEqual({}); + + expect(Promise.reject("jest")).resolves.toEqual("jest"); + expect(Promise.reject({})).resolves.toEqual({}); + expect(Promise.resolve("jest")).resolves.toEqual("jest"); + expect(Promise.resolve({})).resolves.toEqual({}); + + /* type matchers */ + + expect({}).toBe(expect.anything()); + + expect({}).toBe(expect.any(class Foo { })); + expect(new Error()).toBe(expect.any(Error)); + expect(7).toBe(expect.any(Number)); + + expect({}).toBe(expect.arrayContaining(["a", "b"])); + expect(["abc"]).toBe(expect.arrayContaining(["a", "b"])); + + expect.objectContaining({}); + expect.stringMatching("foo"); + expect.stringMatching(/foo/); + expect.stringContaining("foo"); + + expect({ abc: "def" }).toBe(expect.objectContaining({ + abc: expect.arrayContaining([expect.any(Date), {}]), + def: expect.objectContaining({ + foo: "bar", + }), + ghi: expect.stringMatching("foo"), })); - expect.assertions(4); + /* Miscellaneous */ - interface Test { - a: number; - b: string; + expect.hasAssertions(); + expect.assertions(0); + expect.assertions(9001); + }); +}); + +/* Test framework and config */ + +const globalConfig: jest.GlobalConfig = { + bail: true, + collectCoverage: false, + collectCoverageFrom: ["glob"], + collectCoverageOnlyFrom: { + abc: true, + def: false, + }, + coverageDirectory: "", + coverageReporters: [""], + coverageThreshold: { + global: { + abc: 90, + def: 100, + }, + }, + expand: true, + forceExit: false, + logHeapUsage: true, + mapCoverage: false, + noStackTrace: true, + notify: false, + projects: ["projects"], + replname: "", + reporters: [ + ["abc", {}], + ["def", {}], + ], + rootDir: "path", + silent: true, + testNamePattern: "", + testPathPattern: "", + testResultsProcessor: "", + updateSnapshot: "all" as "all" | "new" | "none", + useStderr: true, + verbose: false, + watch: true, + watchman: false, +}; + +const projectConfig: jest.ProjectConfig = { + automock: true, + browser: false, + cache: true, + cacheDirectory: "", + clearMocks: true, + coveragePathIgnorePatterns: [""], + cwd: "", + detectLeaks: true, + displayName: "", + forceCoverageMatch: ["abc", "def"], + globals: { + "ts-jest": {}, + }, + haste: { + defaultPlatform: "", + hasteImplModulePath: "", + platforms: ["win95", "win2000", "clippy"], + providesModuleNodeModules: ["abc", "def"], + }, + moduleDirectories: ["", ""], + moduleFileExtensions: [".ts", ".json"], + moduleLoader: "laoder", + moduleNameMapper: [ + ["abc", "def"], + ["ghi", "jkl"], + ], + modulePathIgnorePatterns: ["abc", "def"], + modulePaths: ["abc", "def"], + name: "", + resetMocks: true, + resetModules: false, + resolver: "", + rootDir: "", + roots: ["", ""], + runner: "", + setupFiles: ["abc", "def"], + setupTestFrameworkScriptFile: "", + skipNodeResolution: true, + snapshotSerializers: ["abc", "def"], + testEnvironment: "", + testEnvironmentOptions: {}, + testLocationInResults: true, + testMatch: [".test.ts"], + testPathIgnorePatterns: ["*.spec.*"], + testRegex: "abc", + testRunner: "m", + testURL: "localhost:3000", + timers: "real", + transform: [ + ["abc", "def"], + ], + transformIgnorePatterns: ["", ""], + unmockedModulePathPatterns: ["abc"], + watchPathIgnorePatterns: ["def"], +}; + +const environment = { + global: {}, + fakeTimers: { + clearAllTimers() { }, + runAllImmediates() { }, + runAllTicks() { }, + runAllTimers() { }, + runTimersToTime(time: number) { }, + advanceTimersByTime(time: number) { }, + runOnlyPendingTimers() { }, + runWithRealTimers(callback: () => void) { + callback(); + }, + useFakeTimers() { }, + useRealTimers() { }, + }, + testFilePath: "", + moduleMocker: {}, + dispose() {}, + runScript(script: "") { + return {}; + }, +}; + +const workTestFramework = async (testFramework: jest.TestFramework): Promise => { + return testFramework( + globalConfig, + projectConfig, + environment, + {}, + "testPath" + ); +}; + +/* Jasmine status changers */ + +describe("", () => { + it("", () => { + pending(); + pending("reason"); + + fail(); + fail("error"); + fail(new Error("reason")); + fail({}); + }); +}); + +/* Jasmine clocks and timing */ + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 9001; + +const clock = jasmine.clock(); + +clock.install(); + +clock.mockDate(); +clock.mockDate(undefined); +clock.mockDate(new Date()); + +clock.tick(0); +clock.tick(9001); + +/* Jasmine matchers */ + +expect({}).toBe(jasmine.anything()); + +expect({}).toBe(jasmine.any(class Foo { })); +expect(new Error()).toBe(jasmine.any(Error)); +expect(7).toBe(jasmine.any(Number)); + +expect({}).toBe(jasmine.arrayContaining(["a", "b"])); +expect(["abc"]).toBe(jasmine.arrayContaining(["a", "b"])); + +jasmine.arrayContaining([]); +new (jasmine.arrayContaining([]))([]); +const arrayContained: boolean = jasmine + .arrayContaining([]) + .asymmetricMatch([]); +const arrayContainedName: string = jasmine + .arrayContaining([]) + .jasmineToString(); + +jasmine.objectContaining({}); +new (jasmine.objectContaining({}))({}); +const objectContained: boolean = jasmine + .objectContaining({}) + .jasmineMatches({}, ["abc"], ["def"]); +const objectContainedName: string = jasmine + .objectContaining({}) + .jasmineToString(); + +jasmine.stringMatching("foo"); +jasmine.stringMatching(/foo/); +new (jasmine.stringMatching("foo"))({}); +const stringContained: boolean = jasmine + .stringMatching(/foo/) + .jasmineMatches({}); +const stringContainedName: string = jasmine + .stringMatching("foo") + .jasmineToString(); + +expect({ abc: "def" }).toBe(jasmine.objectContaining({ + abc: jasmine.arrayContaining([jasmine.any(Date), {}]), + def: jasmine.objectContaining({ + foo: "bar", + }), + ghi: jasmine.stringMatching("foo"), +})); + +/* Jasmine spies */ + +describe("", () => { + it("", () => { + let spy = jasmine.createSpy(); + jasmine.createSpy("name"); + jasmine.createSpy("name", () => {}); + jasmine.createSpy("name", (arg: {}) => arg); + jasmine.createSpy("name", (...args: string[]) => args.join("")); + + spy = jasmine.createSpy() + .and.callFake(() => {}) + .and.callFake((arg: {}) => arg) + .and.callFake((...args: string[]) => args.join("")) + .and.callThrough() + .and.returnValue("jasmine") + .and.returnValue({}) + .and.returnValues() + .and.returnValues("jasmine") + .and.returnValues({}, {}) + .and.stub() + .and.throwError("message"); + + const identity: string = spy.identity; + + let args: any[]; + args = spy.mostRecentCall.args; + args = spy.argsForCall[0]; + args = spy.calls.allArgs(); + args = spy.calls.argsFor(0); + + const spyCalled: boolean = spy.calls.any(); + + const wasCalled: boolean = spy.wasCalled; + + for (const call of [ + ...spy.calls.all(), + spy.calls.first(), + spy.calls.mostRecent(), + ]) { + const callType: jasmine.CallInfo = call; + const callArgs: any[] = call.args; + const { object, returnValue } = call; } - // It's useful to create expected objects before the test call for refactoring purposes - // Assymetric matchers must return any in this case to constrain the required type - const test: Test = { - a: expect.any(Number), - b: expect.anything() + spy.calls.reset(); + + const spyReturn = spy(); + + /* Jasmine spy objects */ + + let spyObject = { + abc() { + return ""; + }, + def: 7, }; - expect(callback).toHaveBeenCalledWith(test); + + spyObject = jasmine.createSpyObj("baseName", ["abc"]); + spyObject = jasmine.createSpyObj("baseName", ["abc"]); + + const newSpyObject: typeof spyObject = jasmine.createSpyObj("baseName", ["abc"]); }); }); -describe('setTimeout', () => { - it('works as expected', done => { - jest.setTimeout(1000); +/* Jasmine pp */ - setTimeout(() => { - expect(true).toBeTruthy(); - done(); - }, 900); - }); -}); +const pp: string = jasmine.pp({}); -describe("spy call matchers", () => { - const spy = jest.fn(); +/* Jasmine equality testers */ - expect(spy).lastReturnedWith("foo"); - expect(spy).nthReturnedWith(3, "foo"); - expect(spy).toHaveBeenCalled(); - expect(spy).toHaveBeenCalledTimes(7); - expect(spy).toHaveBeenCalledWith("foo"); - expect(spy).toHaveBeenLastCalledWith("foo"); - expect(spy).toHaveBeenNthCalledWith(3, "foo"); - expect(spy).toHaveReturned(); - expect(spy).toHaveReturnedTimes(7); - expect(spy).toHaveReturnedWith("foo"); - expect(spy).toHaveLastReturnedWith("foo"); - expect(spy).toHaveNthReturnedWith(3, "foo"); - expect(spy).toReturn(); - expect(spy).toReturnTimes(3); - expect(spy).toReturnWith("foo"); -}); +const equalityTesterObject = (first: {}, second: {}) => false; +const equalityTesterString: jasmine.CustomEqualityTester = (first: string, second: string) => first === second; -describe('Extending extend', () => { - it('works', () => { - expect.extend({ - toBeNumber(received: any, actual: any) { - const pass = received === actual; - const message = - () => `expected ${received} ${pass ? 'not ' : ''} to be ${actual}`; - return { message, pass }; - }, - toBeVariadicMatcher(received: any, floor: number, ceiling: number) { - const pass = received >= floor && received <= ceiling; - const message = - () => `expected ${received} ${pass ? 'not ' : ''} to be within range ${floor}-${ceiling}`; - 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); +jasmine.addCustomEqualityTester(equalityTesterObject); +jasmine.addCustomEqualityTester(equalityTesterObject); - 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', () => { - it('creates closures', () => { - class Closure { - private arg: T; - - constructor(private readonly fn: (arg: T) => void) { - this.fn = fn; - } - - bind(arg: T): void { - this.arg = arg; - } - - call(): void { - this.fn(this.arg); - } - } - - type StringClosure = (arg: string) => void; - const spy: jest.Mock = jest.fn(); - const 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 missing Mocks functionality', () => { - type FruitsGetter = () => string[]; - const 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(); - const thisMock: jest.Mock = jest.fn().mockReturnThis(); - expect(thisMock()).toBe(this); - }); - - it('async test with mockResolvedValue and mockResolvedValueOnce', async () => { - const asyncMock = jest - .fn() - .mockResolvedValue('default') - .mockResolvedValueOnce('first call') - .mockResolvedValueOnce('second call'); - - await asyncMock(); // first call - await asyncMock(); // second call - await asyncMock(); // default - await asyncMock(); // default - }); - - it('async test with mockRejectedValue', async () => { - const asyncMock = jest.fn().mockRejectedValue(new Error('Async error')); - - await asyncMock(); // throws "Async error" - }); - - it('async test with mockResolvedValueOnce and mockRejectedValueOnce', async () => { - const asyncMock = jest - .fn() - .mockResolvedValueOnce('first call') - .mockRejectedValueOnce(new Error('Async error')); - - await asyncMock(); // first call - await asyncMock(); // throws "Async error" - }); - - it('tests mock name functionality', () => { - const mock: jest.Mock = jest.fn(); - mock.mockName('Carrot'); - expect(mock.getMockName()).toBe('Carrot'); - }); - - it('tests mock name functionality', () => { - const mock = spyOn(console, 'warn'); - expect(mock).toHaveBeenCalled(); - }); - - it('creates snapshoter', () => { - 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', () => { - jest.useRealTimers(); - setTimeout(() => expect(1).not.toEqual(0), 3000); - jest.runOnlyPendingTimers().runTimersToTime(300); - }); - - it('runs all timers', () => { - jest.clearAllTimers(); - jest.useFakeTimers(); - setTimeout(() => expect(0).not.toEqual(1), 3000); - jest.runAllTimers(); - }); - - it('cleares cache', () => { - const sum1 = require('../sum'); - jest.resetModules(); - const sum2 = require('../sum'); - expect(sum1).not.toBe(sum2); - }); -}); - -describe('toMatchSnapshot', () => { - it('compares snapshots', () => { - expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot(); - }); - - it('can give name to snapshot', () => { - expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot('given name'); - }); -}); - -describe('toThrowErrorMatchingSnapshot', () => { - it('compares snapshots', () => { - expect(() => { throw new Error('descriptiton'); }).toThrowErrorMatchingSnapshot(); - }); -}); - -const testSerializerPluginString = "set by testSerializerPlugin"; -let testSerializerPluginCallCount = 0; -expect.addSnapshotSerializer({ - print(val, serialize, indent, opts, colors) { - val.willOverwrite = testSerializerPluginString; - testSerializerPluginCallCount += 1; - return 'plugin called: ' + serialize(val.willOverwrite); - }, - test(val) { - return val && val.willOverwrite && val.willOverwrite !== testSerializerPluginString; - }, -}); -describe('addSnapshotSerializer', () => { - it('the plugin does its work', () => { - testSerializerPluginCallCount = 0; - expect({ willOverwrite: { x: 1, y: 2, } }).toMatchSnapshot(); - expect({ willOverwrite: "this will get overwritten by testSerializerPlugin" }).toMatchSnapshot(); - expect({ willOverwrite: "so will this" }).toMatchSnapshot(); - expect({ foo: "this will not" }).toMatchSnapshot(); - expect(testSerializerPluginCallCount).toBe(3); - }); -}); - -function testInstances() { - const mockFn = jest.fn<(...args: any[]) => any>(); - const a = new mockFn(); - const b = new mockFn(); - - mockFn.mock.instances[0] === a; // true - mockFn.mock.instances[1] === b; // true -} - -function testMockImplementation() { - const mockFn = jest.fn<(...args: any[]) => any>().mockImplementation((scalar: number): number => { - return 42 + scalar; - }); - - const a = mockFn(0); - const 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', () => { - // 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', () => { - it('does not complain when using done callback', (done) => { - done(); - }); -}); - -describe('beforeEach with timeout', () => { - beforeEach(() => { - // this shouldn't take more than a second - }, 1000); -}); - -class TestApi { - constructor() { } - testProp: boolean; - private readonly anotherProp: string; - testMethod(a: number): string { return ""; } -} - -declare function mockedFunc(a: number): string; - -declare function mockedFuncWithApi(api: TestApi): void; - -describe('Mocked type', () => { - it('Works', () => { - const mock: jest.Mocked = new TestApi() as any; - mock.testProp; - mock.testMethod.mockImplementation(() => 'test'); - mock.testMethod(5).toUpperCase(); - - mockedFuncWithApi(mock); - }); -}); - -describe('Mocks', () => { - it('jest.fn() without args is a function type', () => { - const test = jest.fn(); - test(); - new test(); - test.mock.instances[0]; - test.mockImplementation(() => { }); - }); - - it('jest.fn() with returned object infers type', () => { - 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); - }); - - it('jest.fn() accepts constructor arguments', () => { - interface TestLog { - log(...msg: any[]): void; - } - - class LogMock extends jest.fn((verbose?: boolean) => { - const mockLog = () => { - if (verbose) { - return jest.fn((...args) => { - const subj = args.shift() || ""; - console.log(subj, ...args); - }); - } - return jest.fn(); - }; +/* Jasmine matchers */ +const customMatcherFactoriesNone = {}; +const customMatcherFactoriesIndex: { [i: string]: jasmine.CustomMatcherFactory } = {}; +const customMatcherFactoriesManual = { + abc: () => ({ + compare: (actual: "", expected: "", ...args: Array<{}>) => ({ + pass: true, + message: "", + }), + }), + def: (util: jasmine.MatchersUtil, customEqualityTestesr: jasmine.CustomEqualityTester): jasmine.CustomMatcher => ({ + compare(actual: T, expected: T): jasmine.CustomMatcherResult { return { - log: mockLog() + pass: actual === expected, + message: () => "foo", }; - }) { - } + }, + }), +}; - const nonVerboseLog = new LogMock(); - nonVerboseLog.log("this is completely catched by jest"); - expect(nonVerboseLog.log).toBeCalledWith("this is completely catched by jest"); - const verboseLog = new LogMock(true); - verboseLog.log("this should also be printed to the console"); - expect(verboseLog.log).toBeCalledWith("this should also be printed to the console"); - }); -}); +const matchersUtil1 = { + buildFailureMessage: () => "", + contains: (haystack: string, needle: string) => haystack.indexOf(needle) !== -1, + equals: (a: {}, b: {}) => false, +}; -// https://facebook.github.io/jest/docs/en/expect.html#resolves -describe('resolves', () => { - it('unwraps the expected Promise', () => { - const expectation = expect(Promise.resolve('test')).resolves.toEqual('test'); - expect(expectation instanceof Promise).toBeTruthy(); - return expectation; - }); - - it('unwraps a .toHaveBeenCalledX', done => { - expect.assertions(2); - - const fn = jest.fn(); - return expect(Promise.resolve(fn)).resolves.toHaveBeenCalledTimes(0).then(val => { - expect(val).toEqual(true); - done(); - }); - }); - - it('unwraps a not.toHaveBeenCalledX', done => { - expect.assertions(2); - - const fn = jest.fn(); - return expect(Promise.resolve(fn)).resolves.not.toHaveBeenCalledTimes(1).then(val => { - expect(val).toEqual(true); - done(); - }); - }); -}); - -// https://facebook.github.io/jest/docs/en/expect.html#rejects -describe('rejects', () => { - it('unwraps the expected Promise', () => { - const expectation = expect(Promise.reject(new Error('error'))).rejects.toMatch('error'); - expect(expectation instanceof Promise).toBeTruthy(); - return expectation; - }); -}); - -// https://facebook.github.io/jest/docs/en/expect.html#tohavepropertykeypath-value -describe('toHaveProperty', () => { - it('it accepts a keyPath as string', () => { - expect({ a: { b: {}}}).toHaveProperty('a'); - }); - it('it accepts a keyPath as string with dot notation', () => { - expect({ a: { b: {}}}).toHaveProperty('a.b'); - }); - it('it accepts a keyPath as an array', () => { - expect({ a: { b: {}}}).toHaveProperty(['a', 'b']); - }); - it('it accepts a keyPath as an array containing non-string values', () => { - expect({ a: ['b']}).toHaveProperty(['a', 0]); - }); -}); - -class MyTransformer implements jest.Transformer { - process(text: string, path: string) { - return ` - // some comments - ${text} - `; - } -} - -class MyReporter implements jest.Reporter { - onRunStart() { - console.log('hello world'); - } -} - -declare const testResult: jest.TestResult; -const myTestRunner: jest.TestFramework = () => Promise.resolve(testResult); - -const testResultsProcessor: jest.TestResultsProcessor = result => ({...result, numFailedTests: 1}); - -// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18826 -test('moduleName 1', () => { - jest.doMock('../moduleName', () => { - return jest.fn(() => 1); - }); - const moduleName = require('../moduleName'); - expect(moduleName()).toEqual(1); -}); -test('moduleName 2', () => { - jest.doMock('../moduleName', () => { - return jest.fn(() => 2); - }); - const moduleName = require('../moduleName'); - expect(moduleName()).toEqual(2); -}); - -describe('toHaveBeenNthCalledWith', () => { - const fn = jest.fn(); - - expect(fn).toHaveBeenNthCalledWith(3, "foo"); -}); +let matchersUtil2: jasmine.MatchersUtil = { + buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string { + return `${matcherName}${isNot ? "1" : "0"}${actual}${expected.join("")}`; + }, + contains(haystack: T[], needle: T, customTesters?: jasmine.CustomEqualityTester[]) { + return true; + }, + equals: (a: {}, b: {}, customTesters?: jasmine.CustomEqualityTester[]) => false, +}; // Jest config -{ -interface JestConfigModule {defaults: jest.DefaultOptions; } -// tslint:disable-next-line:no-var-requires -const {defaults} = require('jest-config') as JestConfigModule; -const config: jest.InitialOptions = { - transform: { - '^.+\\.(ts|tsx)$': 'ts-jest' - }, - testMatch: [ - ...defaults.testMatch, - '**/__tests__/**/*.ts?(x)', - '**/?(*.)+(spec|test).ts?(x)' - ], - moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], - globals: { - 'ts-jest': {} - } +const testJestConfig = (defaults: jest.DefaultOptions) => { + const config: jest.InitialOptions = { + transform: { + '^.+\\.(ts|tsx)$': 'ts-jest' + }, + testMatch: [ + ...defaults.testMatch, + '**/__tests__/**/*.ts?(x)', + '**/?(*.)+(spec|test).ts?(x)' + ], + moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], + globals: { + 'ts-jest': {} + } + }; }; + +// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26368 + +describe.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a: number, b: number, expected: number) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); + } +); + +interface Case { + a: number; + b: number; + expected: number; } + +describe.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("$a + $b", ({ a, b, expected }: Case) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); +}); + +describe.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); + } +); + +describe.only.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("$a + $b", ({ a, b, expected }: Case) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); +}); + +describe.skip.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); + } +); + +describe.skip.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("$a + $b", ({ a, b, expected }: Case) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); +}); + +test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + expect(a + b).toBe(expected); + } +); + +test.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("returns $expected when $a is added $b", ({ a, b, expected }: Case) => { + expect(a + b).toBe(expected); +}); + +test.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + expect(a + b).toBe(expected); + } +); + +test.only.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("returns $expected when $a is added $b", ({ a, b, expected }: Case) => { + expect(a + b).toBe(expected); +}); diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 48e2a0327c..dbf60400b9 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for joi v13.0.1 +// Type definitions for joi v13.3.0 // Project: https://github.com/hapijs/joi // Definitions by: Bart van der Schoor // Laurence Dougal Myers @@ -12,6 +12,7 @@ // Anjun Wang // Rafael Kallis // Conan Lai +// Peter Thorson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -106,6 +107,13 @@ export interface EmailOptions { minDomainAtoms?: number; } +export interface HexOptions { + /** + * hex decoded representation must be byte aligned + */ + byteAligned: boolean; +} + export interface IpOptions { /** * One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture @@ -512,6 +520,11 @@ export interface NumberSchema extends AnySchema { * Requires the number to be negative. */ negative(): this; + + /** + * Requires the number to be a TCP port, so between 0 and 65535. + */ + port(): this; } export interface StringSchema extends AnySchema { @@ -624,7 +637,7 @@ export interface StringSchema extends AnySchema { /** * Requires the string value to be a valid hexadecimal string. */ - hex(): this; + hex(options?: HexOptions): this; /** * Requires the string value to be a valid hostname as per RFC1123. @@ -714,10 +727,15 @@ export interface ArraySchema extends AnySchema { export interface ObjectSchema extends AnySchema { /** - * Sets the allowed object keys. + * Sets or extends the allowed object keys. */ keys(schema?: SchemaMap): this; + /** + * Appends the allowed object keys. If schema is null, undefined, or {}, no changes will be applied. + */ + append(schema?: SchemaMap): this; + /** * Specifies the minimum number of keys in the object. */ @@ -966,7 +984,7 @@ export interface Rules

{ name: string; params?: ObjectSchema | {[key in keyof P]: SchemaLike; }; setup?(this: ExtensionBoundSchema, params: P): Schema | void; - validate?(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): Err | R; + validate?(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): any; description?: string | ((params: P) => string); } @@ -974,8 +992,8 @@ export interface Extension { name: string; base?: Schema; language?: LanguageOptions; - coerce?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): Err | R; - pre?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): Err | R; + coerce?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): any; + pre?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): any; describe?(this: Schema, description: Description): Description; rules?: Rules[]; } @@ -1101,10 +1119,13 @@ export function ref(key: string, options?: ReferenceOptions): Reference; export function isRef(ref: any): ref is Reference; /** - * Get a sub-schema of an existing schema based on a path. Path separator is a dot (.). + * Get a sub-schema of an existing schema based on a `path` that can be either a string or an array + * of strings For string values path separator is a dot (`.`) */ export function reach(schema: ObjectSchema, path: string): Schema; export function reach(schema: ObjectSchema, path: string): T; +export function reach(schema: ObjectSchema, path: string[]): Schema; +export function reach(schema: ObjectSchema, path: string[]): T; /** * Creates a new Joi instance customized with the extension(s) you provide included. diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 5ea9088a74..def9eaafd4 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -96,6 +96,12 @@ emailOpts = { minDomainAtoms: num }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- +let hexOpts: Joi.HexOptions = null; + +hexOpts = { byteAligned: bool }; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + let ipOpts: Joi.IpOptions = null; ipOpts = { version: str }; @@ -602,6 +608,7 @@ numSchema = numSchema.precision(num); numSchema = numSchema.multiple(num); numSchema = numSchema.positive(); numSchema = numSchema.negative(); +numSchema = numSchema.port(); namespace common { numSchema = numSchema.allow(x); @@ -659,6 +666,9 @@ objSchema = Joi.object(schemaMap); objSchema = objSchema.keys(); objSchema = objSchema.keys(schemaMap); +objSchema = objSchema.append(); +objSchema = objSchema.append(schemaMap); + objSchema = objSchema.min(num); objSchema = objSchema.max(num); objSchema = objSchema.length(num); @@ -801,6 +811,7 @@ strSchema = strSchema.guid(); strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions); strSchema = strSchema.guid({ version: 'uuidv4' }); strSchema = strSchema.hex(); +strSchema = strSchema.hex(hexOpts); strSchema = strSchema.hostname(); strSchema = strSchema.isoDate(); strSchema = strSchema.lowercase(); @@ -969,6 +980,7 @@ description = Joi.describe(schema); description = schema.describe(); schema = Joi.reach(objSchema, ''); +schema = Joi.reach(objSchema, []); const Joi2 = Joi.extend({ name: '', base: schema }); @@ -988,13 +1000,13 @@ const Joi3 = Joi.extend({ { name: 'asd', params: { - allowF: Joi.boolean().default(false), + allowFalse: Joi.boolean().default(false), }, setup(params) { - const fIsAllowed = params.allowF; + const fIsAllowed = params.allowFalse; }, - validate(params, value, state, options) { - if (value === 'asd' || params.allowF && value === 'asdf') { + validate(params, value: boolean, state, options) { + if (value || params.allowFalse && !value) { return value; } return this.createError('asd', { v: value }, state, options); diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index b0838f9a8d..68f6079b87 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -37,12 +37,10 @@ declare const $: JQueryStatic; // Used by JQuery.Event type _Event = Event; -// Used by JQuery.Promise3 and JQuery.Promise -type _Promise = Promise; -interface JQueryStatic { +interface JQueryStatic { /** - * @see {@link http://api.jquery.com/jquery.ajax/#jQuery-ajax1} + * @see \`{@link http://api.jquery.com/jquery.ajax/#jQuery-ajax1 }\` * @deprecated Use jQuery.ajaxSetup(options) */ ajaxSettings: JQuery.AjaxSettings; @@ -52,7 +50,7 @@ interface JQueryStatic { * any synchronous or asynchronous function. * * @param beforeStart A function that is called just before the constructor returns. - * @see {@link https://api.jquery.com/jQuery.Deferred/} + * @see \`{@link https://api.jquery.com/jQuery.Deferred/ }\` * @since 1.5 */ Deferred: JQuery.DeferredStatic; @@ -61,7 +59,7 @@ interface JQueryStatic { * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize * CSS property naming, or create custom properties. * - * @see {@link https://api.jquery.com/jQuery.cssHooks/} + * @see \`{@link https://api.jquery.com/jQuery.cssHooks/ }\` * @since 1.4.3 */ cssHooks: JQuery.PlainObject>; @@ -69,7 +67,7 @@ interface JQueryStatic { * An object containing all CSS properties that may be used without a unit. The .css() method uses this * object to see if it may append px to unitless values. * - * @see {@link https://api.jquery.com/jQuery.cssNumber/} + * @see \`{@link https://api.jquery.com/jQuery.cssNumber/ }\` * @since 1.4.3 */ cssNumber: JQuery.PlainObject; @@ -78,7 +76,7 @@ interface JQueryStatic { /** * The rate (in milliseconds) at which animations fire. * - * @see {@link https://api.jquery.com/jQuery.fx.interval/} + * @see \`{@link https://api.jquery.com/jQuery.fx.interval/ }\` * @since 1.4.3 * @deprecated 3.0 */ @@ -86,7 +84,7 @@ interface JQueryStatic { /** * Globally disable all animations. * - * @see {@link https://api.jquery.com/jQuery.fx.off/} + * @see \`{@link https://api.jquery.com/jQuery.fx.off/ }\` * @since 1.3 */ off: boolean; @@ -95,7 +93,7 @@ interface JQueryStatic { /** * A Promise-like object (or "thenable") that resolves when the document is ready. * - * @see {@link https://api.jquery.com/jQuery.ready/} + * @see \`{@link https://api.jquery.com/jQuery.ready/ }\` * @since 1.8 */ ready: JQuery.Thenable>; @@ -106,7 +104,7 @@ interface JQueryStatic { * needs, we strongly recommend the use of an external library such as Modernizr instead of dependency * on properties in jQuery.support. * - * @see {@link https://api.jquery.com/jQuery.support/} + * @see \`{@link https://api.jquery.com/jQuery.support/ }\` * @since 1.3 * @deprecated 1.9 */ @@ -119,7 +117,7 @@ interface JQueryStatic { * A string defining a single, standalone, HTML element (e.g.

or
). * @param ownerDocument_attributes A document in which the new elements will be created. * An object of attributes, events, and methods to call on the newly-created element. - * @see {@link https://api.jquery.com/jQuery/} + * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 * @since 1.4 */ @@ -129,7 +127,7 @@ interface JQueryStatic { * * @param selector A string containing a selector expression * @param context A DOM Element, Document, or jQuery to use as context - * @see {@link https://api.jquery.com/jQuery/} + * @see \`{@link https://api.jquery.com/jQuery/ }\` * @since 1.0 */ (selector: JQuery.Selector, context: Element | Document | JQuery | undefined): JQuery; @@ -137,28 +135,58 @@ interface JQueryStatic { // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function. (window: Window, discriminator: boolean): JQueryStatic; /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created + * by passing an HTML string. + * + * @param element_elementArray A DOM element to wrap in a jQuery object. + * An array containing a set of DOM elements to wrap in a jQuery object. + * @see {@link https://api.jquery.com/jQuery/} + * @since 1.0 + */ + (element_elementArray: T | ArrayLike): JQuery; + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created + * by passing an HTML string. + * + * @param selection An existing jQuery object to clone. + * @see {@link https://api.jquery.com/jQuery/} + * @since 1.0 + */ + (selection: JQuery): JQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * * Creates DOM elements on the fly from the provided string of raw HTML. * * Binds a function to be executed when the DOM has finished loading. * * @param selector_object_callback A string containing a selector expression - * A DOM element to wrap in a jQuery object. - * An array containing a set of DOM elements to wrap in a jQuery object. - * A plain object to wrap in a jQuery object. - * An existing jQuery object to clone. + * A string of HTML to create on the fly. Note that this parses HTML, not XML. * The function to execute when the DOM is ready. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + */ + (selector_object_callback: JQuery.Selector | JQuery.htmlString | ((this: Document, $: JQueryStatic) => void)): JQuery; // tslint:disable-line:unified-signatures + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. + * + * @param object A plain object to wrap in a jQuery object. * @see {@link https://api.jquery.com/jQuery/} * @since 1.0 + */ + (object: T): JQuery; + /** + * Returns an empty jQuery set. + * + * @see {@link https://api.jquery.com/jQuery/} * @since 1.4 */ - (selector_object_callback?: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery | - JQuery.PlainObject | Window | - ((this: Document, $: JQueryStatic) => void)): JQuery; + (): JQuery; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. * * @param flags An optional list of space-separated flags that change how the callback list behaves. - * @see {@link https://api.jquery.com/jQuery.Callbacks/} + * @see \`{@link https://api.jquery.com/jQuery.Callbacks/ }\` * @since 1.7 */ Callbacks(flags?: string): JQuery.Callbacks; @@ -168,7 +196,7 @@ interface JQueryStatic { * @param url A string containing the URL to which the request is sent. * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can * be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings. - * @see {@link https://api.jquery.com/jQuery.ajax/} + * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` * @since 1.5 */ ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR; @@ -177,7 +205,7 @@ interface JQueryStatic { * * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can * be set for any option with $.ajaxSetup(). - * @see {@link https://api.jquery.com/jQuery.ajax/} + * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` * @since 1.0 */ ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR; @@ -187,7 +215,7 @@ interface JQueryStatic { * * @param dataTypes An optional string containing one or more space-separated dataTypes * @param handler A handler to set default values for future Ajax requests. - * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} + * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` * @since 1.5 */ ajaxPrefilter(dataTypes: string, @@ -197,7 +225,7 @@ interface JQueryStatic { * are processed by $.ajax(). * * @param handler A handler to set default values for future Ajax requests. - * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} + * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` * @since 1.5 */ ajaxPrefilter(handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; @@ -205,7 +233,7 @@ interface JQueryStatic { * Set default values for future Ajax requests. Its use is not recommended. * * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - * @see {@link https://api.jquery.com/jQuery.ajaxSetup/} + * @see \`{@link https://api.jquery.com/jQuery.ajaxSetup/ }\` * @since 1.1 */ ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings; @@ -214,7 +242,7 @@ interface JQueryStatic { * * @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/} + * @see \`{@link https://api.jquery.com/jQuery.ajaxTransport/ }\` * @since 1.5 */ ajaxTransport(dataType: string, @@ -228,7 +256,7 @@ interface JQueryStatic { * * @param container The DOM element that may contain the other element. * @param contained The DOM element that may be contained by (a descendant of) the other element. - * @see {@link https://api.jquery.com/jQuery.contains/} + * @see \`{@link https://api.jquery.com/jQuery.contains/ }\` * @since 1.4 */ contains(container: Element, contained: Element): boolean; @@ -239,7 +267,7 @@ interface JQueryStatic { * * @param element The DOM element to query for the data. * @param key Name of the data stored. - * @see {@link https://api.jquery.com/jQuery.data/} + * @see \`{@link https://api.jquery.com/jQuery.data/ }\` * @since 1.2.3 */ data(element: Element, key: string, undefined: undefined): any; // tslint:disable-line:unified-signatures @@ -249,7 +277,7 @@ interface JQueryStatic { * @param element The DOM element to associate with the data. * @param key A string naming the piece of data to set. * @param value The new data value; this can be any Javascript type except undefined. - * @see {@link https://api.jquery.com/jQuery.data/} + * @see \`{@link https://api.jquery.com/jQuery.data/ }\` * @since 1.2.3 */ data(element: Element, key: string, value: T): T; @@ -259,7 +287,7 @@ interface JQueryStatic { * * @param element The DOM element to query for the data. * @param key Name of the data stored. - * @see {@link https://api.jquery.com/jQuery.data/} + * @see \`{@link https://api.jquery.com/jQuery.data/ }\` * @since 1.2.3 * @since 1.4 */ @@ -269,7 +297,7 @@ interface JQueryStatic { * * @param element A DOM element from which to remove and execute a queued function. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/jQuery.dequeue/} + * @see \`{@link https://api.jquery.com/jQuery.dequeue/ }\` * @since 1.3 */ dequeue(element: Element, queueName?: string): void; @@ -280,7 +308,7 @@ interface JQueryStatic { * * @param array The array to iterate over. * @param callback The function that will be executed on every object. - * @see {@link https://api.jquery.com/jQuery.each/} + * @see \`{@link https://api.jquery.com/jQuery.each/ }\` * @since 1.0 */ each(array: ArrayLike, callback: (this: T, indexInArray: number, value: T) => false | any): ArrayLike; @@ -291,7 +319,7 @@ interface JQueryStatic { * * @param obj The object to iterate over. * @param callback The function that will be executed on every object. - * @see {@link https://api.jquery.com/jQuery.each/} + * @see \`{@link https://api.jquery.com/jQuery.each/ }\` * @since 1.0 */ each(obj: T, callback: (this: T[K], propertyName: K, valueOfProperty: T[K]) => false | any): T; @@ -299,7 +327,7 @@ interface JQueryStatic { * Takes a string and throws an exception containing it. * * @param message The message to send out. - * @see {@link https://api.jquery.com/jQuery.error/} + * @see \`{@link https://api.jquery.com/jQuery.error/ }\` * @since 1.4.1 */ error(message: string): any; @@ -307,7 +335,7 @@ interface JQueryStatic { * Escapes any character that has a special meaning in a CSS selector. * * @param selector A string containing a selector expression to escape. - * @see {@link https://api.jquery.com/jQuery.escapeSelector/} + * @see \`{@link https://api.jquery.com/jQuery.escapeSelector/ }\` * @since 3.0 */ escapeSelector(selector: JQuery.Selector): JQuery.Selector; @@ -316,7 +344,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; @@ -325,7 +353,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; @@ -334,7 +362,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; @@ -343,7 +371,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W; @@ -352,7 +380,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: T, object1: U, object2: V): T & U & V; @@ -361,7 +389,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: T, object1: U): T & U; @@ -370,7 +398,7 @@ interface JQueryStatic { * * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. * @param target The object to extend. It will receive the new properties. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.1.4 */ extend(deep: true, target: any, object1: any, ...objects: any[]): any; @@ -379,7 +407,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; @@ -388,7 +416,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; @@ -397,7 +425,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; @@ -406,7 +434,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: T, object1: U, object2: V, object3: W): T & U & V & W; @@ -415,7 +443,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: T, object1: U, object2: V): T & U & V; @@ -424,7 +452,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: T, object1: U): T & U; @@ -433,7 +461,7 @@ interface JQueryStatic { * * @param target An object that will receive the new properties if additional objects are passed in or that will * extend the jQuery namespace if it is the sole argument. - * @see {@link https://api.jquery.com/jQuery.extend/} + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` * @since 1.0 */ extend(target: any, object1: any, ...objects: any[]): any; @@ -445,7 +473,7 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but * you can use null or jQuery.noop as a placeholder. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see {@link https://api.jquery.com/jQuery.get/} + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` * @since 1.0 */ get(url: string, @@ -459,7 +487,7 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but * you can use null or jQuery.noop as a placeholder. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see {@link https://api.jquery.com/jQuery.get/} + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` * @since 1.0 */ get(url: string, @@ -472,7 +500,7 @@ interface JQueryStatic { * @param success_data A callback function that is executed if the request succeeds. Required if dataType is provided, but * you can use null or jQuery.noop as a placeholder. * A plain object or string that is sent to the server with the request. - * @see {@link https://api.jquery.com/jQuery.get/} + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` * @since 1.0 */ get(url: string, @@ -484,7 +512,7 @@ interface JQueryStatic { * A set of key/value pairs that configure the Ajax request. All properties except for url are * optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a * complete list of all settings. The type option will automatically be set to GET. - * @see {@link https://api.jquery.com/jQuery.get/} + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` * @since 1.0 * @since 1.12 * @since 2.2 @@ -496,7 +524,7 @@ interface JQueryStatic { * @param url A string containing the URL to which the request is sent. * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. - * @see {@link https://api.jquery.com/jQuery.getJSON/} + * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\` * @since 1.0 */ getJSON(url: string, @@ -508,7 +536,7 @@ interface JQueryStatic { * @param url A string containing the URL to which the request is sent. * @param success_data A callback function that is executed if the request succeeds. * A plain object or string that is sent to the server with the request. - * @see {@link https://api.jquery.com/jQuery.getJSON/} + * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\` * @since 1.0 */ getJSON(url: string, @@ -518,7 +546,7 @@ interface JQueryStatic { * * @param url A string containing the URL to which the request is sent. * @param success A callback function that is executed if the request succeeds. - * @see {@link https://api.jquery.com/jQuery.getScript/} + * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\` * @since 1.0 */ getScript(url: string, @@ -527,7 +555,7 @@ interface JQueryStatic { * Execute some JavaScript code globally. * * @param code The JavaScript code to execute. - * @see {@link https://api.jquery.com/jQuery.globalEval/} + * @see \`{@link https://api.jquery.com/jQuery.globalEval/ }\` * @since 1.0.4 */ globalEval(code: string): void; @@ -540,7 +568,7 @@ interface JQueryStatic { * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements * for which "callback" returns true. If "invert" is true, then the function returns an array * consisting of all elements for which "callback" returns false. - * @see {@link https://api.jquery.com/jQuery.grep/} + * @see \`{@link https://api.jquery.com/jQuery.grep/ }\` * @since 1.0 */ grep(array: ArrayLike, @@ -550,7 +578,7 @@ interface JQueryStatic { * Determine whether an element has any jQuery data associated with it. * * @param element A DOM element to be checked for data. - * @see {@link https://api.jquery.com/jQuery.hasData/} + * @see \`{@link https://api.jquery.com/jQuery.hasData/ }\` * @since 1.5 */ hasData(element: Element): boolean; @@ -558,7 +586,7 @@ interface JQueryStatic { * Holds or releases the execution of jQuery's ready event. * * @param hold Indicates whether the ready hold is being requested or released - * @see {@link https://api.jquery.com/jQuery.holdReady/} + * @see \`{@link https://api.jquery.com/jQuery.holdReady/ }\` * @since 1.6 * @deprecated 3.2 */ @@ -567,7 +595,7 @@ interface JQueryStatic { * Modify and filter HTML strings passed through jQuery manipulation methods. * * @param html The HTML string on which to operate. - * @see {@link https://api.jquery.com/jQuery.htmlPrefilter/} + * @see \`{@link https://api.jquery.com/jQuery.htmlPrefilter/ }\` * @since 1.12/2.2 */ htmlPrefilter(html: JQuery.htmlString): JQuery.htmlString; @@ -577,7 +605,7 @@ interface JQueryStatic { * @param value The value to search for. * @param array An array through which to search. * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array. - * @see {@link https://api.jquery.com/jQuery.inArray/} + * @see \`{@link https://api.jquery.com/jQuery.inArray/ }\` * @since 1.2 */ inArray(value: T, array: T[], fromIndex?: number): number; @@ -585,7 +613,7 @@ interface JQueryStatic { * Determine whether the argument is an array. * * @param obj Object to test whether or not it is an array. - * @see {@link https://api.jquery.com/jQuery.isArray/} + * @see \`{@link https://api.jquery.com/jQuery.isArray/ }\` * @since 1.3 * @deprecated 3.2 */ @@ -594,7 +622,7 @@ interface JQueryStatic { * Check to see if an object is empty (contains no enumerable properties). * * @param obj The object that will be checked to see if it's empty. - * @see {@link https://api.jquery.com/jQuery.isEmptyObject/} + * @see \`{@link https://api.jquery.com/jQuery.isEmptyObject/ }\` * @since 1.4 */ isEmptyObject(obj: any): boolean; @@ -602,7 +630,7 @@ interface JQueryStatic { * Determine if the argument passed is a JavaScript function object. * * @param obj Object to test whether or not it is a function. - * @see {@link https://api.jquery.com/jQuery.isFunction/} + * @see \`{@link https://api.jquery.com/jQuery.isFunction/ }\` * @since 1.2 * @deprecated 3.3 */ @@ -611,7 +639,7 @@ interface JQueryStatic { * Determines whether its argument represents a JavaScript number. * * @param value The value to be tested. - * @see {@link https://api.jquery.com/jQuery.isNumeric/} + * @see \`{@link https://api.jquery.com/jQuery.isNumeric/ }\` * @since 1.7 * @deprecated 3.3 */ @@ -620,7 +648,7 @@ interface JQueryStatic { * Check to see if an object is a plain object (created using "{}" or "new Object"). * * @param obj The object that will be checked to see if it's a plain object. - * @see {@link https://api.jquery.com/jQuery.isPlainObject/} + * @see \`{@link https://api.jquery.com/jQuery.isPlainObject/ }\` * @since 1.4 */ isPlainObject(obj: any): obj is JQuery.PlainObject; @@ -628,7 +656,7 @@ interface JQueryStatic { * Determine whether the argument is a window. * * @param obj Object to test whether or not it is a window. - * @see {@link https://api.jquery.com/jQuery.isWindow/} + * @see \`{@link https://api.jquery.com/jQuery.isWindow/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -637,7 +665,7 @@ interface JQueryStatic { * Check to see if a DOM node is within an XML document (or is an XML document). * * @param node The DOM node that will be checked to see if it's in an XML document. - * @see {@link https://api.jquery.com/jQuery.isXMLDoc/} + * @see \`{@link https://api.jquery.com/jQuery.isXMLDoc/ }\` * @since 1.1.4 */ isXMLDoc(node: Node): boolean; @@ -645,7 +673,7 @@ interface JQueryStatic { * Convert an array-like object into a true JavaScript array. * * @param obj Any object to turn into a native Array. - * @see {@link https://api.jquery.com/jQuery.makeArray/} + * @see \`{@link https://api.jquery.com/jQuery.makeArray/ }\` * @since 1.2 */ makeArray(obj: ArrayLike): T[]; @@ -656,10 +684,10 @@ interface JQueryStatic { * @param callback The function to process each item against. The first argument to the function is the array item, the * second argument is the index in array The function can return any value. A returned array will be * flattened into the resulting array. Within the function, this refers to the global (window) object. - * @see {@link https://api.jquery.com/jQuery.map/} + * @see \`{@link https://api.jquery.com/jQuery.map/ }\` * @since 1.0 */ - map(array: T[], callback: (elementOfArray: T, indexInArray: number) => R): R[]; + map(array: T[], callback: (this: Window, elementOfArray: T, indexInArray: number) => JQuery.TypeOrArray | null | undefined): TReturn[]; /** * Translate all items in an array or object to new array of items. * @@ -668,16 +696,16 @@ interface JQueryStatic { * second argument is the key of the object property. The function can return any value to add to the * array. A returned array will be flattened into the resulting array. Within the function, this refers * to the global (window) object. - * @see {@link https://api.jquery.com/jQuery.map/} + * @see \`{@link https://api.jquery.com/jQuery.map/ }\` * @since 1.6 */ - map(obj: T, callback: (propertyOfObject: T[K], key: K) => R): R[]; + map(obj: T, callback: (this: Window, propertyOfObject: T[K], key: K) => JQuery.TypeOrArray | null | undefined): TReturn[]; /** * Merge the contents of two arrays together into the first array. * * @param first The first array-like object to merge, the elements of second added. * @param second The second array-like object to merge into the first, unaltered. - * @see {@link https://api.jquery.com/jQuery.merge/} + * @see \`{@link https://api.jquery.com/jQuery.merge/ }\` * @since 1.0 */ merge(first: ArrayLike, second: ArrayLike): Array; @@ -685,21 +713,21 @@ interface JQueryStatic { * Relinquish jQuery's control of the $ variable. * * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). - * @see {@link https://api.jquery.com/jQuery.noConflict/} + * @see \`{@link https://api.jquery.com/jQuery.noConflict/ }\` * @since 1.0 */ noConflict(removeAll?: boolean): this; /** * An empty function. * - * @see {@link https://api.jquery.com/jQuery.noop/} + * @see \`{@link https://api.jquery.com/jQuery.noop/ }\` * @since 1.4 */ noop(): undefined; /** * Return a number representing the current time. * - * @see {@link https://api.jquery.com/jQuery.now/} + * @see \`{@link https://api.jquery.com/jQuery.now/ }\` * @since 1.4.3 * @deprecated 3.3 Use Date.now(). */ @@ -711,7 +739,7 @@ interface JQueryStatic { * * @param obj An array, a plain object, or a jQuery object to serialize. * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - * @see {@link https://api.jquery.com/jQuery.param/} + * @see \`{@link https://api.jquery.com/jQuery.param/ }\` * @since 1.2 * @since 1.4 */ @@ -722,7 +750,7 @@ interface JQueryStatic { * @param data HTML string to be parsed * @param context Document element to serve as the context in which the HTML fragment will be created * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - * @see {@link https://api.jquery.com/jQuery.parseHTML/} + * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\` * @since 1.8 */ parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): JQuery.Node[]; @@ -732,7 +760,7 @@ interface JQueryStatic { * @param data HTML string to be parsed * @param context_keepScripts Document element to serve as the context in which the HTML fragment will be created * A Boolean indicating whether to include scripts passed in the HTML string - * @see {@link https://api.jquery.com/jQuery.parseHTML/} + * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\` * @since 1.8 */ parseHTML(data: string, context_keepScripts?: Document | null | boolean): JQuery.Node[]; @@ -740,7 +768,7 @@ interface JQueryStatic { * Takes a well-formed JSON string and returns the resulting JavaScript value. * * @param json The JSON string to parse. - * @see {@link https://api.jquery.com/jQuery.parseJSON/} + * @see \`{@link https://api.jquery.com/jQuery.parseJSON/ }\` * @since 1.4.1 * @deprecated 3.0 */ @@ -749,7 +777,7 @@ interface JQueryStatic { * Parses a string into an XML document. * * @param data a well-formed XML string to be parsed - * @see {@link https://api.jquery.com/jQuery.parseXML/} + * @see \`{@link https://api.jquery.com/jQuery.parseXML/ }\` * @since 1.5 */ parseXML(data: string): XMLDocument; @@ -761,7 +789,7 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but * can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see {@link https://api.jquery.com/jQuery.post/} + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` * @since 1.0 */ post(url: string, @@ -775,7 +803,7 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but * can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see {@link https://api.jquery.com/jQuery.post/} + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` * @since 1.0 */ post(url: string, @@ -788,7 +816,7 @@ interface JQueryStatic { * @param success_data A callback function that is executed if the request succeeds. Required if dataType is provided, but * can be null in that case. * A plain object or string that is sent to the server with the request. - * @see {@link https://api.jquery.com/jQuery.post/} + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` * @since 1.0 */ post(url: string, @@ -800,7 +828,7 @@ interface JQueryStatic { * A set of key/value pairs that configure the Ajax request. All properties except for url are * optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a * complete list of all settings. Type will automatically be set to POST. - * @see {@link https://api.jquery.com/jQuery.post/} + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` * @since 1.0 * @since 1.12 * @since 2.2 @@ -820,7 +848,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -833,7 +861,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -846,7 +874,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -859,7 +887,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -872,7 +900,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -885,7 +913,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -898,7 +926,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4` * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -912,7 +940,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -928,7 +956,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -943,7 +971,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -958,7 +986,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -973,7 +1001,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -988,7 +1016,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1003,7 +1031,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1018,7 +1046,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1033,7 +1061,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1050,7 +1078,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1065,7 +1093,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1080,7 +1108,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1095,7 +1123,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1110,7 +1138,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1125,7 +1153,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1140,7 +1168,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1155,7 +1183,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1172,7 +1200,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1187,7 +1215,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1202,7 +1230,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1217,7 +1245,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1232,7 +1260,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1247,7 +1275,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1262,7 +1290,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1277,7 +1305,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1294,7 +1322,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1309,7 +1337,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1324,7 +1352,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1339,7 +1367,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1354,7 +1382,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1369,7 +1397,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1384,7 +1412,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1399,7 +1427,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1416,7 +1444,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1431,7 +1459,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1446,7 +1474,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1461,7 +1489,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1476,7 +1504,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1491,7 +1519,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1506,7 +1534,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1521,7 +1549,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1538,7 +1566,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1553,7 +1581,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1568,7 +1596,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1583,7 +1611,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1598,7 +1626,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1613,7 +1641,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1628,7 +1656,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1643,7 +1671,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1660,7 +1688,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1675,7 +1703,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1690,7 +1718,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1705,7 +1733,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1720,7 +1748,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1735,7 +1763,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1750,7 +1778,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1765,7 +1793,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1785,7 +1813,7 @@ interface JQueryStatic { * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.9 * @deprecated 3.3 Use Function#bind. */ @@ -1808,7 +1836,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1823,7 +1851,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1838,7 +1866,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1853,7 +1881,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1868,7 +1896,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1883,7 +1911,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1898,7 +1926,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4` * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1913,7 +1941,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1931,7 +1959,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1948,7 +1976,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1965,7 +1993,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1982,7 +2010,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -1999,7 +2027,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2016,7 +2044,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2033,7 +2061,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2050,7 +2078,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2069,7 +2097,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2086,7 +2114,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2103,7 +2131,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2120,7 +2148,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2137,7 +2165,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2154,7 +2182,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2171,7 +2199,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2188,7 +2216,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2207,7 +2235,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2224,7 +2252,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2241,7 +2269,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2258,7 +2286,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2275,7 +2303,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2292,7 +2320,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2309,7 +2337,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2326,7 +2354,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2345,7 +2373,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2362,7 +2390,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2379,7 +2407,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2396,7 +2424,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2413,7 +2441,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2430,7 +2458,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2447,7 +2475,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2464,7 +2492,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2483,7 +2511,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2500,7 +2528,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2517,7 +2545,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2534,7 +2562,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2551,7 +2579,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2568,7 +2596,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2585,7 +2613,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2602,7 +2630,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2621,7 +2649,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2638,7 +2666,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2655,7 +2683,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2672,7 +2700,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2689,7 +2717,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2706,7 +2734,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2723,7 +2751,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2740,7 +2768,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2759,7 +2787,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2776,7 +2804,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2793,7 +2821,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2810,7 +2838,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2827,7 +2855,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2844,7 +2872,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2861,7 +2889,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2878,7 +2906,7 @@ interface JQueryStatic { * * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2900,7 +2928,7 @@ interface JQueryStatic { * @param fn The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2922,7 +2950,7 @@ interface JQueryStatic { * @param context The object to which the context of the function should be set. * @param name The name of the function whose context will be changed (should be a property of the context object). * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. - * @see {@link https://api.jquery.com/jQuery.proxy/} + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` * @since 1.4 * @since 1.6 * @deprecated 3.3 Use Function#bind. @@ -2942,7 +2970,7 @@ interface JQueryStatic { * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param newQueue The new function to add to the queue. * An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/jQuery.queue/} + * @see \`{@link https://api.jquery.com/jQuery.queue/ }\` * @since 1.3 */ queue(element: T, queueName?: string, newQueue?: JQuery.TypeOrArray>): JQuery.Queue; @@ -2950,7 +2978,7 @@ interface JQueryStatic { * Handles errors thrown synchronously in functions wrapped in jQuery(). * * @param error An error thrown in the function wrapped in jQuery(). - * @see {@link https://api.jquery.com/jQuery.readyException/} + * @see \`{@link https://api.jquery.com/jQuery.readyException/ }\` * @since 3.1 */ readyException(error: Error): any; @@ -2959,7 +2987,7 @@ interface JQueryStatic { * * @param element A DOM element from which to remove data. * @param name A string naming the piece of data to remove. - * @see {@link https://api.jquery.com/jQuery.removeData/} + * @see \`{@link https://api.jquery.com/jQuery.removeData/ }\` * @since 1.2.3 */ removeData(element: Element, name?: string): void; @@ -2969,7 +2997,7 @@ interface JQueryStatic { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/jQuery.speed/} + * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` * @since 1.1 */ speed(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; @@ -2979,7 +3007,7 @@ interface JQueryStatic { * @param duration A string or number determining how long the animation will run. * @param easing_complete A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/jQuery.speed/} + * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` * @since 1.0 * @since 1.1 */ @@ -2990,7 +3018,7 @@ interface JQueryStatic { * * @param duration_complete_settings A string or number determining how long the animation will run. * A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/jQuery.speed/} + * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` * @since 1.0 * @since 1.1 */ @@ -2999,7 +3027,7 @@ interface JQueryStatic { * Remove the whitespace from the beginning and end of a string. * * @param str The string to trim. - * @see {@link https://api.jquery.com/jQuery.trim/} + * @see \`{@link https://api.jquery.com/jQuery.trim/ }\` * @since 1.0 */ trim(str: string): string; @@ -3007,7 +3035,7 @@ interface JQueryStatic { * Determine the internal JavaScript [[Class]] of an object. * * @param obj Object to get the internal JavaScript [[Class]] of. - * @see {@link https://api.jquery.com/jQuery.type/} + * @see \`{@link https://api.jquery.com/jQuery.type/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3017,7 +3045,7 @@ interface JQueryStatic { * arrays of DOM elements, not strings or numbers. * * @param array The Array of DOM elements. - * @see {@link https://api.jquery.com/jQuery.unique/} + * @see \`{@link https://api.jquery.com/jQuery.unique/ }\` * @since 1.1.3 * @deprecated 3.0 */ @@ -3027,7 +3055,7 @@ interface JQueryStatic { * arrays of DOM elements, not strings or numbers. * * @param array The Array of DOM elements. - * @see {@link https://api.jquery.com/jQuery.uniqueSort/} + * @see \`{@link https://api.jquery.com/jQuery.uniqueSort/ }\` * @since 1.12 * @since 2.2 */ @@ -3036,7 +3064,7 @@ interface JQueryStatic { * Provides a way to execute callback functions based on zero or more Thenable objects, usually * Deferred objects that represent asynchronous events. * - * @see {@link https://api.jquery.com/jQuery.when/} + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` * @since 1.5 */ when { * Provides a way to execute callback functions based on zero or more Thenable objects, usually * Deferred objects that represent asynchronous events. * - * @see {@link https://api.jquery.com/jQuery.when/} + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` * @since 1.5 */ when { * Provides a way to execute callback functions based on zero or more Thenable objects, usually * Deferred objects that represent asynchronous events. * - * @see {@link https://api.jquery.com/jQuery.when/} + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` * @since 1.5 */ when { * Provides a way to execute callback functions based on zero or more Thenable objects, usually * Deferred objects that represent asynchronous events. * - * @see {@link https://api.jquery.com/jQuery.when/} + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` * @since 1.5 */ when(deferred: JQuery.Promise | JQuery.Thenable | TR1): JQuery.Promise; @@ -3083,7 +3111,7 @@ interface JQueryStatic { * Deferred objects that represent asynchronous events. * * @param deferreds Zero or more Thenable objects. - * @see {@link https://api.jquery.com/jQuery.when/} + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` * @since 1.5 */ when(...deferreds: Array | JQuery.Thenable | TR1>): JQuery.Promise; @@ -3092,24 +3120,24 @@ interface JQueryStatic { * Deferred objects that represent asynchronous events. * * @param deferreds Zero or more Thenable objects. - * @see {@link https://api.jquery.com/jQuery.when/} + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` * @since 1.5 */ when(...deferreds: any[]): JQuery.Promise; } -interface JQuery extends Iterable { +interface JQuery extends Iterable { /** * A string containing the jQuery version number. * - * @see {@link https://api.jquery.com/jquery/} + * @see \`{@link https://api.jquery.com/jquery/ }\` * @since 1.0 */ jquery: string; /** * The number of elements in the jQuery object. * - * @see {@link https://api.jquery.com/length/} + * @see \`{@link https://api.jquery.com/length/ }\` * @since 1.0 */ length: number; @@ -3119,7 +3147,7 @@ interface JQuery extends Iterable * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. * @param context The point in the document at which the selector should begin matching; similar to the context * argument of the $(selector, context) method. - * @see {@link https://api.jquery.com/add/} + * @see \`{@link https://api.jquery.com/add/ }\` * @since 1.4 */ add(selector: JQuery.Selector, context: Element): this; @@ -3130,7 +3158,7 @@ interface JQuery extends Iterable * One or more elements to add to the set of matched elements. * An HTML fragment to add to the set of matched elements. * An existing jQuery object to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/} + * @see \`{@link https://api.jquery.com/add/ }\` * @since 1.0 * @since 1.3.2 */ @@ -3139,7 +3167,7 @@ interface JQuery extends Iterable * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. * * @param selector A string containing a selector expression to match the current set of elements against. - * @see {@link https://api.jquery.com/addBack/} + * @see \`{@link https://api.jquery.com/addBack/ }\` * @since 1.8 */ addBack(selector?: JQuery.Selector): this; @@ -3151,7 +3179,7 @@ interface JQuery extends Iterable * A function returning one or more space-separated class names to be added to the existing class * name(s). Receives the index position of the element in the set and the existing class name(s) as * arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/addClass/} + * @see \`{@link https://api.jquery.com/addClass/ }\` * @since 1.0 * @since 1.4 * @since 3.3 @@ -3162,7 +3190,7 @@ interface JQuery extends Iterable * * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or * jQuery objects to insert after each element in the set of matched elements. - * @see {@link https://api.jquery.com/after/} + * @see \`{@link https://api.jquery.com/after/ }\` * @since 1.0 */ after(...contents: Array>>): this; @@ -3173,7 +3201,7 @@ interface JQuery extends Iterable * after each element in the set of matched elements. Receives the index position of the element in the * set and the old HTML value of the element as arguments. Within the function, this refers to the * current element in the set. - * @see {@link https://api.jquery.com/after/} + * @see \`{@link https://api.jquery.com/after/ }\` * @since 1.4 * @since 1.10 */ @@ -3182,7 +3210,7 @@ interface JQuery extends Iterable * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. * * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxComplete/} + * @see \`{@link https://api.jquery.com/ajaxComplete/ }\` * @since 1.0 */ ajaxComplete(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; @@ -3190,7 +3218,7 @@ interface JQuery extends Iterable * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. * * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxError/} + * @see \`{@link https://api.jquery.com/ajaxError/ }\` * @since 1.0 */ ajaxError(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this; @@ -3198,7 +3226,7 @@ interface JQuery extends Iterable * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. * * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxSend/} + * @see \`{@link https://api.jquery.com/ajaxSend/ }\` * @since 1.0 */ ajaxSend(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; @@ -3206,7 +3234,7 @@ interface JQuery extends Iterable * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. * * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxStart/} + * @see \`{@link https://api.jquery.com/ajaxStart/ }\` * @since 1.0 */ ajaxStart(handler: (this: Document) => void | false): this; @@ -3214,7 +3242,7 @@ interface JQuery extends Iterable * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. * * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxStop/} + * @see \`{@link https://api.jquery.com/ajaxStop/ }\` * @since 1.0 */ ajaxStop(handler: (this: Document) => void | false): this; @@ -3222,7 +3250,7 @@ interface JQuery extends Iterable * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. * * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxSuccess/} + * @see \`{@link https://api.jquery.com/ajaxSuccess/ }\` * @since 1.0 */ ajaxSuccess(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this; @@ -3233,7 +3261,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/animate/} + * @see \`{@link https://api.jquery.com/animate/ }\` * @since 1.0 */ animate(properties: JQuery.PlainObject, @@ -3247,7 +3275,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/animate/} + * @see \`{@link https://api.jquery.com/animate/ }\` * @since 1.0 */ animate(properties: JQuery.PlainObject, @@ -3258,7 +3286,7 @@ interface JQuery extends Iterable * * @param properties An object of CSS properties and values that the animation will move toward. * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/animate/} + * @see \`{@link https://api.jquery.com/animate/ }\` * @since 1.0 */ animate(properties: JQuery.PlainObject, @@ -3268,7 +3296,7 @@ interface JQuery extends Iterable * * @param properties An object of CSS properties and values that the animation will move toward. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/animate/} + * @see \`{@link https://api.jquery.com/animate/ }\` * @since 1.0 */ animate(properties: JQuery.PlainObject, @@ -3278,7 +3306,7 @@ interface JQuery extends Iterable * * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or * jQuery objects to insert at the end of each element in the set of matched elements. - * @see {@link https://api.jquery.com/append/} + * @see \`{@link https://api.jquery.com/append/ }\` * @since 1.0 */ append(...contents: Array>>): this; @@ -3289,7 +3317,7 @@ interface JQuery extends Iterable * the end of each element in the set of matched elements. Receives the index position of the element * in the set and the old HTML value of the element as arguments. Within the function, this refers to * the current element in the set. - * @see {@link https://api.jquery.com/append/} + * @see \`{@link https://api.jquery.com/append/ }\` * @since 1.4 */ append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; @@ -3298,7 +3326,7 @@ interface JQuery extends Iterable * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements * will be inserted at the end of the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/appendTo/} + * @see \`{@link https://api.jquery.com/appendTo/ }\` * @since 1.0 */ appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; @@ -3309,7 +3337,7 @@ interface JQuery extends Iterable * @param value A value to set for the attribute. If null, the specified attribute will be removed (as in .removeAttr()). * A function returning the value to set. this is the current element. Receives the index position of * the element in the set and the old attribute value as arguments. - * @see {@link https://api.jquery.com/attr/} + * @see \`{@link https://api.jquery.com/attr/ }\` * @since 1.0 * @since 1.1 */ @@ -3319,7 +3347,7 @@ interface JQuery extends Iterable * Set one or more attributes for the set of matched elements. * * @param attributes An object of attribute-value pairs to set. - * @see {@link https://api.jquery.com/attr/} + * @see \`{@link https://api.jquery.com/attr/ }\` * @since 1.0 */ attr(attributes: JQuery.PlainObject): this; @@ -3327,7 +3355,7 @@ interface JQuery extends Iterable * Get the value of an attribute for the first element in the set of matched elements. * * @param attributeName The name of the attribute to get. - * @see {@link https://api.jquery.com/attr/} + * @see \`{@link https://api.jquery.com/attr/ }\` * @since 1.0 */ attr(attributeName: string): string | undefined; @@ -3336,7 +3364,7 @@ interface JQuery extends Iterable * * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or * jQuery objects to insert before each element in the set of matched elements. - * @see {@link https://api.jquery.com/before/} + * @see \`{@link https://api.jquery.com/before/ }\` * @since 1.0 */ before(...contents: Array>>): this; @@ -3347,7 +3375,7 @@ interface JQuery extends Iterable * before each element in the set of matched elements. Receives the index position of the element in * the set and the old HTML value of the element as arguments. Within the function, this refers to the * current element in the set. - * @see {@link https://api.jquery.com/before/} + * @see \`{@link https://api.jquery.com/before/ }\` * @since 1.4 * @since 1.10 */ @@ -3359,7 +3387,7 @@ interface JQuery extends Iterable * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/bind/} + * @see \`{@link https://api.jquery.com/bind/ }\` * @since 1.0 * @since 1.4.3 * @deprecated 3.0 @@ -3374,7 +3402,7 @@ interface JQuery extends Iterable * @param handler A function to execute each time the event is triggered. * Setting the second argument to false will attach a function that prevents the default action from * occurring and stops the event from bubbling. - * @see {@link https://api.jquery.com/bind/} + * @see \`{@link https://api.jquery.com/bind/ }\` * @since 1.0 * @since 1.4.3 * @deprecated 3.0 @@ -3385,7 +3413,7 @@ interface JQuery extends Iterable * Attach a handler to an event for the elements. * * @param events An object containing one or more DOM event types and functions to execute for them. - * @see {@link https://api.jquery.com/bind/} + * @see \`{@link https://api.jquery.com/bind/ }\` * @since 1.4 * @deprecated 3.0 */ @@ -3395,7 +3423,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/blur/} + * @see \`{@link https://api.jquery.com/blur/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3405,7 +3433,7 @@ interface JQuery extends Iterable * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/blur/} + * @see \`{@link https://api.jquery.com/blur/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -3415,7 +3443,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/change/} + * @see \`{@link https://api.jquery.com/change/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3425,7 +3453,7 @@ interface JQuery extends Iterable * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/change/} + * @see \`{@link https://api.jquery.com/change/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -3434,7 +3462,7 @@ interface JQuery extends Iterable * Get the children of each element in the set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/children/} + * @see \`{@link https://api.jquery.com/children/ }\` * @since 1.0 */ children(selector?: JQuery.Selector): this; @@ -3442,7 +3470,7 @@ interface JQuery extends Iterable * Remove from the queue all items that have not yet been run. * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/clearQueue/} + * @see \`{@link https://api.jquery.com/clearQueue/ }\` * @since 1.4 */ clearQueue(queueName?: string): this; @@ -3451,7 +3479,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/click/} + * @see \`{@link https://api.jquery.com/click/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3461,7 +3489,7 @@ interface JQuery extends Iterable * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/click/} + * @see \`{@link https://api.jquery.com/click/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -3474,7 +3502,7 @@ interface JQuery extends Iterable * to false in 1.5.1 and up. * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should * be copied. By default its value matches the first argument's value (which defaults to false). - * @see {@link https://api.jquery.com/clone/} + * @see \`{@link https://api.jquery.com/clone/ }\` * @since 1.0 * @since 1.5 */ @@ -3485,7 +3513,7 @@ interface JQuery extends Iterable * * @param selector A string containing a selector expression to match elements against. * @param context A DOM element within which a matching element may be found. - * @see {@link https://api.jquery.com/closest/} + * @see \`{@link https://api.jquery.com/closest/ }\` * @since 1.4 */ closest(selector: JQuery.Selector, context: Element): this; @@ -3496,7 +3524,7 @@ interface JQuery extends Iterable * @param selector A string containing a selector expression to match elements against. * A jQuery object to match elements against. * An element to match elements against. - * @see {@link https://api.jquery.com/closest/} + * @see \`{@link https://api.jquery.com/closest/ }\` * @since 1.3 * @since 1.6 */ @@ -3504,7 +3532,7 @@ interface JQuery extends Iterable /** * Get the children of each element in the set of matched elements, including text and comment nodes. * - * @see {@link https://api.jquery.com/contents/} + * @see \`{@link https://api.jquery.com/contents/ }\` * @since 1.2 */ contents(): JQuery; @@ -3513,7 +3541,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/contextmenu/} + * @see \`{@link https://api.jquery.com/contextmenu/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3523,7 +3551,7 @@ interface JQuery extends Iterable * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/contextmenu/} + * @see \`{@link https://api.jquery.com/contextmenu/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -3535,7 +3563,7 @@ interface JQuery extends Iterable * @param value A value to set for the property. * A function returning the value to set. this is the current element. Receives the index position of * the element in the set and the old value as arguments. - * @see {@link https://api.jquery.com/css/} + * @see \`{@link https://api.jquery.com/css/ }\` * @since 1.0 * @since 1.4 */ @@ -3545,7 +3573,7 @@ interface JQuery extends Iterable * Set one or more CSS properties for the set of matched elements. * * @param properties An object of property-value pairs to set. - * @see {@link https://api.jquery.com/css/} + * @see \`{@link https://api.jquery.com/css/ }\` * @since 1.0 */ css(properties: JQuery.PlainObject string | number | void | undefined)>): this; @@ -3554,7 +3582,7 @@ interface JQuery extends Iterable * * @param propertyName A CSS property. * An array of one or more CSS properties. - * @see {@link https://api.jquery.com/css/} + * @see \`{@link https://api.jquery.com/css/ }\` * @since 1.0 */ css(propertyName: string): string; @@ -3562,7 +3590,7 @@ interface JQuery extends Iterable * Get the computed style properties for the first element in the set of matched elements. * * @param propertyNames An array of one or more CSS properties. - * @see {@link https://api.jquery.com/css/} + * @see \`{@link https://api.jquery.com/css/ }\` * @since 1.9 */ css(propertyNames: string[]): JQuery.PlainObject; @@ -3571,7 +3599,7 @@ interface JQuery extends Iterable * data(name, value) or by an HTML5 data-* attribute. * * @param key Name of the data stored. - * @see {@link https://api.jquery.com/data/} + * @see \`{@link https://api.jquery.com/data/ }\` * @since 1.2.3 */ data(key: string, undefined: undefined): any; // tslint:disable-line:unified-signatures @@ -3580,7 +3608,7 @@ interface JQuery extends Iterable * * @param key A string naming the piece of data to set. * @param value The new data value; this can be any Javascript type except undefined. - * @see {@link https://api.jquery.com/data/} + * @see \`{@link https://api.jquery.com/data/ }\` * @since 1.2.3 */ data(key: string, value: any): this; @@ -3588,7 +3616,7 @@ interface JQuery extends Iterable * Store arbitrary data associated with the matched elements. * * @param obj An object of key-value pairs of data to update. - * @see {@link https://api.jquery.com/data/} + * @see \`{@link https://api.jquery.com/data/ }\` * @since 1.4.3 */ data(obj: JQuery.PlainObject): this; @@ -3597,7 +3625,7 @@ interface JQuery extends Iterable * data(name, value) or by an HTML5 data-* attribute. * * @param key Name of the data stored. - * @see {@link https://api.jquery.com/data/} + * @see \`{@link https://api.jquery.com/data/ }\` * @since 1.2.3 */ data(key: string): any; @@ -3605,7 +3633,7 @@ interface JQuery extends Iterable * Return the value at the named data store for the first element in the jQuery collection, as set by * data(name, value) or by an HTML5 data-* attribute. * - * @see {@link https://api.jquery.com/data/} + * @see \`{@link https://api.jquery.com/data/ }\` * @since 1.4 */ data(): JQuery.PlainObject; @@ -3614,7 +3642,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/dblclick/} + * @see \`{@link https://api.jquery.com/dblclick/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3624,7 +3652,7 @@ interface JQuery extends Iterable * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/dblclick/} + * @see \`{@link https://api.jquery.com/dblclick/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -3634,7 +3662,7 @@ interface JQuery extends Iterable * * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/delay/} + * @see \`{@link https://api.jquery.com/delay/ }\` * @since 1.4 */ delay(duration: JQuery.Duration, queueName?: string): this; @@ -3647,7 +3675,7 @@ interface JQuery extends Iterable * "keydown," or custom event names. * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/delegate/} + * @see \`{@link https://api.jquery.com/delegate/ }\` * @since 1.4.2 * @deprecated 3.0 */ @@ -3663,7 +3691,7 @@ interface JQuery extends Iterable * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or * "keydown," or custom event names. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/delegate/} + * @see \`{@link https://api.jquery.com/delegate/ }\` * @since 1.4.2 * @deprecated 3.0 */ @@ -3676,7 +3704,7 @@ interface JQuery extends Iterable * * @param selector A selector to filter the elements that trigger the event. * @param events A plain object of one or more event types and functions to execute for them. - * @see {@link https://api.jquery.com/delegate/} + * @see \`{@link https://api.jquery.com/delegate/ }\` * @since 1.4.3 * @deprecated 3.0 */ @@ -3686,7 +3714,7 @@ interface JQuery extends Iterable * Execute the next function on the queue for the matched elements. * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/dequeue/} + * @see \`{@link https://api.jquery.com/dequeue/ }\` * @since 1.2 */ dequeue(queueName?: string): this; @@ -3694,7 +3722,7 @@ interface JQuery extends Iterable * Remove the set of matched elements from the DOM. * * @param selector A selector expression that filters the set of matched elements to be removed. - * @see {@link https://api.jquery.com/detach/} + * @see \`{@link https://api.jquery.com/detach/ }\` * @since 1.4 */ detach(selector?: JQuery.Selector): this; @@ -3702,14 +3730,14 @@ interface JQuery extends Iterable * Iterate over a jQuery object, executing a function for each matched element. * * @param fn A function to execute for each matched element. - * @see {@link https://api.jquery.com/each/} + * @see \`{@link https://api.jquery.com/each/ }\` * @since 1.0 */ each(fn: (this: TElement, index: number, element: TElement) => void | false): this; /** * Remove all child nodes of the set of matched elements from the DOM. * - * @see {@link https://api.jquery.com/empty/} + * @see \`{@link https://api.jquery.com/empty/ }\` * @since 1.0 */ empty(): this; @@ -3717,7 +3745,7 @@ interface JQuery extends Iterable * End the most recent filtering operation in the current chain and return the set of matched elements * to its previous state. * - * @see {@link https://api.jquery.com/end/} + * @see \`{@link https://api.jquery.com/end/ }\` * @since 1.0 */ end(): this; @@ -3726,7 +3754,7 @@ interface JQuery extends Iterable * * @param index An integer indicating the 0-based position of the element. * An integer indicating the position of the element, counting backwards from the last element in the set. - * @see {@link https://api.jquery.com/eq/} + * @see \`{@link https://api.jquery.com/eq/ }\` * @since 1.1.2 * @since 1.4 */ @@ -3735,7 +3763,7 @@ interface JQuery extends Iterable * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. * * @param obj An object to merge onto the jQuery prototype. - * @see {@link https://api.jquery.com/jQuery.fn.extend/} + * @see \`{@link https://api.jquery.com/jQuery.fn.extend/ }\` * @since 1.0 */ extend(obj: object): this; @@ -3745,7 +3773,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeIn/} + * @see \`{@link https://api.jquery.com/fadeIn/ }\` * @since 1.4.3 */ fadeIn(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -3755,7 +3783,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeIn/} + * @see \`{@link https://api.jquery.com/fadeIn/ }\` * @since 1.0 * @since 1.4.3 */ @@ -3767,7 +3795,7 @@ interface JQuery extends Iterable * A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeIn/} + * @see \`{@link https://api.jquery.com/fadeIn/ }\` * @since 1.0 * @since 1.4.3 */ @@ -3778,7 +3806,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeOut/} + * @see \`{@link https://api.jquery.com/fadeOut/ }\` * @since 1.4.3 */ fadeOut(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -3788,7 +3816,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeOut/} + * @see \`{@link https://api.jquery.com/fadeOut/ }\` * @since 1.0 * @since 1.4.3 */ @@ -3800,7 +3828,7 @@ interface JQuery extends Iterable * A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeOut/} + * @see \`{@link https://api.jquery.com/fadeOut/ }\` * @since 1.0 * @since 1.4.3 */ @@ -3812,7 +3840,7 @@ interface JQuery extends Iterable * @param opacity A number between 0 and 1 denoting the target opacity. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeTo/} + * @see \`{@link https://api.jquery.com/fadeTo/ }\` * @since 1.4.3 */ fadeTo(duration: JQuery.Duration, opacity: number, easing: string, complete?: (this: TElement) => void): this; @@ -3822,7 +3850,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param opacity A number between 0 and 1 denoting the target opacity. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeTo/} + * @see \`{@link https://api.jquery.com/fadeTo/ }\` * @since 1.0 */ fadeTo(duration: JQuery.Duration, opacity: number, complete?: (this: TElement) => void): this; @@ -3832,7 +3860,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeToggle/} + * @see \`{@link https://api.jquery.com/fadeToggle/ }\` * @since 1.4.4 */ fadeToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -3842,7 +3870,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/fadeToggle/} + * @see \`{@link https://api.jquery.com/fadeToggle/ }\` * @since 1.0 * @since 1.4.3 */ @@ -3854,7 +3882,7 @@ interface JQuery extends Iterable * A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeToggle/} + * @see \`{@link https://api.jquery.com/fadeToggle/ }\` * @since 1.0 * @since 1.4.3 */ @@ -3866,7 +3894,7 @@ interface JQuery extends Iterable * One or more DOM elements to match the current set of elements against. * An existing jQuery object to match the current set of elements against. * A function used as a test for each element in the set. this is the current DOM element. - * @see {@link https://api.jquery.com/filter/} + * @see \`{@link https://api.jquery.com/filter/ }\` * @since 1.0 * @since 1.4 */ @@ -3877,7 +3905,7 @@ interface JQuery extends Iterable * * @param selector A string containing a selector expression to match elements against. * An element or a jQuery object to match elements against. - * @see {@link https://api.jquery.com/find/} + * @see \`{@link https://api.jquery.com/find/ }\` * @since 1.0 * @since 1.6 */ @@ -3887,14 +3915,14 @@ interface JQuery extends Iterable * the matched elements. * * @param queue The name of the queue in which to stop animations. - * @see {@link https://api.jquery.com/finish/} + * @see \`{@link https://api.jquery.com/finish/ }\` * @since 1.9 */ finish(queue?: string): this; /** * Reduce the set of matched elements to the first in the set. * - * @see {@link https://api.jquery.com/first/} + * @see \`{@link https://api.jquery.com/first/ }\` * @since 1.4 */ first(): this; @@ -3903,7 +3931,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focus/} + * @see \`{@link https://api.jquery.com/focus/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3913,7 +3941,7 @@ interface JQuery extends Iterable * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focus/} + * @see \`{@link https://api.jquery.com/focus/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -3923,7 +3951,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusin/} + * @see \`{@link https://api.jquery.com/focusin/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3933,7 +3961,7 @@ interface JQuery extends Iterable * Bind an event handler to the "focusin" event. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusin/} + * @see \`{@link https://api.jquery.com/focusin/ }\` * @since 1.4 * @deprecated 3.3 */ @@ -3943,7 +3971,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusout/} + * @see \`{@link https://api.jquery.com/focusout/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -3953,7 +3981,7 @@ interface JQuery extends Iterable * Bind an event handler to the "focusout" JavaScript event. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusout/} + * @see \`{@link https://api.jquery.com/focusout/ }\` * @since 1.4 * @deprecated 3.3 */ @@ -3962,14 +3990,14 @@ interface JQuery extends Iterable * Retrieve one of the elements matched by the jQuery object. * * @param index A zero-based integer indicating which element to retrieve. - * @see {@link https://api.jquery.com/get/} + * @see \`{@link https://api.jquery.com/get/ }\` * @since 1.0 */ get(index: number): TElement; /** * Retrieve the elements matched by the jQuery object. * - * @see {@link https://api.jquery.com/get/} + * @see \`{@link https://api.jquery.com/get/ }\` * @since 1.0 */ get(): TElement[]; @@ -3978,7 +4006,7 @@ interface JQuery extends Iterable * * @param selector A string containing a selector expression to match elements against. * A DOM element to match elements against. - * @see {@link https://api.jquery.com/has/} + * @see \`{@link https://api.jquery.com/has/ }\` * @since 1.4 */ has(selector: string | Element): this; @@ -3986,7 +4014,7 @@ interface JQuery extends Iterable * Determine whether any of the matched elements are assigned the given class. * * @param className The class name to search for. - * @see {@link https://api.jquery.com/hasClass/} + * @see \`{@link https://api.jquery.com/hasClass/ }\` * @since 1.2 */ hasClass(className: string): boolean; @@ -3997,7 +4025,7 @@ interface JQuery extends Iterable * appended (as a string). * A function returning the height to set. Receives the index position of the element in the set and * the old height as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/height/} + * @see \`{@link https://api.jquery.com/height/ }\` * @since 1.0 * @since 1.4.1 */ @@ -4005,7 +4033,7 @@ interface JQuery extends Iterable /** * Get the current computed height for the first element in the set of matched elements. * - * @see {@link https://api.jquery.com/height/} + * @see \`{@link https://api.jquery.com/height/ }\` * @since 1.0 */ height(): number | undefined; @@ -4015,7 +4043,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/hide/} + * @see \`{@link https://api.jquery.com/hide/ }\` * @since 1.4.3 */ hide(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; @@ -4025,7 +4053,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing_complete A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/hide/} + * @see \`{@link https://api.jquery.com/hide/ }\` * @since 1.0 * @since 1.4.3 */ @@ -4036,7 +4064,7 @@ interface JQuery extends Iterable * @param duration_complete_options A string or number determining how long the animation will run. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/hide/} + * @see \`{@link https://api.jquery.com/hide/ }\` * @since 1.0 */ hide(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; @@ -4046,7 +4074,7 @@ interface JQuery extends Iterable * * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. * @param handlerOut A function to execute when the mouse pointer leaves the element. - * @see {@link https://api.jquery.com/hover/} + * @see \`{@link https://api.jquery.com/hover/ }\` * @since 1.0 * @since 1.4 */ @@ -4060,7 +4088,7 @@ interface JQuery extends Iterable * A function returning the HTML content to set. Receives the index position of the element in the set * and the old HTML value as arguments. jQuery empties the element before calling the function; use the * oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/html/} + * @see \`{@link https://api.jquery.com/html/ }\` * @since 1.0 * @since 1.4 */ @@ -4068,7 +4096,7 @@ interface JQuery extends Iterable /** * Get the HTML contents of the first element in the set of matched elements. * - * @see {@link https://api.jquery.com/html/} + * @see \`{@link https://api.jquery.com/html/ }\` * @since 1.0 */ html(): string; @@ -4077,7 +4105,7 @@ interface JQuery extends Iterable * * @param element The DOM element or first element within the jQuery object to look for. * A selector representing a jQuery collection in which to look for an element. - * @see {@link https://api.jquery.com/index/} + * @see \`{@link https://api.jquery.com/index/ }\` * @since 1.0 * @since 1.4 */ @@ -4090,7 +4118,7 @@ interface JQuery extends Iterable * A function returning the inner height (including padding but not border) to set. Receives the index * position of the element in the set and the old inner height as arguments. Within the function, this * refers to the current element in the set. - * @see {@link https://api.jquery.com/innerHeight/} + * @see \`{@link https://api.jquery.com/innerHeight/ }\` * @since 1.8.0 */ innerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; @@ -4098,7 +4126,7 @@ interface JQuery extends Iterable * Get the current computed height for the first element in the set of matched elements, including * padding but not border. * - * @see {@link https://api.jquery.com/innerHeight/} + * @see \`{@link https://api.jquery.com/innerHeight/ }\` * @since 1.2.6 */ innerHeight(): number | undefined; @@ -4110,7 +4138,7 @@ interface JQuery extends Iterable * A function returning the inner width (including padding but not border) to set. Receives the index * position of the element in the set and the old inner width as arguments. Within the function, this * refers to the current element in the set. - * @see {@link https://api.jquery.com/innerWidth/} + * @see \`{@link https://api.jquery.com/innerWidth/ }\` * @since 1.8.0 */ innerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; @@ -4118,7 +4146,7 @@ interface JQuery extends Iterable * Get the current computed inner width for the first element in the set of matched elements, including * padding but not border. * - * @see {@link https://api.jquery.com/innerWidth/} + * @see \`{@link https://api.jquery.com/innerWidth/ }\` * @since 1.2.6 */ innerWidth(): number | undefined; @@ -4127,7 +4155,7 @@ interface JQuery extends Iterable * * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements * will be inserted after the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/insertAfter/} + * @see \`{@link https://api.jquery.com/insertAfter/ }\` * @since 1.0 */ insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; @@ -4136,7 +4164,7 @@ interface JQuery extends Iterable * * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements * will be inserted before the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/insertBefore/} + * @see \`{@link https://api.jquery.com/insertBefore/ }\` * @since 1.0 */ insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; @@ -4150,7 +4178,7 @@ interface JQuery extends Iterable * function, this refers to the current DOM element. * An existing jQuery object to match the current set of elements against. * One or more elements to match the current set of elements against. - * @see {@link https://api.jquery.com/is/} + * @see \`{@link https://api.jquery.com/is/ }\` * @since 1.0 * @since 1.6 */ @@ -4160,7 +4188,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keydown/} + * @see \`{@link https://api.jquery.com/keydown/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4170,7 +4198,7 @@ interface JQuery extends Iterable * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keydown/} + * @see \`{@link https://api.jquery.com/keydown/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4180,7 +4208,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keypress/} + * @see \`{@link https://api.jquery.com/keypress/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4190,7 +4218,7 @@ interface JQuery extends Iterable * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keypress/} + * @see \`{@link https://api.jquery.com/keypress/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4200,7 +4228,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keyup/} + * @see \`{@link https://api.jquery.com/keyup/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4210,7 +4238,7 @@ interface JQuery extends Iterable * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keyup/} + * @see \`{@link https://api.jquery.com/keyup/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4218,7 +4246,7 @@ interface JQuery extends Iterable /** * Reduce the set of matched elements to the final one in the set. * - * @see {@link https://api.jquery.com/last/} + * @see \`{@link https://api.jquery.com/last/ }\` * @since 1.4 */ last(): this; @@ -4228,7 +4256,7 @@ interface JQuery extends Iterable * @param url A string containing the URL to which the request is sent. * @param data A plain object or string that is sent to the server with the request. * @param complete A callback function that is executed when the request completes. - * @see {@link https://api.jquery.com/load/} + * @see \`{@link https://api.jquery.com/load/ }\` * @since 1.0 */ load(url: string, @@ -4240,7 +4268,7 @@ interface JQuery extends Iterable * @param url A string containing the URL to which the request is sent. * @param complete_data A callback function that is executed when the request completes. * A plain object or string that is sent to the server with the request. - * @see {@link https://api.jquery.com/load/} + * @see \`{@link https://api.jquery.com/load/ }\` * @since 1.0 */ load(url: string, @@ -4250,16 +4278,16 @@ interface JQuery extends Iterable * containing the return values. * * @param callback A function object that will be invoked for each element in the current set. - * @see {@link https://api.jquery.com/map/} + * @see \`{@link https://api.jquery.com/map/ }\` * @since 1.2 */ - map(callback: (this: TElement, index: number, domElement: TElement) => any | any[] | null | undefined): this; + map(callback: (this: TElement, index: number, domElement: TElement) => JQuery.TypeOrArray | null | undefined): JQuery; /** * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mousedown/} + * @see \`{@link https://api.jquery.com/mousedown/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4269,7 +4297,7 @@ interface JQuery extends Iterable * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mousedown/} + * @see \`{@link https://api.jquery.com/mousedown/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4279,7 +4307,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseenter/} + * @see \`{@link https://api.jquery.com/mouseenter/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4289,7 +4317,7 @@ interface JQuery extends Iterable * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseenter/} + * @see \`{@link https://api.jquery.com/mouseenter/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4299,7 +4327,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseleave/} + * @see \`{@link https://api.jquery.com/mouseleave/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4309,7 +4337,7 @@ interface JQuery extends Iterable * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseleave/} + * @see \`{@link https://api.jquery.com/mouseleave/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4319,7 +4347,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mousemove/} + * @see \`{@link https://api.jquery.com/mousemove/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4329,7 +4357,7 @@ interface JQuery extends Iterable * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mousemove/} + * @see \`{@link https://api.jquery.com/mousemove/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4339,7 +4367,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseout/} + * @see \`{@link https://api.jquery.com/mouseout/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4349,7 +4377,7 @@ interface JQuery extends Iterable * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseout/} + * @see \`{@link https://api.jquery.com/mouseout/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4359,7 +4387,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseover/} + * @see \`{@link https://api.jquery.com/mouseover/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4369,7 +4397,7 @@ interface JQuery extends Iterable * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseover/} + * @see \`{@link https://api.jquery.com/mouseover/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4379,7 +4407,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseup/} + * @see \`{@link https://api.jquery.com/mouseup/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -4389,7 +4417,7 @@ interface JQuery extends Iterable * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/mouseup/} + * @see \`{@link https://api.jquery.com/mouseup/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -4399,7 +4427,7 @@ interface JQuery extends Iterable * is provided, it retrieves the next sibling only if it matches that selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/next/} + * @see \`{@link https://api.jquery.com/next/ }\` * @since 1.0 */ next(selector?: JQuery.Selector): this; @@ -4407,7 +4435,7 @@ interface JQuery extends Iterable * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/nextAll/} + * @see \`{@link https://api.jquery.com/nextAll/ }\` * @since 1.2 */ nextAll(selector?: string): this; @@ -4418,7 +4446,7 @@ interface JQuery extends Iterable * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. * A DOM node or jQuery object indicating where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/nextUntil/} + * @see \`{@link https://api.jquery.com/nextUntil/ }\` * @since 1.4 * @since 1.6 */ @@ -4431,7 +4459,7 @@ interface JQuery extends Iterable * element's index in the jQuery collection, and element, which is the DOM element. Within the * function, this refers to the current DOM element. * An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/not/} + * @see \`{@link https://api.jquery.com/not/ }\` * @since 1.0 * @since 1.4 */ @@ -4443,7 +4471,7 @@ interface JQuery extends Iterable * "click", "keydown.myPlugin", or ".myPlugin". * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/off/} + * @see \`{@link https://api.jquery.com/off/ }\` * @since 1.7 */ off(events: string, selector: JQuery.Selector, handler: JQuery.EventHandlerBase> | false): this; @@ -4454,7 +4482,7 @@ interface JQuery extends Iterable * "click", "keydown.myPlugin", or ".myPlugin". * @param selector_handler A selector which should match the one originally passed to .on() when attaching event handlers. * A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/off/} + * @see \`{@link https://api.jquery.com/off/ }\` * @since 1.7 */ off(events: string, selector_handler?: JQuery.Selector | JQuery.EventHandlerBase> | false): this; @@ -4464,7 +4492,7 @@ interface JQuery extends Iterable * @param events An object where the string keys represent one or more space-separated event types and optional * namespaces, and the values represent handler functions previously attached for the event(s). * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @see {@link https://api.jquery.com/off/} + * @see \`{@link https://api.jquery.com/off/ }\` * @since 1.7 */ off(events: JQuery.PlainObject> | false>, selector?: JQuery.Selector): this; @@ -4472,7 +4500,7 @@ interface JQuery extends Iterable * Remove an event handler. * * @param event A jQuery.Event object. - * @see {@link https://api.jquery.com/off/} + * @see \`{@link https://api.jquery.com/off/ }\` * @since 1.7 */ off(event?: JQuery.Event): this; @@ -4484,21 +4512,21 @@ interface JQuery extends Iterable * A function to return the coordinates to set. Receives the index of the element in the collection as * the first argument and the current coordinates as the second argument. The function should return an * object with the new top and left properties. - * @see {@link https://api.jquery.com/offset/} + * @see \`{@link https://api.jquery.com/offset/ }\` * @since 1.4 */ offset(coordinates: JQuery.Coordinates | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.Coordinates)): this; /** * Get the current coordinates of the first element in the set of matched elements, relative to the document. * - * @see {@link https://api.jquery.com/offset/} + * @see \`{@link https://api.jquery.com/offset/ }\` * @since 1.2 */ offset(): JQuery.Coordinates | undefined; /** * Get the closest ancestor element that is positioned. * - * @see {@link https://api.jquery.com/offsetParent/} + * @see \`{@link https://api.jquery.com/offsetParent/ }\` * @since 1.2.6 */ offsetParent(): this; @@ -4510,7 +4538,7 @@ interface JQuery extends Iterable * selector is null or omitted, the event is always triggered when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4525,7 +4553,7 @@ interface JQuery extends Iterable * selector is null or omitted, the event is always triggered when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4540,7 +4568,7 @@ interface JQuery extends Iterable * selector is null or omitted, the event is always triggered when it reaches the selected element. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand * for a function that simply does return false. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4553,7 +4581,7 @@ interface JQuery extends Iterable * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the * selector is null or omitted, the event is always triggered when it reaches the selected element. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4565,7 +4593,7 @@ interface JQuery extends Iterable * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4577,7 +4605,7 @@ interface JQuery extends Iterable * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4589,7 +4617,7 @@ interface JQuery extends Iterable * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand * for a function that simply does return false. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4599,7 +4627,7 @@ interface JQuery extends Iterable * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: string, @@ -4612,7 +4640,7 @@ interface JQuery extends Iterable * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If * the selector is null or omitted, the handler is always called when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, @@ -4625,7 +4653,7 @@ interface JQuery extends Iterable * namespaces, and the values represent a handler function to be called for the event(s). * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If * the selector is null or omitted, the handler is always called when it reaches the selected element. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, @@ -4636,7 +4664,7 @@ interface JQuery extends Iterable * @param events An object in which the string keys represent one or more space-separated event types and optional * namespaces, and the values represent a handler function to be called for the event(s). * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, @@ -4646,7 +4674,7 @@ interface JQuery extends Iterable * * @param events An object in which the string keys represent one or more space-separated event types and optional * namespaces, and the values represent a handler function to be called for the event(s). - * @see {@link https://api.jquery.com/on/} + * @see \`{@link https://api.jquery.com/on/ }\` * @since 1.7 */ on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; @@ -4658,7 +4686,7 @@ interface JQuery extends Iterable * selector is null or omitted, the event is always triggered when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: string, @@ -4673,7 +4701,7 @@ interface JQuery extends Iterable * selector is null or omitted, the event is always triggered when it reaches the selected element. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand * for a function that simply does return false. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: string, @@ -4685,7 +4713,7 @@ interface JQuery extends Iterable * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: string, @@ -4697,7 +4725,7 @@ interface JQuery extends Iterable * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand * for a function that simply does return false. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: string, @@ -4710,7 +4738,7 @@ interface JQuery extends Iterable * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If * the selector is null or omitted, the handler is always called when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, @@ -4723,7 +4751,7 @@ interface JQuery extends Iterable * namespaces, and the values represent a handler function to be called for the event(s). * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If * the selector is null or omitted, the handler is always called when it reaches the selected element. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, @@ -4734,7 +4762,7 @@ interface JQuery extends Iterable * @param events An object in which the string keys represent one or more space-separated event types and optional * namespaces, and the values represent a handler function to be called for the event(s). * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, @@ -4744,7 +4772,7 @@ interface JQuery extends Iterable * * @param events An object in which the string keys represent one or more space-separated event types and optional * namespaces, and the values represent a handler function to be called for the event(s). - * @see {@link https://api.jquery.com/one/} + * @see \`{@link https://api.jquery.com/one/ }\` * @since 1.7 */ one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; @@ -4753,7 +4781,7 @@ interface JQuery extends Iterable * * @param value A number representing the number of pixels, or a number along with an optional unit of measure * appended (as a string). - * @see {@link https://api.jquery.com/outerHeight/} + * @see \`{@link https://api.jquery.com/outerHeight/ }\` * @since 1.8.0 */ outerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; @@ -4762,7 +4790,7 @@ interface JQuery extends Iterable * first element in the set of matched elements. * * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see {@link https://api.jquery.com/outerHeight/} + * @see \`{@link https://api.jquery.com/outerHeight/ }\` * @since 1.2.6 */ outerHeight(includeMargin?: boolean): number | undefined; @@ -4773,7 +4801,7 @@ interface JQuery extends Iterable * appended (as a string). * A function returning the outer width to set. Receives the index position of the element in the set * and the old outer width as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/outerWidth/} + * @see \`{@link https://api.jquery.com/outerWidth/ }\` * @since 1.8.0 */ outerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; @@ -4782,7 +4810,7 @@ interface JQuery extends Iterable * first element in the set of matched elements. * * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see {@link https://api.jquery.com/outerWidth/} + * @see \`{@link https://api.jquery.com/outerWidth/ }\` * @since 1.2.6 */ outerWidth(includeMargin?: boolean): number | undefined; @@ -4790,7 +4818,7 @@ interface JQuery extends Iterable * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parent/} + * @see \`{@link https://api.jquery.com/parent/ }\` * @since 1.0 */ parent(selector?: JQuery.Selector): this; @@ -4798,7 +4826,7 @@ interface JQuery extends Iterable * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parents/} + * @see \`{@link https://api.jquery.com/parents/ }\` * @since 1.0 */ parents(selector?: JQuery.Selector): this; @@ -4809,7 +4837,7 @@ interface JQuery extends Iterable * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. * A DOM node or jQuery object indicating where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parentsUntil/} + * @see \`{@link https://api.jquery.com/parentsUntil/ }\` * @since 1.4 * @since 1.6 */ @@ -4817,7 +4845,7 @@ interface JQuery extends Iterable /** * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. * - * @see {@link https://api.jquery.com/position/} + * @see \`{@link https://api.jquery.com/position/ }\` * @since 1.2 */ position(): JQuery.Coordinates; @@ -4826,7 +4854,7 @@ interface JQuery extends Iterable * * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or * jQuery objects to insert at the beginning of each element in the set of matched elements. - * @see {@link https://api.jquery.com/prepend/} + * @see \`{@link https://api.jquery.com/prepend/ }\` * @since 1.0 */ prepend(...contents: Array>>): this; @@ -4837,7 +4865,7 @@ interface JQuery extends Iterable * the beginning of each element in the set of matched elements. Receives the index position of the * element in the set and the old HTML value of the element as arguments. Within the function, this * refers to the current element in the set. - * @see {@link https://api.jquery.com/prepend/} + * @see \`{@link https://api.jquery.com/prepend/ }\` * @since 1.4 */ prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; @@ -4846,7 +4874,7 @@ interface JQuery extends Iterable * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements * will be inserted at the beginning of the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/prependTo/} + * @see \`{@link https://api.jquery.com/prependTo/ }\` * @since 1.0 */ prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; @@ -4855,7 +4883,7 @@ interface JQuery extends Iterable * is provided, it retrieves the previous sibling only if it matches that selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prev/} + * @see \`{@link https://api.jquery.com/prev/ }\` * @since 1.0 */ prev(selector?: JQuery.Selector): this; @@ -4863,7 +4891,7 @@ interface JQuery extends Iterable * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prevAll/} + * @see \`{@link https://api.jquery.com/prevAll/ }\` * @since 1.2 */ prevAll(selector?: JQuery.Selector): this; @@ -4874,7 +4902,7 @@ interface JQuery extends Iterable * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. * A DOM node or jQuery object indicating where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prevUntil/} + * @see \`{@link https://api.jquery.com/prevUntil/ }\` * @since 1.4 * @since 1.6 */ @@ -4885,7 +4913,7 @@ interface JQuery extends Iterable * * @param type The type of queue that needs to be observed. * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/promise/} + * @see \`{@link https://api.jquery.com/promise/ }\` * @since 1.6 */ promise(type: string, target: T): T & JQuery.Promise; @@ -4894,7 +4922,7 @@ interface JQuery extends Iterable * queued or not, have finished. * * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/promise/} + * @see \`{@link https://api.jquery.com/promise/ }\` * @since 1.6 */ promise(target: T): T & JQuery.Promise; @@ -4903,7 +4931,7 @@ interface JQuery extends Iterable * queued or not, have finished. * * @param type The type of queue that needs to be observed. - * @see {@link https://api.jquery.com/promise/} + * @see \`{@link https://api.jquery.com/promise/ }\` * @since 1.6 */ promise(type?: string): JQuery.Promise; @@ -4913,7 +4941,7 @@ interface JQuery extends Iterable * @param propertyName The name of the property to set. * @param value A function returning the value to set. Receives the index position of the element in the set and the * old property value as arguments. Within the function, the keyword this refers to the current element. - * @see {@link https://api.jquery.com/prop/} + * @see \`{@link https://api.jquery.com/prop/ }\` * @since 1.6 */ prop(propertyName: string, value: (this: TElement, index: number, oldPropertyValue: any) => any): this; @@ -4922,7 +4950,7 @@ interface JQuery extends Iterable * * @param propertyName The name of the property to set. * @param value A value to set for the property. - * @see {@link https://api.jquery.com/prop/} + * @see \`{@link https://api.jquery.com/prop/ }\` * @since 1.6 */ prop(propertyName: string, value: any): this; // tslint:disable-line:unified-signatures @@ -4930,7 +4958,7 @@ interface JQuery extends Iterable * Set one or more properties for the set of matched elements. * * @param properties An object of property-value pairs to set. - * @see {@link https://api.jquery.com/prop/} + * @see \`{@link https://api.jquery.com/prop/ }\` * @since 1.6 */ prop(properties: JQuery.PlainObject): this; @@ -4938,7 +4966,7 @@ interface JQuery extends Iterable * Get the value of a property for the first element in the set of matched elements. * * @param propertyName The name of the property to get. - * @see {@link https://api.jquery.com/prop/} + * @see \`{@link https://api.jquery.com/prop/ }\` * @since 1.6 */ prop(propertyName: string): any | undefined; @@ -4948,7 +4976,7 @@ interface JQuery extends Iterable * @param elements An array of elements to push onto the stack and make into a new jQuery object. * @param name The name of a jQuery method that generated the array of elements. * @param args The arguments that were passed in to the jQuery method (for serialization). - * @see {@link https://api.jquery.com/pushStack/} + * @see \`{@link https://api.jquery.com/pushStack/ }\` * @since 1.3 */ pushStack(elements: ArrayLike, name: string, args: any[]): this; @@ -4956,7 +4984,7 @@ interface JQuery extends Iterable * Add a collection of DOM elements onto the jQuery stack. * * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @see {@link https://api.jquery.com/pushStack/} + * @see \`{@link https://api.jquery.com/pushStack/ }\` * @since 1.0 */ pushStack(elements: ArrayLike): this; @@ -4966,7 +4994,7 @@ interface JQuery extends Iterable * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. * An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/queue/} + * @see \`{@link https://api.jquery.com/queue/ }\` * @since 1.2 */ queue(queueName: string, newQueue: JQuery.TypeOrArray>): this; @@ -4975,7 +5003,7 @@ interface JQuery extends Iterable * * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. * An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/queue/} + * @see \`{@link https://api.jquery.com/queue/ }\` * @since 1.2 */ queue(newQueue: JQuery.TypeOrArray>): this; @@ -4983,7 +5011,7 @@ interface JQuery extends Iterable * Show the queue of functions to be executed on the matched elements. * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/queue/} + * @see \`{@link https://api.jquery.com/queue/ }\` * @since 1.2 */ queue(queueName?: string): JQuery.Queue; @@ -4991,7 +5019,7 @@ interface JQuery extends Iterable * Specify a function to execute when the DOM is fully loaded. * * @param handler A function to execute after the DOM is ready. - * @see {@link https://api.jquery.com/ready/} + * @see \`{@link https://api.jquery.com/ready/ }\` * @since 1.0 * @deprecated 3.0 */ @@ -5000,7 +5028,7 @@ interface JQuery extends Iterable * Remove the set of matched elements from the DOM. * * @param selector A selector expression that filters the set of matched elements to be removed. - * @see {@link https://api.jquery.com/remove/} + * @see \`{@link https://api.jquery.com/remove/ }\` * @since 1.0 */ remove(selector?: string): this; @@ -5008,7 +5036,7 @@ interface JQuery extends Iterable * Remove an attribute from each element in the set of matched elements. * * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - * @see {@link https://api.jquery.com/removeAttr/} + * @see \`{@link https://api.jquery.com/removeAttr/ }\` * @since 1.0 */ removeAttr(attributeName: string): this; @@ -5019,7 +5047,7 @@ interface JQuery extends Iterable * An array of classes to be removed from the class attribute of each matched element. * A function returning one or more space-separated class names to be removed. Receives the index * position of the element in the set and the old class value as arguments. - * @see {@link https://api.jquery.com/removeClass/} + * @see \`{@link https://api.jquery.com/removeClass/ }\` * @since 1.0 * @since 1.4 * @since 3.3 @@ -5030,7 +5058,7 @@ interface JQuery extends Iterable * * @param name A string naming the piece of data to delete. * An array or space-separated string naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/} + * @see \`{@link https://api.jquery.com/removeData/ }\` * @since 1.2.3 * @since 1.7 */ @@ -5039,7 +5067,7 @@ interface JQuery extends Iterable * Remove a property for the set of matched elements. * * @param propertyName The name of the property to remove. - * @see {@link https://api.jquery.com/removeProp/} + * @see \`{@link https://api.jquery.com/removeProp/ }\` * @since 1.6 */ removeProp(propertyName: string): this; @@ -5047,7 +5075,7 @@ interface JQuery extends Iterable * Replace each target element with the set of matched elements. * * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - * @see {@link https://api.jquery.com/replaceAll/} + * @see \`{@link https://api.jquery.com/replaceAll/ }\` * @since 1.2 */ replaceAll(target: JQuery.Selector | JQuery | JQuery.TypeOrArray): this; @@ -5057,7 +5085,7 @@ interface JQuery extends Iterable * * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. * A function that returns content with which to replace the set of matched elements. - * @see {@link https://api.jquery.com/replaceWith/} + * @see \`{@link https://api.jquery.com/replaceWith/ }\` * @since 1.2 * @since 1.4 */ @@ -5067,7 +5095,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/resize/} + * @see \`{@link https://api.jquery.com/resize/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -5077,7 +5105,7 @@ interface JQuery extends Iterable * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/resize/} + * @see \`{@link https://api.jquery.com/resize/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -5087,7 +5115,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/scroll/} + * @see \`{@link https://api.jquery.com/scroll/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -5097,7 +5125,7 @@ interface JQuery extends Iterable * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/scroll/} + * @see \`{@link https://api.jquery.com/scroll/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -5106,14 +5134,14 @@ interface JQuery extends Iterable * Set the current horizontal position of the scroll bar for each of the set of matched elements. * * @param value An integer indicating the new position to set the scroll bar to. - * @see {@link https://api.jquery.com/scrollLeft/} + * @see \`{@link https://api.jquery.com/scrollLeft/ }\` * @since 1.2.6 */ scrollLeft(value: number): this; /** * Get the current horizontal position of the scroll bar for the first element in the set of matched elements. * - * @see {@link https://api.jquery.com/scrollLeft/} + * @see \`{@link https://api.jquery.com/scrollLeft/ }\` * @since 1.2.6 */ scrollLeft(): number | undefined; @@ -5121,7 +5149,7 @@ interface JQuery extends Iterable * Set the current vertical position of the scroll bar for each of the set of matched elements. * * @param value A number indicating the new position to set the scroll bar to. - * @see {@link https://api.jquery.com/scrollTop/} + * @see \`{@link https://api.jquery.com/scrollTop/ }\` * @since 1.2.6 */ scrollTop(value: number): this; @@ -5129,7 +5157,7 @@ interface JQuery extends Iterable * Get the current vertical position of the scroll bar for the first element in the set of matched * elements or set the vertical position of the scroll bar for every matched element. * - * @see {@link https://api.jquery.com/scrollTop/} + * @see \`{@link https://api.jquery.com/scrollTop/ }\` * @since 1.2.6 */ scrollTop(): number | undefined; @@ -5138,7 +5166,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/select/} + * @see \`{@link https://api.jquery.com/select/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -5148,7 +5176,7 @@ interface JQuery extends Iterable * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/select/} + * @see \`{@link https://api.jquery.com/select/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -5156,14 +5184,14 @@ interface JQuery extends Iterable /** * Encode a set of form elements as a string for submission. * - * @see {@link https://api.jquery.com/serialize/} + * @see \`{@link https://api.jquery.com/serialize/ }\` * @since 1.0 */ serialize(): string; /** * Encode a set of form elements as an array of names and values. * - * @see {@link https://api.jquery.com/serializeArray/} + * @see \`{@link https://api.jquery.com/serializeArray/ }\` * @since 1.2 */ serializeArray(): JQuery.NameValuePair[]; @@ -5173,7 +5201,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/show/} + * @see \`{@link https://api.jquery.com/show/ }\` * @since 1.4.3 */ show(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; @@ -5183,7 +5211,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing_complete A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/show/} + * @see \`{@link https://api.jquery.com/show/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5194,7 +5222,7 @@ interface JQuery extends Iterable * @param duration_complete_options A string or number determining how long the animation will run. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/show/} + * @see \`{@link https://api.jquery.com/show/ }\` * @since 1.0 */ show(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; @@ -5202,7 +5230,7 @@ interface JQuery extends Iterable * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. * * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/siblings/} + * @see \`{@link https://api.jquery.com/siblings/ }\` * @since 1.0 */ siblings(selector?: JQuery.Selector): this; @@ -5213,7 +5241,7 @@ interface JQuery extends Iterable * it indicates an offset from the end of the set. * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, * it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. - * @see {@link https://api.jquery.com/slice/} + * @see \`{@link https://api.jquery.com/slice/ }\` * @since 1.1.4 */ slice(start: number, end?: number): this; @@ -5223,7 +5251,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/slideDown/} + * @see \`{@link https://api.jquery.com/slideDown/ }\` * @since 1.4.3 */ slideDown(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -5233,7 +5261,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/slideDown/} + * @see \`{@link https://api.jquery.com/slideDown/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5245,7 +5273,7 @@ interface JQuery extends Iterable * A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideDown/} + * @see \`{@link https://api.jquery.com/slideDown/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5256,7 +5284,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/slideToggle/} + * @see \`{@link https://api.jquery.com/slideToggle/ }\` * @since 1.4.3 */ slideToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -5266,7 +5294,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/slideToggle/} + * @see \`{@link https://api.jquery.com/slideToggle/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5278,7 +5306,7 @@ interface JQuery extends Iterable * A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideToggle/} + * @see \`{@link https://api.jquery.com/slideToggle/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5289,7 +5317,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/slideUp/} + * @see \`{@link https://api.jquery.com/slideUp/ }\` * @since 1.4.3 */ slideUp(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -5299,7 +5327,7 @@ interface JQuery extends Iterable * @param duration_easing A string or number determining how long the animation will run. * A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/slideUp/} + * @see \`{@link https://api.jquery.com/slideUp/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5311,7 +5339,7 @@ interface JQuery extends Iterable * A string indicating which easing function to use for the transition. * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideUp/} + * @see \`{@link https://api.jquery.com/slideUp/ }\` * @since 1.0 * @since 1.4.3 */ @@ -5322,7 +5350,7 @@ interface JQuery extends Iterable * @param queue The name of the queue in which to stop animations. * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - * @see {@link https://api.jquery.com/stop/} + * @see \`{@link https://api.jquery.com/stop/ }\` * @since 1.7 */ stop(queue: string, clearQueue?: boolean, jumpToEnd?: boolean): this; @@ -5331,7 +5359,7 @@ interface JQuery extends Iterable * * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - * @see {@link https://api.jquery.com/stop/} + * @see \`{@link https://api.jquery.com/stop/ }\` * @since 1.2 */ stop(clearQueue?: boolean, jumpToEnd?: boolean): this; @@ -5340,7 +5368,7 @@ interface JQuery extends Iterable * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/submit/} + * @see \`{@link https://api.jquery.com/submit/ }\` * @since 1.4.3 * @deprecated 3.3 */ @@ -5350,7 +5378,7 @@ interface JQuery extends Iterable * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. * * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/submit/} + * @see \`{@link https://api.jquery.com/submit/ }\` * @since 1.0 * @deprecated 3.3 */ @@ -5362,7 +5390,7 @@ interface JQuery extends Iterable * be converted to a String representation. * A function returning the text content to set. Receives the index position of the element in the set * and the old text value as arguments. - * @see {@link https://api.jquery.com/text/} + * @see \`{@link https://api.jquery.com/text/ }\` * @since 1.0 * @since 1.4 */ @@ -5370,14 +5398,14 @@ interface JQuery extends Iterable /** * Get the combined text contents of each element in the set of matched elements, including their descendants. * - * @see {@link https://api.jquery.com/text/} + * @see \`{@link https://api.jquery.com/text/ }\` * @since 1.0 */ text(): string; /** * Retrieve all the elements contained in the jQuery set, as an array. * - * @see {@link https://api.jquery.com/toArray/} + * @see \`{@link https://api.jquery.com/toArray/ }\` * @since 1.4 */ toArray(): TElement[]; @@ -5387,7 +5415,7 @@ interface JQuery extends Iterable * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/toggle/} + * @see \`{@link https://api.jquery.com/toggle/ }\` * @since 1.4.3 */ toggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; @@ -5396,7 +5424,7 @@ interface JQuery extends Iterable * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete, called once per matched element. - * @see {@link https://api.jquery.com/toggle/} + * @see \`{@link https://api.jquery.com/toggle/ }\` * @since 1.0 */ toggle(duration: JQuery.Duration, complete: (this: TElement) => void): this; @@ -5407,7 +5435,7 @@ interface JQuery extends Iterable * A function to call once the animation is complete, called once per matched element. * A map of additional options to pass to the method. * Use true to show the element or false to hide it. - * @see {@link https://api.jquery.com/toggle/} + * @see \`{@link https://api.jquery.com/toggle/ }\` * @since 1.0 * @since 1.3 */ @@ -5421,7 +5449,7 @@ interface JQuery extends Iterable * A function that returns class names to be toggled in the class attribute of each element in the * matched set. Receives the index position of the element in the set, the old class value, and the state as arguments. * @param state A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/} + * @see \`{@link https://api.jquery.com/toggleClass/ }\` * @since 1.0 * @since 1.3 * @since 1.4 @@ -5434,7 +5462,7 @@ interface JQuery extends Iterable * either the class's presence or the value of the state argument. * * @param state A boolean value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/} + * @see \`{@link https://api.jquery.com/toggleClass/ }\` * @since 1.4 * @deprecated 3.0 */ @@ -5445,7 +5473,7 @@ interface JQuery extends Iterable * @param eventType A string containing a JavaScript event type, such as click or submit. * A jQuery.Event object. * @param extraParameters Additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/trigger/} + * @see \`{@link https://api.jquery.com/trigger/ }\` * @since 1.0 * @since 1.3 */ @@ -5456,7 +5484,7 @@ interface JQuery extends Iterable * @param eventType A string containing a JavaScript event type, such as click or submit. * A jQuery.Event object. * @param extraParameters Additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/} + * @see \`{@link https://api.jquery.com/triggerHandler/ }\` * @since 1.2 * @since 1.3 */ @@ -5466,7 +5494,7 @@ interface JQuery extends Iterable * * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/unbind/} + * @see \`{@link https://api.jquery.com/unbind/ }\` * @since 1.0 * @since 1.4.3 * @deprecated 3.0 @@ -5477,7 +5505,7 @@ interface JQuery extends Iterable * * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * A jQuery.Event object. - * @see {@link https://api.jquery.com/unbind/} + * @see \`{@link https://api.jquery.com/unbind/ }\` * @since 1.0 * @deprecated 3.0 */ @@ -5489,7 +5517,7 @@ interface JQuery extends Iterable * @param selector A selector which will be used to filter the event results. * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/undelegate/} + * @see \`{@link https://api.jquery.com/undelegate/ }\` * @since 1.4.2 * @deprecated 3.0 */ @@ -5501,7 +5529,7 @@ interface JQuery extends Iterable * @param selector A selector which will be used to filter the event results. * @param eventTypes A string containing a JavaScript event type, such as "click" or "keydown" * An object of one or more event types and previously bound functions to unbind from them. - * @see {@link https://api.jquery.com/undelegate/} + * @see \`{@link https://api.jquery.com/undelegate/ }\` * @since 1.4.2 * @since 1.4.3 * @deprecated 3.0 @@ -5512,7 +5540,7 @@ interface JQuery extends Iterable * specific set of root elements. * * @param namespace A selector which will be used to filter the event results. - * @see {@link https://api.jquery.com/undelegate/} + * @see \`{@link https://api.jquery.com/undelegate/ }\` * @since 1.4.2 * @since 1.6 * @deprecated 3.0 @@ -5523,7 +5551,7 @@ interface JQuery extends Iterable * * @param selector A selector to check the parent element against. If an element's parent does not match the selector, * the element won't be unwrapped. - * @see {@link https://api.jquery.com/unwrap/} + * @see \`{@link https://api.jquery.com/unwrap/ }\` * @since 1.4 * @since 3.0 */ @@ -5535,7 +5563,7 @@ interface JQuery extends Iterable * element to set as selected/checked. * A function returning the value to set. this is the current element. Receives the index position of * the element in the set and the old value as arguments. - * @see {@link https://api.jquery.com/val/} + * @see \`{@link https://api.jquery.com/val/ }\` * @since 1.0 * @since 1.4 */ @@ -5543,7 +5571,7 @@ interface JQuery extends Iterable /** * Get the current value of the first element in the set of matched elements. * - * @see {@link https://api.jquery.com/val/} + * @see \`{@link https://api.jquery.com/val/ }\` * @since 1.0 */ val(): string | number | string[] | undefined; @@ -5554,7 +5582,7 @@ interface JQuery extends Iterable * appended (as a string). * A function returning the width to set. Receives the index position of the element in the set and the * old width as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/width/} + * @see \`{@link https://api.jquery.com/width/ }\` * @since 1.0 * @since 1.4.1 */ @@ -5562,7 +5590,7 @@ interface JQuery extends Iterable /** * Get the current computed width for the first element in the set of matched elements. * - * @see {@link https://api.jquery.com/width/} + * @see \`{@link https://api.jquery.com/width/ }\` * @since 1.0 */ width(): number | undefined; @@ -5575,7 +5603,7 @@ interface JQuery extends Iterable * A callback function returning the HTML content or jQuery object to wrap around the matched elements. * Receives the index position of the element in the set as an argument. Within the function, this * refers to the current element in the set. - * @see {@link https://api.jquery.com/wrap/} + * @see \`{@link https://api.jquery.com/wrap/ }\` * @since 1.0 * @since 1.4 */ @@ -5588,7 +5616,7 @@ interface JQuery extends Iterable * elements. Within the function, this refers to the first element in the set. Prior to jQuery 3.0, the * callback was incorrectly called for every element in the set and received the index position of the * element in the set as an argument. - * @see {@link https://api.jquery.com/wrapAll/} + * @see \`{@link https://api.jquery.com/wrapAll/ }\` * @since 1.2 * @since 1.4 */ @@ -5601,7 +5629,7 @@ interface JQuery extends Iterable * A callback function which generates a structure to wrap around the content of the matched elements. * Receives the index position of the element in the set as an argument. Within the function, this * refers to the current element in the set. - * @see {@link https://api.jquery.com/wrapInner/} + * @see \`{@link https://api.jquery.com/wrapInner/ }\` * @since 1.2 * @since 1.4 */ @@ -5691,7 +5719,7 @@ declare namespace JQuery { } /** - * @see {@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings} + * @see \`{@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings }\` */ interface AjaxSettingsBase { /** @@ -6363,7 +6391,9 @@ declare namespace JQuery { }; // Writable properties on XMLHttpRequest - interface XHRFields extends Partial> { } + interface XHRFields extends Partial> { + msCaching?: string; + } } interface Transport { @@ -6378,7 +6408,7 @@ declare namespace JQuery { } /** - * @see {@link http://api.jquery.com/jquery.ajax/#jqXHR} + * @see \`{@link http://api.jquery.com/jquery.ajax/#jqXHR }\` */ interface jqXHR extends Promise3, never, Ajax.SuccessTextStatus, Ajax.ErrorTextStatus, never, @@ -6391,7 +6421,7 @@ declare namespace JQuery { /** * Determine the current state of a Deferred object. * - * @see {@link https://api.jquery.com/deferred.state/} + * @see \`{@link https://api.jquery.com/deferred.state/ }\` * @since 1.7 */ state(): 'pending' | 'resolved' | 'rejected'; @@ -6425,28 +6455,28 @@ declare namespace JQuery { * * @param callback A function, or array of functions, that are to be added to the callback list. * @param callbacks A function, or array of functions, that are to be added to the callback list. - * @see {@link https://api.jquery.com/callbacks.add/} + * @see \`{@link https://api.jquery.com/callbacks.add/ }\` * @since 1.7 */ add(callback: TypeOrArray, ...callbacks: Array>): this; /** * Disable a callback list from doing anything more. * - * @see {@link https://api.jquery.com/callbacks.disable/} + * @see \`{@link https://api.jquery.com/callbacks.disable/ }\` * @since 1.7 */ disable(): this; /** * Determine if the callbacks list has been disabled. * - * @see {@link https://api.jquery.com/callbacks.disabled/} + * @see \`{@link https://api.jquery.com/callbacks.disabled/ }\` * @since 1.7 */ disabled(): boolean; /** * Remove all of the callbacks from a list. * - * @see {@link https://api.jquery.com/callbacks.empty/} + * @see \`{@link https://api.jquery.com/callbacks.empty/ }\` * @since 1.7 */ empty(): this; @@ -6454,7 +6484,7 @@ declare namespace JQuery { * Call all of the callbacks with the given arguments. * * @param args The argument or list of arguments to pass back to the callback list. - * @see {@link https://api.jquery.com/callbacks.fire/} + * @see \`{@link https://api.jquery.com/callbacks.fire/ }\` * @since 1.7 */ fire(...args: any[]): this; @@ -6463,14 +6493,14 @@ declare namespace JQuery { * * @param context A reference to the context in which the callbacks in the list should be fired. * @param args An argument, or array of arguments, to pass to the callbacks in the list. - * @see {@link https://api.jquery.com/callbacks.fireWith/} + * @see \`{@link https://api.jquery.com/callbacks.fireWith/ }\` * @since 1.7 */ fireWith(context: object, args?: ArrayLike): this; /** * Determine if the callbacks have already been called at least once. * - * @see {@link https://api.jquery.com/callbacks.fired/} + * @see \`{@link https://api.jquery.com/callbacks.fired/ }\` * @since 1.7 */ fired(): boolean; @@ -6479,21 +6509,21 @@ declare namespace JQuery { * argument, determine whether it is in a list. * * @param callback The callback to search for. - * @see {@link https://api.jquery.com/callbacks.has/} + * @see \`{@link https://api.jquery.com/callbacks.has/ }\` * @since 1.7 */ has(callback?: T): boolean; /** * Lock a callback list in its current state. * - * @see {@link https://api.jquery.com/callbacks.lock/} + * @see \`{@link https://api.jquery.com/callbacks.lock/ }\` * @since 1.7 */ lock(): this; /** * Determine if the callbacks list has been locked. * - * @see {@link https://api.jquery.com/callbacks.locked/} + * @see \`{@link https://api.jquery.com/callbacks.locked/ }\` * @since 1.7 */ locked(): boolean; @@ -6501,7 +6531,7 @@ declare namespace JQuery { * Remove a callback or a collection of callbacks from a callback list. * * @param callbacks A function, or array of functions, that are to be removed from the callback list. - * @see {@link https://api.jquery.com/callbacks.remove/} + * @see \`{@link https://api.jquery.com/callbacks.remove/ }\` * @since 1.7 */ remove(...callbacks: T[]): this; @@ -6525,6 +6555,28 @@ declare namespace JQuery { */ interface Thenable extends PromiseLike { } + // NOTE: This is a private copy of the global Promise interface. It is used by JQuery.PromiseBase to indicate compatibility with other Promise implementations. + // The global Promise interface cannot be used directly as it may be modified, as in the case of @types/bluebird-global. + /** + * Represents the completion of an asynchronous operation + */ + interface _Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): JQuery._Promise; + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): JQuery._Promise; + } + // Type parameter guide // -------------------- // Each type parameter represents a parameter in one of the three possible callbacks. @@ -6544,19 +6596,19 @@ declare namespace JQuery { * This object provides a subset of the methods of the Deferred object (then, done, fail, always, * pipe, progress, state and promise) to prevent users from changing the state of the Deferred. * - * @see {@link http://api.jquery.com/Types/#Promise} + * @see \`{@link http://api.jquery.com/Types/#Promise }\` * @deprecated Experimental. Avoid referncing this type directly in your code. */ interface PromiseBase extends _Promise, PromiseLike { + SR, SJ, SN> extends JQuery._Promise, PromiseLike { /** * Add handlers to be called when the Deferred object is either resolved or rejected. * * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - * @see {@link https://api.jquery.com/deferred.always/} + * @see \`{@link https://api.jquery.com/deferred.always/ }\` * @since 1.6 */ always(alwaysCallback: TypeOrArray>, @@ -6566,7 +6618,7 @@ declare namespace JQuery { * * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see {@link https://api.jquery.com/deferred.done/} + * @see \`{@link https://api.jquery.com/deferred.done/ }\` * @since 1.5 */ done(doneCallback: TypeOrArray>, @@ -6576,7 +6628,7 @@ declare namespace JQuery { * * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.fail/} + * @see \`{@link https://api.jquery.com/deferred.fail/ }\` * @since 1.5 */ fail(failCallback: TypeOrArray>, @@ -6587,7 +6639,7 @@ declare namespace JQuery { * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates * progress notifications. - * @see {@link https://api.jquery.com/deferred.progress/} + * @see \`{@link https://api.jquery.com/deferred.progress/ }\` * @since 1.7 */ progress(progressCallback: TypeOrArray>, @@ -6596,21 +6648,21 @@ declare namespace JQuery { * Return a Deferred's Promise object. * * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/deferred.promise/} + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` * @since 1.5 */ promise(target: TTarget): this & TTarget; /** * Return a Deferred's Promise object. * - * @see {@link https://api.jquery.com/deferred.promise/} + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` * @since 1.5 */ promise(): this; /** * Determine the current state of a Deferred object. * - * @see {@link https://api.jquery.com/deferred.state/} + * @see \`{@link https://api.jquery.com/deferred.state/ }\` * @since 1.7 */ state(): 'pending' | 'resolved' | 'rejected'; @@ -6623,7 +6675,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6661,7 +6713,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6692,7 +6744,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6723,7 +6775,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6747,7 +6799,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6778,7 +6830,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6802,7 +6854,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -6831,7 +6883,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.then/} + * @see \`{@link https://api.jquery.com/deferred.then/ }\` * @since 1.8 */ then extends PromiseBase extends PromiseBase): this; @@ -7101,7 +7153,7 @@ declare namespace JQuery { * Reject a Deferred object and call any failCallbacks with the given args. * * @param args Optional arguments that are passed to the failCallbacks. - * @see {@link https://api.jquery.com/deferred.reject/} + * @see \`{@link https://api.jquery.com/deferred.reject/ }\` * @since 1.5 */ reject(...args: TJ[]): this; @@ -7110,7 +7162,7 @@ declare namespace JQuery { * * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. - * @see {@link https://api.jquery.com/deferred.rejectWith/} + * @see \`{@link https://api.jquery.com/deferred.rejectWith/ }\` * @since 1.5 */ rejectWith(context: object, args?: ArrayLike): this; @@ -7118,7 +7170,7 @@ declare namespace JQuery { * Resolve a Deferred object and call any doneCallbacks with the given args. * * @param args Optional arguments that are passed to the doneCallbacks. - * @see {@link https://api.jquery.com/deferred.resolve/} + * @see \`{@link https://api.jquery.com/deferred.resolve/ }\` * @since 1.5 */ resolve(...args: TR[]): this; @@ -7127,7 +7179,7 @@ declare namespace JQuery { * * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. - * @see {@link https://api.jquery.com/deferred.resolveWith/} + * @see \`{@link https://api.jquery.com/deferred.resolveWith/ }\` * @since 1.5 */ resolveWith(context: object, args?: ArrayLike): this; @@ -7137,7 +7189,7 @@ declare namespace JQuery { * * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - * @see {@link https://api.jquery.com/deferred.always/} + * @see \`{@link https://api.jquery.com/deferred.always/ }\` * @since 1.6 */ always(alwaysCallback: TypeOrArray>, @@ -7147,7 +7199,7 @@ declare namespace JQuery { * * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see {@link https://api.jquery.com/deferred.done/} + * @see \`{@link https://api.jquery.com/deferred.done/ }\` * @since 1.5 */ done(doneCallback: TypeOrArray>, @@ -7157,7 +7209,7 @@ declare namespace JQuery { * * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.fail/} + * @see \`{@link https://api.jquery.com/deferred.fail/ }\` * @since 1.5 */ fail(failCallback: TypeOrArray>, @@ -7168,7 +7220,7 @@ declare namespace JQuery { * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates * progress notifications. - * @see {@link https://api.jquery.com/deferred.progress/} + * @see \`{@link https://api.jquery.com/deferred.progress/ }\` * @since 1.7 */ progress(progressCallback: TypeOrArray>, @@ -7177,21 +7229,21 @@ declare namespace JQuery { * Return a Deferred's Promise object. * * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/deferred.promise/} + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` * @since 1.5 */ promise(target: TTarget): JQuery.Promise & TTarget; /** * Return a Deferred's Promise object. * - * @see {@link https://api.jquery.com/deferred.promise/} + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` * @since 1.5 */ promise(): JQuery.Promise; /** * Determine the current state of a Deferred object. * - * @see {@link https://api.jquery.com/deferred.state/} + * @see \`{@link https://api.jquery.com/deferred.state/ }\` * @since 1.7 */ state(): 'pending' | 'resolved' | 'rejected'; @@ -7204,7 +7256,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7242,7 +7294,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7273,7 +7325,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7304,7 +7356,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7328,7 +7380,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7359,7 +7411,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7383,7 +7435,7 @@ declare namespace JQuery { * @param doneFilter An optional function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.pipe/} + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` * @since 1.6 * @since 1.7 * @deprecated 1.8 @@ -7412,7 +7464,7 @@ declare namespace JQuery { * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see {@link https://api.jquery.com/deferred.then/} + * @see \`{@link https://api.jquery.com/deferred.then/ }\` * @since 1.8 */ then { /** @@ -7775,98 +7827,98 @@ declare namespace JQuery { /** * Indicates whether the META key was pressed when the event fired. * - * @see {@link https://api.jquery.com/event.metaKey/} + * @see \`{@link https://api.jquery.com/event.metaKey/ }\` * @since 1.0.4 */ metaKey: boolean; /** * The namespace specified when the event was triggered. * - * @see {@link https://api.jquery.com/event.namespace/} + * @see \`{@link https://api.jquery.com/event.namespace/ }\` * @since 1.4.3 */ namespace: string; /** * The mouse position relative to the left edge of the document. * - * @see {@link https://api.jquery.com/event.pageX/} + * @see \`{@link https://api.jquery.com/event.pageX/ }\` * @since 1.0.4 */ pageX: number; /** * The mouse position relative to the top edge of the document. * - * @see {@link https://api.jquery.com/event.pageY/} + * @see \`{@link https://api.jquery.com/event.pageY/ }\` * @since 1.0.4 */ pageY: number; /** * The last value returned by an event handler that was triggered by this event, unless the value was undefined. * - * @see {@link https://api.jquery.com/event.result/} + * @see \`{@link https://api.jquery.com/event.result/ }\` * @since 1.3 */ result: any; /** * The difference in milliseconds between the time the browser created the event and January 1, 1970. * - * @see {@link https://api.jquery.com/event.timeStamp/} + * @see \`{@link https://api.jquery.com/event.timeStamp/ }\` * @since 1.2.6 */ timeStamp: number; /** * Describes the nature of the event. * - * @see {@link https://api.jquery.com/event.type/} + * @see \`{@link https://api.jquery.com/event.type/ }\` * @since 1.0 */ type: string; /** * For key or mouse events, this property indicates the specific key or button that was pressed. * - * @see {@link https://api.jquery.com/event.which/} + * @see \`{@link https://api.jquery.com/event.which/ }\` * @since 1.1.3 */ which: number; /** * Returns whether event.preventDefault() was ever called on this event object. * - * @see {@link https://api.jquery.com/event.isDefaultPrevented/} + * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\` * @since 1.3 */ isDefaultPrevented(): boolean; /** * Returns whether event.stopImmediatePropagation() was ever called on this event object. * - * @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/} + * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\` * @since 1.3 */ isImmediatePropagationStopped(): boolean; /** * Returns whether event.stopPropagation() was ever called on this event object. * - * @see {@link https://api.jquery.com/event.isPropagationStopped/} + * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\` * @since 1.3 */ isPropagationStopped(): boolean; /** * If this method is called, the default action of the event will not be triggered. * - * @see {@link https://api.jquery.com/event.preventDefault/} + * @see \`{@link https://api.jquery.com/event.preventDefault/ }\` * @since 1.0 */ preventDefault(): void; /** * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. * - * @see {@link https://api.jquery.com/event.stopImmediatePropagation/} + * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\` * @since 1.3 */ stopImmediatePropagation(): void; /** * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. * - * @see {@link https://api.jquery.com/event.stopPropagation/} + * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\` * @since 1.0 */ stopPropagation(): void; @@ -7881,21 +7933,21 @@ declare namespace JQuery { /** * The current DOM element within the event bubbling phase. * - * @see {@link https://api.jquery.com/event.currentTarget/} + * @see \`{@link https://api.jquery.com/event.currentTarget/ }\` * @since 1.3 */ currentTarget: TTarget; /** * An optional object of data passed to an event method when the current executing handler is bound. * - * @see {@link https://api.jquery.com/event.data/} + * @see \`{@link https://api.jquery.com/event.data/ }\` * @since 1.1 */ data: TData; /** * The element where the currently-called jQuery event handler was attached. * - * @see {@link https://api.jquery.com/event.delegateTarget/} + * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\` * @since 1.7 */ delegateTarget: TTarget; @@ -7903,14 +7955,14 @@ declare namespace JQuery { /** * The other DOM element involved in the event, if any. * - * @see {@link https://api.jquery.com/event.relatedTarget/} + * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\` * @since 1.1.4 */ relatedTarget: TTarget | null; /** * The DOM element that initiated the event. * - * @see {@link https://api.jquery.com/event.target/} + * @see \`{@link https://api.jquery.com/event.target/ }\` * @since 1.0 */ target: TTarget; @@ -7922,9 +7974,9 @@ declare namespace JQuery { // endregion - interface EventHandler extends EventHandlerBase> { } + interface EventHandler extends EventHandlerBase> { } - interface EventHandlerBase { + interface EventHandlerBase { // Extra parameters can be passed from trigger() (this: TContext, t: T, ...args: any[]): void | false | any; } @@ -8117,92 +8169,92 @@ interface JQueryParam { interface BaseJQueryEventObject extends Event { /** * The current DOM element within the event bubbling phase. - * @see {@link https://api.jquery.com/event.currentTarget/} + * @see \`{@link https://api.jquery.com/event.currentTarget/ }\` */ currentTarget: Element; /** * An optional object of data passed to an event method when the current executing handler is bound. - * @see {@link https://api.jquery.com/event.data/} + * @see \`{@link https://api.jquery.com/event.data/ }\` */ data: any; /** * The element where the currently-called jQuery event handler was attached. - * @see {@link https://api.jquery.com/event.delegateTarget/} + * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\` */ delegateTarget: Element; /** * Returns whether event.preventDefault() was ever called on this event object. - * @see {@link https://api.jquery.com/event.isDefaultPrevented/} + * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\` */ isDefaultPrevented(): boolean; /** * Returns whether event.stopImmediatePropagation() was ever called on this event object. - * @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/} + * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\` */ isImmediatePropagationStopped(): boolean; /** * Returns whether event.stopPropagation() was ever called on this event object. - * @see {@link https://api.jquery.com/event.isPropagationStopped/} + * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\` */ isPropagationStopped(): boolean; /** * The namespace specified when the event was triggered. - * @see {@link https://api.jquery.com/event.namespace/} + * @see \`{@link https://api.jquery.com/event.namespace/ }\` */ namespace: string; /** * The browser's original Event object. - * @see {@link https://api.jquery.com/category/events/event-object/} + * @see \`{@link https://api.jquery.com/category/events/event-object/ }\` */ originalEvent: Event; /** * If this method is called, the default action of the event will not be triggered. - * @see {@link https://api.jquery.com/event.preventDefault/} + * @see \`{@link https://api.jquery.com/event.preventDefault/ }\` */ preventDefault(): any; /** * The other DOM element involved in the event, if any. - * @see {@link https://api.jquery.com/event.relatedTarget/} + * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\` */ relatedTarget: Element; /** * The last value returned by an event handler that was triggered by this event, unless the value was undefined. - * @see {@link https://api.jquery.com/event.result/} + * @see \`{@link https://api.jquery.com/event.result/ }\` */ result: any; /** * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. - * @see {@link https://api.jquery.com/event.stopImmediatePropagation/} + * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\` */ stopImmediatePropagation(): void; /** * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. - * @see {@link https://api.jquery.com/event.stopPropagation/} + * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\` */ stopPropagation(): void; /** * The DOM element that initiated the event. - * @see {@link https://api.jquery.com/event.target/} + * @see \`{@link https://api.jquery.com/event.target/ }\` */ target: Element; /** * The mouse position relative to the left edge of the document. - * @see {@link https://api.jquery.com/event.pageX/} + * @see \`{@link https://api.jquery.com/event.pageX/ }\` */ pageX: number; /** * The mouse position relative to the top edge of the document. - * @see {@link https://api.jquery.com/event.pageY/} + * @see \`{@link https://api.jquery.com/event.pageY/ }\` */ pageY: number; /** * For key or mouse events, this property indicates the specific key or button that was pressed. - * @see {@link https://api.jquery.com/event.which/} + * @see \`{@link https://api.jquery.com/event.which/ }\` */ which: number; /** * Indicates whether the META key was pressed when the event fired. - * @see {@link https://api.jquery.com/event.metaKey/} + * @see \`{@link https://api.jquery.com/event.metaKey/ }\` */ metaKey: boolean; } diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 47a85b80d2..f0d1ce5ef8 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -42,7 +42,7 @@ function JQueryStatic() { // $ExpectType JQuery $([new HTMLElement()]); - // $ExpectType JQuery + // $ExpectType JQuery<{ foo: string; hello: string; }> $({ foo: 'bar', hello: 'world' }); // $ExpectType JQuery @@ -58,6 +58,41 @@ function JQueryStatic() { // $ExpectType JQuery $(); + + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432 + function issue_19597_378218432() { + let myDiv = $(document.createElement('div')); + // $ExpectType JQuery + myDiv; + myDiv.on('click', (evt) => { + let target = evt.target; + // $ExpectType HTMLDivElement + target; + }); + let myDiv1 = $(document.createElement('div')); + + let myForcedDiv: JQuery = $(document.createElement('div')) as any; + myForcedDiv.on('click', (evt) => { + let target = evt.target; // HTMLDivElement + // $ExpectType HTMLDivElement + target; + }); + let myDoc = $(document); + // $ExpectType JQuery + myDoc; + myDoc.on('click', (evt) => { + let target = evt.target; + // $ExpectType Document + target; + }); + let myDocForced: JQuery = $(document); + let myWindow = $(window); + // $ExpectType JQuery + myWindow; + let myWindowForced: JQuery = $(window); + // $ExpectType JQuery + myWindowForced; + } } function ajaxSettings() { @@ -699,7 +734,9 @@ function JQueryStatic() { function map() { // $ExpectType number[] - $.map([1, 2, 3], (elementOfArray, indexInArray) => { + $.map([1, 2, 3], function (elementOfArray, indexInArray) { + // $ExpectType Window + this; // $ExpectType number elementOfArray; // $ExpectType number @@ -708,11 +745,49 @@ function JQueryStatic() { return 200 + 10; }); + // $ExpectType number[] + $.map([1, 2, 3], function (elementOfArray, indexInArray) { + // $ExpectType Window + this; + // $ExpectType number + elementOfArray; + // $ExpectType number + indexInArray; + + return [200, 10]; + }); + + // $ExpectType (number | null)[] + $.map([1, 2, 3], function (elementOfArray, indexInArray) { + // $ExpectType Window + this; + // $ExpectType number + elementOfArray; + // $ExpectType number + indexInArray; + + return [200, 10, null]; + }); + + // $ExpectType (number | undefined)[] + $.map([1, 2, 3], function (elementOfArray, indexInArray) { + // $ExpectType Window + this; + // $ExpectType number + elementOfArray; + // $ExpectType number + indexInArray; + + return [200, 10, undefined]; + }); + // $ExpectType (false | 1)[] $.map({ myProp: true, name: 'Rogers', - }, (propertyOfObject, key) => { + }, function (propertyOfObject, key) { + // $ExpectType Window + this; // $ExpectType string | boolean propertyOfObject; // $ExpectType "myProp" | "name" @@ -725,6 +800,67 @@ function JQueryStatic() { return false; } }); + + // $ExpectType (string | number | boolean)[] + $.map({ + myProp: true, + name: 'Rogers', + }, function (propertyOfObject, key) { + // $ExpectType Window + this; + // $ExpectType string | boolean + propertyOfObject; + // $ExpectType "myProp" | "name" + key; + + return [propertyOfObject, 24]; + }); + + // $ExpectType (false | 1)[] + $.map({ + myProp: true, + name: 'Rogers', + anotherProp: 70, + }, function (propertyOfObject, key) { + // $ExpectType Window + this; + // $ExpectType string | number | boolean + propertyOfObject; + // $ExpectType "myProp" | "name" | "anotherProp" + key; + + switch (key) { + case 'myProp': + return 1; + case 'name': + return false; + } + + return null; + }); + + // $ExpectType (false | 1)[] + $.map({ + myProp: true, + name: 'Rogers', + anotherProp: 70, + }, function (propertyOfObject, key) { + // $ExpectType Window + this; + // $ExpectType string | number | boolean + propertyOfObject; + // $ExpectType "myProp" | "name" | "anotherProp" + key; + + switch (key) { + case 'myProp': + return 1; + case 'name': + return false; + } + + return undefined; + }); } function merge() { @@ -2041,7 +2177,7 @@ function JQuery() { function ajax() { function ajaxComplete() { - // $ExpectType JQuery + // $ExpectType JQuery $(document).ajaxComplete(function(event, jqXHR, ajaxOptions) { // $ExpectType Document this; @@ -2057,7 +2193,7 @@ function JQuery() { } function ajaxError() { - // $ExpectType JQuery + // $ExpectType JQuery $(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) { // $ExpectType Document this; @@ -2075,7 +2211,7 @@ function JQuery() { } function ajaxSend() { - // $ExpectType JQuery + // $ExpectType JQuery $(document).ajaxSend(function(event, jqXHR, ajaxOptions) { // $ExpectType Document this; @@ -2091,7 +2227,7 @@ function JQuery() { } function ajaxStart() { - // $ExpectType JQuery + // $ExpectType JQuery $(document).ajaxStart(function() { // $ExpectType Document this; @@ -2101,7 +2237,7 @@ function JQuery() { } function ajaxStop() { - // $ExpectType JQuery + // $ExpectType JQuery $(document).ajaxStop(function() { // $ExpectType Document this; @@ -2111,7 +2247,7 @@ function JQuery() { } function ajaxSuccess() { - // $ExpectType JQuery + // $ExpectType JQuery $(document).ajaxSuccess(function(event, jqXHR, ajaxOptions, data) { // $ExpectType Document this; @@ -5898,8 +6034,9 @@ function JQuery() { } function contents() { - // $ExpectType JQuery - $('p').contents(); + // TODO: Flaky test due to type ordering. + // // $ExpectType JQuery + // $('p').contents(); } function end() { @@ -6131,7 +6268,7 @@ function JQuery() { } function map() { - // $ExpectType JQuery + // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; @@ -6143,7 +6280,7 @@ function JQuery() { return 'myVal'; }); - // $ExpectType JQuery + // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; @@ -6155,7 +6292,7 @@ function JQuery() { return ['myVal1', 'myVal2']; }); - // $ExpectType JQuery + // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; @@ -6164,10 +6301,10 @@ function JQuery() { // $ExpectType HTMLElement domElement; - return null; + return ['myVal1', 'myVal2', null]; }); - // $ExpectType JQuery + // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; @@ -6176,8 +6313,72 @@ function JQuery() { // $ExpectType HTMLElement domElement; - return undefined; + return ['myVal1', 'myVal2', undefined]; }); + + // $ExpectType JQuery + $('p').map(function(index, domElement) { + // $ExpectType HTMLElement + this; + // $ExpectType number + index; + // $ExpectType HTMLElement + domElement; + + let value: string; + + if (index % 2 === 0) { + return null; + } + + value = 'myVal'; + + return value; + }); + + // $ExpectType JQuery + $('p').map(function(index, domElement) { + // $ExpectType HTMLElement + this; + // $ExpectType number + index; + // $ExpectType HTMLElement + domElement; + + let value: string; + + if (index % 2 === 0) { + return undefined; + } + + value = 'myVal'; + + return value; + }); + + // // $ExpectType JQuery + // $('p').map(function(index, domElement) { + // // $ExpectType HTMLElement + // this; + // // $ExpectType number + // index; + // // $ExpectType HTMLElement + // domElement; + // + // return null; + // }); + + // // $ExpectType JQuery + // $('p').map(function(index, domElement) { + // // $ExpectType HTMLElement + // this; + // // $ExpectType number + // index; + // // $ExpectType HTMLElement + // domElement; + // + // return undefined; + // }); } function slice() { @@ -6857,7 +7058,7 @@ function JQuery_jqXHR() { } } - function compatibleWithPromise(): Promise { + function compatibleWithPromise(): JQuery._Promise { return p; } @@ -7279,7 +7480,7 @@ function JQuery_Promise3() { return s; } - function compatibleWithPromise(): Promise { + function compatibleWithPromise(): JQuery._Promise { return p; } @@ -7423,7 +7624,7 @@ function JQuery_Promise2(p: JQuery.Promise2 { + function compatibleWithPromise(): JQuery._Promise { return p; } @@ -7544,7 +7745,7 @@ function JQuery_Promise(p: JQuery.Promise) { return s; } - function compatibleWithPromise(): Promise { + function compatibleWithPromise(): JQuery._Promise { return p; } } diff --git a/types/jquery/test/bluebird-global-tests.ts b/types/jquery/test/bluebird-global-tests.ts new file mode 100644 index 0000000000..3b7f58e9cd --- /dev/null +++ b/types/jquery/test/bluebird-global-tests.ts @@ -0,0 +1,4 @@ +/// + +// Pulls in bluebird-global to test compatibility. +// Fixes https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26328. diff --git a/types/jquery/test/example-tests.ts b/types/jquery/test/example-tests.ts index 728a42b3d6..f725cb2bcb 100644 --- a/types/jquery/test/example-tests.ts +++ b/types/jquery/test/example-tests.ts @@ -3428,7 +3428,7 @@ function examples() { function map_0() { $('p') .append($('input').map(function() { - return $(this).val(); + return $(this).val() as string; }) .get() .join(', ')); diff --git a/types/jquery/test/jquery-slim-window-module-tests.ts b/types/jquery/test/jquery-slim-window-module-tests.ts index b47707cb23..bf4331d824 100644 --- a/types/jquery/test/jquery-slim-window-module-tests.ts +++ b/types/jquery/test/jquery-slim-window-module-tests.ts @@ -1,5 +1,5 @@ import jq = require('jquery/dist/jquery.slim'); const $window = jq(window); -// $ExpectType JQuery +// $ExpectType JQuery $window; diff --git a/types/jquery/test/jquery-window-module-tests.ts b/types/jquery/test/jquery-window-module-tests.ts index 6bc5486fb9..72cb44c5aa 100644 --- a/types/jquery/test/jquery-window-module-tests.ts +++ b/types/jquery/test/jquery-window-module-tests.ts @@ -1,7 +1,7 @@ import jq = require('jquery'); const $window = jq(window); -// $ExpectType JQuery +// $ExpectType JQuery $window; class CanvasLayersDirective { diff --git a/types/jquery/tsconfig.json b/types/jquery/tsconfig.json index e481dc63c6..40a0bc76d4 100644 --- a/types/jquery/tsconfig.json +++ b/types/jquery/tsconfig.json @@ -21,6 +21,7 @@ "files": [ "index.d.ts", "jquery-tests.ts", + "test/bluebird-global-tests.ts", "test/example-tests.ts", "test/longdesc-tests.ts", "test/learn-tests.ts", @@ -29,4 +30,4 @@ "test/jquery-slim-no-window-module-tests.ts", "test/jquery-slim-window-module-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery/tslint.json b/types/jquery/tslint.json index deae83dc66..d1d7bd0a0a 100644 --- a/types/jquery/tslint.json +++ b/types/jquery/tslint.json @@ -14,6 +14,7 @@ "no-empty-interface": false, "no-misused-new": false, "no-object-literal-type-assertion": false, + "no-redundant-jsdoc-2": false, "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-unnecessary-type-assertion": false, diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index da68ea250e..c799bd734b 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -4760,6 +4760,6 @@ declare namespace _ { zipObjectDeep: LodashZipObjectDeep; zipWith: LodashZipWith; __: lodash.__; - placehodler: lodash.__; + placeholder: lodash.__; } } diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts index 9a03fef544..817b485cf2 100644 --- a/types/lodash/scripts/generate-fp.ts +++ b/types/lodash/scripts/generate-fp.ts @@ -118,7 +118,7 @@ async function main() { " interface LoDashFp {", ...interfaceGroups.map(g => ` ${g.functionName}: ${g.interfaces[0].name};`), " __: lodash.__;", - " placehodler: lodash.__;", + " placeholder: lodash.__;", " }", "}", "", diff --git a/types/ltx/lib/Element.d.ts b/types/ltx/lib/Element.d.ts index d0f50ae783..203eaa93b6 100644 --- a/types/ltx/lib/Element.d.ts +++ b/types/ltx/lib/Element.d.ts @@ -67,7 +67,7 @@ export declare class Element { getText(): string; - getChildText(name: string, xmlns: any): string; + getChildText(name: string, xmlns?: any): string; /** * Return all direct descendents that are Elements. diff --git a/types/ltx/ltx-tests.ts b/types/ltx/ltx-tests.ts index 1e617ad27d..522b7673c8 100644 --- a/types/ltx/ltx-tests.ts +++ b/types/ltx/ltx-tests.ts @@ -2,6 +2,11 @@ import * as ltx from 'ltx'; ltx.parse(''); +const getChildTextElement = ltx.parse('body text') as ltx.Element; +if (getChildTextElement.getChildText('child') !== 'body text') { + throw new Error("body does not match"); +} + const p = new ltx.Parser(); p.on('tree', (ignored: any) => {}); diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index a4dc048cc8..034c0cca18 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Marked 0.3 +// Type definitions for Marked 0.4 // Project: https://github.com/chjj/marked // Definitions by: William Orr // BendingBender +// CrossR // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace marked; @@ -202,21 +203,9 @@ declare namespace marked { interface MarkedOptions { /** - * Type: object Default: new Renderer() - * - * An object containing functions to render tokens to HTML. + * A prefix URL for any relative link. */ - renderer?: Renderer; - - /** - * Enable GitHub flavored markdown. - */ - gfm?: boolean; - - /** - * Enable GFM tables. This option requires the gfm option to be true. - */ - tables?: boolean; + baseUrl?: string; /** * Enable GFM line breaks. This option requires the gfm option to be true. @@ -224,34 +213,19 @@ declare namespace marked { breaks?: boolean; /** - * Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior. + * Enable GitHub flavored markdown. */ - pedantic?: boolean; + gfm?: boolean; /** - * Sanitize the output. Ignore any HTML that has been input. + * Include an id attribute when emitting headings. */ - sanitize?: boolean; + headerIds?: boolean; /** - * Optionally sanitize found HTML with a sanitizer function. + * Set the prefix for header tag ids. */ - sanitizer?(html: string): string; - - /** - * Mangle autolinks (). - */ - mangle?: boolean; - - /** - * Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic. - */ - smartLists?: boolean; - - /** - * Shows an HTML error message when rendering fails. - */ - silent?: boolean; + headerPrefix?: string; /** * A function to highlight code blocks. The function takes three arguments: code, lang, and callback. @@ -263,15 +237,52 @@ declare namespace marked { */ langPrefix?: string; + /** + * Mangle autolinks (). + */ + mangle?: boolean; + + /** + * Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior. + */ + pedantic?: boolean; + + /** + * Type: object Default: new Renderer() + * + * An object containing functions to render tokens to HTML. + */ + renderer?: Renderer; + + /** + * Sanitize the output. Ignore any HTML that has been input. + */ + sanitize?: boolean; + + /** + * Optionally sanitize found HTML with a sanitizer function. + */ + sanitizer?(html: string): string; + + /** + * Shows an HTML error message when rendering fails. + */ + silent?: boolean; + + /** + * Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic. + */ + smartLists?: boolean; + /** * Use "smart" typograhic punctuation for things like quotes and dashes. */ smartypants?: boolean; /** - * Set the prefix for header tag ids. + * Enable GFM tables. This option requires the gfm option to be true. */ - headerPrefix?: string; + tables?: boolean; /** * Generate closing slash for self-closing tags (
instead of
) diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index 9499de3a56..e1cb63042c 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -1,6 +1,7 @@ import * as marked from 'marked'; const options: marked.MarkedOptions = { + baseUrl: '', gfm: true, tables: true, breaks: false, @@ -16,23 +17,24 @@ const options: marked.MarkedOptions = { renderer: new marked.Renderer() }; -function callback() { - console.log('callback called'); +function callback(err: string, markdown: string) { + console.log("Callback called!"); + return markdown; } const myOldMarked: typeof marked = marked.setOptions(options); -console.log(marked('i am using __markdown__.')); -console.log(marked('i am using __markdown__.', options)); -console.log(marked('i am using __markdown__.', callback)); -console.log(marked('i am using __markdown__.', options, callback)); +console.log(marked('1) I am using __markdown__.')); +console.log(marked('2) I am using __markdown__.', options)); +console.log(marked('3) I am using __markdown__.', callback)); +console.log(marked('4) I am using __markdown__.', options, callback)); -console.log(marked.parse('i am using __markdown__.')); -console.log(marked.parse('i am using __markdown__.', options)); -console.log(marked.parse('i am using __markdown__.', callback)); -console.log(marked.parse('i am using __markdown__.', options, callback)); +console.log(marked.parse('5) I am using __markdown__.')); +console.log(marked.parse('6) I am using __markdown__.', options)); +console.log(marked.parse('7) I am using __markdown__.', callback)); +console.log(marked.parse('8) I am using __markdown__.', options, callback)); -const text = 'something'; +const text = 'Something'; const tokens: marked.TokensList = marked.lexer(text, options); console.log(marked.parser(tokens)); diff --git a/types/materialize-css/test/inputfields.test.ts b/types/materialize-css/test/inputfields.test.ts index ecde571537..15ea61c1ee 100644 --- a/types/materialize-css/test/inputfields.test.ts +++ b/types/materialize-css/test/inputfields.test.ts @@ -1,6 +1,6 @@ import * as materialize from "materialize-css"; -const elem = document.querySelector('.whatever')!; +const elem = document.querySelector('.whatever') as HTMLElement; M.textareaAutoResize(elem); M.textareaAutoResize($(elem)); diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 886e6da20e..eda68ade10 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1,2260 +1,4546 @@ -// Type definitions for mathjs 3.21 +// Type definitions for mathjs 4.4 // Project: http://mathjs.org/ // Definitions by: Ilya Shestakov , -// Andy Patterson +// Andy Patterson , +// Brad Besserman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 -import { Decimal } from 'decimal.js'; +import { Decimal } from "decimal.js"; -declare const math: math.MathJsStatic; // tslint:disable-line strict-export-declare-modifiers -export as namespace math; // tslint:disable-line strict-export-declare-modifiers -export = math; // tslint:disable-line strict-export-declare-modifiers +declare const math: math.MathJsStatic; +export as namespace math; +export = math; -declare namespace math { // tslint:disable-line strict-export-declare-modifiers - type MathArray = number[]|number[][]; - type MathType = number|BigNumber|Fraction|Complex|Unit|MathArray|Matrix; - type MathExpression = string|string[]|MathArray|Matrix; +declare namespace math { + type MathArray = number[] | number[][]; + type MathType = + | number + | BigNumber + | Fraction + | Complex + | Unit + | MathArray + | Matrix; + type MathExpression = string | string[] | MathArray | Matrix; - interface MathJsStatic { - e: number; - pi: number; - i: number; - Infinity: number; - LN2: number; - LN10: number; - LOG2E: number; - LOG10E: number; - NaN: number; - null: number; - phi: number; - SQRT1_2: number; - SQRT2: number; - tau: number; + interface MathJsStatic { + e: number; + pi: number; + i: number; + Infinity: number; + LN2: number; + LN10: number; + LOG2E: number; + LOG10E: number; + NaN: number; + null: number; + phi: number; + SQRT1_2: number; + SQRT2: number; + tau: number; - uninitialized: any; - version: string; + uninitialized: any; + version: string; - expression: MathNode; - json: MathJsJson; + expression: MathNode; + json: MathJsJson; - config: (options: any) => void; + /************************************************************************* + * Core functions + ************************************************************************/ - /** - * Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix. - * @param L A N x N matrix or array (L) - * @param b A column vector with the b values - * @returns A column vector with the linear system solution (x) - */ - lsolve(L: Matrix|MathArray, b: Matrix|MathArray): Matrix|MathArray; + /** + * Set configuration options for math.js, and get current options. Will + * emit a ‘config’ event, with arguments (curr, prev, changes). + * @param options Available options: {number} epsilon Minimum relative + * difference between two compared values, used by all comparison + * functions. {string} matrix A string ‘Matrix’ (default) or ‘Array’. + * {string} number A string ‘number’ (default), ‘BigNumber’, or + * ‘Fraction’ {number} precision The number of significant digits for + * BigNumbers. Not applicable for Numbers. {string} parenthesis How to + * display parentheses in LaTeX and string output. {string} randomSeed + * Random seed for seeded pseudo random number generator. Set to null to + * randomly seed. + * @returns Returns the current configuration + */ + config: (options: ConfigOptions) => ConfigOptions; + /** + * Create a typed-function which checks the types of the arguments and + * can match them against multiple provided signatures. The + * typed-function automatically converts inputs in order to find a + * matching signature. Typed functions throw informative errors in case + * of wrong input arguments. + * @param name Optional name for the typed-function + * @param signatures Object with one or multiple function signatures + * @returns The created typed-function. + */ + typed: (name: string, signatures: Record any>) => ((...args: any[]) => any); - /** - * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U) - * and a row permutation vector p where A[p,:] = L * U - * @param A A two dimensional matrix or array for which to get the LUP decomposition. - * @returns The lower triangular matrix, the upper triangular matrix and the permutation matrix. - */ - lup(A?: Matrix|MathArray): MathArray; + /************************************************************************* + * Construction functions + ************************************************************************/ - /** - * Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector. - * @param A Invertible Matrix or the Matrix LU decomposition - * @param b Column Vector - * @returns Column vector with the solution to the linear system A * x = b - */ - lusolve(A: Matrix|MathArray|number, b: Matrix|MathArray): Matrix|MathArray; + /** + * Create a BigNumber, which can store numbers with arbitrary precision. + * When a matrix is provided, all elements will be converted to + * BigNumber. + * @param x Value for the big number, 0 by default. + * @returns The created bignumber + */ + bignumber( + x?: + | number + | string + | Fraction + | BigNumber + | MathArray + | Matrix + | boolean + | Fraction + | null + ): BigNumber; - /** - * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in - * two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U - * @param A A two dimensional sparse matrix for which to get the LU decomposition. - * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is - * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic - * ordering and analysis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. - * This is appropriate for LU factorization of non-symmetric matrices. 3 - Symbolic ordering and analysis is performed - * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with - * more than 10*sqr(columns) entries. - * @param threshold Partial pivoting threshold (1 for partial pivoting) - * @returns The lower triangular matrix, the upper triangular matrix and the permutation vectors. - */ - slu(A: Matrix, order: number, threshold: number): any; + /** + * Create a boolean or convert a string or number to a boolean. In case + * of a number, true is returned for non-zero numbers, and false in case + * of zero. Strings can be 'true' or 'false', or can contain a number. + * When value is a matrix, all elements will be converted to boolean. + * @param x A value of any type + * @returns The boolean value + */ + boolean( + x: string | number | boolean | MathArray | Matrix | null + ): boolean | MathArray | Matrix; - /** - * Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b - * @param U A N x N matrix or array (U) - * @param b A column vector with the b values - * @returns A column vector with the linear system solution (x) - */ - usolve(U: Matrix|MathArray, b: Matrix|MathArray): Matrix|MathArray; + /** + * Wrap any value in a chain, allowing to perform chained operations on + * the value. All methods available in the math.js library can be called + * upon the chain, and then will be evaluated with the value itself as + * first argument. The chain can be closed by executing chain.done(), + * which returns the final value. The chain has a number of special + * functions: done() Finalize the chain and return the chain's value. + * valueOf() The same as done() toString() Executes math.format() onto + * the chain's value, returning a string representation of the value. + * @param value A value of any type on which to start a chained + * operation. + * @returns The created chain + */ + chain(value?: any): MathJsChain; - /** - * Calculate the absolute value of a number. For matrices, the function is evaluated element wise. - * @param x A number or matrix for which to get the absolute value - * @returns Absolute value of x - */ - abs(x: number): number; - abs(x: BigNumber): BigNumber; - abs(x: Fraction): Fraction; - abs(x: Complex): Complex; - abs(x: MathArray): MathArray; - abs(x: Matrix): Matrix; - abs(x: Unit): Unit; + /** + * Create a complex value or convert a value to a complex value. + * @param args Arguments specifying the real and imaginary part of the + * complex number + * @returns Returns a complex value + */ + complex(arg?: Complex | string | PolarCoordinates): Complex; + complex(arg?: MathArray | Matrix): MathArray | Matrix; + /** + * @param re Argument specifying the real part of the complex number + * @param im Argument specifying the imaginary part of the complex + * number + * @returns Returns a complex value + */ + complex(re: number, im: number): Complex; - /** - * Add two values, x + y. For matrices, the function is evaluated element wise. - * @param x First value to add - * @param y Second value to add - * @returns Sum of x and y - */ - add(x: MathType, y: MathType): MathType; + /** + * Create a user-defined unit and register it with the Unit type. + * @param name The name of the new unit. Must be unique. Example: ‘knot’ + * @param definition Definition of the unit in terms of existing units. + * For example, ‘0.514444444 m / s’. + * @param options (optional) An object containing any of the following + * properties:
- prefixes {string} “none”, “short”, “long”, + * “binary_short”, or “binary_long”. The default is “none”.
- + * aliases {Array} Array of strings. Example: [‘knots’, ‘kt’, + * ‘kts’]
- offset {Numeric} An offset to apply when converting from + * the unit. For example, the offset for celsius is 273.15. Default is + * 0. + * @returns The new unit + */ + createUnit( + name: string, + definition?: string | UnitDefinition, + options?: CreateUnitOptions + ): Unit; + /** + * Create a user-defined unit and register it with the Unit type. + * @param units Definition of the unit + * @param options + * @returns The new unit + */ + createUnit( + units: Record, + options?: CreateUnitOptions + ): Unit; - /** - * Calculate the cubic root of a value. For matrices, the function is evaluated element wise. - * @param x Value for which to calculate the cubic root. - * @param allRoots Optional, false by default. Only applicable when x is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned. - * @returns Returns the cubic root of x - */ - cbrt(x: number, allRoots?: boolean): number; - cbrt(x: BigNumber, allRoots?: boolean): BigNumber; - cbrt(x: Fraction, allRoots?: boolean): Fraction; - cbrt(x: Complex, allRoots?: boolean): Complex; - cbrt(x: MathArray, allRoots?: boolean): MathArray; - cbrt(x: Matrix, allRoots?: boolean): Matrix; - cbrt(x: Unit, allRoots?: boolean): Unit; + /** + * Create a fraction convert a value to a fraction. + * @param args Arguments specifying the numerator and denominator of the + * fraction + * @returns Returns a fraction + */ + fraction( + args: Fraction | MathArray | Matrix + ): Fraction | MathArray | Matrix; + /** + * @param numerator Argument specifying the numerator of the fraction + * @param denominator Argument specifying the denominator of the + * fraction + * @returns Returns a fraction + */ + fraction( + numerator: number | string | MathArray | Matrix, + denominator?: number | string | MathArray | Matrix + ): Fraction | MathArray | Matrix; - /** - * Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. For matrices, the function is evaluated element wise. - * @param x Number to be rounded - * @returns Rounded value - */ - ceil(x: number): number; - ceil(x: BigNumber): BigNumber; - ceil(x: Fraction): Fraction; - ceil(x: Complex): Complex; - ceil(x: MathArray): MathArray; - ceil(x: Matrix): Matrix; - ceil(x: Unit): Unit; + /** + * Create an index. An Index can store ranges having start, step, and + * end for multiple dimensions. Matrix.get, Matrix.set, and math.subset + * accept an Index as input. + * @param ranges Zero or more ranges or numbers. + * @returns Returns the created index + */ + index(...ranges: any[]): Index; - /** - * Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise. - * @param x Number for which to calculate the cube - * @returns Cube of x - */ - cube(x: number): number; - cube(x: BigNumber): BigNumber; - cube(x: Fraction): Fraction; - cube(x: Complex): Complex; - cube(x: MathArray): MathArray; - cube(x: Matrix): Matrix; - cube(x: Unit): Unit; + /** + * Create a Matrix. The function creates a new math.type.Matrix object + * from an Array. A Matrix has utility functions to manipulate the data + * in the matrix, like getting the size and getting or setting values in + * the matrix. Supported storage formats are 'dense' and 'sparse'. + * @param format The Matrix storage format + * @returns The created Matrix + */ + matrix(format?: "sparse" | "dense"): Matrix; + /** + * @param data A multi dimensional array + * @param format The Matrix storage format + * @param dataType The Matrix data type + * @returns The created Matrix + */ + matrix( + data: MathArray | Matrix, + format?: "sparse" | "dense", + dataType?: string + ): Matrix; - /** - * Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y). - * @param x Numerator - * @param y Denominator - * @returns Quotient, x / y - */ - divide(x: Unit, y: Unit): Unit; - divide(x: number, y: number): number; - divide(x: MathType, y: MathType): MathType; + /** + * Create a number or convert a string, boolean, or unit to a number. + * When value is a matrix, all elements will be converted to number. + * @param value Value to be converted + * @returns The created number + */ + number( + value?: + | string + | number + | BigNumber + | Fraction + | boolean + | MathArray + | Matrix + | Unit + | null + ): number | MathArray | Matrix; + /** + * @param value Value to be converted + * @param valuelessUnit A valueless unit, used to convert a unit to a + * number + * @returns The created number + */ + number(unit: Unit, valuelessUnit: Unit | string): number; - /** - * Divide two matrices element wise. The function accepts both matrices and scalar values. - * @param x Numerator - * @param y Denominator - * @returns Quotient, x ./ y - */ - dotDivide(x: MathType, y: MathType): MathType; + /** + * Create a Sparse Matrix. The function creates a new math.type.Matrix + * object from an Array. A Matrix has utility functions to manipulate + * the data in the matrix, like getting the size and getting or setting + * values in the matrix. + * @param data A two dimensional array + * @param dataType Sparse Matrix data type + * @returns The created matrix + */ + sparse(data?: MathArray | Matrix, dataType?: string): Matrix; - /** - * Multiply two matrices element wise. The function accepts both matrices and scalar values. - * @param x Left hand value - * @param y Right hand value - * @returns Multiplication of x and y - */ - dotMultiply(x: MathType, y: MathType): MathType; + /** + * Split a unit in an array of units whose sum is equal to the original + * unit. + * @param unit A unit to be split + * @param parts An array of strings or valueless units + * @returns An array of units + */ + splitUnit(unit: Unit, parts: Unit[]): Unit[]; - /** - * Calculates the power of x to y element wise. - * @param x The base - * @param y The exponent - * @returns The value of x to the power y - */ - dotPow(x: MathType, y: MathType): MathType; + /** + * Create a string or convert any object into a string. Elements of + * Arrays and Matrices are processed element wise. + * @param value A value to convert to a string + * @returns The created string + */ + string( + value: MathType | null + ): string | MathArray | Matrix; - /** - * Calculate the exponent of a value. For matrices, the function is evaluated element wise. - * @param x A number or matrix to exponentiate - * #returns Exponent of x - */ - exp(x: number): number; - exp(x: BigNumber): BigNumber ; - exp(x: Complex): Complex ; - exp(x: MathArray): MathArray ; - exp(x: Matrix): Matrix; + /** + * Create a unit. Depending on the passed arguments, the function will + * create and return a new math.type.Unit object. When a matrix is + * provided, all elements will be converted to units. + * @param unit The unit to be created + * @returns The created unit + */ + unit(unit: string): Unit; + /** + * @param value The value of the unit to be created + * @param unit The unit to be created + * @returns The created unit + */ + unit(value: number | MathArray | Matrix, unit: string): Unit; - /** - * Round a value towards zero. For matrices, the function is evaluated element wise. - * @param x Number to be rounded - * @returns Rounded value - */ - fix(x: number): number; - fix(x: BigNumber): BigNumber ; - fix(x: Fraction): Fraction ; - fix(x: Complex): Complex ; - fix(x: MathArray): MathArray ; - fix(x: Matrix): Matrix; + /************************************************************************* + * Expression functions + ************************************************************************/ - /** - * Round a value towards minus infinity. For matrices, the function is evaluated element wise. - * @param Number to be rounded - * @returns Rounded value - */ - floor(x: number): number; - floor(x: BigNumber): BigNumber ; - floor(x: Fraction): Fraction ; - floor(x: Complex): Complex ; - floor(x: MathArray): MathArray ; - floor(x: Matrix): Matrix; + /** + * Parse and compile an expression. Returns a an object with a function + * eval([scope]) to evaluate the compiled expression. + * @param expr The expression to be compiled + * @returns An object with the compiled expression + */ + compile(expr: MathExpression): EvalFunction; + /** + * @param exprs The expressions to be compiled + * @returns An array of objects with the compiled expressions + */ + compile(exprs: MathExpression[]): EvalFunction[]; - /** - * Calculate the greatest common divisor for two or more values or arrays. For matrices, the function is evaluated element wise. - */ - gcd(...args: number[]): number; - gcd(...args: BigNumber[]): BigNumber ; - gcd(...args: Fraction[]): Fraction ; - gcd(...args: MathArray[]): MathArray ; - gcd(...args: Matrix[]): Matrix; + /** + * Evaluate an expression. + * @param expr The expression to be evaluated + * @param scope Scope to read/write variables + * @returns The result of the expression + */ + eval( + expr: MathExpression | MathExpression[] | Matrix, + scope?: object + ): any; - /** - * Calculate the hypotenusa of a list with values. The hypotenusa is defined as: - * hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) - * For matrix input, the hypotenusa is calculated for all values in the matrix. - */ - hypot(...args: number[]): number; - hypot(...args: BigNumber[]): BigNumber; + /** + * Retrieve help on a function or data type. Help files are retrieved + * from the documentation in math.expression.docs. + * @param search A function or function name for which to get help + * @returns A help object + */ + help(search: () => any): Help; + + /** + * Parse an expression. Returns a node tree, which can be evaluated by + * invoking node.eval(); + * @param expr Expression to be parsed + * @param options Available options: nodes - a set of custome nodes + * @returns A node + */ + parse(expr: MathExpression, options?: any): MathNode; + /** + * @param exprs Expressions to be parsed + * @param options Available options: nodes - a set of custome nodes + * @returns An arry of nodes + */ + parse(exprs: MathExpression[], options?: any): MathNode[]; + + /** + * Create a parser. The function creates a new math.expression.Parser + * object. + * @returns A Parser object + */ + parser(): Parser; + + /************************************************************************* + * Algebra functions + ************************************************************************/ + /** + * @param expr The expression to differentiate + * @param variable The variable over which to differentiate + * @param options There is one option available, simplify, which is true + * by default. When false, output will not be simplified. + * @returns The derivative of expr + */ + derivative( + expr: MathNode | string, + variable: MathNode | string, + options?: {simplify: boolean} + ): MathNode; + + /** + * Solves the linear equation system by forwards substitution. Matrix + * must be a lower triangular matrix. + * @param L A N x N matrix or array (L) + * @param b A column vector with the b values + * @returns A column vector with the linear system solution (x) + */ + lsolve( + L: Matrix | MathArray, + b: Matrix | MathArray + ): Matrix | MathArray; + + /** + * Calculate the Matrix LU decomposition with partial pivoting. Matrix A + * is decomposed in two matrices (L, U) and a row permutation vector p + * where A[p,:] = L * U + * @param A A two dimensional matrix or array for which to get the LUP + * decomposition. + * @returns The lower triangular matrix, the upper triangular matrix and + * the permutation matrix. + */ + lup( + A?: Matrix | MathArray + ): { L: MathArray | Matrix; U: MathArray | Matrix; P: number[] }; + + /** + * Solves the linear system A * x = b where A is an [n x n] matrix and b + * is a [n] column vector. + * @param A Invertible Matrix or the Matrix LU decomposition + * @param b Column Vector + * @param order The Symbolic Ordering and Analysis order, see slu for + * details. Matrix must be a SparseMatrix + * @param threshold Partial pivoting threshold (1 for partial pivoting), + * see slu for details. Matrix must be a SparseMatrix. + * @returns Column vector with the solution to the linear system A * x = + * b + */ + lusolve( + A: Matrix | MathArray | number, + b: Matrix | MathArray, + order?: number, + threshold?: number + ): Matrix | MathArray; + + /** + * Calculate the Matrix QR decomposition. Matrix A is decomposed in two + * matrices (Q, R) where Q is an orthogonal matrix and R is an upper + * triangular matrix. + * @param A A two dimensional matrix or array for which to get the QR + * decomposition. + * @returns Q: the orthogonal matrix and R: the upper triangular matrix + */ + qr( + A: Matrix | MathArray + ): { Q: MathArray | Matrix; R: MathArray | Matrix }; + + /** + * Transform a rationalizable expression in a rational fraction. If + * rational fraction is one variable polynomial then converts the + * numerator and denominator in canonical form, with decreasing + * exponents, returning the coefficients of numerator. + * @param expr The expression to check if is a polynomial expression + * @param optional scope of expression or true for already evaluated + * rational expression at input + * @param detailed optional True if return an object, false if return + * expression node (default) + * @returns The rational polynomial of expr + */ + rationalize(expr: MathNode | string, optional?: object | boolean, detailed?: true): { expression: MathNode | string, variables: string[], coefficients: MathType[] }; + rationalize(expr: MathNode | string, optional?: object | boolean, detailed?: false): MathNode; + + /** + * Simplify an expression tree. + * @param expr The expression to be simplified + * @param rules A list of rules are applied to an expression, repeating + * over the list until no further changes are made. It’s possible to + * pass a custom set of rules to the function as second argument. A rule + * can be specified as an object, string, or function. + * @param scope Scope to variables + * @returns Returns the simplified form of expr + */ + simplify( + expr: MathNode | string, + rules?: Array<({ l: string; r: string } | string | ((node: MathNode) => MathNode))>, + scope?: object + ): MathNode; + + /** + * Calculate the Sparse Matrix LU decomposition with full pivoting. + * Sparse Matrix A is decomposed in two matrices (L, U) and two + * permutation vectors (pinv, q) where P * A * Q = L * U + * @param A A two dimensional sparse matrix for which to get the LU + * decomposition. + * @param order The Symbolic Ordering and Analysis order: 0 - Natural + * ordering, no permutation vector q is returned 1 - Matrix must be + * square, symbolic ordering and analisis is performed on M = A + A' 2 - + * Symbolic ordering and analysis is performed on M = A' * A. Dense + * columns from A' are dropped, A recreated from A'. This is appropriate + * for LU factorization of non-symmetric matrices. 3 - Symbolic ordering + * and analysis is performed on M = A' * A. This is best used for LU + * factorization is matrix M has no dense rows. A dense row is a row + * with more than 10*sqr(columns) entries. + * @param threshold Partial pivoting threshold (1 for partial pivoting) + * @returns The lower triangular matrix, the upper triangular matrix and + * the permutation vectors. + */ + slu(A: Matrix, order: number, threshold: number): object; + + /** + * Solves the linear equation system by backward substitution. Matrix + * must be an upper triangular matrix. U * x = b + * @param U A N x N matrix or array (U) + * @param b A column vector with the b values + * @returns A column vector with the linear system solution (x) + */ + usolve( + U: Matrix | MathArray, + b: Matrix | MathArray + ): Matrix | MathArray; + + /************************************************************************* + * Arithmetic functions + ************************************************************************/ + + /** + * Calculate the absolute value of a number. For matrices, the function + * is evaluated element wise. + * @param x A number or matrix for which to get the absolute value + * @returns Absolute value of x + */ + abs(x: number): number; + abs(x: BigNumber): BigNumber; + abs(x: Fraction): Fraction; + abs(x: Complex): Complex; + abs(x: MathArray): MathArray; + abs(x: Matrix): Matrix; + abs(x: Unit): Unit; + + /** + * Add two values, x + y. For matrices, the function is evaluated + * element wise. + * @param x First value to add + * @param y Second value to add + * @returns Sum of x and y + */ + add(x: MathType, y: MathType): MathType; + + /** + * Calculate the cubic root of a value. For matrices, the function is + * evaluated element wise. + * @param x Value for which to calculate the cubic root. + * @param allRoots Optional, false by default. Only applicable when x is + * a number or complex number. If true, all complex roots are returned, + * if false (default) the principal root is returned. + * @returns Returns the cubic root of x + */ + cbrt(x: number, allRoots?: boolean): number; + cbrt(x: BigNumber, allRoots?: boolean): BigNumber; + cbrt(x: Fraction, allRoots?: boolean): Fraction; + cbrt(x: Complex, allRoots?: boolean): Complex; + cbrt(x: MathArray, allRoots?: boolean): MathArray; + cbrt(x: Matrix, allRoots?: boolean): Matrix; + cbrt(x: Unit, allRoots?: boolean): Unit; + + /** + * Round a value towards plus infinity If x is complex, both real and + * imaginary part are rounded towards plus infinity. For matrices, the + * function is evaluated element wise. + * @param x Number to be rounded + * @returns Rounded value + */ + ceil(x: number): number; + ceil(x: BigNumber): BigNumber; + ceil(x: Fraction): Fraction; + ceil(x: Complex): Complex; + ceil(x: MathArray): MathArray; + ceil(x: Matrix): Matrix; + ceil(x: Unit): Unit; + + /** + * Compute the cube of a value, x * x * x. For matrices, the function is + * evaluated element wise. + * @param x Number for which to calculate the cube + * @returns Cube of x + */ + cube(x: number): number; + cube(x: BigNumber): BigNumber; + cube(x: Fraction): Fraction; + cube(x: Complex): Complex; + cube(x: MathArray): MathArray; + cube(x: Matrix): Matrix; + cube(x: Unit): Unit; + + /** + * Divide two values, x / y. To divide matrices, x is multiplied with + * the inverse of y: x * inv(y). + * @param x Numerator + * @param y Denominator + * @returns Quotient, x / y + */ + divide(x: Unit, y: Unit): Unit; + divide(x: number, y: number): number; + divide(x: MathType, y: MathType): MathType; + + /** + * Divide two matrices element wise. The function accepts both matrices + * and scalar values. + * @param x Numerator + * @param y Denominator + * @returns Quotient, x ./ y + */ + dotDivide(x: MathType, y: MathType): MathType; + + /** + * Multiply two matrices element wise. The function accepts both + * matrices and scalar values. + * @param x Left hand value + * @param y Right hand value + * @returns Multiplication of x and y + */ + dotMultiply(x: MathType, y: MathType): MathType; + + /** + * Calculates the power of x to y element wise. + * @param x The base + * @param y The exponent + * @returns The value of x to the power y + */ + dotPow(x: MathType, y: MathType): MathType; + + /** + * Calculate the exponent of a value. For matrices, the function is + * evaluated element wise. + * @param x A number or matrix to exponentiate + * @returns Exponent of x + */ + exp(x: number): number; + exp(x: BigNumber): BigNumber; + exp(x: Complex): Complex; + exp(x: MathArray): MathArray; + exp(x: Matrix): Matrix; + + /** + * Calculate the value of subtracting 1 from the exponential value. For + * matrices, the function is evaluated element wise. + * @param x A number or matrix to apply expm1 + * @returns Exponent of x + */ + expm1(x: number): number; + expm1(x: BigNumber): BigNumber; + expm1(x: Complex): Complex; + expm1(x: MathArray): MathArray; + expm1(x: Matrix): Matrix; + + /** + * Round a value towards zero. For matrices, the function is evaluated + * element wise. + * @param x Number to be rounded + * @returns Rounded value + */ + fix(x: number): number; + fix(x: BigNumber): BigNumber; + fix(x: Fraction): Fraction; + fix(x: Complex): Complex; + fix(x: MathArray): MathArray; + fix(x: Matrix): Matrix; + + /** + * Round a value towards minus infinity. For matrices, the function is + * evaluated element wise. + * @param Number to be rounded + * @returns Rounded value + */ + floor(x: number): number; + floor(x: BigNumber): BigNumber; + floor(x: Fraction): Fraction; + floor(x: Complex): Complex; + floor(x: MathArray): MathArray; + floor(x: Matrix): Matrix; + + /** + * Calculate the greatest common divisor for two or more values or + * arrays. For matrices, the function is evaluated element wise. + * @param args Two or more integer numbers + * @returns The greatest common divisor + */ + gcd(...args: number[]): number; + gcd(...args: BigNumber[]): BigNumber; + gcd(...args: Fraction[]): Fraction; + gcd(...args: MathArray[]): MathArray; + gcd(...args: Matrix[]): Matrix; + + /** + * Calculate the hypotenusa of a list with values. The hypotenusa is + * defined as: hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) For + * matrix input, the hypotenusa is calculated for all values in the + * matrix. + * @param args A list with numeric values or an Array or Matrix. Matrix + * and Array input is flattened and returns a single number for the + * whole matrix. + * @returns Returns the hypothenuse of the input values. + */ + hypot(...args: number[]): number; + hypot(...args: BigNumber[]): BigNumber; + + /** + * Calculate the least common multiple for two or more values or arrays. + * lcm is defined as: lcm(a, b) = abs(a * b) / gcd(a, b) For matrices, + * the function is evaluated element wise. + * @param a An integer number + * @param b An integer number + * @returns The least common multiple + */ + lcm(a: number, b: number): number; + lcm(a: BigNumber, b: BigNumber): BigNumber; + lcm(a: MathArray, b: MathArray): MathArray; + lcm(a: Matrix, b: Matrix): Matrix; + + /** + * Calculate the logarithm of a value. For matrices, the function is + * evaluated element wise. + * @param x Value for which to calculate the logarithm. + * @param base Optional base for the logarithm. If not provided, the + * natural logarithm of x is calculated. Default value: e. + * @returns Returns the logarithm of x + */ + log( + x: number | BigNumber | Complex | MathArray | Matrix, + base?: number | BigNumber | Complex + ): number | BigNumber | Complex | MathArray | Matrix; + + /** + * Calculate the 10-base of a value. This is the same as calculating + * log(x, 10). For matrices, the function is evaluated element wise. + * @param x Value for which to calculate the logarithm. + * @returns Returns the 10-base logarithm of x + */ + log10(x: number): number; + log10(x: BigNumber): BigNumber; + log10(x: Complex): Complex; + log10(x: MathArray): MathArray; + log10(x: Matrix): Matrix; + + /** + * Calculate the logarithm of a value+1. For matrices, the function is + * evaluated element wise. + * @param x Value for which to calculate the logarithm. + * @returns Returns the logarithm of x+1 + */ + log1p(x: number, base?: number | BigNumber | Complex): number; + log1p(x: BigNumber, base?: number | BigNumber | Complex): BigNumber; + log1p(x: Complex, base?: number | BigNumber | Complex): Complex; + log1p(x: MathArray, base?: number | BigNumber | Complex): MathArray; + log1p(x: Matrix, base?: number | BigNumber | Complex): Matrix; + + /** + * Calculate the 2-base of a value. This is the same as calculating + * log(x, 2). For matrices, the function is evaluated element wise. + * @param x Value for which to calculate the logarithm. + * @returns Returns the 2-base logarithm of x + */ + log2(x: number): number; + log2(x: BigNumber): BigNumber; + log2(x: Complex): Complex; + log2(x: MathArray): MathArray; + log2(x: Matrix): Matrix; + + /** + * Calculates the modulus, the remainder of an integer division. For + * matrices, the function is evaluated element wise. The modulus is + * defined as: x - y * floor(x / y) + * @see http://en.wikipedia.org/wiki/Modulo_operation. + * @param x Dividend + * @param y Divisor + * @returns Returns the remainder of x divided by y + */ + mod( + x: number | BigNumber | Fraction | MathArray | Matrix, + y: number | BigNumber | Fraction | MathArray | Matrix + ): number | BigNumber | Fraction | MathArray | Matrix; + + /** + * Multiply two values, x * y. The result is squeezed. For matrices, the + * matrix product is calculated. + * @param x The first value to multiply + * @param y The second value to multiply + * @returns Multiplication of x and y + */ + multiply(x: Matrix | MathArray, y: MathType): Matrix | MathArray; + multiply(x: Unit, y: Unit): Unit; + multiply(x: number, y: number): number; + multiply(x: MathType, y: MathType): MathType; + + /** + * Calculate the norm of a number, vector or matrix. The second + * parameter p is optional. If not provided, it defaults to 2. + * @param x Value for which to calculate the norm + * @param p Vector space. Supported numbers include Infinity and + * -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The + * Frobenius norm) Default value: 2. + * @returns the p-norm + */ + norm( + x: number | BigNumber | Complex | MathArray | Matrix, + p?: number | BigNumber | string + ): number | BigNumber; + + /** + * Calculate the nth root of a value. The principal nth root of a + * positive real number A, is the positive real solution of the equation + * x^root = A For matrices, the function is evaluated element wise. + * @param a Value for which to calculate the nth root + * @param root The root. Default value: 2. + * @return The nth root of a + */ + nthRoot( + a: number | BigNumber | MathArray | Matrix | Complex, + root?: number | BigNumber + ): number | Complex | MathArray | Matrix; + + /** + * Calculates the power of x to y, x ^ y. Matrix exponentiation is + * supported for square matrices x, and positive integer exponents y. + * @param x The base + * @param y The exponent + * @returns x to the power y + */ + pow(x: MathType, y: number | BigNumber | Complex): MathType; + + /** + * Round a value towards the nearest integer. For matrices, the function + * is evaluated element wise. + * @param x Number to be rounded + * @param n Number of decimals Default value: 0. + * @returns Rounded value of x + */ + round( + x: number | BigNumber | Fraction | Complex | MathArray | Matrix, + n?: number | BigNumber | MathArray + ): number | BigNumber | Fraction | Complex | MathArray | Matrix; + + /** + * Compute the sign of a value. The sign of a value x is: 1 when x > 1 + * -1 when x < 0 0 when x == 0 For matrices, the function is evaluated + * element wise. + * @param x The number for which to determine the sign + * @returns The sign of x + */ + sign(x: number): number; + sign(x: BigNumber): BigNumber; + sign(x: Fraction): Fraction; + sign(x: Complex): Complex; + sign(x: MathArray): MathArray; + sign(x: Matrix): Matrix; + sign(x: Unit): Unit; + + /** + * Calculate the square root of a value. For matrices, the function is + * evaluated element wise. + * @param x Value for which to calculate the square root + * @returns Returns the square root of x + */ + sqrt(x: number): number; + sqrt(x: BigNumber): BigNumber; + sqrt(x: Complex): Complex; + sqrt(x: MathArray): MathArray; + sqrt(x: Matrix): Matrix; + sqrt(x: Unit): Unit; + + /** + * Compute the square of a value, x * x. For matrices, the function is + * evaluated element wise. + * @param x Number for which to calculate the square + * @returns Squared value + */ + square(x: number): number; + square(x: BigNumber): BigNumber; + square(x: Fraction): Fraction; + square(x: Complex): Complex; + square(x: MathArray): MathArray; + square(x: Matrix): Matrix; + square(x: Unit): Unit; + + /** + * Subtract two values, x - y. For matrices, the function is evaluated + * element wise. + * @param x Initial value + * @param y Value to subtract from x + * @returns Subtraction of x and y + */ + subtract(x: MathType, y: MathType): MathType; + + /** + * Inverse the sign of a value, apply a unary minus operation. For + * matrices, the function is evaluated element wise. Boolean values and + * strings will be converted to a number. For complex numbers, both real + * and complex value are inverted. + * @param x Number to be inverted + * @returns Retursn the value with inverted sign + */ + unaryMinus(x: number): number; + unaryMinus(x: BigNumber): BigNumber; + unaryMinus(x: Fraction): Fraction; + unaryMinus(x: Complex): Complex; + unaryMinus(x: MathArray): MathArray; + unaryMinus(x: Matrix): Matrix; + unaryMinus(x: Unit): Unit; + + /** + * Unary plus operation. Boolean values and strings will be converted to + * a number, numeric values will be returned as is. For matrices, the + * function is evaluated element wise. + * @param x Input value + * @returns Returns the input value when numeric, converts to a number + * when input is non-numeric. + */ + unaryPlus(x: number): number; + unaryPlus(x: BigNumber): BigNumber; + unaryPlus(x: Fraction): Fraction; + unaryPlus(x: string): string; + unaryPlus(x: Complex): Complex; + unaryPlus(x: MathArray): MathArray; + unaryPlus(x: Matrix): Matrix; + unaryPlus(x: Unit): Unit; + + /** + * Calculate the extended greatest common divisor for two values. See + * http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. + * @param a An integer number + * @param b An integer number + * @returns Returns an array containing 3 integers [div, m, n] where div + * = gcd(a, b) and a*m + b*n = div + */ + xgcd(a: number | BigNumber, b: number | BigNumber): MathArray; + + /************************************************************************* + * Bitwise functions + ************************************************************************/ + + /** + * Bitwise AND two values, x & y. For matrices, the function is + * evaluated element wise. + * @param x First value to and + * @param y Second value to and + * @returns AND of x and y + */ + bitAnd( + x: number | BigNumber | MathArray | Matrix, + y: number | BigNumber | MathArray | Matrix + ): number | BigNumber | MathArray | Matrix; + + /** + * Bitwise NOT value, ~x. For matrices, the function is evaluated + * element wise. For units, the function is evaluated on the best prefix + * base. + * @param x Value to not + * @returns NOT of x + */ + bitNot(x: number): number; + bitNot(x: BigNumber): BigNumber; + bitNot(x: MathArray): MathArray; + bitNot(x: Matrix): Matrix; + + /** + * Bitwise OR two values, x | y. For matrices, the function is evaluated + * element wise. For units, the function is evaluated on the lowest + * print base. + * @param x First value to or + * @param y Second value to or + * @returns OR of x and y + */ + bitOr(x: number, y: number): number; + bitOr(x: BigNumber, y: BigNumber): BigNumber; + bitOr(x: MathArray, y: MathArray): MathArray; + bitOr(x: Matrix, y: Matrix): Matrix; + + /** + * Bitwise XOR two values, x ^ y. For matrices, the function is + * evaluated element wise. + * @param x First value to xor + * @param y Second value to xor + * @returns XOR of x and y + */ + bitXor( + x: number | BigNumber | MathArray | Matrix, + y: number | BigNumber | MathArray | Matrix + ): number | BigNumber | MathArray | Matrix; + + /** + * Bitwise left logical shift of a value x by y number of bits, x << y. + * For matrices, the function is evaluated element wise. For units, the + * function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + * @returns x shifted left y times + */ + leftShift( + x: number | BigNumber | MathArray | Matrix, + y: number | BigNumber + ): number | BigNumber | MathArray | Matrix; + + /** + * Bitwise right arithmetic shift of a value x by y number of bits, x >> + * y. For matrices, the function is evaluated element wise. For units, + * the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + * @returns x sign-filled shifted right y times + */ + rightArithShift( + x: number | BigNumber | MathArray | Matrix, + y: number | BigNumber + ): number | BigNumber | MathArray | Matrix; + + /** + * Bitwise right logical shift of value x by y number of bits, x >>> y. + * For matrices, the function is evaluated element wise. For units, the + * function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + * @returns x zero-filled shifted right y times + */ + rightLogShift( + x: number | MathArray | Matrix, + y: number + ): number | MathArray | Matrix; + + /************************************************************************* + * Combinatorics functions + ************************************************************************/ + + /** + * The Bell Numbers count the number of partitions of a set. A partition + * is a pairwise disjoint subset of S whose union is S. bellNumbers only + * takes integer arguments. The following condition must be enforced: n + * >= 0 + * @param n Total number of objects in the set + * @returns B(n) + */ + bellNumbers(n: number): number; + bellNumbers(n: BigNumber): BigNumber; + + /** + * The Catalan Numbers enumerate combinatorial structures of many + * different types. catalan only takes integer arguments. The following + * condition must be enforced: n >= 0 + * @param n nth Catalan number + * @returns Cn(n) + */ + catalan(n: number): number; + catalan(n: BigNumber): BigNumber; + + /** + * The composition counts of n into k parts. Composition only takes + * integer arguments. The following condition must be enforced: k <= n. + * @param n Total number of objects in the set + * @param k Number of objects in the subset + * @returns Returns the composition counts of n into k parts. + */ + composition( + n: number | BigNumber, + k: number | BigNumber + ): number | BigNumber; + + /** + * The Stirling numbers of the second kind, counts the number of ways to + * partition a set of n labelled objects into k nonempty unlabelled + * subsets. stirlingS2 only takes integer arguments. The following + * condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = + * 1 + * @param n Total number of objects in the set + * @param k Number of objects in the subset + * @returns S(n,k) + */ + stirlingS2( + n: number | BigNumber, + k: number | BigNumber + ): number | BigNumber; + + /************************************************************************* + * Complex functions + ************************************************************************/ + + /** + * Compute the argument of a complex value. For a complex number a + bi, + * the argument is computed as atan2(b, a). For matrices, the function + * is evaluated element wise. + * @param x A complex number or array with complex numbers + * @returns The argument of x + */ + arg(x: number | Complex): number; + arg(x: BigNumber | Complex): BigNumber; + arg(x: MathArray): MathArray; + arg(x: Matrix): Matrix; + + /** + * Compute the complex conjugate of a complex value. If x = a+bi, the + * complex conjugate of x is a - bi. For matrices, the function is + * evaluated element wise. + * @param x A complex number or array with complex numbers + * @returns The complex conjugate of x + */ + conj( + x: number | BigNumber | Complex | MathArray | Matrix + ): number | BigNumber | Complex | MathArray | Matrix; + + /** + * Get the imaginary part of a complex number. For a complex number a + + * bi, the function returns b. For matrices, the function is evaluated + * element wise. + * @param x A complex number or array with complex numbers + * @returns The imaginary part of x + */ + im( + x: number | BigNumber | Complex | MathArray | Matrix + ): number | BigNumber | MathArray | Matrix; + + /** + * Get the real part of a complex number. For a complex number a + bi, + * the function returns a. For matrices, the function is evaluated + * element wise. + * @param x A complex number or array of complex numbers + * @returns The real part of x + */ + re( + x: number | BigNumber | Complex | MathArray | Matrix + ): number | BigNumber | MathArray | Matrix; + + /************************************************************************* + * Geometry functions + ************************************************************************/ + + /** + * Calculates: The eucledian distance between two points in 2 and 3 + * dimensional spaces. Distance between point and a line in 2 and 3 + * dimensional spaces. Pairwise distance between a set of 2D or 3D + * points NOTE: When substituting coefficients of a line(a, b and c), + * use ax + by + c = 0 instead of ax + by = c For parametric equation of + * a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, + * c) + * @param x Coordinates of the first point + * @param y Coordinates of the second point + * @returns Returns the distance from two/three points + */ + distance( + x: MathArray | Matrix | object, + y: MathArray | Matrix | object + ): number | BigNumber; + + /** + * Calculates the point of intersection of two lines in two or three + * dimensions and of a line and a plane in three dimensions. The inputs + * are in the form of arrays or 1 dimensional matrices. The line + * intersection functions return null if the lines do not meet. Note: + * Fill the plane coefficients as x + y + z = c and not as x + y + z + c + * = 0. + * @param w Co-ordinates of first end-point of first line + * @param x Co-ordinates of second end-point of first line + * @param y Co-ordinates of first end-point of second line OR + * Coefficients of the plane's equation + * @param z Co-ordinates of second end-point of second line OR null if + * the calculation is for line and plane + * @returns Returns the point of intersection of lines/lines-planes + */ + intersect( + w: MathArray | Matrix, + x: MathArray | Matrix, + y: MathArray | Matrix, + z: MathArray | Matrix + ): MathArray; + + /************************************************************************* + * Logical functions + ************************************************************************/ + + /** + * Logical and. Test whether two values are both defined with a + * nonzero/nonempty value. For matrices, the function is evaluated + * element wise. + * @param x First value to and + * @param y Second value to and + * @returns Returns true when both inputs are defined with a + * nonzero/nonempty value. + */ + and( + x: number | BigNumber | Complex | Unit | MathArray | Matrix, + y: number | BigNumber | Complex | Unit | MathArray | Matrix + ): boolean | MathArray | Matrix; + + /** + * Logical not. Flips boolean value of a given parameter. For matrices, + * the function is evaluated element wise. + * @param x First value to not + * @returns Returns true when input is a zero or empty value. + */ + not( + x: number | BigNumber | Complex | Unit | MathArray | Matrix + ): boolean | MathArray | Matrix; + + /** + * Logical or. Test if at least one value is defined with a + * nonzero/nonempty value. For matrices, the function is evaluated + * element wise. + * @param x First value to or + * @param y Second value to or + * @returns Returns true when one of the inputs is defined with a + * nonzero/nonempty value. + */ + or( + x: number | BigNumber | Complex | Unit | MathArray | Matrix, + y: number | BigNumber | Complex | Unit | MathArray | Matrix + ): boolean | MathArray | Matrix; + + /** + * Logical xor. Test whether one and only one value is defined with a + * nonzero/nonempty value. For matrices, the function is evaluated + * element wise. + * @param x First value to xor + * @param y Second value to xor + * @returns Returns true when one and only one input is defined with a + * nonzero/nonempty value. + */ + xor( + x: number | BigNumber | Complex | Unit | MathArray | Matrix, + y: number | BigNumber | Complex | Unit | MathArray | Matrix + ): boolean | MathArray | Matrix; + + /************************************************************************* + * Matrix functions + ************************************************************************/ + + /** + * Concatenate two or more matrices. dim: number is a zero-based + * dimension over which to concatenate the matrices. By default the last + * dimension of the matrices. + * @param args Two or more matrices + * @returns Concatenated matrix + */ + concat(...args: Array): MathArray | Matrix; + + /** + * Calculate the cross product for two vectors in three dimensional + * space. The cross product of A = [a1, a2, a3] and B =[b1, b2, b3] is + * defined as: cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 + * * b2 - a2 * b1 ] + * @param x First vector + * @param y Second vector + * @returns Returns the cross product of x and y + */ + cross(x: MathArray | Matrix, y: MathArray | Matrix): Matrix | MathArray; + + /** + * Calculate the determinant of a matrix. + * @param x A Matrix + * @returns the determinant of x + */ + det(x: MathArray | Matrix): number; + + /** + * Create a diagonal matrix or retrieve the diagonal of a matrix. When x + * is a vector, a matrix with vector x on the diagonal will be returned. + * When x is a two dimensional matrix, the matrixes kth diagonal will be + * returned as vector. When k is positive, the values are placed on the + * super diagonal. When k is negative, the values are placed on the sub + * diagonal. + * @param X A two dimensional matrix or a vector + * @param k The diagonal where the vector will be filled in or + * retrieved. Default value: 0. + * @param format The matrix storage format. Default value: 'dense'. + * @returns Diagonal matrix from input vector, or diagonal from input + * matrix + */ + diag(X: MathArray | Matrix, format?: string): Matrix; + diag( + X: MathArray | Matrix, + k: number | BigNumber, + format?: string + ): Matrix | MathArray; + + /** + * Calculate the dot product of two vectors. The dot product of A = [a1, + * a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as: dot(A, + * B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn + * @param x First vector + * @param y Second vector + * @returns Returns the dot product of x and y + */ + dot(x: MathArray | Matrix, y: MathArray | Matrix): number; + + /** + * Compute the matrix exponential, expm(A) = e^A. The matrix must be + * square. Not to be confused with exp(a), which performs element-wise + * exponentiation. The exponential is calculated using the Padé + * approximant with scaling and squaring; see “Nineteen Dubious Ways to + * Compute the Exponential of a Matrix,” by Moler and Van Loan. + * @param x A square matrix + * @returns The exponential of x + */ + expm(x: Matrix): Matrix; + + /** + * Create a 2-dimensional identity matrix with size m x n or n x n. The + * matrix has ones on the diagonal and zeros elsewhere. + * @param size The size for the matrix + * @param format The Matrix storage format + * @returns A matrix with ones on the diagonal + */ + eye( + size: number | number[] | Matrix | MathArray, + format?: string + ): Matrix | MathArray | number; + /** + * @param m The x dimension for the matrix + * @param n The y dimension for the matrix + * @param format The Matrix storage format + * @returns A matrix with ones on the diagonal + */ + eye(m: number, n: number, format?: string): Matrix | MathArray | number; + + /** + * Filter the items in an array or one dimensional matrix. + * @param x A one dimensional matrix or array to filter + * @param test A function or regular expression to test items. All + * entries for which test returns true are returned. When test is a + * function, it is invoked with three parameters: the value of the + * element, the index of the element, and the matrix/array being + * traversed. The function must return a boolean. + */ + filter( + x: Matrix | MathArray, + test: ((value: any, index: any, matrix: Matrix | MathArray) => Matrix | MathArray) | RegExp + ): Matrix | MathArray; + + /** + * Flatten a multi dimensional matrix into a single dimensional matrix. + * @param x Matrix to be flattened + * @returns Returns the flattened matrix + */ + flatten(x: MathArray | Matrix): MathArray | Matrix; + + /** + * Iterate over all elements of a matrix/array, and executes the given + * callback function. + * @param x The matrix to iterate on. + * @param callback The callback function is invoked with three + * parameters: the value of the element, the index of the element, and + * the Matrix/array being traversed. + */ + forEach(x: Matrix | MathArray, callback: ((value: any, index: any, matrix: Matrix | MathArray) => void)): void; + + /** + * Calculate the inverse of a square matrix. + * @param x Matrix to be inversed + * @returns The inverse of x + */ + inv( + x: number | Complex | MathArray | Matrix + ): number | Complex | MathArray | Matrix; /** * Calculate the kronecker product of two matrices or vectors - * @param x First Matrix - * @param y Second Matrix + * @param x First vector + * @param y Second vector + * @returns Returns the kronecker product of x and y */ - kron(x: Matrix|MathArray, y: Matrix|MathArray): Matrix; - - /** - * Calculate the least common multiple for two or more values or arrays. lcm is defined as: - * lcm(a, b) = abs(a * b) / gcd(a, b) - * For matrices, the function is evaluated element wise. - */ - lcm(a: number, b: number): number; - lcm(a: BigNumber , b: BigNumber): BigNumber ; - lcm(a: MathArray, b: MathArray): MathArray; - lcm(a: Matrix, b: Matrix): Matrix; - - /** - * Calculate the logarithm of a value. For matrices, the function is evaluated element wise. - * @param x Value for which to calculate the logarithm. - * @param base Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e. - */ - log(x: number|BigNumber|Complex|MathArray|Matrix, base?: number|BigNumber|Complex): number|BigNumber|Complex|MathArray|Matrix; - - /** - * Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise. - * @param x Value for which to calculate the logarithm. - */ - log10(x: number): number; - log10(x: BigNumber): BigNumber; - log10(x: Complex): Complex; - log10(x: MathArray): MathArray; - log10(x: Matrix): Matrix; - - /** - * Calculates the modulus, the remainder of an integer division. For matrices, the function is evaluated element wise. - * The modulus is defined as: - * x - y * floor(x / y) - * @see http://en.wikipedia.org/wiki/Modulo_operation. - * @param x Dividend - * @param y Divisor - */ - mod(x: number|BigNumber|Fraction|MathArray|Matrix, y: number|BigNumber|Fraction|MathArray|Matrix): number|BigNumber|Fraction|MathArray|Matrix; - - /** - * Multiply two values, x * y. The result is squeezed. For matrices, the matrix product is calculated. - */ - multiply(x: MathArray|Matrix, y: MathType): Matrix; - multiply(x: Unit, y: Unit): Unit; - multiply(x: number, y: number): number; - multiply(x: MathType, y: MathType): MathType; - - /** - * Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2. - * @param x Value for which to calculate the norm - * @param p Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2. - * @returns the p-norm - */ - norm(x: number|BigNumber|Complex|MathArray|Matrix, p?: number|BigNumber|string): number|BigNumber; - - /** - * Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation - * x^root = A - * For matrices, the function is evaluated element wise. - * @param a Value for which to calculate the nth root - * @param root The root. Default value: 2. - */ - nthRoot(a: number|BigNumber|MathArray|Matrix|Complex, root?: number|BigNumber): number|Complex|MathArray|Matrix; - - /** - * Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y. - * @param x The base - * @param y The exponent - */ - pow(x: MathType, y: number|BigNumber|Complex): MathType; - - /** - * Round a value towards the nearest integer. For matrices, the function is evaluated element wise. - * @param x Number to be rounded - * @param n Number of decimals Default value: 0. - */ - round(x: number|BigNumber|Fraction|Complex|MathArray|Matrix, n?: number|BigNumber|MathArray): number|BigNumber|Fraction|Complex|MathArray|Matrix; - - /** - * Compute the sign of a value. The sign of a value x is: - * 1 when x > 1 - * -1 when x < 0 - * 0 when x == 0 - * For matrices, the function is evaluated element wise. - */ - sign(x: number): number; - sign(x: BigNumber): BigNumber; - sign(x: Fraction): Fraction ; - sign(x: Complex): Complex ; - sign(x: MathArray): MathArray; - sign(x: Matrix): Matrix; - sign(x: Unit): Unit; - - /** - * Calculate the square root of a value. For matrices, the function is evaluated element wise. - */ - sqrt(x: number): number; - sqrt(x: BigNumber): BigNumber; - sqrt(x: Complex): Complex ; - sqrt(x: MathArray): MathArray; - sqrt(x: Matrix): Matrix; - sqrt(x: Unit): Unit; - - /** - * Compute the square of a value, x * x. For matrices, the function is evaluated element wise. - */ - square(x: number): number; - square(x: BigNumber): BigNumber; - square(x: Fraction): Fraction ; - square(x: Complex): Complex ; - square(x: MathArray): MathArray; - square(x: Matrix): Matrix; - square(x: Unit): Unit; - - /** - * Subtract two values, x - y. For matrices, the function is evaluated element wise. - */ - subtract(x: MathType, y: MathType): MathType; - - /** - * Inverse the sign of a value, apply a unary minus operation. - * For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted. - */ - unaryMinus(x: number): number; - unaryMinus(x: BigNumber): BigNumber; - unaryMinus(x: Fraction): Fraction ; - unaryMinus(x: Complex): Complex ; - unaryMinus(x: MathArray): MathArray; - unaryMinus(x: Matrix): Matrix; - unaryMinus(x: Unit): Unit; - - /** - * Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is. - * For matrices, the function is evaluated element wise. - */ - unaryPlus(x: number): number; - unaryPlus(x: BigNumber): BigNumber; - unaryPlus(x: Fraction): Fraction ; - unaryPlus(x: string): string; - unaryPlus(x: Complex): Complex ; - unaryPlus(x: MathArray): MathArray; - unaryPlus(x: Matrix): Matrix; - unaryPlus(x: Unit): Unit; - - /** - * Calculate the extended greatest common divisor for two values. See http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. - */ - xgcd(a: number|BigNumber, b: number|BigNumber): MathArray; - - /** - * Bitwise AND two values, x & y. For matrices, the function is evaluated element wise. - */ - bitAnd(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix; - - /** - * Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - */ - bitNot(x: number): number; - bitNot(x: BigNumber): BigNumber ; - bitNot(x: MathArray): MathArray; - bitNot(x: Matrix): Matrix; - - /** - * Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base. - */ - bitOr(x: number): number; - bitOr(x: BigNumber): BigNumber ; - bitOr(x: MathArray): MathArray; - bitOr(x: Matrix): Matrix; - - /** - * Bitwise XOR two values, x ^ y. For matrices, the function is evaluated element wise. - */ - bitXor(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix; - - /** - * Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - * @param x Value to be shifted - * @param y Amount of shifts - */ - leftShift(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber): number|BigNumber|MathArray|Matrix; - - /** - * Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - * @param x Value to be shifted - * @param y Amount of shifts - */ - rightArithShift(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber): number|BigNumber|MathArray|Matrix; - - /** - * Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - * @param x Value to be shifted - * @param y Amount of shifts - */ - rightLogShift(x: number|MathArray|Matrix, y: number): number|MathArray|Matrix; - - /** - * The Bell Numbers count the number of partitions of a set. - * A partition is a pairwise disjoint subset of S whose union is S. bellNumbers only takes integer arguments. - * The following condition must be enforced: n >= 0 - * @param n Total number of objects in the set - */ - bellNumbers(n: number): number; - bellNumbers(n: BigNumber): BigNumber; - - /** - * The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0 - * @param n nth Catalan number - */ - catalan(n: number): number; - catalan(n: BigNumber): BigNumber; - - /** - * The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n. - * @param n Total number of objects in the set - * @param k Number of objects in the subset - * @returns Returns the composition counts of n into k parts. - */ - composition(n: number|BigNumber, k: number|BigNumber): number|BigNumber; - - /** - * The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. - * stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n. - * If n = k or k = 1, then s(n,k) = 1 - * @param n Total number of objects in the set - * @param k Number of objects in the subset - */ - stirlingS2(n: number|BigNumber, k: number|BigNumber): number|BigNumber; - - /** - * Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise. - * @param x A complex number or array with complex numbers - */ - arg(x: number|Complex): number; - arg(x: MathArray): MathArray; - arg(x: Matrix): Matrix; - - /** - * Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate of x is a - bi. For matrices, the function is evaluated element wise. - * @param x A complex number or array with complex numbers - */ - conj(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|Complex|MathArray|Matrix; - - /** - * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b. - * For matrices, the function is evaluated element wise. - */ - im(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|MathArray|Matrix; - - /** - * Get the real part of a complex number. For a complex number a + bi, the function returns a. - * For matrices, the function is evaluated element wise. - */ - re(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|MathArray|Matrix; - - /** - * Create a BigNumber, which can store numbers with arbitrary precision. When a matrix is provided, all elements will be converted to BigNumber. - */ - bignumber(x?: number|string|MathArray|Matrix|boolean): BigNumber; - - /** - * Create a boolean or convert a string or number to a boolean. - * In case of a number, true is returned for non-zero numbers, and false in case of zero. - * Strings can be 'true' or 'false', or can contain a number. When value is a matrix, all elements will be converted to boolean. - */ - boolean(x: string|number|boolean|MathArray|Matrix): boolean|MathArray|Matrix; - - /** - * Wrap any value in a chain, allowing to perform chained operations on the value. - * All methods available in the math.js library can be called upon the chain, and then will be evaluated with the value itself as first argument. - * The chain can be closed by executing chain.done(), which returns the final value. - * The chain has a number of special functions: - * done() Finalize the chain and return the chain's value. - * valueOf() The same as done() - * toString() Executes math.format() onto the chain's value, returning a string representation of the value. - */ - chain(value?: any): MathJsChain; - - /** - * Create a complex value or convert a value to a complex value. - */ - complex(arg?: Complex|string|MathArray| PolarCoordinates): Complex; - complex(re: number, im: number): Complex; - - /** - * Create a fraction convert a value to a fraction. - */ - fraction(numerator: number|string|MathArray|Matrix, denominator?: number|string|MathArray|Matrix): Fraction|MathArray|Matrix; - - /** - * Create an index. An Index can store ranges having start, step, and end for multiple dimensions. Matrix.get, Matrix.set, and math.subset accept an Index as input. - */ - index(...ranges: any[]): Index; - - /** - * Create a Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility functions - * to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix. Supported - * storage formats are 'dense' and 'sparse'. - */ - matrix(format?: 'sparse'|'dense'): Matrix; - matrix(data: MathArray|Matrix, format?: 'sparse'|'dense', dataType?: string): Matrix; - - /** - * Create a number or convert a string, boolean, or unit to a number. When value is a matrix, all elements will be converted to number. - */ - number(value?: string|number|boolean|MathArray|Matrix|Unit|BigNumber|Fraction): number|MathArray|Matrix; - number(unit: Unit, valuelessUnit: Unit|string): number|MathArray|Matrix; - - /** - * Create a Sparse Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility - * functions to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix. - * @param data A two dimensional array - */ - sparse(data?: MathArray|Matrix, dataType?: string): Matrix; - - /** - * Create a string or convert any object into a string. Elements of Arrays and Matrices are processed element wise. - * @param value A value to convert to a string - */ - string(value: any): string|MathArray|Matrix; - - /** - * Create a unit. Depending on the passed arguments, the function will create and return a new math.type.Unit object. - * When a matrix is provided, all elements will be converted to units. - */ - unit(unit: string): Unit; - unit(value: number, unit: string): Unit; - - /** - * Create a user-defined unit and register it with the Unit type. - */ - createUnit(name: string, definition?: string|UnitDefinition, options?: CreateUnitOptions): Unit; - createUnit(units: Record, options?: CreateUnitOptions): Unit; - - /** - * Parse and compile an expression. Returns a an object with a function eval([scope]) to evaluate the compiled expression. - */ - compile(expr: MathExpression): EvalFunction; - compile(exprs: MathExpression[]): EvalFunction[]; - - /** - * Evaluate an expression. - */ - eval(expr: MathExpression|MathExpression[], scope?: any): any; - - /** - * Retrieve help on a function or data type. Help files are retrieved from the documentation in math.expression.docs. - */ - help(search: any): Help; - - /** - * Parse an expression. Returns a node tree, which can be evaluated by invoking node.eval(); - */ - parse(expr: MathExpression, options?: any): MathNode; - parse(exprs: MathExpression[], options?: any): MathNode[]; - - /** - * Create a parser. The function creates a new math.expression.Parser object. - */ - parser(): Parser; - - /** - * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point - * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When - * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric - * equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c) - */ - distance(x: MathType, y: MathType): number | BigNumber; - - /** - * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in - * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions - * return null if the lines do not meet. - * Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0. - * @param w Co-ordinates of first end-point of first line - * @param x Co-ordinates of second end-point of first line - * @param y Co-ordinates of first end-point of second line OR Coefficients of the plane's equation - * @param z Co-ordinates of second end-point of second line OR null if the calculation is for line and plane - * @returns Returns the point of intersection of lines/lines-planes - */ - intersect(w: MathArray|Matrix, x: MathArray|Matrix, y: MathArray|Matrix, z: MathArray|Matrix): MathArray; - - /** - * Logical and. Test whether two values are both defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. - */ - and(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; - - /** - * Logical not. Flips boolean value of a given parameter. For matrices, the function is evaluated element wise. - */ - not(x: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; - - /** - * Logical or. Test if at least one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. - */ - or(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; - - /** - * Logical xor. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. - */ - xor(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; - - /** - * Concatenate two or more matrices. - * dim: number is a zero-based dimension over which to concatenate the matrices. By default the last dimension of the matrices. - */ - concat(...args: Array): MathArray|Matrix; - - /** - * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3] - * and B =[b1, b2, b3] is defined as: - * cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ] - */ - cross(x: MathArray|Matrix, y: MathArray|Matrix): Matrix; - - /** - * Calculate the determinant of a matrix. - */ - det(x: MathArray|Matrix): number; - - /** - * Create a diagonal matrix or retrieve the diagonal of a matrix. - * When x is a vector, a matrix with vector x on the diagonal will be returned. When x is a two dimensional matrix, - * the matrixes kth diagonal will be returned - * as vector. When k is positive, the values are placed on the super diagonal. When k is negative, the values are - * placed on the sub diagonal. - * @param X A two dimensional matrix or a vector - * @param k The diagonal where the vector will be filled in or retrieved. Default value: 0. - * @param format The matrix storage format. Default value: 'dense'. - */ - diag(X: MathArray|Matrix, format?: string): Matrix; - diag(X: MathArray|Matrix, k: number|BigNumber, format?: string): Matrix; - - /** - * Calculate the dot product of two vectors. - * The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] - * is defined as: - * dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn - */ - dot(x: MathArray|Matrix, y: MathArray|Matrix): number; - - /** - * Create a 2-dimensional identity matrix with size m x n or n x n. The matrix has ones on the diagonal and zeros elsewhere. - */ - eye(n: number|number[], format?: string): Matrix; - eye(m: number, n: number, format?: string): Matrix; - - /** - * Flatten a multi dimensional matrix into a single dimensional matrix. - */ - flatten(x: MathArray|Matrix): MathArray|Matrix; - - /** - * Calculate the inverse of a square matrix. - */ - inv(x: number|Complex|MathArray|Matrix): number|Complex|MathArray|Matrix; - - /** - * Create a matrix filled with ones. The created matrix can have one or multiple dimensions. - */ - ones(n: number|number[], format?: string): MathArray|Matrix; - ones(m: number, n: number, format?: string): MathArray|Matrix; - - /** - * Create an array from a range. By default, the range end is excluded. This can be customized by providing an extra parameter includeEnd. - * @param str A string 'start:end' or 'start:step:end' - * @param start Start of the range - * @param end End of the range, excluded by default, included when parameter includeEnd=true - * @param step Step size. Default value is 1. - * @returns Parameters describing the ranges start, end, and optional step. - */ - range(str: string, includeEnd?: boolean): Matrix; - range(start: number|BigNumber, end: number|BigNumber, includeEnd?: boolean): Matrix; - range(start: number|BigNumber, end: number|BigNumber, step: number|BigNumber, includeEnd?: boolean): Matrix; - - /** - * Resize a matrix - * @param x Matrix to be resized - * @param size One dimensional array with numbers - * @param defaultValue Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0. - */ - resize(x: MathArray|Matrix, size: MathArray|Matrix, defaultValue?: number|string): MathArray|Matrix; - - /** - * Calculate the size of a matrix or scalar. - */ - size(x: boolean|number|Complex|Unit|string|MathArray|Matrix): MathArray|Matrix; - - /** - * Squeeze a matrix, remove inner and outer singleton dimensions from a matrix. - */ - squeeze(x: MathArray|Matrix): Matrix|MathArray; - - /** - * Get or set a subset of a matrix or string. - * @param value An array, matrix, or string - * @param index An index containing ranges for each dimension - * @param replacement An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned - * @param defaultValue Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined. - */ - subset(value: MathArray|Matrix|string, index: Index, replacement?: any, defaultValue?: any): MathArray|Matrix|string; - - /** - * Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix. - */ - trace(x: MathArray|Matrix): number; - - /** - * Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported. - */ - transpose(x: MathArray|Matrix): MathArray|Matrix; - - /** - * Create a matrix filled with zeros. The created matrix can have one or multiple dimensions. - */ - zeros(n: number|number[], format?: string): MathArray|Matrix; - zeros(m: number, n: number, format?: string): MathArray|Matrix; - - /** - * Compute the number of ways of picking k unordered outcomes from n possibilities. - * Combinations only takes integer arguments. The following condition must be enforced: k <= n. - */ - combinations(n: number|BigNumber, k: number|BigNumber): number|BigNumber; - - /** - * Create a distribution object with a set of random functions for given random distribution. - * @param name Name of a distribution. Choose from 'uniform', 'normal'. - */ - distribution(name: string): Distribution; - - /** - * Compute the factorial of a value - * Factorial only supports an integer value as argument. For matrices, the function is evaluated element wise. - */ - factorial(n: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix; - - /** - * Compute the gamma function of a value using Lanczos approximation for small values, and an extended - * Stirling approximation for large values. - * For matrices, the function is evaluated element wise. - */ - gamma(n: number|MathArray|Matrix): number|MathArray|Matrix; - - /** - * Calculate the Kullback-Leibler (KL) divergence between two distributions - */ - kldivergence(x: MathArray|Matrix, y: MathArray|Matrix): number; - - /** - * Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from n possibilities. - * multinomial takes one array of integers as an argument. The following condition must be enforced: every ai <= 0 - */ - multinomial(a: number[]|BigNumber[]): number|BigNumber; - - /** - * Compute the number of ways of obtaining an ordered subset of k elements from a set of n elements. - * Permutations only takes integer arguments. The following condition must be enforced: k <= n. - * @param n The number of objects in total - * @param k The number of objects in the subset - */ - permutations(n: number|BigNumber, k?: number|BigNumber): number|BigNumber; - - /** - * Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution. - */ - pickRandom(array: number[]): number; - - /** - * Return a random number larger or equal to min and smaller than max using a uniform distribution. - */ - random(min?: number, max?: number): number; - random(size: MathArray|Matrix, min?: number, max?: number): MathArray|Matrix; - - /** - * Return a random integer number larger or equal to min and smaller than max using a uniform distribution. - */ - randomInt(min: number, max?: number): number; - randomInt(size: MathArray|Matrix, min?: number, max?: number): MathArray|Matrix; - - /** - * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y. - * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - compare(x: MathType, y: MathType): number|BigNumber|Fraction|MathArray|Matrix; - - /** - * Test element wise whether two matrices are equal. The function accepts both matrices and scalar values. - */ - deepEqual(x: MathType, y: MathType): number|BigNumber|Fraction|Complex|Unit|MathArray|Matrix; - - /** - * Test whether two values are equal. - * - * The function tests whether the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im. - * Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else. - */ - equal(x: MathType, y: MathType): boolean|MathArray|Matrix; - - /** - * Test whether value x is larger than y. - * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - larger(x: MathType, y: MathType): boolean|MathArray|Matrix; - - /** - * Test whether value x is larger or equal to y. - * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - largerEq(x: MathType, y: MathType): boolean|MathArray|Matrix; - - /** - * Test whether value x is smaller than y. - * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - smaller(x: MathType, y: MathType): boolean|MathArray|Matrix; - - /** - * Test whether value x is smaller or equal to y. - * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. - */ - smallerEq(x: MathType, y: MathType): boolean|MathArray|Matrix; - - /** - * Test whether two values are unequal. - * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot - * be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im. - * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with - * everything except undefined. - */ - unequal(x: MathType, y: MathType): boolean|MathArray|Matrix; - - /** - * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened - * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. - */ - max(...args: MathType[]): any; - max(A: MathArray|Matrix, dim?: number): any; - - /** - * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be - * calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. - */ - mean(...args: MathType[]): any; - mean(A: MathArray|Matrix, dim?: number): any; - - /** - * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an - * even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit - * In case of a (multi dimensional) array or matrix, the median of all elements will be calculated. - */ - median(...args: MathType[]): any; - - /** - * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened - * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. - */ - min(...args: MathType[]): any; - min(A: MathArray|Matrix, dim?: number): any; - - /** - * Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values. - */ - mode(...args: MathType[]): any; - - /** - * Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. - */ - prod(...args: MathType[]): any; - - /** - * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. - * Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber - * In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated. - */ - quantileSeq(A: MathArray|Matrix, prob: number|BigNumber|MathArray, sorted?: boolean): number|BigNumber|Unit|MathArray; - - /** - * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the - * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will - * be calculated. - * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following - * values: - * 'unbiased' (default) The sum of squared errors is divided by (n - 1) - * 'uncorrected' The sum of squared errors is divided by n - * 'biased' The sum of squared errors is divided by (n + 1) - */ - std(array: MathArray|Matrix, normalization?: string): number; - - /** - * Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. - */ - sum(...args: Array): any; - sum(array: MathArray|Matrix): any; - - /** - * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all - * elements will be calculated. - * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the - * following values: - * 'unbiased' (default) The sum of squared errors is divided by (n - 1) - * 'uncorrected' The sum of squared errors is divided by n - * 'biased' The sum of squared errors is divided by (n + 1) - * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...) - * instead of math.var(...). - */ - var(...args: Array): any; - var(array: MathArray|Matrix, normalization?: string): any; - - /** - * Calculate the inverse cosine of a value. For matrices, the function is evaluated element wise. - */ - acos(x: number): number; - acos(x: BigNumber): BigNumber; - acos(x: Complex): Complex; - acos(x: MathArray): MathArray; - acos(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic arccos of a value, defined as acosh(x) = ln(sqrt(x^2 - 1) + x). - * For matrices, the function is evaluated element wise. - */ - acosh(x: number): number; - acosh(x: BigNumber): BigNumber; - acosh(x: Complex): Complex; - acosh(x: MathArray): MathArray; - acosh(x: Matrix): Matrix; - - /** - * Calculate the inverse cotangent of a value. For matrices, the function is evaluated element wise. - */ - acot(x: number): number; - acot(x: BigNumber): BigNumber; - acot(x: MathArray): MathArray; - acot(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2. - * For matrices, the function is evaluated element wise. - */ - acoth(x: number): number; - acoth(x: BigNumber): BigNumber; - acoth(x: MathArray): MathArray; - acoth(x: Matrix): Matrix; - - /** - * Calculate the inverse cosecant of a value. For matrices, the function is evaluated element wise. - */ - acsc(x: number): number; - acsc(x: BigNumber): BigNumber; - acsc(x: MathArray): MathArray; - acsc(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)). - * For matrices, the function is evaluated element wise. - */ - acsch(x: number): number; - acsch(x: BigNumber): BigNumber; - acsch(x: MathArray): MathArray; - acsch(x: Matrix): Matrix; - - /** - * Calculate the inverse secant of a value. For matrices, the function is evaluated element wise. - */ - asec(x: number): number; - asec(x: BigNumber): BigNumber; - asec(x: MathArray): MathArray; - asec(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated element wise. - */ - asech(x: number): number; - asech(x: BigNumber): BigNumber; - asech(x: MathArray): MathArray; - asech(x: Matrix): Matrix; - - /** - * Calculate the inverse sine of a value. For matrices, the function is evaluated element wise. - */ - asin(x: number): number; - asin(x: BigNumber): BigNumber; - asin(x: Complex): Complex; - asin(x: MathArray): MathArray; - asin(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated element wise. - */ - asinh(x: number): number; - asinh(x: BigNumber): BigNumber; - asinh(x: MathArray): MathArray; - asinh(x: Matrix): Matrix; - - /** - * Calculate the inverse tangent of a value. For matrices, the function is evaluated element wise. - */ - atan(x: number): number; - atan(x: BigNumber): BigNumber; - atan(x: MathArray): MathArray; - atan(x: Matrix): Matrix; - - /** - * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the - * computed angle can be determined. - * For matrices, the function is evaluated element wise. - */ - atan2(y: number, x: number): number; - atan2(y: MathArray|Matrix, x: MathArray|Matrix): MathArray|Matrix; - - /** - * Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2. - * For matrices, the function is evaluated element wise. - */ - atanh(x: number): number; - atanh(x: BigNumber): BigNumber; - atanh(x: MathArray): MathArray; - atanh(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)). For matrices, the function is evaluated element wise. - */ - cosh(x: number|Unit): number; - cosh(x: BigNumber): BigNumber; - cosh(x: Complex): Complex; - cosh(x: MathArray): MathArray; - cosh(x: Matrix): Matrix; - - /** - * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). For matrices, the function is evaluated element wise. - */ - cot(x: number|Unit): number; - cot(x: Complex): Complex; - cot(x: MathArray): MathArray; - cot(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). For matrices, the function is evaluated element wise. - */ - coth(x: number|Unit): number; - coth(x: Complex): Complex; - coth(x: MathArray): MathArray; - coth(x: Matrix): Matrix; - - /** - * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For matrices, the function is evaluated element wise. - */ - csc(x: number|Unit): number; - csc(x: Complex): Complex; - csc(x: MathArray): MathArray; - csc(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x). For matrices, the function is evaluated element wise. - */ - csch(x: number|Unit): number; - csch(x: Complex): Complex; - csch(x: MathArray): MathArray; - csch(x: Matrix): Matrix; - - /** - * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For matrices, the function is evaluated element wise. - */ - sec(x: number|Unit): number; - sec(x: Complex): Complex; - sec(x: MathArray): MathArray; - sec(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x). For matrices, the function is evaluated element wise. - */ - sech(x: number|Unit): number; - sech(x: Complex): Complex; - sech(x: MathArray): MathArray; - sech(x: Matrix): Matrix; - - /** - * Calculate the sine of a value. For matrices, the function is evaluated element wise. - */ - sin(x: number|Unit): number; - sin(x: BigNumber): BigNumber; - sin(x: Complex): Complex; - sin(x: MathArray): MathArray; - sin(x: Matrix): Matrix; - - /** - * Calculate the cosine of a value. For matrices, the function is evaluated element wise. - */ - cos(x: number|Unit): number; - cos(x: BigNumber): BigNumber; - cos(x: Complex): Complex; - cos(x: MathArray): MathArray; - cos(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise. - */ - sinh(x: number|Unit): number; - sinh(x: BigNumber): BigNumber; - sinh(x: Complex): Complex; - sinh(x: MathArray): MathArray; - sinh(x: Matrix): Matrix; - - /** - * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). For matrices, the function is evaluated element wise. - */ - tan(x: number|Unit): number; - tan(x: BigNumber): BigNumber; - tan(x: Complex): Complex; - tan(x: MathArray): MathArray; - tan(x: Matrix): Matrix; - - /** - * Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is evaluated element wise. - */ - tanh(x: number|Unit): number; - tanh(x: BigNumber): BigNumber; - tanh(x: Complex): Complex; - tanh(x: MathArray): MathArray; - tanh(x: Matrix): Matrix; - - /** - * Change the unit of a value. For matrices, the function is evaluated element wise. - * @param x The unit to be converted. - * @param unit New unit. Can be a string like "cm" or a unit without value. - */ - to(x: Unit|MathArray|Matrix, unit: Unit|string): Unit|MathArray|Matrix; - - /** - * Clone an object. - */ - clone(x: any): any; - - /** - * Filter the items in an array or one dimensional matrix. - * @param x A one dimensional matrix or array to filter - * @param test - */ - filter(x: MathArray|Matrix, test: RegExp|((item: any) => boolean)): MathArray|Matrix; - - /** - * Iterate over all elements of a matrix/array, and executes the given callback function. - * @param x The matrix to iterate on. - * @param callback The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed. - */ - forEach: (x: MathArray|Matrix, callback: (item: any) => any) => void; - - /** - * Format a value of any type into a string. - * @param value The value to be formatted - */ - format(value: any, options?: FormatOptions|number|((item: any) => string)): string; - - /** - * Test whether a value is an integer number. The function supports number, BigNumber, and Fraction. - * The function is evaluated element-wise in case of Array or Matrix input. - */ - isInteger(x: any): boolean; - - /** - * Test whether a value is negative: smaller than zero. The function supports types number, BigNumber, Fraction, and Unit. - * The function is evaluated element-wise in case of Array or Matrix input. - */ - isNegative(x: any): boolean; - - /** - * Test whether a value is an numeric value. The function is evaluated element-wise in case of Array or Matrix input. - */ - isNumeric(x: any): boolean; - - /** - * Test whether a value is positive: larger than zero. The function supports types number, BigNumber, Fraction, and Unit. - * The function is evaluated element-wise in case of Array or Matrix input. - */ - isPositive(x: any): boolean; - - /** - * Test whether a value is zero. The function can check for zero for types number, BigNumber, Fraction, Complex, and Unit. - * The function is evaluated element-wise in case of Array or Matrix input. - */ - isZero(x: any): boolean; - - /** - * Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array. - * @param x The matrix to iterate on. - * @param callback The callback method is invoked with three parameters: the value of the element, the index of the element, and the matrix being traversed. - */ - map(x: MathArray|Matrix, callback: (item: any) => any): MathArray|Matrix; - - /** - * Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect. - * @param x A one dimensional matrix or array to sort - * @param k The kth smallest value to be retrieved; zero-based index - * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. - * @returns Returns the kth lowest value. - */ - partitionSelect(x: MathArray|Matrix, k: number, compare?: string|((a: any, b: any) => number)): any; - - /** - * Interpolate values into a string template. - * @param template A string containing variable placeholders. - * @param values An object containing variables which will be filled in in the template. - * @param precision Number of digits to format numbers. If not provided, the value will not be rounded. - */ - print: (template: string, values: any, precision?: number) => void; - - /** - * Sort the items in a matrix. - * @param x A one dimensional matrix or array to sort - * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. - */ - sort(x: MathArray|Matrix, compare?: string|((a: any, b: any) => number)): MathArray|Matrix; - - /** - * Determine the type of a variable. - */ - typeof(x: any): string; - } - - interface Matrix { - type: string; - storage(): string; - datatype(): string; - density(): number; - subset(index: Index, replacement?: any, defaultValue?: any): Matrix; - get(index: number[]): any; - set(index: number[], value: any, defaultValue?: number|string): Matrix; - resize(size: MathArray|Matrix, defaultValue?: number|string): Matrix; - clone(): Matrix; - size(): number[]; - map(callback: (a: any, b: number, c: Matrix) => any, skipZeros?: boolean): Matrix; - forEach: (callback: (a: any, b: number, c: Matrix) => void, skipZeros?: boolean) => void; - toJSON(): any; - diagonal(k?: number|BigNumber): any[]; - swapRows(i: number, j: number): Matrix; - } - - interface BigNumber extends Decimal {} // tslint:disable-line no-empty-interface - - interface Fraction { - s: number; - n: number; - d: number; - } - - interface Complex { - re: number; - im: number; - toPolar(): PolarCoordinates; - clone(): Complex; - } - - interface PolarCoordinates { - r: number; - phi: number; + kron(x: Matrix | MathArray, y: Matrix | MathArray): Matrix; + + /** + * Iterate over all elements of a matrix/array, and executes the given + * callback function. + * @param x The matrix to iterate on. + * @param callback The callback function is invoked with three + * parameters: the value of the element, the index of the element, and + * the Matrix/array being traversed. + * @returns Transformed map of x + */ + map(x: Matrix | MathArray, callback: ((value: any, index: any, matrix: Matrix | MathArray) => Matrix | MathArray)): Matrix | MathArray; + + /** + * Create a matrix filled with ones. The created matrix can have one or + * multiple dimensions. + * @param size The size of each dimension of the matrix + * @param format The matrix storage format + * @returns A matrix filled with ones + */ + ones(size: number | number[], format?: string): MathArray | Matrix; + /** + * @param m The x dimension of the matrix + * @param n The y dimension of the amtrix + * @param format The matrix storage format + * @returns A matrix filled with ones + */ + ones(m: number, n: number, format?: string): MathArray | Matrix; + + /** + * Partition-based selection of an array or 1D matrix. Will find the kth + * smallest value, and mutates the input array. Uses Quickselect. + * @param x A one dimensional matrix or array to sort + * @param k The kth smallest value to be retrieved; zero-based index + * @param compare An optional comparator function. The function is + * called as compare(a, b), and must return 1 when a > b, -1 when a < b, + * and 0 when a == b. Default value: 'asc'. + * @returns Returns the kth lowest value. + */ + partitionSelect( + x: MathArray | Matrix, + k: number, + compare?: "asc" | "desc" | ((a: any, b: any) => number) + ): any; + + /** + * Create an array from a range. By default, the range end is excluded. + * This can be customized by providing an extra parameter includeEnd. + * @param str A string 'start:end' or 'start:step:end' + * @param start Start of the range + * @param end End of the range, excluded by default, included when + * parameter includeEnd=true + * @param step Step size. Default value is 1. + * @param includeEnd: Option to specify whether to include the end or + * not. False by default + * @returns Parameters describing the ranges start, end, and optional + * step. + */ + range(str: string, includeEnd?: boolean): Matrix; + range( + start: number | BigNumber, + end: number | BigNumber, + includeEnd?: boolean + ): Matrix; + range( + start: number | BigNumber, + end: number | BigNumber, + step: number | BigNumber, + includeEnd?: boolean + ): Matrix; + + /** + * Reshape a multi dimensional array to fit the specified dimensions + * @param x Matrix to be reshaped + * @param sizes One dimensional array with integral sizes for each + * dimension + * @returns A reshaped clone of matrix x + */ + reshape( + x: MathArray | Matrix, + sizes: number[] + ): MathArray | Matrix; + + /** + * Resize a matrix + * @param x Matrix to be resized + * @param size One dimensional array with numbers + * @param defaultValue Zero by default, except in case of a string, in + * that case defaultValue = ' ' Default value: 0. + * @returns A resized clone of matrix x + */ + resize( + x: MathArray | Matrix, + size: MathArray | Matrix, + defaultValue?: number | string + ): MathArray | Matrix; + + /** + * Calculate the size of a matrix or scalar. + * @param A matrix + * @returns A vector with the size of x + */ + size( + x: boolean | number | Complex | Unit | string | MathArray | Matrix + ): MathArray | Matrix; + + /** + * Sort the items in a matrix + * @param x A one dimensional matrix or array to sort + * @param compare An optional _comparator function or name. The function + * is called as compare(a, b), and must return 1 when a > b, -1 when a < + * b, and 0 when a == b. Default value: ‘asc’ + * @returns Returns the sorted matrix + */ + sort( + x: Matrix | MathArray, + compare: ((a: any, b: any) => number) | "asc" | "desc" | "natural" + ): Matrix | MathArray; + + /** + * Calculate the principal square root of a square matrix. The principal + * square root matrix X of another matrix A is such that X * X = A. + * @param A The square matrix A + * @returns The principal square root of matrix A + */ + sqrtm(A: MathArray | Matrix): MathArray | Matrix; + + /** + * Squeeze a matrix, remove inner and outer singleton dimensions from a + * matrix. + * @param x Matrix to be squeezed + * @returns Squeezed matrix + */ + squeeze(x: MathArray | Matrix): Matrix | MathArray; + + /** + * Get or set a subset of a matrix or string. + * @param value An array, matrix, or string + * @param index An index containing ranges for each dimension + * @param replacement An array, matrix, or scalar. If provided, the + * subset is replaced with replacement. If not provided, the subset is + * returned + * @param defaultValue Default value, filled in on new entries when the + * matrix is resized. If not provided, math.matrix elements will be left + * undefined. Default value: undefined. + * @returns Either the retrieved subset or the updated matrix + */ + subset( + value: MathArray | Matrix | string, + index: Index, + replacement?: any, + defaultValue?: any + ): MathArray | Matrix | string; + + /** + * Calculate the trace of a matrix: the sum of the elements on the main + * diagonal of a square matrix. + * @param x A matrix + * @returns The trace of x + */ + trace(x: MathArray | Matrix): number; + + /** + * Transpose a matrix. All values of the matrix are reflected over its + * main diagonal. Only two dimensional matrices are supported. + * @param x Matrix to be transposed + * @returns The transposed matrix + */ + transpose(x: MathArray | Matrix): MathArray | Matrix; + + /** + * Create a matrix filled with zeros. The created matrix can have one or + * multiple dimensions. + * @param size The size of each dimension of the matrix + * @param format The matrix storage format + * @returns A matrix filled with zeros + */ + zeros(size: number | number[], format?: string): MathArray | Matrix; + /** + * @param m The x dimension of the matrix + * @param n The y dimension of the matrix + * @param format The matrix storage format + * @returns A matrix filled with zeros + */ + zeros(m: number, n: number, format?: string): MathArray | Matrix; + + /************************************************************************* + * Probability functions + ************************************************************************/ + + /** + * Compute the number of ways of picking k unordered outcomes from n + * possibilities. Combinations only takes integer arguments. The + * following condition must be enforced: k <= n. + * @param n Total number of objects in the set + * @param k Number of objects in the subset + * @returns Number of possible combinations + */ + combinations( + n: number | BigNumber, + k: number | BigNumber + ): number | BigNumber; + + /** + * Compute the factorial of a value Factorial only supports an integer + * value as argument. For matrices, the function is evaluated element + * wise. + * @param n An integer number + * @returns The factorial of n + */ + factorial( + n: number | BigNumber | MathArray | Matrix + ): number | BigNumber | MathArray | Matrix; + + /** + * Compute the gamma function of a value using Lanczos approximation for + * small values, and an extended Stirling approximation for large + * values. For matrices, the function is evaluated element wise. + * @param n A real or complex number + * @returns The gamma of n + */ + gamma(n: number | MathArray | Matrix): number | MathArray | Matrix; + + /** + * Calculate the Kullback-Leibler (KL) divergence between two + * distributions + * @param q First vector + * @param p Second vector + * @returns Returns disance between q and p + */ + kldivergence(q: MathArray | Matrix, p: MathArray | Matrix): number; + + /** + * Multinomial Coefficients compute the number of ways of picking a1, + * a2, ..., ai unordered outcomes from n possibilities. multinomial + * takes one array of integers as an argument. The following condition + * must be enforced: every ai <= 0 + * @param a Integer number of objects in the subset + * @returns multinomial coefficent + */ + multinomial(a: number[] | BigNumber[]): number | BigNumber; + + /** + * Compute the number of ways of obtaining an ordered subset of k + * elements from a set of n elements. Permutations only takes integer + * arguments. The following condition must be enforced: k <= n. + * @param n The number of objects in total + * @param k The number of objects in the subset + * @returns The number of permutations + */ + permutations( + n: number | BigNumber, + k?: number | BigNumber + ): number | BigNumber; + + /** + * Random pick a value from a one dimensional array. Array element is + * picked using a random function with uniform distribution. + * @param array A one dimensional array + * @param number An int or float + * @param weights An array of ints or floats + * @returns Returns a single random value from array when number is 1 or + * undefined. Returns an array with the configured number of elements + * when number is > 1. + */ + pickRandom( + array: number[], + number?: number, + weights?: number[] + ): number; + + /** + * Return a random number larger or equal to min and smaller than max + * using a uniform distribution. + * @param size If provided, an array or matrix with given size and + * filled with random values is returned + * @param min Minimum boundary for the random value, included + * @param max Maximum boundary for the random value, excluded + * @returns A random number + */ + random(min?: number, max?: number): number; + random( + size: MathArray | Matrix, + min?: number, + max?: number + ): MathArray | Matrix; + + /** + * Return a random integer number larger or equal to min and smaller + * than max using a uniform distribution. + * @param size If provided, an array or matrix with given size and + * filled with random values is returned + * @param min Minimum boundary for the random value, included + * @param max Maximum boundary for the random value, excluded + * @returns A random number + */ + randomInt(min: number, max?: number): number; + randomInt( + size: MathArray | Matrix, + min?: number, + max?: number + ): MathArray | Matrix; + + /************************************************************************* + * Relational functions + ************************************************************************/ + + /** + * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x + * == y. x and y are considered equal when the relative difference + * between x and y is smaller than the configured epsilon. The function + * cannot be used to compare values smaller than approximately 2.22e-16. + * For matrices, the function is evaluated element wise. + * @param x First value to compare + * @param y Second value to compare + * @returns Returns the result of the comparison: 1 when x > y, -1 when + * x < y, and 0 when x == y. + */ + compare( + x: MathType | string, + y: MathType | string + ): number | BigNumber | Fraction | MathArray | Matrix; + + /** + * Compare two values of any type in a deterministic, natural way. For + * numeric values, the function works the same as math.compare. For + * types of values that can’t be compared mathematically, the function + * compares in a natural way. + * @param x First value to compare + * @param y Second value to compare + * @returns Returns the result of the comparison: 1 when x > y, -1 when + * x < y, and 0 when x == y. + */ + compareNatural(x: any, y: any): number; + + /** + * Compare two strings lexically. Comparison is case sensitive. Returns + * 1 when x > y, -1 when x < y, and 0 when x == y. For matrices, the + * function is evaluated element wise. + * @param x First string to compare + * @param y Second string to compare + * @returns Returns the result of the comparison: 1 when x > y, -1 when + * x < y, and 0 when x == y. + */ + compareText( + x: string | MathArray | Matrix, + y: string | MathArray | Matrix + ): number | MathArray | Matrix; + + /** + * Test element wise whether two matrices are equal. The function + * accepts both matrices and scalar values. + * @param x First matrix to compare + * @param y Second amtrix to compare + * @returns Returns true when the input matrices have the same size and + * each of their elements is equal. + */ + deepEqual( + x: MathType, + y: MathType + ): number | BigNumber | Fraction | Complex | Unit | MathArray | Matrix; + + /** + * Test whether two values are equal. + * + * The function tests whether the relative difference between x and y is + * smaller than the configured epsilon. The function cannot be used to + * compare values smaller than approximately 2.22e-16. For matrices, the + * function is evaluated element wise. In case of complex numbers, x.re + * must equal y.re, and x.im must equal y.im. Values null and undefined + * are compared strictly, thus null is only equal to null and nothing + * else, and undefined is only equal to undefined and nothing else. + * @param x First value to compare + * @param y Second value to compare + * @returns Returns true when the compared values are equal, else + * returns false + */ + equal( + x: MathType | string, + y: MathType | string + ): boolean | MathArray | Matrix; + + /** + * Check equality of two strings. Comparison is case sensitive. For + * matrices, the function is evaluated element wise. + * @param x First string to compare + * @param y Second string to compare + * @returns Returns true if the values are equal, and false if not. + */ + equalText( + x: string | MathArray | Matrix, + y: string | MathArray | Matrix + ): number | MathArray | Matrix; + + /** + * Test whether value x is larger than y. The function returns true when + * x is larger than y and the relative difference between x and y is + * larger than the configured epsilon. The function cannot be used to + * compare values smaller than approximately 2.22e-16. For matrices, the + * function is evaluated element wise. + * @param x First value to compare + * @param y Second value to vcompare + * @returns Returns true when x is larger than y, else returns false + */ + larger( + x: MathType | string, + y: MathType | string + ): boolean | MathArray | Matrix; + + /** + * Test whether value x is larger or equal to y. The function returns + * true when x is larger than y or the relative difference between x and + * y is smaller than the configured epsilon. The function cannot be used + * to compare values smaller than approximately 2.22e-16. For matrices, + * the function is evaluated element wise. + * @param x First value to compare + * @param y Second value to vcompare + * @returns Returns true when x is larger than or equal to y, else + * returns false + */ + largerEq( + x: MathType | string, + y: MathType | string + ): boolean | MathArray | Matrix; + + /** + * Test whether value x is smaller than y. The function returns true + * when x is smaller than y and the relative difference between x and y + * is smaller than the configured epsilon. The function cannot be used + * to compare values smaller than approximately 2.22e-16. For matrices, + * the function is evaluated element wise. + * @param x First value to compare + * @param y Second value to vcompare + * @returns Returns true when x is smaller than y, else returns false + */ + smaller( + x: MathType | string, + y: MathType | string + ): boolean | MathArray | Matrix; + + /** + * Test whether value x is smaller or equal to y. The function returns + * true when x is smaller than y or the relative difference between x + * and y is smaller than the configured epsilon. The function cannot be + * used to compare values smaller than approximately 2.22e-16. For + * matrices, the function is evaluated element wise. + * @param x First value to compare + * @param y Second value to vcompare + * @returns Returns true when x is smaller than or equal to y, else + * returns false + */ + smallerEq( + x: MathType | string, + y: MathType | string + ): boolean | MathArray | Matrix; + + /** + * Test whether two values are unequal. The function tests whether the + * relative difference between x and y is larger than the configured + * epsilon. The function cannot be used to compare values smaller than + * approximately 2.22e-16. For matrices, the function is evaluated + * element wise. In case of complex numbers, x.re must unequal y.re, or + * x.im must unequal y.im. Values null and undefined are compared + * strictly, thus null is unequal with everything except null, and + * undefined is unequal with everything except undefined. + * @param x First value to compare + * @param y Second value to vcompare + * @returns Returns true when the compared values are unequal, else + * returns false + */ + unequal( + x: MathType | string, + y: MathType | string + ): boolean | MathArray | Matrix; + + /************************************************************************* + * Set functions + ************************************************************************/ + + /** + * Create the cartesian product of two (multi)sets. Multi-dimension + * arrays will be converted to single-dimension arrays before the + * operation. + * @param a1 A (multi)set + * @param a2 A (multi)set + * @returns The cartesian product of two (multi)sets + */ + setCartesian( + a1: MathArray | Matrix, + a2: MathArray | Matrix + ): MathArray | Matrix; + + /** + * Create the difference of two (multi)sets: every element of set1, that + * is not the element of set2. Multi-dimension arrays will be converted + * to single-dimension arrays before the operation + * @param a1 A (multi)set + * @param a2 A (multi)set + * @returns The difference of two (multi)sets + */ + setDifference( + a1: MathArray | Matrix, + a2: MathArray | Matrix + ): MathArray | Matrix; + + /** + * Collect the distinct elements of a multiset. A multi-dimension array + * will be converted to a single-dimension array before the operation. + * @param a A multiset + * @returns A set containing the distinct elements of the multiset + */ + setDistinct(a: MathArray | Matrix): MathArray | Matrix; + + /** + * Create the intersection of two (multi)sets. Multi-dimension arrays + * will be converted to single-dimension arrays before the operation. + * @param a1 A (multi)set + * @param a2 A (multi)set + * @returns The intersection of two (multi)sets + */ + setIntersect( + a1: MathArray | Matrix, + a2: MathArray | Matrix + ): MathArray | Matrix; + + /** + * Check whether a (multi)set is a subset of another (multi)set. (Every + * element of set1 is the element of set2.) Multi-dimension arrays will + * be converted to single-dimension arrays before the operation. + * @param a1 A (multi)set + * @param a2 A (multi)set + * @returns True if a1 is subset of a2, else false + */ + setIsSubset(a1: MathArray | Matrix, a2: MathArray | Matrix): boolean; + + /** + * Count the multiplicity of an element in a multiset. A multi-dimension + * array will be converted to a single-dimension array before the + * operation. + * @param e An element in the multiset + * @param a A multiset + * @returns The number of how many times the multiset contains the + * element + */ + setMultiplicity( + e: number | BigNumber | Fraction | Complex, + a: MathArray | Matrix + ): number; + + /** + * Create the powerset of a (multi)set. (The powerset contains very + * possible subsets of a (multi)set.) A multi-dimension array will be + * converted to a single-dimension array before the operation. + * @param a A multiset + * @returns The powerset of the (multi)set + */ + setPowerset(a: MathArray | Matrix): MathArray | Matrix; + + /** + * Count the number of elements of a (multi)set. When a second parameter + * is ‘true’, count only the unique values. A multi-dimension array will + * be converted to a single-dimension array before the operation. + * @param a A multiset + * @returns The number of elements of the (multi)set + */ + setSize(a: MathArray | Matrix): number; + + /** + * Create the symmetric difference of two (multi)sets. Multi-dimension + * arrays will be converted to single-dimension arrays before the + * operation. + * @param a1 A (multi)set + * @param a2 A (multi)set + * @returns The symmetric difference of two (multi)sets + */ + setSymDifference( + a1: MathArray | Matrix, + a2: MathArray | Matrix + ): MathArray | Matrix; + + /** + * Create the union of two (multi)sets. Multi-dimension arrays will be + * converted to single-dimension arrays before the operation. + * @param a1 A (multi)set + * @param a2 A (multi)set + * @returns The union of two (multi)sets + */ + setUnion( + a1: MathArray | Matrix, + a2: MathArray | Matrix + ): MathArray | Matrix; + + /************************************************************************* + * Special functions + ************************************************************************/ + + /** + * Compute the erf function of a value using a rational Chebyshev + * approximations for different intervals of x. + * @param x A real number + * @returns The erf of x + */ + erf(x: number | MathArray | Matrix): number | MathArray | Matrix; + + /************************************************************************* + * Statistics functions + ************************************************************************/ + + /** + * Compute the median absolute deviation of a matrix or a list with + * values. The median absolute deviation is defined as the median of the + * absolute deviations from the median. + * @param array A single matrix or multiple scalar values. + * @returns The median absolute deviation + */ + mad(array: MathArray | Matrix): any; + + /** + * Compute the maximum value of a matrix or a list with values. In case + * of a multi dimensional array, the maximum of the flattened array will + * be calculated. When dim is provided, the maximum over the selected + * dimension will be calculated. Parameter dim is zero-based. + * @param args A single matrix or multiple scalar values + * @returns The maximum value + */ + max(...args: MathType[]): any; + /** + * @param A A single matrix + * @param dim The maximum over the selected dimension + * @returns The maximum value + */ + max(A: MathArray | Matrix, dim?: number): any; + + /** + * Compute the mean value of matrix or a list with values. In case of a + * multi dimensional array, the mean of the flattened array will be + * calculated. When dim is provided, the maximum over the selected + * dimension will be calculated. Parameter dim is zero-based. + * @param args A single matrix or multiple scalar values + * @returns The mean of all values + */ + mean(...args: MathType[]): any; + /** + * @param A A single matrix + * @param dim The mean over the selected dimension + * @returns The mean of all values + */ + mean(A: MathArray | Matrix, dim?: number): any; + + /** + * Compute the median of a matrix or a list with values. The values are + * sorted and the middle value is returned. In case of an even number of + * values, the average of the two middle values is returned. Supported + * types of values are: Number, BigNumber, Unit In case of a (multi + * dimensional) array or matrix, the median of all elements will be + * calculated. + * @param args A single matrix or or multiple scalar values + * @returns The median + */ + median(...args: MathType[]): any; + + /** + * Compute the maximum value of a matrix or a list of values. In case of + * a multi dimensional array, the maximum of the flattened array will be + * calculated. When dim is provided, the maximum over the selected + * dimension will be calculated. Parameter dim is zero-based. + * @param args A single matrix or or multiple scalar values + * @returns The minimum value + */ + min(...args: MathType[]): any; + /** + * @param A A single matrix + * @param dim The minimum over the selected dimension + * @returns The minimum value + */ + min(A: MathArray | Matrix, dim?: number): any; + + /** + * Computes the mode of a set of numbers or a list with values(numbers + * or characters). If there are more than one modes, it returns a list + * of those values. + * @param args A single matrix + * @returns The mode of all values + */ + mode(...args: MathType[]): any; + + /** + * Compute the product of a matrix or a list with values. In case of a + * (multi dimensional) array or matrix, the sum of all elements will be + * calculated. + * @param args A single matrix or multiple scalar values + * @returns The product of all values + */ + prod(...args: MathType[]): any; + + /** + * Compute the prob order quantile of a matrix or a list with values. + * The sequence is sorted and the middle value is returned. Supported + * types of sequence values are: Number, BigNumber, Unit Supported types + * of probability are: Number, BigNumber In case of a (multi + * dimensional) array or matrix, the prob order quantile of all elements + * will be calculated. + * @param A A single matrix or array + * @param probOrN prob is the order of the quantile, while N is the + * amount of evenly distributed steps of probabilities; only one of + * these options can be provided + * @param sorted =false is data sorted in ascending order + * @returns Quantile(s) + */ + quantileSeq( + A: MathArray | Matrix, + prob: number | BigNumber | MathArray, + sorted?: boolean + ): number | BigNumber | Unit | MathArray; + + /** + * Compute the standard deviation of a matrix or a list with values. The + * standard deviations is defined as the square root of the variance: + * std(A) = sqrt(var(A)). In case of a (multi dimensional) array or + * matrix, the standard deviation over all elements will be calculated. + * Optionally, the type of normalization can be specified as second + * parameter. The parameter normalization can be one of the following + * values: 'unbiased' (default) The sum of squared errors is divided by + * (n - 1) 'uncorrected' The sum of squared errors is divided by n + * 'biased' The sum of squared errors is divided by (n + 1) + * @param array A single matrix or multiple scalar values + * @param normalization Determines how to normalize the variance. Choose + * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value: + * ‘unbiased’. + * @returns The standard deviation + */ + std( + array: MathArray | Matrix, + normalization?: "unbiased" | "uncorrected" | "biased" | "unbiased" + ): number; + + /** + * Compute the sum of a matrix or a list with values. In case of a + * (multi dimensional) array or matrix, the sum of all elements will be + * calculated. + * @param args A single matrix or multiple scalar values + * @returns The sum of all values + */ + sum(...args: Array): any; + /** + * @param array A single matrix + * @returns The sum of all values + */ + sum(array: MathArray | Matrix): any; + + /** + * Compute the variance of a matrix or a list with values. In case of a + * (multi dimensional) array or matrix, the variance over all elements + * will be calculated. Optionally, the type of normalization can be + * specified as second parameter. The parameter normalization can be one + * of the following values: 'unbiased' (default) The sum of squared + * errors is divided by (n - 1) 'uncorrected' The sum of squared errors + * is divided by n 'biased' The sum of squared errors is divided by (n + + * 1) Note that older browser may not like the variable name var. In + * that case, the function can be called as math['var'](...) instead of + * math.var(...). + * @param args A single matrix or multiple scalar values + * @returns The variance + */ + var(...args: Array): any; + /** + * @param array A single matrix + * @param normalization normalization Determines how to normalize the + * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. + * Default value: ‘unbiased’. + * @returns The variance + */ + var( + array: MathArray | Matrix, + normalization?: "unbiased" | "uncorrected" | "biased" | "unbiased" + ): any; + + /************************************************************************* + * String functions + ************************************************************************/ + + /** + * Format a value of any type into a string. + * @param value The value to be formatted + * @param options An object with formatting options. + * @param callback A custom formatting function, invoked for all numeric + * elements in value, for example all elements of a matrix, or the real + * and imaginary parts of a complex number. This callback can be used to + * override the built-in numeric notation with any type of formatting. + * Function callback is called with value as parameter and must return a + * string. + * @see http://mathjs.org/docs/reference/functions/format.html + * @returns The formatted value + */ + format( + value: any, + options?: FormatOptions | number | ((item: any) => string), + callback?: ((value: any) => string) + ): string; + + /** + * Interpolate values into a string template. + * @param template A string containing variable placeholders. + * @param values An object containing variables which will be filled in + * in the template. + * @param precision Number of digits to format numbers. If not provided, + * the value will not be rounded. + * @param options Formatting options, or the number of digits to format + * numbers. See function math.format for a description of all options. + * @returns Interpolated string + */ + print( + template: string, + values: any, + precision?: number, + options?: number | object + ): void; + + /************************************************************************* + * Trigonometry functions + ************************************************************************/ + + /** + * Calculate the inverse cosine of a value. For matrices, the function + * is evaluated element wise. + * @param x Function input + * @returns The arc cosine of x + */ + acos(x: number): number; + acos(x: BigNumber): BigNumber; + acos(x: Complex): Complex; + acos(x: MathArray): MathArray; + acos(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arccos of a value, defined as acosh(x) = + * ln(sqrt(x^2 - 1) + x). For matrices, the function is evaluated + * element wise. + * @param x Function input + * @returns The hyperbolic arccosine of x + */ + acosh(x: number): number; + acosh(x: BigNumber): BigNumber; + acosh(x: Complex): Complex; + acosh(x: MathArray): MathArray; + acosh(x: Matrix): Matrix; + + /** + * Calculate the inverse cotangent of a value. For matrices, the + * function is evaluated element wise. + * @param x Function input + * @returns The arc cotangent of x + */ + acot(x: number): number; + acot(x: BigNumber): BigNumber; + acot(x: MathArray): MathArray; + acot(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arccotangent of a value, defined as acoth(x) + * = (ln((x+1)/x) + ln(x/(x-1))) / 2. For matrices, the function is + * evaluated element wise. + * @param x Function input + * @returns The hyperbolic arccotangent of x + */ + acoth(x: number): number; + acoth(x: BigNumber): BigNumber; + acoth(x: MathArray): MathArray; + acoth(x: Matrix): Matrix; + + /** + * Calculate the inverse cosecant of a value. For matrices, the function + * is evaluated element wise. + * @param x Function input + * @returns The arc cosecant of x + */ + acsc(x: number): number; + acsc(x: BigNumber): BigNumber; + acsc(x: MathArray): MathArray; + acsc(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arccosecant of a value, defined as acsch(x) + * = ln(1/x + sqrt(1/x^2 + 1)). For matrices, the function is evaluated + * element wise. + * @param x Function input + * @returns The hyperbolic arccosecant of x + */ + acsch(x: number): number; + acsch(x: BigNumber): BigNumber; + acsch(x: MathArray): MathArray; + acsch(x: Matrix): Matrix; + + /** + * Calculate the inverse secant of a value. For matrices, the function + * is evaluated element wise. + * @param x Function input + * @returns The arc secant of x + */ + asec(x: number): number; + asec(x: BigNumber): BigNumber; + asec(x: MathArray): MathArray; + asec(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arcsecant of a value, defined as asech(x) = + * ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated + * element wise. + * @param x Function input + * @returns The hyperbolic arcsecant of x + */ + asech(x: number): number; + asech(x: BigNumber): BigNumber; + asech(x: MathArray): MathArray; + asech(x: Matrix): Matrix; + + /** + * Calculate the inverse sine of a value. For matrices, the function is + * evaluated element wise. + * @param x Function input + * @returns The arc sine of x + */ + asin(x: number): number; + asin(x: BigNumber): BigNumber; + asin(x: Complex): Complex; + asin(x: MathArray): MathArray; + asin(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arcsine of a value, defined as asinh(x) = + * ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated + * element wise. + * @param x Function input + * @returns The hyperbolic arcsine of x + */ + asinh(x: number): number; + asinh(x: BigNumber): BigNumber; + asinh(x: MathArray): MathArray; + asinh(x: Matrix): Matrix; + + /** + * Calculate the inverse tangent of a value. For matrices, the function + * is evaluated element wise. + * @param x Function input + * @returns The arc tangent of x + */ + atan(x: number): number; + atan(x: BigNumber): BigNumber; + atan(x: MathArray): MathArray; + atan(x: Matrix): Matrix; + + /** + * Calculate the inverse tangent function with two arguments, y/x. By + * providing two arguments, the right quadrant of the computed angle can + * be determined. For matrices, the function is evaluated element wise. + * @param x Function input + * @returns Four quadrant inverse tangent + */ + atan2(y: number, x: number): number; + atan2(y: MathArray | Matrix, x: MathArray | Matrix): MathArray | Matrix; + + /** + * Calculate the hyperbolic arctangent of a value, defined as atanh(x) = + * ln((1 + x)/(1 - x)) / 2. For matrices, the function is evaluated + * element wise. + * @param x Function input + * @returns The hyperbolic arctangent of x + */ + atanh(x: number): number; + atanh(x: BigNumber): BigNumber; + atanh(x: MathArray): MathArray; + atanh(x: Matrix): Matrix; + + /** + * Calculate the cosine of a value. For matrices, the function is + * evaluated element wise. + * @param x Function input + * @returns The cosine of x + */ + cos(x: number | Unit): number; + cos(x: BigNumber): BigNumber; + cos(x: Complex): Complex; + cos(x: MathArray): MathArray; + cos(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 + * * (exp(x) + exp(-x)). For matrices, the function is evaluated element + * wise. + * @param x Function input + * @returns The hyperbolic cosine of x + */ + cosh(x: number | Unit): number; + cosh(x: BigNumber): BigNumber; + cosh(x: Complex): Complex; + cosh(x: MathArray): MathArray; + cosh(x: Matrix): Matrix; + + /** + * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). + * For matrices, the function is evaluated element wise. + * @param x Function input + * @returns The cotangent of x + */ + cot(x: number | Unit): number; + cot(x: Complex): Complex; + cot(x: MathArray): MathArray; + cot(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 + * / tanh(x). For matrices, the function is evaluated element wise. + * @param x Function input + * @returns The hyperbolic cotangent of x + */ + coth(x: number | Unit): number; + coth(x: Complex): Complex; + coth(x: MathArray): MathArray; + coth(x: Matrix): Matrix; + + /** + * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For + * matrices, the function is evaluated element wise. + * @param x Function input + * @returns The cosecant hof x + */ + csc(x: number | Unit): number; + csc(x: Complex): Complex; + csc(x: MathArray): MathArray; + csc(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 + * / sinh(x). For matrices, the function is evaluated element wise. + * @param x Function input + * @returns The hyperbolic cosecant of x + */ + csch(x: number | Unit): number; + csch(x: Complex): Complex; + csch(x: MathArray): MathArray; + csch(x: Matrix): Matrix; + + /** + * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For + * matrices, the function is evaluated element wise. + * @param x Function input + * @returns The secant of x + */ + sec(x: number | Unit): number; + sec(x: Complex): Complex; + sec(x: MathArray): MathArray; + sec(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / + * cosh(x). For matrices, the function is evaluated element wise. + * @param x Function input + * @returns The hyperbolic secant of x + */ + sech(x: number | Unit): number; + sech(x: Complex): Complex; + sech(x: MathArray): MathArray; + sech(x: Matrix): Matrix; + + /** + * Calculate the sine of a value. For matrices, the function is + * evaluated element wise. + * @param x Function input + * @returns The sine of x + */ + sin(x: number | Unit): number; + sin(x: BigNumber): BigNumber; + sin(x: Complex): Complex; + sin(x: MathArray): MathArray; + sin(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * + * (exp(x) - exp(-x)). For matrices, the function is evaluated element + * wise. + * @param x Function input + * @returns The hyperbolic sine of x + */ + sinh(x: number | Unit): number; + sinh(x: BigNumber): BigNumber; + sinh(x: Complex): Complex; + sinh(x: MathArray): MathArray; + sinh(x: Matrix): Matrix; + + /** + * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). + * For matrices, the function is evaluated element wise. + * @param x Function input + * @returns The tangent of x + */ + tan(x: number | Unit): number; + tan(x: BigNumber): BigNumber; + tan(x: Complex): Complex; + tan(x: MathArray): MathArray; + tan(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic tangent of a value, defined as tanh(x) = + * (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is + * evaluated element wise. + * @param x Function input + * @returns The hyperbolic tangent of x + */ + tanh(x: number | Unit): number; + tanh(x: BigNumber): BigNumber; + tanh(x: Complex): Complex; + tanh(x: MathArray): MathArray; + tanh(x: Matrix): Matrix; + + /************************************************************************* + * Unit functions + ************************************************************************/ + + /** + * Change the unit of a value. For matrices, the function is evaluated + * element wise. + * @param x The unit to be converted. + * @param unit New unit. Can be a string like "cm" or a unit without + * value. + * @returns Value with changed, fixed unit + */ + to( + x: Unit | MathArray | Matrix, + unit: Unit | string + ): Unit | MathArray | Matrix; + + /************************************************************************* + * Utils functions + ************************************************************************/ + + /** + * Clone an object. + * @param x Object to be cloned + * @returns A clone of object x + */ + clone(x: any): any; + + /** + * Test whether a value is an integer number. The function supports + * number, BigNumber, and Fraction. The function is evaluated + * element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x contains a numeric, integer value. + * Throws an error in case of an unknown data type. + */ + isInteger( + x: number | BigNumber | Fraction | MathArray | Matrix + ): boolean; + + /** + * Test whether a value is NaN (not a number). The function supports + * types number, BigNumber, Fraction, Unit and Complex. The function is + * evaluated element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x is NaN. Throws an error in case of an + * unknown data type. + */ + isNaN( + x: number | BigNumber | Fraction | MathArray | Matrix | Unit + ): boolean; + + /** + * Test whether a value is negative: smaller than zero. The function + * supports types number, BigNumber, Fraction, and Unit. The function is + * evaluated element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x is larger than zero. Throws an error in + * case of an unknown data type. + */ + isNegative( + x: number | BigNumber | Fraction | MathArray | Matrix | Unit + ): boolean; + + /** + * Test whether a value is an numeric value. The function is evaluated + * element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x is a number, BigNumber, Fraction, or + * boolean. Returns false for other types. Throws an error in case of + * unknown types. + */ + isNumeric(x: any): x is number | BigNumber | Fraction | boolean; + + /** + * Test whether a value is positive: larger than zero. The function + * supports types number, BigNumber, Fraction, and Unit. The function is + * evaluated element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x is larger than zero. Throws an error in + * case of an unknown data type. + */ + isPositive( + x: number | BigNumber | Fraction | MathArray | Matrix | Unit + ): boolean; + + /** + * Test whether a value is prime: has no divisors other than itself and + * one. The function supports type number, bignumber. The function is + * evaluated element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x is larger than zero. Throws an error in + * case of an unknown data type. + */ + isPrime(x: number | BigNumber | MathArray | Matrix): boolean; + + /** + * Test whether a value is zero. The function can check for zero for + * types number, BigNumber, Fraction, Complex, and Unit. The function is + * evaluated element-wise in case of Array or Matrix input. + * @param x Value to be tested + * @returns Returns true when x is zero. Throws an error in case of an + * unknown data type. + */ + isZero( + x: + | number + | BigNumber + | Fraction + | MathArray + | Matrix + | Unit + | Complex + ): boolean; + + /** + * Determine the type of a variable. + * @param x The variable for which to test the type + * @returns Returns the name of the type. Primitive types are lower + * case, non-primitive types are upper-camel-case. For example ‘number’, + * ‘string’, ‘Array’, ‘Date’. + */ + typeof(x: any): string; } - interface MathJSON { - mathjs?: string; - value: number; - unit: string; - fixPrefix?: boolean; - } + interface Matrix { + type: string; + storage(): string; + datatype(): string; + create(data: MathArray, datatype?: string): void; + density(): number; + subset(index: Index, replacement?: any, defaultValue?: any): Matrix; + get(index: number[]): any; + set( + index: number[], + value: any, + defaultValue?: number | string + ): Matrix; + resize( + size: MathArray | Matrix, + defaultValue?: number | string + ): Matrix; + clone(): Matrix; + size(): number[]; + map( + callback: (a: any, b: number, c: Matrix) => any, + skipZeros?: boolean + ): Matrix; + forEach( + callback: (a: any, b: number, c: Matrix) => void, + skipZeros?: boolean + ): void; + toArray(): MathArray | Matrix; + valueOff(): MathArray | Matrix; + format(options?: FormatOptions | number | ((value: any) => string)): string; + toString(): string; + toJSON(): any; + diagonal(k?: number | BigNumber): any[]; + swapRows(i: number, j: number): Matrix; + } - interface Unit { - to(unit: string): Unit; - toNumber(unit: string): number; - clone(): Unit; - equalBase(unit: Unit): boolean; - equals(unit: Unit): boolean; - format(options: FormatOptions): string; - fromJSON(json: MathJSON): Unit; - toJSON(): MathJSON; - splitUnit(parts: ReadonlyArray): Unit[]; - toNumeric(unit: string): number | Fraction | BigNumber; - toSI(): Unit; - toString(): string; - } + interface BigNumber extends Decimal {} // tslint:disable-line no-empty-interface - interface CreateUnitOptions { - override?: boolean; - } + interface Fraction { + s: number; + n: number; + d: number; + } - interface UnitDefinition { - definition?: string|Unit; - prefixes?: string; - offset?: number; - aliases?: string[]; - } + interface Complex { + re: number; + im: number; + clone(): Complex; + equals(other: Complex): boolean; + format(precision?: number): string; + fromJSON(json: object): Complex; + fromPolar(polar: object): Complex; + fromPolar(r: number, phi: number): Complex; + toJSON(): object; + toPolar(): PolarCoordinates; + toString(): string; + compare(a: Complex, b: Complex): number; + } - interface Index {} // tslint:disable-line no-empty-interface + interface PolarCoordinates { + r: number; + phi: number; + } - interface EvalFunction { - eval(scope?: any): any; - } + interface MathJSON { + mathjs?: string; + value: number; + unit: string; + fixPrefix?: boolean; + } - interface MathNode { - isNode: boolean; - isSymbolNode?: boolean; - isConstantNode?: boolean; - isOperatorNode?: boolean; - op?: string; - fn?: string; - args?: MathNode[]; - type: string; - name?: string; - value?: any; + interface Unit { + valueOf(): string; + clone(): Unit; + isDerived(): boolean; + hasBase(base: any): boolean; + equalBase(unit: Unit): boolean; + equals(unit: Unit): boolean; + multiply(unit: Unit): Unit; + divide(unit: Unit): Unit; + pow(unit: Unit): Unit; + abs(unit: Unit): Unit; + to(unit: string): Unit; + toNumber(unit: string): number; + toNumeric(unit: string): number | Fraction | BigNumber; + toString(): string; + toJSON(): MathJSON; + formatUnits(): string; + format(options: FormatOptions): string; + parse(str: DOMStringList): Unit; + isValuelessUnit(name: string): boolean; + fromJSON(json: MathJSON): Unit; + } - compile(): EvalFunction; - eval(expr?: string): any; - /** - * - * Filter nodes in an expression tree. The callback function is called as callback(node: Node, path: string, parent: Node) : boolean for every node in the tree, - * and must return a boolean. The function filter returns an array with nodes for which the test returned true. - * Parameter path is a string containing a relative JSON Path. - * - * Example: - * - * ``` - * var node = math.parse('x^2 + x/4 + 3*y'); - * var filtered = node.filter(function (node) { - * return node.isSymbolNode && node.name == 'x'; - * }); - * // returns an array with two entries: two SymbolNodes 'x' - * ``` - * - * The callback function is called as callback(node: Node, path: string, parent: Node) : boolean for every node in the tree, and must return a boolean. - * The function filter returns an array with nodes for which the test returned true. Parameter path is a string containing a relative JSON Path. - * @return Returns an array with nodes for which test returned true - */ - filter(callback: (node: MathNode, path: string, parent: MathNode) => any): MathNode[]; + interface CreateUnitOptions { + prefixes?: "none" | "short" | "long" | "binary_short" | "binary_long"; + aliases?: string[]; + offset?: number; + override?: boolean; + } - /** - * [forEach description] - */ - forEach(callback: (node: MathNode, path: string, parent: MathNode) => any): MathNode[]; + interface UnitDefinition { + definition?: string | Unit; + prefixes?: string; + offset?: number; + aliases?: string[]; + } - /** - * `traverse(callback)` - * - * Recursively traverse all nodes in a node tree. - * Executes given callback for this node and each of its child nodes. - * Similar to Array.forEach, except recursive. - * The callback function is a mapping function accepting a node, and returning a replacement for the node or the original node. - * Function callback is called as callback(node: Node, path: string, parent: Node) for every node in the tree. - * Parameter path is a string containing a relative JSON Path. Example: - * - * ``` - * var node = math.parse('3 * x + 2'); - * node.traverse(function (node, path, parent) { - * switch (node.type) { - * case 'OperatorNode': console.log(node.type, node.op); break; - * case 'ConstantNode': console.log(node.type, node.value); break; - * case 'SymbolNode': console.log(node.type, node.name); break; - * default: console.log(node.type); - * } - * }); - * // outputs: - * // OperatorNode + - * // OperatorNode * - * // ConstantNode 3 - * // SymbolNode x - * // ConstantNode 2 - * ``` - */ - traverse(callback: (node: MathNode, path: string, parent: MathNode) => void): any; - /** - * Recursively transform an expression tree via a transform function. Similar to Array.map, - * but recursively executed on all nodes in the expression tree. The callback function is a - * mapping function accepting a node, and returning a replacement for the node or the original node. - * Function callback is called as callback(node: Node, path: string, parent: Node) for every node in - * the tree, and must return a Node. Parameter path is a string containing a relative JSON Path. - * - * For example, to replace all nodes of type SymbolNode having name ‘x’ with a ConstantNode with value 3: - * ```js - * var node = math.parse('x^2 + 5*x'); - * var transformed = node.transform(function (node, path, parent) { - * if (node.SymbolNode && node.name == 'x') { - * return new math.expression.node.ConstantNode(3); - * } - * else { - * return node; - * } - * }); - * transformed.toString(); // returns '(3 ^ 2) + (5 * 3)' - * ``` - */ - transform(callback: (node: MathNode, path: string, parent: MathNode) => MathNode): MathNode; + interface Index {} // tslint:disable-line no-empty-interface - /** - * Transform a node. Creates a new Node having it’s child's be the results of calling the provided - * callback function for each of the child's of the original node. The callback function is called - * as `callback(child: Node, path: string, parent: Node)` and must return a Node. - * Parameter path is a string containing a relative JSON Path. - * - * - * See also transform, which is a recursive version of map. - */ - map(callback: (node: MathNode, path: string, parent: MathNode) => MathNode): MathNode; - } + interface EvalFunction { + eval(scope?: any): any; + } - interface Parser { - eval(expr: string): any; - get(variable: string): any; - set: (variable: string, value: any) => void; - clear: () => void; - } + interface MathNode { + isNode: boolean; + isAccessorNode?: boolean; + isArrayNode?: boolean; + isAssignmentNode?: boolean; + isBlockNode?: boolean; + isConditionalnode?: boolean; + isConstantNode?: boolean; + isFunctionAssignmentNode?: boolean; + isFunctionNode?: boolean; + isIndexNode?: boolean; + isObjectNode?: boolean; + isOperatorNode?: boolean; + isParenthesisNode?: boolean; + isRangeNode?: boolean; + isSymbolNode?: boolean; + isUpdateNode?: boolean; + comment?: string; + op?: string; + fn?: string; + args?: MathNode[]; + type: string; + name?: string; + value?: any; - interface Distribution { - random(size: any, min?: any, max?: any): any; - randomInt(min: any, max?: any): any; - pickRandom(array: any): any; - } + /** + * Create a shallow clone of the node. The node itself is cloned, its + * childs are not cloned. + */ + clone(): MathNode; + /** + * Create a deep clone of the node. Both the node as well as all its + * childs are cloned recursively. + */ + cloneDeep(): MathNode; + /** + * Compile an expression into optimized JavaScript code. compile returns + * an object with a function eval([scope]) to evaluate. Example: + */ + compile(): EvalFunction; + /** + * Compile and eval an expression, this is the equivalent of doing + * node.compile().eval(scope). Example: + */ + eval(expr?: any): any; + /** + * Test whether this node equals an other node. Does a deep comparison + * of the values of both nodes. + */ + equals(other: MathNode): boolean; + /** + * + * Filter nodes in an expression tree. The callback function is called + * as callback(node: MathNode, path: string, parent: MathNode) : boolean + * for every node in the tree, and must return a boolean. The function + * filter returns an array with nodes for which the test returned true. + * Parameter path is a string containing a relative JSON Path. + * + * Example: + * + * ``` + * var node = math.parse('x^2 + x/4 + 3*y'); + * var filtered = node.filter(function (node) { + * return node.isSymbolMathNode && node.name == 'x'; + * }); + * // returns an array with two entries: two SymbolMathNodes 'x' + * ``` + * + * The callback function is called as callback(node: MathNode, path: + * string, parent: MathNode) : boolean for every node in the tree, and + * must return a boolean. The function filter returns an array with + * nodes for which the test returned true. Parameter path is a string + * containing a relative JSON Path. + * @return Returns an array with nodes for which test returned true + */ + filter( + callback: (node: MathNode, path: string, parent: MathNode) => any + ): MathNode[]; - interface FormatOptions { - /** - * Number notation. Choose from: - * 'fixed' Always use regular number notation. For example '123.40' and '14000000' - * 'exponential' Always use exponential notation. For example '1.234e+2' and '1.4e+7' - * 'auto' (default) Regular number notation for numbers having an absolute value between lower and upper bounds, and - * uses exponential notation elsewhere. Lower bound is included, upper bound is excluded. For example '123.4' and '1.4e7'. - */ - notation?: string; + /** + * [forEach description] + */ + forEach( + callback: (node: MathNode, path: string, parent: MathNode) => any + ): MathNode[]; - /** - * A number between 0 and 16 to round the digits of the number. In case of notations 'exponential' and 'auto', - * precision defines the total number of significant digits returned and is undefined by default. In case of notation 'fixed', - * precision defines the number of significant digits after the decimal point, and is 0 by default. - */ - precision?: number; + /** + * Transform a node. Creates a new MathNode having it’s child's be the + * results of calling the provided callback function for each of the + * child's of the original node. The callback function is called as + * `callback(child: MathNode, path: string, parent: MathNode)` and must + * return a MathNode. Parameter path is a string containing a relative + * JSON Path. + * + * + * See also transform, which is a recursive version of map. + */ + map( + callback: ( + node: MathNode, + path: string, + parent: MathNode + ) => MathNode + ): MathNode; - /** - * An object containing two parameters, {number} lower and {number} upper, used by notation 'auto' to determine - * when to return exponential notation. Default values are lower=1e-3 and upper=1e5. Only applicable for notation auto. - */ - exponential?: {lower: number; upper: number}; + /** + * Get a HTML representation of the parsed expression. + */ + toHtml(options?: object): string; - /** - * Available values: 'ratio' (default) or 'decimal'. For example format(fraction(1, 3)) will output '1/3' when 'ratio' - * is configured, and will output 0.(3) when 'decimal' is configured. - */ - fraction?: string; + /** + * Get a string representation of the parsed expression. This is not + * exactly the same as the original input. + */ + toString(options?: object): string; - /** - * A custom formatting function. Can be used to override the built-in notations. Function fn is called with - * value as parameter and must return a string. Is useful for example to format all values inside a matrix in a particular way. - */ - fn?: (item: any) => string; - } + /** + * Get a LaTeX representation of the expression. + */ + toTex(options?: object): string; - interface Help { - toString(): string; - toJSON(): string; + /** + * Recursively transform an expression tree via a transform function. + * Similar to Array.map, but recursively executed on all nodes in the + * expression tree. The callback function is a mapping function + * accepting a node, and returning a replacement for the node or the + * original node. Function callback is called as callback(node: + * MathNode, path: string, parent: MathNode) for every node in the tree, + * and must return a MathNode. Parameter path is a string containing a + * relative JSON Path. + * + * For example, to replace all nodes of type SymbolMathNode having name + * ‘x’ with a ConstantMathNode with value 3: + * ```js + * var node = math.parse('x^2 + 5*x'); + * var transformed = node.transform(function (node, path, parent) { + * if (node.SymbolMathNode && node.name == 'x') { + * return new math.expression.node.ConstantMathNode(3); + * } + * else { + * return node; + * } + * }); + * transformed.toString(); // returns '(3 ^ 2) + (5 * 3)' + * ``` + */ + transform( + callback: ( + node: MathNode, + path: string, + parent: MathNode + ) => MathNode + ): MathNode; + + /** + * `traverse(callback)` + * + * Recursively traverse all nodes in a node tree. Executes given + * callback for this node and each of its child nodes. Similar to + * Array.forEach, except recursive. The callback function is a mapping + * function accepting a node, and returning a replacement for the node + * or the original node. Function callback is called as callback(node: + * MathNode, path: string, parent: MathNode) for every node in the tree. + * Parameter path is a string containing a relative JSON Path. Example: + * + * ``` + * var node = math.parse('3 * x + 2'); + * node.traverse(function (node, path, parent) { + * switch (node.type) { + * case 'OperatorMathNode': console.log(node.type, node.op); break; + * case 'ConstantMathNode': console.log(node.type, node.value); break; + * case 'SymbolMathNode': console.log(node.type, node.name); break; + * default: console.log(node.type); + * } + * }); + * // outputs: + * // OperatorMathNode + + * // OperatorMathNode * + * // ConstantMathNode 3 + * // SymbolMathNode x + * // ConstantMathNode 2 + * ``` + */ + traverse( + callback: (node: MathNode, path: string, parent: MathNode) => void + ): any; + } + + interface Parser { + eval(expr: string): any; + get(variable: string): any; + set: (variable: string, value: any) => void; + clear: () => void; + } + + interface Distribution { + random(size: any, min?: any, max?: any): any; + randomInt(min: any, max?: any): any; + pickRandom(array: any): any; + } + + interface FormatOptions { + /** + * Number notation. Choose from: 'fixed' Always use regular number + * notation. For example '123.40' and '14000000' 'exponential' Always + * use exponential notation. For example '1.234e+2' and '1.4e+7' 'auto' + * (default) Regular number notation for numbers having an absolute + * value between lower and upper bounds, and uses exponential notation + * elsewhere. Lower bound is included, upper bound is excluded. For + * example '123.4' and '1.4e7'. + */ + notation?: "fixed" | "exponential" | "engineering" | "auto"; + + /** + * A number between 0 and 16 to round the digits of the number. In case + * of notations 'exponential' and 'auto', precision defines the total + * number of significant digits returned and is undefined by default. In + * case of notation 'fixed', precision defines the number of significant + * digits after the decimal point, and is 0 by default. + */ + precision?: number; + + /** + * Exponent determining the lower boundary for formatting a value with + * an exponent when notation='auto. Default value is -3. + */ + lowerExp?: number; + + /** + * Exponent determining the upper boundary for formatting a value with + * an exponent when notation='auto. Default value is 5. + */ + upperExp?: number; + + /** + * Available values: 'ratio' (default) or 'decimal'. For example + * format(fraction(1, 3)) will output '1/3' when 'ratio' is configured, + * and will output 0.(3) when 'decimal' is configured. + */ + fraction?: string; + } + + interface Help { + toString(): string; + toJSON(): string; + } + + interface ConfigOptions { + epsilon?: number; + matrix?: string; + number?: string; + precision?: number; + parenthesis?: string; + randomSeed?: string; + } + + interface MathJsJson { + /** + * Returns reviver function that can be used as reviver in JSON.parse function. + */ + reviver(): (key: any, value: any) => any; } interface MathJsChain { - /** - * Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix. - * @param b A column vector with the b values - */ - lsolve(b: Matrix|MathArray): MathJsChain; + done(): any; - /** - * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U) - * and a row permutation vector p where A[p,:] = L * U - */ - lup(): MathJsChain; + /************************************************************************* + * Construction functions + ************************************************************************/ - /** - * Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector. - * @param b Column Vector - */ - lusolve(b: Matrix|MathArray): MathJsChain; + /** + * Create a BigNumber, which can store numbers with arbitrary precision. + * When a matrix is provided, all elements will be converted to + * BigNumber. + */ + bignumber(): MathJsChain; - /** - * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in - * two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U - * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is - * returned 1 - Matrix must be square, symbolic ordering and analysis is performed on M = A + A' 2 - Symbolic - * ordering and analysis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. - * This is appropriate for LU factorization of non-symmetric matrices. 3 - Symbolic ordering and analysis is performed - * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with - * more than 10*sqr(columns) entries. - * @param threshold Partial pivoting threshold (1 for partial pivoting) - * @returns The lower triangular matrix, the upper triangular matrix and the permutation vectors. - */ - slu(order: number, threshold: number): MathJsChain; + /** + * Create a boolean or convert a string or number to a boolean. In case + * of a number, true is returned for non-zero numbers, and false in case + * of zero. Strings can be 'true' or 'false', or can contain a number. + * When value is a matrix, all elements will be converted to boolean. + */ + boolean(): MathJsChain; - /** - * Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b - * @param b A column vector with the b values - * @returns A column vector with the linear system solution (x) - */ - usolve(b: Matrix|MathArray): MathJsChain; + /** + * Create a complex value or convert a value to a complex value. + * @param im Argument specifying the imaginary part of the complex + * number + */ + complex(im?: number): MathJsChain; - /** - * Calculate the absolute value of a number. For matrices, the function is evaluated element wise. - */ - abs(): MathJsChain; + /** + * Create a user-defined unit and register it with the Unit type. + * @param definition Definition of the unit in terms of existing units. + * For example, ‘0.514444444 m / s’. + * @param options (optional) An object containing any of the following + * properties:
- prefixes {string} “none”, “short”, “long”, + * “binary_short”, or “binary_long”. The default is “none”.
- + * aliases {Array} Array of strings. Example: [‘knots’, ‘kt’, + * ‘kts’]
- offset {Numeric} An offset to apply when converting from + * the unit. For example, the offset for celsius is 273.15. Default is + * 0. + */ + createUnit( + definition?: string | UnitDefinition, + options?: CreateUnitOptions + ): MathJsChain; + /** + * Create a user-defined unit and register it with the Unit type. + * @param options (optional) An object containing any of the following + * properties:
- prefixes {string} “none”, “short”, “long”, + * “binary_short”, or “binary_long”. The default is “none”.
- + * aliases {Array} Array of strings. Example: [‘knots’, ‘kt’, + * ‘kts’]
- offset {Numeric} An offset to apply when converting from + * the unit. For example, the offset for celsius is 273.15. Default is + * 0. + */ + createUnit(options?: CreateUnitOptions): MathJsChain; - /** - * Add two values, x + y. For matrices, the function is evaluated element wise. - * @param y Second value to add - */ - add(y: MathType): MathJsChain; + /** + * Create a fraction convert a value to a fraction. + * @param denominator Argument specifying the denominator of the + * fraction + */ + fraction( + denominator?: number | string | MathArray | Matrix + ): MathJsChain; - /** - * Calculate the cubic root of a value. For matrices, the function is evaluated element wise. - * @param allRoots Optional, false by default. Only applicable when x is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned. - */ - cbrt(allRoots?: boolean): MathJsChain; + /** + * Create an index. An Index can store ranges having start, step, and + * end for multiple dimensions. Matrix.get, Matrix.set, and math.subset + * accept an Index as input. + */ + index(): MathJsChain; - /** - * Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. For matrices, the function is evaluated element wise. - */ - ceil(): MathJsChain; + /** + * Create a Matrix. The function creates a new math.type.Matrix object + * from an Array. A Matrix has utility functions to manipulate the data + * in the matrix, like getting the size and getting or setting values in + * the matrix. Supported storage formats are 'dense' and 'sparse'. + */ + matrix(format?: "sparse" | "dense", dataType?: string): MathJsChain; - /** - * Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise. - */ - cube(): MathJsChain; + /** + * Create a number or convert a string, boolean, or unit to a number. + * When value is a matrix, all elements will be converted to number. + * @param valuelessUnit A valueless unit, used to convert a unit to a + * number + */ + number(valuelessUnit?: Unit | string): MathJsChain; - /** - * Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y). - * @param y Denominator - */ - divide(y: MathType): MathJsChain; + /** + * Create a Sparse Matrix. The function creates a new math.type.Matrix + * object from an Array. A Matrix has utility functions to manipulate + * the data in the matrix, like getting the size and getting or setting + * values in the matrix. + * @param dataType Sparse Matrix data type + */ + sparse(dataType?: string): MathJsChain; - /** - * Divide two matrices element wise. The function accepts both matrices and scalar values. - * @param y Denominator - */ - dotDivide(y: MathType): MathJsChain; + /** + * Split a unit in an array of units whose sum is equal to the original + * unit. + * @param parts An array of strings or valueless units + */ + splitUnit(parts: Unit[]): MathJsChain; - /** - * Multiply two matrices element wise. The function accepts both matrices and scalar values. - * @param y Right hand value - */ - dotMultiply(y: MathType): MathJsChain; + /** + * Create a string or convert any object into a string. Elements of + * Arrays and Matrices are processed element wise. + */ + string(): MathJsChain; - /** - * Calculates the power of x to y element wise. - * @param y The exponent - */ - dotPow(y: MathType): MathJsChain; + /** + * Create a unit. Depending on the passed arguments, the function will + * create and return a new math.type.Unit object. When a matrix is + * provided, all elements will be converted to units. + * @param unit The unit to be created + */ + unit(unit?: string): MathJsChain; - /** - * Calculate the exponent of a value. For matrices, the function is evaluated element wise. - */ - exp(): MathJsChain; + /************************************************************************* + * Expression functions + ************************************************************************/ - /** - * Round a value towards zero. For matrices, the function is evaluated element wise. - */ - fix(): MathJsChain; + /** + * Parse and compile an expression. Returns a an object with a function + * eval([scope]) to evaluate the compiled expression. + */ + compile(): MathJsChain; - /** - * Round a value towards minus infinity. For matrices, the function is evaluated element wise. - */ - floor(): MathJsChain; + /** + * Evaluate an expression. + * @param scope Scope to read/write variables + */ + eval(scope?: object): MathJsChain; - /** - * Calculate the greatest common divisor for two or more values or arrays. For matrices, the function is evaluated element wise. - */ - gcd(...args: number[]): MathJsChain; - gcd(...args: BigNumber[]): MathJsChain ; - gcd(...args: Fraction[]): MathJsChain ; - gcd(...args: MathArray[]): MathJsChain ; - gcd(...args: Matrix[]): MathJsChain; + /** + * Retrieve help on a function or data type. Help files are retrieved + * from the documentation in math.expression.docs. + */ + help(): MathJsChain; - /** - * Calculate the hypotenuse of a list with values. The hypotenuse is defined as: - * hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) - * For matrix input, the hypotenuse is calculated for all values in the matrix. - */ - hypot(...args: number[]): MathJsChain; - hypot(...args: BigNumber[]): MathJsChain; + /** + * Parse an expression. Returns a node tree, which can be evaluated by + * invoking node.eval(); + * @param options Available options: nodes - a set of custome nodes + */ + parse(options?: any): MathJsChain; + /** + * @param options Available options: nodes - a set of custome nodes + */ + parse(options?: any): MathJsChain; + + /** + * Create a parser. The function creates a new math.expression.Parser + * object. + */ + parser(): MathJsChain; + + /************************************************************************* + * Algebra functions + ************************************************************************/ + /** + * @param variable The variable over which to differentiate + * @param options There is one option available, simplify, which is true + * by default. When false, output will not be simplified. + */ + derivative(variable: MathNode | string, options?: {simplify: boolean}): MathJsChain; + + /** + * Solves the linear equation system by forwards substitution. Matrix + * must be a lower triangular matrix. + * @param b A column vector with the b values + */ + lsolve(b: Matrix | MathArray): MathJsChain; + + /** + * Calculate the Matrix LU decomposition with partial pivoting. Matrix A + * is decomposed in two matrices (L, U) and a row permutation vector p + * where A[p,:] = L * U + */ + lup(): MathJsChain; + + /** + * Solves the linear system A * x = b where A is an [n x n] matrix and b + * is a [n] column vector. + * @param b Column Vector + * @param order The Symbolic Ordering and Analysis order, see slu for + * details. Matrix must be a SparseMatrix + * @param threshold Partial pivoting threshold (1 for partial pivoting), + * see slu for details. Matrix must be a SparseMatrix. + */ + lusolve( + b: Matrix | MathArray, + order?: number, + threshold?: number + ): MathJsChain; + + /** + * Calculate the Matrix QR decomposition. Matrix A is decomposed in two + * matrices (Q, R) where Q is an orthogonal matrix and R is an upper + * triangular matrix. + */ + qr(): MathJsChain; + + /** + * Transform a rationalizable expression in a rational fraction. If + * rational fraction is one variable polynomial then converts the + * numerator and denominator in canonical form, with decreasing + * exponents, returning the coefficients of numerator. + * @param optional scope of expression or true for already evaluated + * rational expression at input + * @param detailed optional True if return an object, false if return + * expression node (default) + */ + rationalize(optional?: object | boolean, detailed?: boolean): MathJsChain; + + /** + * Simplify an expression tree. + * @param rules A list of rules are applied to an expression, repeating + * over the list until no further changes are made. It’s possible to + * pass a custom set of rules to the function as second argument. A rule + * can be specified as an object, string, or function. + * @param scope Scope to variables + */ + simplify( + rules?: Array<({ l: string; r: string } | string | ((node: MathNode) => MathNode))>, + scope?: object + ): MathJsChain; + + /** + * Calculate the Sparse Matrix LU decomposition with full pivoting. + * Sparse Matrix A is decomposed in two matrices (L, U) and two + * permutation vectors (pinv, q) where P * A * Q = L * U + * @param order The Symbolic Ordering and Analysis order: 0 - Natural + * ordering, no permutation vector q is returned 1 - Matrix must be + * square, symbolic ordering and analisis is performed on M = A + A' 2 - + * Symbolic ordering and analysis is performed on M = A' * A. Dense + * columns from A' are dropped, A recreated from A'. This is appropriate + * for LU factorization of non-symmetric matrices. 3 - Symbolic ordering + * and analysis is performed on M = A' * A. This is best used for LU + * factorization is matrix M has no dense rows. A dense row is a row + * with more than 10*sqr(columns) entries. + * @param threshold Partial pivoting threshold (1 for partial pivoting) + */ + slu(order: number, threshold: number): MathJsChain; + + /** + * Solves the linear equation system by backward substitution. Matrix + * must be an upper triangular matrix. U * x = b + * @param b A column vector with the b values + */ + usolve(b: Matrix | MathArray): MathJsChain; + + /************************************************************************* + * Arithmetic functions + ************************************************************************/ + + /** + * Calculate the absolute value of a number. For matrices, the function + * is evaluated element wise. + */ + abs(): MathJsChain; + + /** + * Add two values, x + y. For matrices, the function is evaluated + * element wise. + * @param y Second value to add + */ + add(y: MathType): MathJsChain; + + /** + * Calculate the cubic root of a value. For matrices, the function is + * evaluated element wise. + * @param allRoots Optional, false by default. Only applicable when x is + * a number or complex number. If true, all complex roots are returned, + * if false (default) the principal root is returned. + */ + cbrt(allRoots?: boolean): MathJsChain; + + /** + * Round a value towards plus infinity If x is complex, both real and + * imaginary part are rounded towards plus infinity. For matrices, the + * function is evaluated element wise. + */ + ceil(): MathJsChain; + + /** + * Compute the cube of a value, x * x * x. For matrices, the function is + * evaluated element wise. + */ + cube(): MathJsChain; + + /** + * Divide two values, x / y. To divide matrices, x is multiplied with + * the inverse of y: x * inv(y). + * @param y Denominator + */ + divide(y: MathType): MathJsChain; + + /** + * Divide two matrices element wise. The function accepts both matrices + * and scalar values. + * @param y Denominator + */ + dotDivide(y: MathType): MathJsChain; + + /** + * Multiply two matrices element wise. The function accepts both + * matrices and scalar values. + * @param y Right hand value + */ + dotMultiply(y: MathType): MathJsChain; + + /** + * Calculates the power of x to y element wise. + * @param y The exponent + */ + dotPow(y: MathType): MathJsChain; + + /** + * Calculate the exponent of a value. For matrices, the function is + * evaluated element wise. + */ + exp(): MathJsChain; + + /** + * Calculate the value of subtracting 1 from the exponential value. For + * matrices, the function is evaluated element wise. + */ + expm1(): MathJsChain; + + /** + * Round a value towards zero. For matrices, the function is evaluated + * element wise. + */ + fix(): MathJsChain; + + /** + * Round a value towards minus infinity. For matrices, the function is + * evaluated element wise. + */ + floor(): MathJsChain; + + /** + * Calculate the greatest common divisor for two or more values or + * arrays. For matrices, the function is evaluated element wise. + */ + gcd(): MathJsChain; + + /** + * Calculate the hypotenusa of a list with values. The hypotenusa is + * defined as: hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) For + * matrix input, the hypotenusa is calculated for all values in the + * matrix. + */ + hypot(): MathJsChain; + + /** + * Calculate the least common multiple for two or more values or arrays. + * lcm is defined as: lcm(a, b) = abs(a * b) / gcd(a, b) For matrices, + * the function is evaluated element wise. + * @param b An integer number + */ + lcm(b: number | BigNumber | MathArray | Matrix): MathJsChain; + + /** + * Calculate the logarithm of a value. For matrices, the function is + * evaluated element wise. + * @param base Optional base for the logarithm. If not provided, the + * natural logarithm of x is calculated. Default value: e. + */ + log(base?: number | BigNumber | Complex): MathJsChain; + + /** + * Calculate the 10-base of a value. This is the same as calculating + * log(x, 10). For matrices, the function is evaluated element wise. + */ + log10(): MathJsChain; + + /** + * Calculate the logarithm of a value+1. For matrices, the function is + * evaluated element wise. + */ + log1p(base?: number | BigNumber | Complex): MathJsChain; + /** + * Calculate the 2-base of a value. This is the same as calculating + * log(x, 2). For matrices, the function is evaluated element wise. + */ + log2(): MathJsChain; + /** + * Calculates the modulus, the remainder of an integer division. For + * matrices, the function is evaluated element wise. The modulus is + * defined as: x - y * floor(x / y) + * @see http://en.wikipedia.org/wiki/Modulo_operation. + * @param y Divisor + */ + mod(y: number | BigNumber | Fraction | MathArray | Matrix): MathJsChain; + + /** + * Multiply two values, x * y. The result is squeezed. For matrices, the + * matrix product is calculated. + * @param y The second value to multiply + */ + multiply(y: MathType): MathJsChain; + + /** + * Calculate the norm of a number, vector or matrix. The second + * parameter p is optional. If not provided, it defaults to 2. + * @param p Vector space. Supported numbers include Infinity and + * -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The + * Frobenius norm) Default value: 2. + */ + norm(p?: number | BigNumber | string): MathJsChain; + + /** + * Calculate the nth root of a value. The principal nth root of a + * positive real number A, is the positive real solution of the equation + * x^root = A For matrices, the function is evaluated element wise. + * @param root The root. Default value: 2. + */ + nthRoot(root?: number | BigNumber): MathJsChain; + + /** + * Calculates the power of x to y, x ^ y. Matrix exponentiation is + * supported for square matrices x, and positive integer exponents y. + * @param y The exponent + */ + pow(): MathJsChain; + + /** + * Round a value towards the nearest integer. For matrices, the function + * is evaluated element wise. + * @param n Number of decimals Default value: 0. + */ + round(n?: number | BigNumber | MathArray): MathJsChain; + + /** + * Compute the sign of a value. The sign of a value x is: 1 when x > 1 + * -1 when x < 0 0 when x == 0 For matrices, the function is evaluated + * element wise. + * @param x The number for which to determine the sign + * @returns The sign of x + */ + sign(): MathJsChain; + + /** + * Calculate the square root of a value. For matrices, the function is + * evaluated element wise. + */ + sqrt(): MathJsChain; + + /** + * Compute the square of a value, x * x. For matrices, the function is + * evaluated element wise. + */ + square(): MathJsChain; + + /** + * Subtract two values, x - y. For matrices, the function is evaluated + * element wise. + * @param y Value to subtract from x + */ + subtract(y: MathType): MathJsChain; + + /** + * Inverse the sign of a value, apply a unary minus operation. For + * matrices, the function is evaluated element wise. Boolean values and + * strings will be converted to a number. For complex numbers, both real + * and complex value are inverted. + */ + unaryMinus(): MathJsChain; + + /** + * Unary plus operation. Boolean values and strings will be converted to + * a number, numeric values will be returned as is. For matrices, the + * function is evaluated element wise. + */ + unaryPlus(): MathJsChain; + + /** + * Calculate the extended greatest common divisor for two values. See + * http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. + * @param b An integer number + */ + xgcd(b: number | BigNumber): MathJsChain; + + /************************************************************************* + * Bitwise functions + ************************************************************************/ + + /** + * Bitwise AND two values, x & y. For matrices, the function is + * evaluated element wise. + * @param y Second value to and + */ + bitAnd(y: number | BigNumber | MathArray | Matrix): MathJsChain; + + /** + * Bitwise NOT value, ~x. For matrices, the function is evaluated + * element wise. For units, the function is evaluated on the best prefix + * base. + */ + bitNot(): MathJsChain; + + /** + * Bitwise OR two values, x | y. For matrices, the function is evaluated + * element wise. For units, the function is evaluated on the lowest + * print base. + * @param y Second value to or + */ + bitOr(y: number | BigNumber | MathArray | Matrix): MathJsChain; + + /** + * Bitwise XOR two values, x ^ y. For matrices, the function is + * evaluated element wise. + * @param y Second value to xor + */ + bitXor(y: number | BigNumber | MathArray | Matrix): MathJsChain; + + /** + * Bitwise left logical shift of a value x by y number of bits, x << y. + * For matrices, the function is evaluated element wise. For units, the + * function is evaluated on the best prefix base. + * @param y Amount of shifts + */ + leftShift(y: number | BigNumber): MathJsChain; + + /** + * Bitwise right arithmetic shift of a value x by y number of bits, x >> + * y. For matrices, the function is evaluated element wise. For units, + * the function is evaluated on the best prefix base. + * @param y Amount of shifts + */ + rightArithShift(y: number | BigNumber): MathJsChain; + + /** + * Bitwise right logical shift of value x by y number of bits, x >>> y. + * For matrices, the function is evaluated element wise. For units, the + * function is evaluated on the best prefix base. + * @param y Amount of shifts + */ + rightLogShift(y: number): MathJsChain; + + /************************************************************************* + * Combinatorics functions + ************************************************************************/ + + /** + * The Bell Numbers count the number of partitions of a set. A partition + * is a pairwise disjoint subset of S whose union is S. bellNumbers only + * takes integer arguments. The following condition must be enforced: n + * >= 0 + */ + bellNumbers(): MathJsChain; + + /** + * The Catalan Numbers enumerate combinatorial structures of many + * different types. catalan only takes integer arguments. The following + * condition must be enforced: n >= 0 + */ + catalan(): MathJsChain; + + /** + * The composition counts of n into k parts. Composition only takes + * integer arguments. The following condition must be enforced: k <= n. + * @param k Number of objects in the subset + */ + composition(k: number | BigNumber): MathJsChain; + + /** + * The Stirling numbers of the second kind, counts the number of ways to + * partition a set of n labelled objects into k nonempty unlabelled + * subsets. stirlingS2 only takes integer arguments. The following + * condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = + * 1 + * @param k Number of objects in the subset + */ + stirlingS2(k: number | BigNumber): MathJsChain; + + /************************************************************************* + * Complex functions + ************************************************************************/ + + /** + * Compute the argument of a complex value. For a complex number a + bi, + * the argument is computed as atan2(b, a). For matrices, the function + * is evaluated element wise. + */ + arg(): MathJsChain; + + /** + * Compute the complex conjugate of a complex value. If x = a+bi, the + * complex conjugate of x is a - bi. For matrices, the function is + * evaluated element wise. + */ + conj(): MathJsChain; + + /** + * Get the imaginary part of a complex number. For a complex number a + + * bi, the function returns b. For matrices, the function is evaluated + * element wise. + */ + im(): MathJsChain; + + /** + * Get the real part of a complex number. For a complex number a + bi, + * the function returns a. For matrices, the function is evaluated + * element wise. + */ + re(): MathJsChain; + + /************************************************************************* + * Geometry functions + ************************************************************************/ + + /** + * Calculates: The eucledian distance between two points in 2 and 3 + * dimensional spaces. Distance between point and a line in 2 and 3 + * dimensional spaces. Pairwise distance between a set of 2D or 3D + * points NOTE: When substituting coefficients of a line(a, b and c), + * use ax + by + c = 0 instead of ax + by = c For parametric equation of + * a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, + * c) + * @param y Coordinates of the second point + */ + distance(y: MathArray | Matrix | object): MathJsChain; + + /** + * Calculates the point of intersection of two lines in two or three + * dimensions and of a line and a plane in three dimensions. The inputs + * are in the form of arrays or 1 dimensional matrices. The line + * intersection functions return null if the lines do not meet. Note: + * Fill the plane coefficients as x + y + z = c and not as x + y + z + c + * = 0. + * @param x Co-ordinates of second end-point of first line + * @param y Co-ordinates of first end-point of second line OR + * Coefficients of the plane's equation + * @param z Co-ordinates of second end-point of second line OR null if + * the calculation is for line and plane + */ + intersect( + x: MathArray | Matrix, + y: MathArray | Matrix, + z: MathArray | Matrix + ): MathJsChain; + + /************************************************************************* + * Logical functions + ************************************************************************/ + + /** + * Logical and. Test whether two values are both defined with a + * nonzero/nonempty value. For matrices, the function is evaluated + * element wise. + * @param y Second value to and + */ + and( + y: number | BigNumber | Complex | Unit | MathArray | Matrix + ): MathJsChain; + + /** + * Logical not. Flips boolean value of a given parameter. For matrices, + * the function is evaluated element wise. + */ + not(): MathJsChain; + + /** + * Logical or. Test if at least one value is defined with a + * nonzero/nonempty value. For matrices, the function is evaluated + * element wise. + * @param y Second value to or + */ + or( + y: number | BigNumber | Complex | Unit | MathArray | Matrix + ): MathJsChain; + + /** + * Logical xor. Test whether one and only one value is defined with a + * nonzero/nonempty value. For matrices, the function is evaluated + * element wise. + * @param y Second value to xor + */ + xor( + y: number | BigNumber | Complex | Unit | MathArray | Matrix + ): MathJsChain; + + /************************************************************************* + * Matrix functions + ************************************************************************/ + + /** + * Concatenate two or more matrices. dim: number is a zero-based + * dimension over which to concatenate the matrices. By default the last + * dimension of the matrices. + */ + concat(): MathJsChain; + + /** + * Calculate the cross product for two vectors in three dimensional + * space. The cross product of A = [a1, a2, a3] and B =[b1, b2, b3] is + * defined as: cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 + * * b2 - a2 * b1 ] + * @param y Second vector + */ + cross(y: MathArray | Matrix): MathJsChain; + + /** + * Calculate the determinant of a matrix. + */ + det(): MathJsChain; + + /** + * Create a diagonal matrix or retrieve the diagonal of a matrix. When x + * is a vector, a matrix with vector x on the diagonal will be returned. + * When x is a two dimensional matrix, the matrixes kth diagonal will be + * returned as vector. When k is positive, the values are placed on the + * super diagonal. When k is negative, the values are placed on the sub + * diagonal. + * @param k The diagonal where the vector will be filled in or + * retrieved. Default value: 0. + * @param format The matrix storage format. Default value: 'dense'. + */ + diag(format?: string): MathJsChain; + diag(k: number | BigNumber, format?: string): MathJsChain; + + /** + * Calculate the dot product of two vectors. The dot product of A = [a1, + * a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as: dot(A, + * B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn + * @param y Second vector + */ + dot(y: MathArray | Matrix): MathJsChain; + + /** + * Compute the matrix exponential, expm(A) = e^A. The matrix must be + * square. Not to be confused with exp(a), which performs element-wise + * exponentiation. The exponential is calculated using the Padé + * approximant with scaling and squaring; see “Nineteen Dubious Ways to + * Compute the Exponential of a Matrix,” by Moler and Van Loan. + */ + expm(): MathJsChain; + + /** + * Create a 2-dimensional identity matrix with size m x n or n x n. The + * matrix has ones on the diagonal and zeros elsewhere. + * @param format The Matrix storage format + */ + eye(format?: string): MathJsChain; + /** + * @param n The y dimension for the matrix + * @param format The Matrix storage format + */ + eye(n: number, format?: string): MathJsChain; + + /** + * Filter the items in an array or one dimensional matrix. + */ + filter(test: ((value: any, index: any, matrix: Matrix | MathArray) => Matrix | MathArray)| RegExp): MathJsChain; + + /** + * Flatten a multi dimensional matrix into a single dimensional matrix. + */ + flatten(): MathJsChain; + + /** + * Iterate over all elements of a matrix/array, and executes the given + * callback function. + */ + forEach(callback: ((value: any, index: any, matrix: Matrix | MathArray) => void)): MathJsChain; + + /** + * Calculate the inverse of a square matrix. + */ + inv(): MathJsChain; /** * Calculate the kronecker product of two matrices or vectors - * @param x First Matrix - * @param y Second Matrix + * @param y Second vector */ - kron(x: Matrix|MathArray, y: Matrix|MathArray): MathJsChain; - - /** - * Calculate the least common multiple for two or more values or arrays. lcm is defined as: - * lcm(a, b) = abs(a * b) / gcd(a, b) - * For matrices, the function is evaluated element wise. - */ - lcm(b: number|BigNumber|MathArray|Matrix): MathJsChain; - - /** - * Calculate the logarithm of a value. For matrices, the function is evaluated element wise. - * @param base Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e. - */ - log(base?: number|BigNumber|Complex): MathJsChain; - - /** - * Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise. - */ - log10(): MathJsChain; - - /** - * Calculates the modulus, the remainder of an integer division. For matrices, the function is evaluated element wise. - * The modulus is defined as: - * x - y * floor(x / y) - * @see http://en.wikipedia.org/wiki/Modulo_operation. - * @param y Divisor - */ - mod(y: number|BigNumber|Fraction|MathArray|Matrix): MathJsChain; - - /** - * Multiply two values, x * y. The result is squeezed. For matrices, the matrix product is calculated. - */ - multiply(y: MathType): MathJsChain; - - /** - * Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2. - * @param p Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2. - */ - norm(p?: number|BigNumber|string): MathJsChain; - - /** - * Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation - * x^root = A - * For matrices, the function is evaluated element wise. - * @param root The root. Default value: 2. - */ - nthRoot(root?: number|BigNumber): MathJsChain; - - /** - * Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y. - * @param y The exponent - */ - pow(y: number|BigNumber|Complex): MathJsChain; - - /** - * Round a value towards the nearest integer. For matrices, the function is evaluated element wise. - * @param n Number of decimals Default value: 0. - */ - round(n?: number|BigNumber|MathArray): MathJsChain; - - /** - * Compute the sign of a value. The sign of a value x is: - * 1 when x > 1 - * -1 when x < 0 - * 0 when x == 0 - * For matrices, the function is evaluated element wise. - */ - sign(): MathJsChain; - - /** - * Calculate the square root of a value. For matrices, the function is evaluated element wise. - */ - sqrt(): MathJsChain; - - /** - * Compute the square of a value, x * x. For matrices, the function is evaluated element wise. - */ - square(): MathJsChain; - - /** - * Subtract two values, x - y. For matrices, the function is evaluated element wise. - */ - subtract(y: MathType): MathJsChain; - - /** - * Inverse the sign of a value, apply a unary minus operation. - * For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted. - */ - unaryMinus(): MathJsChain; - - /** - * Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is. - * For matrices, the function is evaluated element wise. - */ - unaryPlus(): MathJsChain; - - /** - * Calculate the extended greatest common divisor for two values. See http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. - */ - xgcd(b: number|BigNumber): MathJsChain; - - /** - * Bitwise AND two values, x & y. For matrices, the function is evaluated element wise. - */ - bitAnd(y: number|BigNumber|MathArray|Matrix): MathJsChain; - - /** - * Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - */ - bitNot(): MathJsChain; - - /** - * Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base. - */ - bitOr(): MathJsChain; - - /** - * Bitwise XOR two values, x ^ y. For matrices, the function is evaluated element wise. - */ - bitXor(y: number|BigNumber|MathArray|Matrix): MathJsChain; - - /** - * Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - * @param x Value to be shifted - * @param y Amount of shifts - */ - leftShift(y: number|BigNumber): MathJsChain; - - /** - * Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - * @param x Value to be shifted - * @param y Amount of shifts - */ - rightArithShift(y: number|BigNumber): MathJsChain; - - /** - * Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. - * @param x Value to be shifted - * @param y Amount of shifts - */ - rightLogShift(y: number): MathJsChain; - - /** - * The Bell Numbers count the number of partitions of a set. - * A partition is a pairwise disjoint subset of S whose union is S. - * bellNumbers only takes integer arguments. The following condition must be enforced: n >= 0 - * @param n Total number of objects in the set - */ - bellNumbers(): MathJsChain; - - /** - * The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0 - * @param n nth Catalan number - */ - catalan(): MathJsChain; - - /** - * The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n. - * @param n Total number of objects in the set - * @param k Number of objects in the subset - * @returns Returns the composition counts of n into k parts. - */ - composition(k: number|BigNumber): MathJsChain; - - /** - * The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. - * stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n. - * If n = k or k = 1, then s(n,k) = 1 - * @param n Total number of objects in the set - * @param k Number of objects in the subset - */ - stirlingS2(k: number|BigNumber): MathJsChain; - - /** - * Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise. - * @param x A complex number or array with complex numbers - */ - arg(): MathJsChain; - - /** - * Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate of x is a - bi. For matrices, the function is evaluated element wise. - * @param x A complex number or array with complex numbers - */ - conj(): MathJsChain; - - /** - * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b. - * For matrices, the function is evaluated element wise. - */ - im(): MathJsChain; - - /** - * Get the real part of a complex number. For a complex number a + bi, the function returns a. - * For matrices, the function is evaluated element wise. - */ - re(): MathJsChain; - - /** - * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point - * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When - * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric - * equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c) - */ - distance(y: MathType): MathJsChain; - - /** - * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in - * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions - * return null if the lines do not meet. - * Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0. - * @param w Co-ordinates of first end-point of first line - * @param x Co-ordinates of second end-point of first line - * @param y Co-ordinates of first end-point of second line OR Co-efficients of the plane's equation - * @param z Co-ordinates of second end-point of second line OR null if the calculation is for line and plane - * @returns Returns the point of intersection of lines/lines-planes - */ - intersect(x: MathArray|Matrix, y: MathArray|Matrix, z: MathArray|Matrix): MathJsChain; - - /** - * Logical and. Test whether two values are both defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. - */ - and(y: number|BigNumber|Complex|Unit|MathArray|Matrix): MathJsChain; - - /** - * Logical not. Flips boolean value of a given parameter. For matrices, the function is evaluated element wise. - */ - not(): MathJsChain; - - /** - * Logical or. Test if at least one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. - */ - or(y: number|BigNumber|Complex|Unit|MathArray|Matrix): MathJsChain; - - /** - * Logical xor. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. - */ - xor(y: number|BigNumber|Complex|Unit|MathArray|Matrix): MathJsChain; - - /** - * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3] - * and B =[b1, b2, b3] is defined as: - * cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ] - */ - cross(y: MathArray|Matrix): MathJsChain; - - /** - * Calculate the determinant of a matrix. - */ - det(): MathJsChain; - - /** - * Resize a matrix - * @param x Matrix to be resized - * @param size One dimensional array with numbers - * @param defaultValue Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0. - */ - resize(size: MathArray|Matrix, defaultValue?: number|string): MathJsChain; - - /** - * Calculate the size of a matrix or scalar. - */ - size(): MathJsChain; - - /** - * Squeeze a matrix, remove inner and outer singleton dimensions from a matrix. - */ - squeeze(): MathJsChain; - - /** - * Get or set a subset of a matrix or string. - * @param value An array, matrix, or string - * @param index An index containing ranges for each dimension - * @param replacement An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned - * @param defaultValue Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined. - */ - subset(index: Index, replacement?: any, defaultValue?: any): MathJsChain; - - /** - * Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix. - */ - trace(): MathJsChain; - - /** - * Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported. - */ - transpose(): MathJsChain; - - /** - * Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution. - */ - pickRandom(): MathJsChain; - - /** - * Return a random number larger or equal to min and smaller than max using a uniform distribution. - */ - random(min?: number, max?: number): MathJsChain; - - /** - * Return a random integer number larger or equal to min and smaller than max using a uniform distribution. - */ - randomInt(min?: number, max?: number): MathJsChain; - - /** - * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y. - * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - compare(y: MathType): MathJsChain; - - /** - * Test element wise whether two matrices are equal. The function accepts both matrices and scalar values. - */ - deepEqual(y: MathType): MathJsChain; - - /** - * Test whether two values are equal. - * The function tests whether the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im. - * Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else. - */ - equal(y: MathType): MathJsChain; - - /** - * Test whether value x is larger than y. - * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - larger(y: MathType): MathJsChain; - - /** - * Test whether value x is larger or equal to y. - * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - largerEq(y: MathType): MathJsChain; - - /** - * Test whether value x is smaller than y. - * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. - */ - smaller(MathJsChainy: MathType): MathJsChain; - - /** - * Test whether value x is smaller or equal to y. - * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon. - * The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. - */ - smallerEq(MathJsChainy: MathType): MathJsChain; - - /** - * Test whether two values are unequal. - * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot - * be used to compare values smaller than approximately 2.22e-16. - * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im. - * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with - * everything except undefined. - */ - unequal(MathJsChainy: MathType): MathJsChain; - - /** - * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened - * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. - */ - max(dim?: number): MathJsChain; - - /** - * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be - * calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. - */ - mean(dim?: number): MathJsChain; - - /** - * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an - * even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit - * In case of a (multi dimensional) array or matrix, the median of all elements will be calculated. - */ - median(): MathJsChain; - - /** - * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened - * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. - */ - min(dim?: number): MathJsChain; - - /** - * Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values. - */ - mode(): MathJsChain; - - /** - * Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. - */ - prod(): MathJsChain; - - /** - * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. - * Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber - * In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated. - */ - quantileSeq(prob: number|BigNumber|MathArray, sorted?: boolean): MathJsChain; - - /** - * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the - * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will - * be calculated. - * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following - * values: - * 'unbiased' (default) The sum of squared errors is divided by (n - 1) - * 'uncorrected' The sum of squared errors is divided by n - * 'biased' The sum of squared errors is divided by (n + 1) - */ - std(normalization?: string): MathJsChain; - - /** - * Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. - */ - sum(): MathJsChain; - - /** - * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all - * elements will be calculated. - * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the - * following values: - * 'unbiased' (default) The sum of squared errors is divided by (n - 1) - * 'uncorrected' The sum of squared errors is divided by n - * 'biased' The sum of squared errors is divided by (n + 1) - * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...) - * instead of math.var(...). - */ - var(normalization?: string): MathJsChain; - - /** - * Calculate the inverse cosine of a value. For matrices, the function is evaluated element wise. - */ - acos(): MathJsChain; - - /** - * Calculate the hyperbolic arccos of a value, defined as acosh(x) = ln(sqrt(x^2 - 1) + x). - * For matrices, the function is evaluated element wise. - */ - acosh(): MathJsChain; - - /** - * Calculate the inverse cotangent of a value. For matrices, the function is evaluated element wise. - */ - acot(): MathJsChain; - - /** - * Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2. - * For matrices, the function is evaluated element wise. - */ - acoth(): MathJsChain; - - /** - * Calculate the inverse cosecant of a value. For matrices, the function is evaluated element wise. - */ - acsc(): MathJsChain; - - /** - * Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)). - * For matrices, the function is evaluated element wise. - */ - acsch(): MathJsChain; - - /** - * Calculate the inverse secant of a value. For matrices, the function is evaluated element wise. - */ - asec(): MathJsChain; - - /** - * Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated element wise. - */ - asech(): MathJsChain; - - /** - * Calculate the inverse sine of a value. For matrices, the function is evaluated element wise. - */ - asin(): MathJsChain; - - /** - * Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated element wise. - */ - asinh(): MathJsChain; - - /** - * Calculate the inverse tangent of a value. For matrices, the function is evaluated element wise. - */ - atan(): MathJsChain; - - /** - * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the - * computed angle can be determined. - * For matrices, the function is evaluated element wise. - */ - atan2(x: number|MathArray|Matrix): MathJsChain; - - /** - * Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2. - * For matrices, the function is evaluated element wise. - */ - atanh(): MathJsChain; - - /** - * Calculate the cosine of a value. For matrices, the function is evaluated element wise. - */ - asin(): MathJsChain; // tslint:disable-line adjacent-overload-signatures - - /** - * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)). For matrices, the function is evaluated element wise. - */ - cosh(): MathJsChain; - - /** - * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). For matrices, the function is evaluated element wise. - */ - cot(): MathJsChain; - - /** - * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). For matrices, the function is evaluated element wise. - */ - coth(): MathJsChain; - - /** - * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For matrices, the function is evaluated element wise. - */ - csc(): MathJsChain; - - /** - * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x). For matrices, the function is evaluated element wise. - */ - csch(): MathJsChain; - - /** - * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For matrices, the function is evaluated element wise. - */ - sec(): MathJsChain; - - /** - * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x). For matrices, the function is evaluated element wise. - */ - sech(): MathJsChain; - - /** - * Calculate the sine of a value. For matrices, the function is evaluated element wise. - */ - sin(): MathJsChain; - - /** - * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise. - */ - sinh(): MathJsChain; - - /** - * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). For matrices, the function is evaluated element wise. - */ - tan(): MathJsChain; - - /** - * Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is evaluated element wise. - */ - tanh(): MathJsChain; - - /** - * Change the unit of a value. For matrices, the function is evaluated element wise. - * @param x The unit to be converted. - * @param unit New unit. Can be a string like "cm" or a unit without value. - */ - to(unit: Unit|string): MathJsChain; - - /** - * Clone an object. - */ - clone(): MathJsChain; - - /** - * Filter the items in an array or one dimensional matrix. - * @param x A one dimensional matrix or array to filter - * @param test - */ - filter(test: RegExp|((item: any) => boolean)): MathJsChain; - - /** - * Format a value of any type into a string. - */ - format(options?: FormatOptions|number|((item: any) => string)): MathJsChain; - - /** - * Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array. - * @param callback The callback method is invoked with three parameters: the value of the element, the index of the element, and the matrix being traversed. - */ - map(callback: (item: any) => any): MathJsChain; - - /** - * Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect. - * @param k The kth smallest value to be retrieved; zero-based index - * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. - * @returns Returns the kth lowest value. - */ - partitionSelect(k: number, compare?: string|((a: any, b: any) => number)): MathJsChain; - - /** - * Sort the items in a matrix. - * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. - */ - sort(compare?: string|((a: any, b: any) => number)): MathJsChain; - - done(): any; - valueOf(): any; - toString(): string; - } - - interface MathJsJson { - /** - * Returns reviver function that can be used as reviver in JSON.parse function. - */ - reviver(): (key: any, value: any) => any; - } + kron(y: Matrix | MathArray): MathJsChain; + + /** + * Iterate over all elements of a matrix/array, and executes the given + * callback function. + * @param callback The callback function is invoked with three + * parameters: the value of the element, the index of the element, and + * the Matrix/array being traversed. + */ + map(callback: ((value: any, index: any, matrix: Matrix | MathArray) => Matrix | MathArray)): MathJsChain; + + /** + * Create a matrix filled with ones. The created matrix can have one or + * multiple dimensions. + * @param format The matrix storage format + */ + ones(format?: string): MathJsChain; + /** + * @param format The matrix storage format + */ + ones(n: number, format?: string): MathJsChain; + /** + * Partition-based selection of an array or 1D matrix. Will find the kth + * smallest value, and mutates the input array. Uses Quickselect. + * @param k The kth smallest value to be retrieved; zero-based index + * @param compare An optional comparator function. The function is + * called as compare(a, b), and must return 1 when a > b, -1 when a < b, + * and 0 when a == b. Default value: 'asc'. + */ + partitionSelect( + k: number, + compare?: "asc" | "desc" | ((a: any, b: any) => number) + ): MathJsChain; + + /** + * Create an array from a range. By default, the range end is excluded. + * This can be customized by providing an extra parameter includeEnd. + * @param end End of the range, excluded by default, included when + * parameter includeEnd=true + * @param step Step size. Default value is 1. + * @param includeEnd: Option to specify whether to include the end or + * not. False by default + */ + range(includeEnd?: boolean): Matrix; + range(end: number | BigNumber, includeEnd?: boolean): MathJsChain; + range( + end: number | BigNumber, + step: number | BigNumber, + includeEnd?: boolean + ): MathJsChain; + + /** + * Reshape a multi dimensional array to fit the specified dimensions + * @param sizes One dimensional array with integral sizes for each + * dimension + */ + reshape(sizes: number[]): MathJsChain; + + /** + * Resize a matrix + * @param size One dimensional array with numbers + * @param defaultValue Zero by default, except in case of a string, in + * that case defaultValue = ' ' Default value: 0. + */ + resize( + size: MathArray | Matrix, + defaultValue?: number | string + ): MathJsChain; + + /** + * Calculate the size of a matrix or scalar. + */ + size(): MathJsChain; + + /** + * Sort the items in a matrix + * @param compare An optional _comparator function or name. The function + * is called as compare(a, b), and must return 1 when a > b, -1 when a < + * b, and 0 when a == b. Default value: ‘asc’ + */ + sort(compare: ((a: any, b: any) => number) | "asc" | "desc" | "natural"): MathJsChain; + + /** + * Calculate the principal square root of a square matrix. The principal + * square root matrix X of another matrix A is such that X * X = A. + */ + sqrtm(): MathJsChain; + + /** + * Squeeze a matrix, remove inner and outer singleton dimensions from a + * matrix. + */ + squeeze(): MathJsChain; + + /** + * Get or set a subset of a matrix or string. + * @param index An index containing ranges for each dimension + * @param replacement An array, matrix, or scalar. If provided, the + * subset is replaced with replacement. If not provided, the subset is + * returned + * @param defaultValue Default value, filled in on new entries when the + * matrix is resized. If not provided, math.matrix elements will be left + * undefined. Default value: undefined. + */ + subset( + index: Index, + replacement?: any, + defaultValue?: any + ): MathJsChain; + + /** + * Calculate the trace of a matrix: the sum of the elements on the main + * diagonal of a square matrix. + */ + trace(): MathJsChain; + + /** + * Transpose a matrix. All values of the matrix are reflected over its + * main diagonal. Only two dimensional matrices are supported. + */ + transpose(): MathJsChain; + + /** + * Create a matrix filled with zeros. The created matrix can have one or + * multiple dimensions. + * @param format The matrix storage format + * @returns A matrix filled with zeros + */ + zeros(format?: string): MathJsChain; + /** + * @param n The y dimension of the matrix + * @param format The matrix storage format + */ + zeros(n: number, format?: string): MathJsChain; + + /************************************************************************* + * Probability functions + ************************************************************************/ + + /** + * Compute the number of ways of picking k unordered outcomes from n + * possibilities. Combinations only takes integer arguments. The + * following condition must be enforced: k <= n. + * @param k Number of objects in the subset + */ + combinations(k: number | BigNumber): MathJsChain; + + /** + * Compute the factorial of a value Factorial only supports an integer + * value as argument. For matrices, the function is evaluated element + * wise. + */ + factorial(): MathJsChain; + + /** + * Compute the gamma function of a value using Lanczos approximation for + * small values, and an extended Stirling approximation for large + * values. For matrices, the function is evaluated element wise. + */ + gamma(): MathJsChain; + + /** + * Calculate the Kullback-Leibler (KL) divergence between two + * distributions + * @param p Second vector + */ + kldivergence(p: MathArray | Matrix): MathJsChain; + + /** + * Multinomial Coefficients compute the number of ways of picking a1, + * a2, ..., ai unordered outcomes from n possibilities. multinomial + * takes one array of integers as an argument. The following condition + * must be enforced: every ai <= 0 + */ + multinomial(): MathJsChain; + + /** + * Compute the number of ways of obtaining an ordered subset of k + * elements from a set of n elements. Permutations only takes integer + * arguments. The following condition must be enforced: k <= n. + * @param k The number of objects in the subset + */ + permutations(k?: number | BigNumber): MathJsChain; + + /** + * Random pick a value from a one dimensional array. Array element is + * picked using a random function with uniform distribution. + * @param number An int or float + * @param weights An array of ints or floats + */ + pickRandom(number?: number, weights?: number[]): MathJsChain; + + /** + * Return a random number larger or equal to min and smaller than max + * using a uniform distribution. + * @param min Minimum boundary for the random value, included + * @param max Maximum boundary for the random value, excluded + */ + // tslint:disable-next-line unified-signatures + random(max?: number): MathJsChain; + // tslint:disable-next-line unified-signatures + random(min: number, max: number): MathJsChain; + + /** + * Return a random integer number larger or equal to min and smaller + * than max using a uniform distribution. + * @param min Minimum boundary for the random value, included + * @param max Maximum boundary for the random value, excluded + */ + // tslint:disable-next-line unified-signatures + randomInt(max?: number): MathJsChain; + // tslint:disable-next-line unified-signatures + randomInt(min: number, max: number): MathJsChain; + + /************************************************************************* + * Relational functions + ************************************************************************/ + + /** + * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x + * == y. x and y are considered equal when the relative difference + * between x and y is smaller than the configured epsilon. The function + * cannot be used to compare values smaller than approximately 2.22e-16. + * For matrices, the function is evaluated element wise. + * @param y Second value to compare + */ + compare(y: MathType | string): MathJsChain; + + /** + * Compare two values of any type in a deterministic, natural way. For + * numeric values, the function works the same as math.compare. For + * types of values that can’t be compared mathematically, the function + * compares in a natural way. + * @param y Second value to compare + */ + compareNatural(y: any): MathJsChain; + + /** + * Compare two strings lexically. Comparison is case sensitive. Returns + * 1 when x > y, -1 when x < y, and 0 when x == y. For matrices, the + * function is evaluated element wise. + * @param y Second string to compare + */ + compareText(y: string | MathArray | Matrix): MathJsChain; + + /** + * Test element wise whether two matrices are equal. The function + * accepts both matrices and scalar values. + * @param y Second amtrix to compare + */ + deepEqual(y: MathType): MathJsChain; + + /** + * Test whether two values are equal. + * + * The function tests whether the relative difference between x and y is + * smaller than the configured epsilon. The function cannot be used to + * compare values smaller than approximately 2.22e-16. For matrices, the + * function is evaluated element wise. In case of complex numbers, x.re + * must equal y.re, and x.im must equal y.im. Values null and undefined + * are compared strictly, thus null is only equal to null and nothing + * else, and undefined is only equal to undefined and nothing else. + * @param y Second value to compare + */ + equal(y: MathType | string): MathJsChain; + + /** + * Check equality of two strings. Comparison is case sensitive. For + * matrices, the function is evaluated element wise. + * @param y Second string to compare + */ + equalText(y: string | MathArray | Matrix): MathJsChain; + + /** + * Test whether value x is larger than y. The function returns true when + * x is larger than y and the relative difference between x and y is + * larger than the configured epsilon. The function cannot be used to + * compare values smaller than approximately 2.22e-16. For matrices, the + * function is evaluated element wise. + * @param y Second value to compare + */ + larger(y: MathType | string): MathJsChain; + + /** + * Test whether value x is larger or equal to y. The function returns + * true when x is larger than y or the relative difference between x and + * y is smaller than the configured epsilon. The function cannot be used + * to compare values smaller than approximately 2.22e-16. For matrices, + * the function is evaluated element wise. + * @param y Second value to vcompare + */ + largerEq(y: MathType | string): MathJsChain; + + /** + * Test whether value x is smaller than y. The function returns true + * when x is smaller than y and the relative difference between x and y + * is smaller than the configured epsilon. The function cannot be used + * to compare values smaller than approximately 2.22e-16. For matrices, + * the function is evaluated element wise. + * @param y Second value to vcompare + */ + smaller(y: MathType | string): MathJsChain; + + /** + * Test whether value x is smaller or equal to y. The function returns + * true when x is smaller than y or the relative difference between x + * and y is smaller than the configured epsilon. The function cannot be + * used to compare values smaller than approximately 2.22e-16. For + * matrices, the function is evaluated element wise. + * @param y Second value to compare + */ + smallerEq(y: MathType | string): MathJsChain; + + /** + * Test whether two values are unequal. The function tests whether the + * relative difference between x and y is larger than the configured + * epsilon. The function cannot be used to compare values smaller than + * approximately 2.22e-16. For matrices, the function is evaluated + * element wise. In case of complex numbers, x.re must unequal y.re, or + * x.im must unequal y.im. Values null and undefined are compared + * strictly, thus null is unequal with everything except null, and + * undefined is unequal with everything except undefined. + * @param y Second value to vcompare + */ + unequal(y: MathType | string): MathJsChain; + + /************************************************************************* + * Set functions + ************************************************************************/ + + /** + * Create the cartesian product of two (multi)sets. Multi-dimension + * arrays will be converted to single-dimension arrays before the + * operation. + * @param a2 A (multi)set + */ + setCartesian(a2: MathArray | Matrix): MathJsChain; + + /** + * Create the difference of two (multi)sets: every element of set1, that + * is not the element of set2. Multi-dimension arrays will be converted + * to single-dimension arrays before the operation + * @param a2 A (multi)set + */ + setDifference(a2: MathArray | Matrix): MathJsChain; + + /** + * Collect the distinct elements of a multiset. A multi-dimension array + * will be converted to a single-dimension array before the operation. + */ + setDistinct(): MathJsChain; + + /** + * Create the intersection of two (multi)sets. Multi-dimension arrays + * will be converted to single-dimension arrays before the operation. + * @param a2 A (multi)set + */ + setIntersect(a2: MathArray | Matrix): MathJsChain; + + /** + * Check whether a (multi)set is a subset of another (multi)set. (Every + * element of set1 is the element of set2.) Multi-dimension arrays will + * be converted to single-dimension arrays before the operation. + * @param a2 A (multi)set + */ + setIsSubset(a2: MathArray | Matrix): MathJsChain; + + /** + * Count the multiplicity of an element in a multiset. A multi-dimension + * array will be converted to a single-dimension array before the + * operation. + * @param a A multiset + */ + setMultiplicity(a: MathArray | Matrix): MathJsChain; + + /** + * Create the powerset of a (multi)set. (The powerset contains very + * possible subsets of a (multi)set.) A multi-dimension array will be + * converted to a single-dimension array before the operation. + */ + setPowerset(): MathJsChain; + + /** + * Count the number of elements of a (multi)set. When a second parameter + * is ‘true’, count only the unique values. A multi-dimension array will + * be converted to a single-dimension array before the operation. + */ + setSize(): MathJsChain; + + /** + * Create the symmetric difference of two (multi)sets. Multi-dimension + * arrays will be converted to single-dimension arrays before the + * operation. + * @param a2 A (multi)set + */ + setSymDifference(a2: MathArray | Matrix): MathJsChain; + + /** + * Create the union of two (multi)sets. Multi-dimension arrays will be + * converted to single-dimension arrays before the operation. + * @param a2 A (multi)set + */ + setUnion(a2: MathArray | Matrix): MathJsChain; + + /************************************************************************* + * Special functions + ************************************************************************/ + + /** + * Compute the erf function of a value using a rational Chebyshev + * approximations for different intervals of x. + */ + erf(): MathJsChain; + + /************************************************************************* + * Statistics functions + ************************************************************************/ + + /** + * Compute the median absolute deviation of a matrix or a list with + * values. The median absolute deviation is defined as the median of the + * absolute deviations from the median. + */ + mad(): MathJsChain; + + /** + * Compute the maximum value of a matrix or a list with values. In case + * of a multi dimensional array, the maximum of the flattened array will + * be calculated. When dim is provided, the maximum over the selected + * dimension will be calculated. Parameter dim is zero-based. + * @param dim The maximum over the selected dimension + */ + max(dim?: number): MathJsChain; + + /** + * Compute the mean value of matrix or a list with values. In case of a + * multi dimensional array, the mean of the flattened array will be + * calculated. When dim is provided, the maximum over the selected + * dimension will be calculated. Parameter dim is zero-based. + * @param dim The mean over the selected dimension + */ + mean(dim?: number): MathJsChain; + + /** + * Compute the median of a matrix or a list with values. The values are + * sorted and the middle value is returned. In case of an even number of + * values, the average of the two middle values is returned. Supported + * types of values are: Number, BigNumber, Unit In case of a (multi + * dimensional) array or matrix, the median of all elements will be + * calculated. + */ + median(): MathJsChain; + + /** + * Compute the maximum value of a matrix or a list of values. In case of + * a multi dimensional array, the maximum of the flattened array will be + * calculated. When dim is provided, the maximum over the selected + * dimension will be calculated. Parameter dim is zero-based. + * @param dim The minimum over the selected dimension + */ + min(dim?: number): MathJsChain; + + /** + * Computes the mode of a set of numbers or a list with values(numbers + * or characters). If there are more than one modes, it returns a list + * of those values. + */ + mode(): MathJsChain; + + /** + * Compute the product of a matrix or a list with values. In case of a + * (multi dimensional) array or matrix, the sum of all elements will be + * calculated. + */ + prod(): MathJsChain; + + /** + * Compute the prob order quantile of a matrix or a list with values. + * The sequence is sorted and the middle value is returned. Supported + * types of sequence values are: Number, BigNumber, Unit Supported types + * of probability are: Number, BigNumber In case of a (multi + * dimensional) array or matrix, the prob order quantile of all elements + * will be calculated. + * @param probOrN prob is the order of the quantile, while N is the + * amount of evenly distributed steps of probabilities; only one of + * these options can be provided + * @param sorted =false is data sorted in ascending order + */ + quantileSeq( + prob: number | BigNumber | MathArray, + sorted?: boolean + ): MathJsChain; + + /** + * Compute the standard deviation of a matrix or a list with values. The + * standard deviations is defined as the square root of the variance: + * std(A) = sqrt(var(A)). In case of a (multi dimensional) array or + * matrix, the standard deviation over all elements will be calculated. + * Optionally, the type of normalization can be specified as second + * parameter. The parameter normalization can be one of the following + * values: 'unbiased' (default) The sum of squared errors is divided by + * (n - 1) 'uncorrected' The sum of squared errors is divided by n + * 'biased' The sum of squared errors is divided by (n + 1) + * @param array A single matrix or multiple scalar values + * @param normalization Determines how to normalize the variance. Choose + * ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. Default value: + * ‘unbiased’. + * @returns The standard deviation + */ + std( + normalization?: "unbiased" | "uncorrected" | "biased" | "unbiased" + ): MathJsChain; + + /** + * Compute the sum of a matrix or a list with values. In case of a + * (multi dimensional) array or matrix, the sum of all elements will be + * calculated. + */ + sum(): MathJsChain; + + /** + * Compute the variance of a matrix or a list with values. In case of a + * (multi dimensional) array or matrix, the variance over all elements + * will be calculated. Optionally, the type of normalization can be + * specified as second parameter. The parameter normalization can be one + * of the following values: 'unbiased' (default) The sum of squared + * errors is divided by (n - 1) 'uncorrected' The sum of squared errors + * is divided by n 'biased' The sum of squared errors is divided by (n + + * 1) Note that older browser may not like the variable name var. In + * that case, the function can be called as math['var'](...) instead of + * math.var(...). + * @param normalization normalization Determines how to normalize the + * variance. Choose ‘unbiased’ (default), ‘uncorrected’, or ‘biased’. + * Default value: ‘unbiased’. + * @returns The variance + */ + var( + normalization?: "unbiased" | "uncorrected" | "biased" | "unbiased" + ): MathJsChain; + + /************************************************************************* + * String functions + ************************************************************************/ + + /** + * Format a value of any type into a string. + * @param options An object with formatting options. + * @param callback A custom formatting function, invoked for all numeric + * elements in value, for example all elements of a matrix, or the real + * and imaginary parts of a complex number. This callback can be used to + * override the built-in numeric notation with any type of formatting. + * Function callback is called with value as parameter and must return a + * string. + * @see http://mathjs.org/docs/reference/functions/format.html + */ + format( + value: any, + options?: FormatOptions | number | ((item: any) => string), + callback?: ((value: any) => string) + ): MathJsChain; + + /** + * Interpolate values into a string template. + * @param values An object containing variables which will be filled in + * in the template. + * @param precision Number of digits to format numbers. If not provided, + * the value will not be rounded. + * @param options Formatting options, or the number of digits to format + * numbers. See function math.format for a description of all options. + */ + print( + values: any, + precision?: number, + options?: number | object + ): MathJsChain; + + /************************************************************************* + * Trigonometry functions + ************************************************************************/ + + /** + * Calculate the inverse cosine of a value. For matrices, the function + * is evaluated element wise. + */ + acos(): MathJsChain; + + /** + * Calculate the hyperbolic arccos of a value, defined as acosh(x) = + * ln(sqrt(x^2 - 1) + x). For matrices, the function is evaluated + * element wise. + */ + acosh(): MathJsChain; + + /** + * Calculate the inverse cotangent of a value. For matrices, the + * function is evaluated element wise. + */ + acot(): MathJsChain; + + /** + * Calculate the hyperbolic arccotangent of a value, defined as acoth(x) + * = (ln((x+1)/x) + ln(x/(x-1))) / 2. For matrices, the function is + * evaluated element wise. + */ + acoth(): MathJsChain; + + /** + * Calculate the inverse cosecant of a value. For matrices, the function + * is evaluated element wise. + */ + acsc(): MathJsChain; + + /** + * Calculate the hyperbolic arccosecant of a value, defined as acsch(x) + * = ln(1/x + sqrt(1/x^2 + 1)). For matrices, the function is evaluated + * element wise. + */ + acsch(): MathJsChain; + + /** + * Calculate the inverse secant of a value. For matrices, the function + * is evaluated element wise. + */ + asec(): MathJsChain; + + /** + * Calculate the hyperbolic arcsecant of a value, defined as asech(x) = + * ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated + * element wise. + */ + asech(): MathJsChain; + + /** + * Calculate the inverse sine of a value. For matrices, the function is + * evaluated element wise. + */ + asin(): MathJsChain; + + /** + * Calculate the hyperbolic arcsine of a value, defined as asinh(x) = + * ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated + * element wise. + */ + asinh(): MathJsChain; + + /** + * Calculate the inverse tangent of a value. For matrices, the function + * is evaluated element wise. + */ + atan(): MathJsChain; + + /** + * Calculate the inverse tangent function with two arguments, y/x. By + * providing two arguments, the right quadrant of the computed angle can + * be determined. For matrices, the function is evaluated element wise. + */ + atan2(): MathJsChain; + + /** + * Calculate the hyperbolic arctangent of a value, defined as atanh(x) = + * ln((1 + x)/(1 - x)) / 2. For matrices, the function is evaluated + * element wise. + */ + atanh(): MathJsChain; + + /** + * Calculate the cosine of a value. For matrices, the function is + * evaluated element wise. + */ + cos(): MathJsChain; + + /** + * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 + * * (exp(x) + exp(-x)). For matrices, the function is evaluated element + * wise. + */ + cosh(): MathJsChain; + + /** + * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). + * For matrices, the function is evaluated element wise. + */ + cot(): MathJsChain; + + /** + * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 + * / tanh(x). For matrices, the function is evaluated element wise. + */ + coth(): MathJsChain; + + /** + * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For + * matrices, the function is evaluated element wise. + */ + csc(): MathJsChain; + + /** + * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 + * / sinh(x). For matrices, the function is evaluated element wise. + */ + csch(): MathJsChain; + + /** + * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For + * matrices, the function is evaluated element wise. + */ + sec(): MathJsChain; + + /** + * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / + * cosh(x). For matrices, the function is evaluated element wise. + */ + sech(): MathJsChain; + + /** + * Calculate the sine of a value. For matrices, the function is + * evaluated element wise. + */ + sin(): MathJsChain; + + /** + * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * + * (exp(x) - exp(-x)). For matrices, the function is evaluated element + * wise. + */ + sinh(): MathJsChain; + + /** + * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). + * For matrices, the function is evaluated element wise. + */ + tan(): MathJsChain; + + /** + * Calculate the hyperbolic tangent of a value, defined as tanh(x) = + * (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is + * evaluated element wise. + */ + tanh(): MathJsChain; + + /************************************************************************* + * Unit functions + ************************************************************************/ + + /** + * Change the unit of a value. For matrices, the function is evaluated + * element wise. + * @param unit New unit. Can be a string like "cm" or a unit without + * value. + */ + to(unit: Unit | string): MathJsChain; + + /************************************************************************* + * Utils functions + ************************************************************************/ + + /** + * Clone an object. + */ + clone(): MathJsChain; + + /** + * Test whether a value is an integer number. The function supports + * number, BigNumber, and Fraction. The function is evaluated + * element-wise in case of Array or Matrix input. + */ + isInteger(): MathJsChain; + + /** + * Test whether a value is NaN (not a number). The function supports + * types number, BigNumber, Fraction, Unit and Complex. The function is + * evaluated element-wise in case of Array or Matrix input. + */ + isNaN(): MathJsChain; + + /** + * Test whether a value is negative: smaller than zero. The function + * supports types number, BigNumber, Fraction, and Unit. The function is + * evaluated element-wise in case of Array or Matrix input. + */ + isNegative(): MathJsChain; + + /** + * Test whether a value is an numeric value. The function is evaluated + * element-wise in case of Array or Matrix input. + */ + isNumeric(): MathJsChain; + + /** + * Test whether a value is positive: larger than zero. The function + * supports types number, BigNumber, Fraction, and Unit. The function is + * evaluated element-wise in case of Array or Matrix input. + */ + isPositive(): MathJsChain; + + /** + * Test whether a value is prime: has no divisors other than itself and + * one. The function supports type number, bignumber. The function is + * evaluated element-wise in case of Array or Matrix input. + */ + isPrime(): MathJsChain; + + /** + * Test whether a value is zero. The function can check for zero for + * types number, BigNumber, Fraction, Complex, and Unit. The function is + * evaluated element-wise in case of Array or Matrix input. + */ + isZero(): MathJsChain; + + /** + * Determine the type of a variable. + */ + typeof(): MathJsChain; + } } diff --git a/types/mathjs/mathjs-tests.ts b/types/mathjs/mathjs-tests.ts index 09202e0599..c1e32a7d9a 100644 --- a/types/mathjs/mathjs-tests.ts +++ b/types/mathjs/mathjs-tests.ts @@ -33,7 +33,7 @@ Bignumbers examples { // configure the default type of numbers as BigNumbers math.config({ - number: 'bignumber', + number: 'BigNumber', precision: 20, }); @@ -108,16 +108,13 @@ Complex numbers examples // create a complex number from polar coordinates { - const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 }; - const c: math.Complex = math - .complex(p); + const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 }; + const c: math.Complex = math.complex(p); } // get polar coordinates of a complex number { - const p: math.PolarCoordinates = math - .complex(3, 4) - .toPolar(); + const p: math.PolarCoordinates = math.complex(3, 4).toPolar(); } } @@ -175,6 +172,11 @@ Expressions examples // get and set variables and functions { + parser.eval('x = 7 / 2'); // 3.5 + parser.eval('x + 3'); // 6.5 + parser.eval('f(x, y) = x^y'); // f(x, y) + parser.eval('f(2, 3)'); // 8 + const x = parser.get('x'); const f = parser.get('f'); const g = f(3, 3); @@ -193,7 +195,7 @@ Fractions examples { // configure the default type of numbers as Fractions math.config({ - number: 'fraction', + number: 'Fraction', }); const x = math.fraction(0.125); @@ -205,9 +207,6 @@ Fractions examples // output formatting const a = math.fraction('2/3'); - console.log(math.format(a)); - console.log(math.format(a, {fraction: 'ratio'})); - console.log(math.format(a, {fraction: 'decimal'})); } /* @@ -237,7 +236,8 @@ Matrices examples b.subset(math.index(1, [0, 1]), [[7, 8]]); const c = math.multiply(a, b); - const d: math.Matrix = c.subset(math.index(1, 0)); + const f: math.Matrix = math.matrix([1, 0]); + const d: math.Matrix = f.subset(math.index(1, 0)); } // get a sub matrix @@ -282,8 +282,9 @@ Sparse matrices examples // do operations with a sparse matrix const b = math.multiply(a, a); const c = math.multiply(b, math.complex(2, 2)); - const d = math.transpose(c); - const e = math.multiply(d, a); + const d = math.matrix([0, 1]); + const e = math.transpose(d); + const f = math.multiply(e, a); } /* @@ -299,8 +300,8 @@ Units examples math.createUnit('foo'); math.createUnit('furlong', '220 yards'); math.createUnit('furlong', '220 yards', {override: true}); - math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67}); - math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true}); + math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67}); + math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true}); math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']}); math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']}, {override: true}); math.createUnit('knot', { @@ -309,7 +310,7 @@ Units examples prefixes: 'long' }, {override: true}); math.createUnit({ - foo: { + foo_2: { prefixes: 'long' }, bar: '40 foo', diff --git a/types/maxmind/index.d.ts b/types/maxmind/index.d.ts index da45eb907b..c93c59a72a 100644 --- a/types/maxmind/index.d.ts +++ b/types/maxmind/index.d.ts @@ -68,6 +68,11 @@ export declare interface Response { readonly names: Translations; }; readonly postal?: { code: string }; + readonly isp?: { + readonly isp: string; + readonly autonomous_system_number: number; + }; + readonly connection?: { connection_type: string }; } export declare interface Translations { diff --git a/types/memoize-one/index.d.ts b/types/memoize-one/index.d.ts index caac3a4429..71f785e73c 100644 --- a/types/memoize-one/index.d.ts +++ b/types/memoize-one/index.d.ts @@ -1,12 +1,9 @@ // Type definitions for memoize-one 3.1 // Project: https://github.com/alexreardon/memoize-one#readme -// Definitions by: Karol Majewski +// Definitions by: Karol Majewski , Frank Li // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = memoizeOne; +declare function memoizeOne any>(resultFn: T, isEqual?: EqualityFn): T; +export type EqualityFn = (a: any, b: any) => boolean; -declare function memoizeOne any>(resultFn: T, isEqual?: memoizeOne.EqualityFn): T; - -declare namespace memoizeOne { - type EqualityFn = (a: any, b: any) => boolean; -} +export default memoizeOne; diff --git a/types/memoize-one/memoize-one-tests.ts b/types/memoize-one/memoize-one-tests.ts index 7ab20ac891..4feddf6e57 100644 --- a/types/memoize-one/memoize-one-tests.ts +++ b/types/memoize-one/memoize-one-tests.ts @@ -1,4 +1,4 @@ -import memoizeOne = require('memoize-one'); +import memoizeOne, { EqualityFn } from 'memoize-one'; declare function add(a: number, b: number): number ; declare function lousyEqualityFn(a: any, b: any): boolean; @@ -30,4 +30,4 @@ memoizeOne(add, (a: string, b: string) => 0); // $ExpectError /** * The `EqualityFn` type is publicly accessible. */ -const simpleIsEqual: memoizeOne.EqualityFn = (x: number, y: number): boolean => (x === y); +const simpleIsEqual: EqualityFn = (x: number, y: number): boolean => (x === y); diff --git a/types/microrouter/index.d.ts b/types/microrouter/index.d.ts index 934affd630..c4927ecf9b 100644 --- a/types/microrouter/index.d.ts +++ b/types/microrouter/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for microrouter 2.2 +// Type definitions for microrouter 3.1 // Project: https://github.com/pedronauck/micro-router#readme // Definitions by: Mathieu Dutour // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -21,6 +21,7 @@ export type AugmentedRequestHandler = ( export type RouteHandler = (path: string, handler: AugmentedRequestHandler) => RequestHandler; export function router(...routes: RequestHandler[]): RequestHandler; +export function withNamespace(namespace: string): (...routes: RequestHandler[]) => RequestHandler; export const get: RouteHandler; export const post: RouteHandler; diff --git a/types/moment-duration-format/index.d.ts b/types/moment-duration-format/index.d.ts index 4506311ab6..1716d55d83 100644 --- a/types/moment-duration-format/index.d.ts +++ b/types/moment-duration-format/index.d.ts @@ -80,12 +80,12 @@ declare module "moment" { } interface LocaleSpecification { - durationLabelsLong: DurationLabelDef; - durationLabelsStandard: DurationLabelDef; - durationLabelsShort: DurationLabelDef; - durationTimeTemplates: DurationTimeDef; - durationLabelTypes: DurationLabelTypeDef[]; - durationPluralKey: (token: string, integerValue: number, decimalValue: number) => string; + durationLabelsLong?: DurationLabelDef; + durationLabelsStandard?: DurationLabelDef; + durationLabelsShort?: DurationLabelDef; + durationTimeTemplates?: DurationTimeDef; + durationLabelTypes?: DurationLabelTypeDef[]; + durationPluralKey?: (token: string, integerValue: number, decimalValue: number) => string; } type TemplateFunction = ((this: DurationFormatSettings) => string); diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 98aa2daca8..3048da4dd4 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1252,7 +1252,7 @@ export class Cursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */ limit(value: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */ - map(transform: Function): Cursor; + map(transform: (document: T) => U): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */ max(max: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */ diff --git a/types/mongodb/tsconfig.json b/types/mongodb/tsconfig.json index 8ed16ed7e6..aae592b3bd 100644 --- a/types/mongodb/tsconfig.json +++ b/types/mongodb/tsconfig.json @@ -4,7 +4,7 @@ "lib": [ "es6" ], - "noImplicitAny": false, + "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index a94f3a691d..17176079ca 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -854,6 +854,8 @@ declare module "mongoose" { typeKey?: string; /** defaults to false */ useNestedStrict?: boolean; + /** defaults to false */ + usePushEach?: boolean; /** defaults to true */ validateBeforeSave?: boolean; /** defaults to "__v" */ diff --git a/types/navermaps/index.d.ts b/types/navermaps/index.d.ts index ec857696bf..8ba4d52bd5 100644 --- a/types/navermaps/index.d.ts +++ b/types/navermaps/index.d.ts @@ -39,7 +39,7 @@ declare namespace naver.maps { */ interface MapEventListener { eventName: string; - listener: () => any; + listener: (event: any) => any; listenerId: string; target: any; } @@ -1303,14 +1303,14 @@ declare namespace naver.maps { function Event(): void; namespace Event { - function addDOMListener(element: HTMLElement, eventName: string, listener: () => any): void; - function addListener(target: any, eventName: string, listener: () => any): MapEventListener; + function addDOMListener(element: HTMLElement, eventName: string, listener: (event: any) => any): void; + function addListener(target: any, eventName: string, listener: (event: any) => any): MapEventListener; function clearInstanceListeners(target: any): void; function clearListeners(target: any, fromEventName: string): void; function forward(source: any, fromEventName: string, target: any, toEventName: string): MapEventListener; function hasListener(target: any, eventName: string): boolean; - function once(target: any, eventName: string, listener: () => any): MapEventListener; - function removeDOMListener(element: HTMLElement, eventName: string, listener: () => any): void; + function once(target: any, eventName: string, listener: (event: any) => any): MapEventListener; + function removeDOMListener(element: HTMLElement, eventName: string, listener: (event: any) => any): void; function removeDOMListener(listeners: DOMEventListener | DOMEventListener[]): void; function removeListener(listeners: MapEventListener | MapEventListener[]): void; function resumeDispatch(target: any, eventName: string): void; diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 544c29bc7e..4eb24dc3ff 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -8,12 +8,11 @@ export interface EventChangeOptions { [key: string]: any; } +export type PopStateCallback = (state: any) => boolean | undefined; + export type RouterCallback = () => void; export interface RouterProps { - // router properties - readonly components: { - [key: string]: { Component: React.ComponentType; err: any }; - }; + // url property fields readonly pathname: string; readonly route: string; readonly asPath?: string; @@ -27,39 +26,50 @@ export interface RouterProps { | string[]; }; - // router methods - reload(route: string): Promise; + // property fields + readonly components: { + [key: string]: { Component: React.ComponentType; err: any }; + }; + + // core method fields back(): void; + beforePopState(cb: PopStateCallback): boolean; + prefetch(url: string): Promise>; push( url: string | UrlLike, as?: string | UrlLike, options?: EventChangeOptions, ): Promise; + reload(route: string): Promise; replace( url: string | UrlLike, as?: string | UrlLike, options?: EventChangeOptions, ): Promise; - prefetch(url: string): Promise>; - // router events + // events onAppUpdated?(nextRoute: string): void; - onRouteChangeStart?(url: string): void; onBeforeHistoryChange?(as: string): void; + onHashChangeStart?(url: string): void; + onHashChangeComplete?(url: string): void; onRouteChangeComplete?(url: string): void; onRouteChangeError?(error: any, url: string): void; + onRouteChangeStart?(url: string): void; } -export interface SingletonRouter { - router: RouterProps; +export interface SingletonRouter extends RouterProps { + router: RouterProps | null; readyCallbacks: RouterCallback[]; ready(cb: RouterCallback): void; } +export interface WithRouterProps { + router: SingletonRouter; +} + export function withRouter( - Component: React.ComponentType, + Component: React.ComponentType, ): React.ComponentType; -export const Singleton: SingletonRouter; -export type ImperativeRouter = RouterProps; -export default Singleton; +declare const Router: SingletonRouter; +export default Router; diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 822b9b8e6f..70c41081bd 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -1,4 +1,4 @@ -import Router, * as r from "next/router"; +import Router, { withRouter, WithRouterProps } from "next/router"; import * as React from "react"; import * as qs from "querystring"; @@ -13,8 +13,8 @@ Router.ready(() => { // Access readonly properties of the router. -Object.keys(Router.router.components).forEach(key => { - const c = Router.router.components[key]; +Object.keys(Router.components).forEach(key => { + const c = Router.components[key]; c.err.isAnAny; return ; @@ -26,52 +26,78 @@ function split(routeLike: string) { }); } -if (Router.router.asPath) { - split(Router.router.asPath); - split(Router.router.asPath); +if (Router.asPath) { + split(Router.asPath); + split(Router.asPath); } -split(Router.router.pathname); +split(Router.pathname); -const query = `?${qs.stringify(Router.router.query)}`; +const query = `?${qs.stringify(Router.query)}`; // Assign some callback methods. -Router.router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); -Router.router.onRouteChangeStart = (url: string) => +Router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); +Router.onRouteChangeStart = (url: string) => console.log("Route is starting to change.", url); -Router.router.onBeforeHistoryChange = (as: string) => +Router.onBeforeHistoryChange = (as: string) => console.log("History hasn't changed yet.", as); -Router.router.onRouteChangeComplete = (url: string) => +Router.onRouteChangeComplete = (url: string) => console.log("Route chaneg is complete.", url); -Router.router.onRouteChangeError = (err: any, url: string) => +Router.onRouteChangeError = (err: any, url: string) => console.log("Route is starting to change.", url, err); // Call methods on the router itself. -Router.router.reload("/route").then(() => console.log("route was reloaded")); -Router.router.back(); +Router.reload("/route").then(() => console.log("route was reloaded")); +Router.back(); +Router.beforePopState(({ url }) => !!url); -Router.router.push("/route").then((success: boolean) => +Router.push("/route").then((success: boolean) => console.log("route push success: ", success), ); -Router.router.push("/route", "/asRoute").then((success: boolean) => +Router.push("/route", "/asRoute").then((success: boolean) => console.log("route push success: ", success), ); -Router.router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => +Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => console.log("route push success: ", success), ); -Router.router.replace("/route").then((success: boolean) => +Router.replace("/route").then((success: boolean) => console.log("route replace success: ", success), ); -Router.router.replace("/route", "/asRoute").then((success: boolean) => +Router.replace("/route", "/asRoute").then((success: boolean) => console.log("route replace success: ", success), ); -Router.router.replace("/route", "/asRoute", { +Router.replace("/route", "/asRoute", { shallow: false, }).then((success: boolean) => console.log("route replace success: ", success)); -Router.router.prefetch("/route").then(Component => { +Router.prefetch("/route").then(Component => { const element = ; }); -r.withRouter(props =>
); +interface TestComponentProps { + testValue: string; +} + +class TestComponent extends React.Component { + state = { ready: false }; + + constructor(props: TestComponentProps & WithRouterProps) { + super(props); + props.router.ready(() => { + this.setState({ ready: true }); + }); + } + + render() { + return ( +
+

{this.state.ready ? 'Ready' : 'Not Ready'}

+

Route: {this.props.router.route}

+

Another prop: {this.props.testValue}

+
+ ); + } +} + +withRouter(TestComponent); diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 5d6b9e9d79..aed01dd504 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -25,6 +25,7 @@ // Alexander T. // Lishude // Andrew Makarov +// Zane Hannan AU // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -2560,11 +2561,19 @@ declare module "dns" { ttl: number; } + export interface AnyRecordWithTtl extends RecordWithTtl { + type: "A" | "AAAA"; + } + export interface MxRecord { priority: number; exchange: string; } + export interface AnyMxRecord extends MxRecord { + type: "MX"; + } + export interface NaptrRecord { flags: string; service: string; @@ -2574,6 +2583,10 @@ declare module "dns" { preference: number; } + export interface AnyNaptrRecord extends NaptrRecord { + type: "NAPTR"; + } + export interface SoaRecord { nsname: string; hostmaster: string; @@ -2584,6 +2597,10 @@ declare module "dns" { minttl: number; } + export interface AnySoaRecord extends SoaRecord { + type: "SOA"; + } + export interface SrvRecord { priority: number; weight: number; @@ -2591,9 +2608,19 @@ declare module "dns" { name: string; } + export interface AnySrvRecord extends SrvRecord { + type: "SRV"; + } + + export interface AnyTxtRecord { + type: "TXT"; + entries: string[]; + } + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray) => void): void; export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; @@ -2607,6 +2634,7 @@ declare module "dns" { // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve { export function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; + export function __promisify__(hostname: string, rrtype: "ANY"): Promise>; export function __promisify__(hostname: string, rrtype: "MX"): Promise; export function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; export function __promisify__(hostname: string, rrtype: "SOA"): Promise; @@ -2637,6 +2665,7 @@ declare module "dns" { export function __promisify__(hostname: string, options?: ResolveOptions): Promise; } + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray) => void): void; export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; @@ -5807,19 +5836,19 @@ declare module "crypto" { verifyError: number; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => any): void; export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string): Buffer; export function randomBytes(size: number): Buffer; - export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; + export function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; export function pseudoRandomBytes(size: number): Buffer; - export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; + export function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; export function randomFillSync(buffer: Buffer | Uint8Array, offset?: number, size?: number): Buffer; - export function randomFill(buffer: Buffer, callback: (err: Error, buf: Buffer) => void): void; - export function randomFill(buffer: Uint8Array, callback: (err: Error, buf: Uint8Array) => void): void; - export function randomFill(buffer: Buffer, offset: number, callback: (err: Error, buf: Buffer) => void): void; - export function randomFill(buffer: Uint8Array, offset: number, callback: (err: Error, buf: Uint8Array) => void): void; - export function randomFill(buffer: Buffer, offset: number, size: number, callback: (err: Error, buf: Buffer) => void): void; - export function randomFill(buffer: Uint8Array, offset: number, size: number, callback: (err: Error, buf: Uint8Array) => void): void; + export function randomFill(buffer: Buffer, callback: (err: Error | null, buf: Buffer) => void): void; + export function randomFill(buffer: Uint8Array, callback: (err: Error | null, buf: Uint8Array) => void): void; + export function randomFill(buffer: Buffer, offset: number, callback: (err: Error | null, buf: Buffer) => void): void; + export function randomFill(buffer: Uint8Array, offset: number, callback: (err: Error | null, buf: Uint8Array) => void): void; + export function randomFill(buffer: Buffer, offset: number, size: number, callback: (err: Error | null, buf: Buffer) => void): void; + export function randomFill(buffer: Uint8Array, offset: number, size: number, callback: (err: Error | null, buf: Uint8Array) => void): void; export interface RsaPublicKey { key: string; padding?: number; @@ -5836,8 +5865,8 @@ declare module "crypto" { export function getCiphers(): string[]; export function getCurves(): string[]; export function getHashes(): string[]; - export interface ECDH { - convertKey(key: string | Buffer /*| TypedArray*/ | DataView, curve: string, inputEncoding?: string, outputEncoding?: string, format?: string): Buffer | string; + export class ECDH { + static convertKey(key: string | Buffer /*| TypedArray*/ | DataView, curve: string, inputEncoding?: "latin1" | "hex" | "base64", outputEncoding?: "latin1" | "hex" | "base64", format?: "uncompressed" | "compressed" | "hybrid"): Buffer | string; generateKeys(): Buffer; generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; computeSecret(other_public_key: Buffer): Buffer; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index c8f61b948a..d9fe6768f6 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1151,6 +1151,19 @@ namespace crypto_tests { crypto.randomFill(arr, 2, (err: Error, buf: Uint8Array) => void {}); crypto.randomFill(arr, 2, 3, (err: Error, buf: Uint8Array) => void {}); } + + { + let key: string | Buffer = Buffer.from("buf"); + let curve = "secp256k1"; + let ret: string | Buffer = crypto.ECDH.convertKey(key, curve); + key = "0xfff"; + ret = crypto.ECDH.convertKey(key, curve); + ret = crypto.ECDH.convertKey(key, curve, "hex"); + ret = crypto.ECDH.convertKey(key, curve, "hex", "hex"); + ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "uncompressed"); + ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "compressed"); + ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "hybrid"); + } } ////////////////////////////////////////////////// @@ -3129,6 +3142,9 @@ namespace dns_tests { dns.resolve("nodejs.org", "AAAA", (err, addresses) => { const _addresses: string[] = addresses; }); + dns.resolve("nodejs.org", "ANY", (err, addresses) => { + const _addresses: ReadonlyArray = addresses; + }); dns.resolve("nodejs.org", "MX", (err, addresses) => { const _addresses: dns.MxRecord[] = addresses; }); diff --git a/types/nodemailer/index.d.ts b/types/nodemailer/index.d.ts index 0b46c67789..31175bd148 100644 --- a/types/nodemailer/index.d.ts +++ b/types/nodemailer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nodemailer/nodemailer // Definitions by: Rogier Schouten // Piotr Roszatycki +// Daniel Chao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/nodemailer/lib/sendmail-transport.d.ts b/types/nodemailer/lib/sendmail-transport/index.d.ts similarity index 84% rename from types/nodemailer/lib/sendmail-transport.d.ts rename to types/nodemailer/lib/sendmail-transport/index.d.ts index 92e461b01b..d1bc9b888b 100644 --- a/types/nodemailer/lib/sendmail-transport.d.ts +++ b/types/nodemailer/lib/sendmail-transport/index.d.ts @@ -1,14 +1,12 @@ /// -import { EventEmitter } from 'events'; +import { Transport, TransportOptions } from '../..'; -import { Transport, TransportOptions } from '..'; +import * as shared from '../shared'; -import * as shared from './shared'; - -import Mail = require('./mailer'); -import MailMessage = require('./mailer/mail-message'); -import MimeNode = require('./mime-node'); +import Mail = require('../mailer'); +import MailMessage = require('../mailer/mail-message'); +import MimeNode = require('../mime-node'); declare namespace SendmailTransport { type MailOptions = Mail.Options; diff --git a/types/nodemailer/lib/sendmail-transport/le-unix.d.ts b/types/nodemailer/lib/sendmail-transport/le-unix.d.ts new file mode 100644 index 0000000000..5f5a3bb25d --- /dev/null +++ b/types/nodemailer/lib/sendmail-transport/le-unix.d.ts @@ -0,0 +1,7 @@ +/// + +import { Transform } from 'stream'; + +declare class LeUnix extends Transform {} + +export = LeUnix; diff --git a/types/nodemailer/lib/sendmail-transport/le-windows.d.ts b/types/nodemailer/lib/sendmail-transport/le-windows.d.ts new file mode 100644 index 0000000000..67ab01ff43 --- /dev/null +++ b/types/nodemailer/lib/sendmail-transport/le-windows.d.ts @@ -0,0 +1,7 @@ +/// + +import { Transform } from 'stream'; + +declare class LeWindows extends Transform {} + +export = LeWindows; diff --git a/types/nodemailer/nodemailer-tests.ts b/types/nodemailer/nodemailer-tests.ts index 0caa84b0e0..6f045df08b 100644 --- a/types/nodemailer/nodemailer-tests.ts +++ b/types/nodemailer/nodemailer-tests.ts @@ -21,6 +21,8 @@ import SMTPTransport = require('nodemailer/lib/smtp-transport'); import StreamTransport = require('nodemailer/lib/stream-transport'); import wellKnown = require('nodemailer/lib/well-known'); import XOAuth2 = require('nodemailer/lib/xoauth2'); +import LeWindows = require('nodemailer/lib/sendmail-transport/le-windows'); +import LeUnix = require('nodemailer/lib/sendmail-transport/le-unix'); import * as fs from 'fs'; import * as stream from 'stream'; @@ -722,6 +724,24 @@ function sendmail_test() { }); } +// line ending transforms using windows-style newlines + +function sendmail_line_endings_windows_test() { + function process_le(mail: MailMessage) { + const input = mail.message.createReadStream(); + input.pipe(new LeWindows()); + } +} + +// line ending transforms using unix-style newlines + +function sendmail_line_endings_unix_test() { + function process_le(mail: MailMessage) { + const input = mail.message.createReadStream(); + input.pipe(new LeUnix()); + } +} + // 5. SES transport // Send a message using SES transport diff --git a/types/nodemailer/tsconfig.json b/types/nodemailer/tsconfig.json index f2c1ffbbe8..5977291812 100644 --- a/types/nodemailer/tsconfig.json +++ b/types/nodemailer/tsconfig.json @@ -31,7 +31,9 @@ "lib/mime-funcs/mime-types.d.ts", "lib/mime-node.d.ts", "lib/qp.d.ts", - "lib/sendmail-transport.d.ts", + "lib/sendmail-transport/index.d.ts", + "lib/sendmail-transport/le-unix.d.ts", + "lib/sendmail-transport/le-windows.d.ts", "lib/ses-transport.d.ts", "lib/shared.d.ts", "lib/smtp-connection.d.ts", diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 9a2f8981a5..a6892eb189 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -240,8 +240,20 @@ declare namespace Office { */ var context: Context; /** - * This method is called after the Office API was loaded. - * @param reason Indicates how the app was initialized + * Occurs when the runtime environment is loaded and the add-in is ready to start interacting with the application and hosted document. + * + * The reason parameter of the initialize event listener function returns an `InitializationReason` enumeration value that specifies how initialization occurred. A task pane or content add-in can be initialized in two ways: + * + * - The user just inserted it from Recently Used Add-ins section of the Add-in drop-down list on the Insert tab of the ribbon in the Office host application, or from Insert add-in dialog box. + * + * - The user opened a document that already contains the add-in. + * + * *Note*: The reason parameter of the initialize event listener function only returns an `InitializationReason` enumeration value for task pane and content add-ins. It does not return a value for Outlook add-ins. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * @param reason Indicates how the app was initialized. */ function initialize(reason: InitializationReason): void; /** @@ -252,8 +264,12 @@ declare namespace Office { */ function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>; /** - * Indicates if the large namespace for objects will be used or not. - * @param useShortNamespace Indicates if 'true' that the short namespace will be used + * Toggles on and off the `Office` alias for the full `Microsoft.Office.WebExtension` namespace. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * @param useShortNamespace True to use the shortcut alias; otherwise false to disable it. The default is true. */ function useShortNamespace(useShortNamespace: boolean): void; // Enumerations @@ -523,7 +539,7 @@ declare namespace Office { */ name: string; } - export namespace AddinCommands { + namespace AddinCommands { /** * The event object is passed as a parameter to add-in functions invoked by UI-less command buttons. The object allows the add-in to identify which button was clicked and to signal the host that it has completed its processing. * @@ -539,8 +555,13 @@ declare namespace Office { * * Applicable Outlook mode: Compose or Read */ - export interface Event { + interface Event { + /** + * Information about the control that triggered calling this function + */ + source:Source; + /** * Indicates that the add-in has completed processing that was triggered by an add-in command button or event handler. * @@ -561,6 +582,17 @@ declare namespace Office { */ completed(options?: any): void; } + + /** + * Encapsulates source data for add-in events. + */ + interface Source { + + /** + * The id of the control that triggered calling this function. The id comes from the manifest and is the unique ID of your Office Add-in as a GUID. + */ + id: string; + } } /** * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins. @@ -576,7 +608,7 @@ declare namespace Office { * * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to other domains. * - * Any page calling office.context.ui.messageParent must also be on the same domain as the parent page. + * Any page calling `office.context.ui.messageParent` must also be on the same domain as the parent page. * * The following design considerations apply to dialog boxes: * @@ -624,6 +656,7 @@ declare namespace Office { */ closeContainer(): void; } + /** * Provides information about what Requirement Sets are supported in current environment. */ @@ -634,7 +667,8 @@ declare namespace Office { * @param minVersion - The minimum required version; e.g., "1.4". */ isSetSupported(name: string, minVersion?: number): boolean; -} + } + /** * Provides options for how a dialog is displayed. */ @@ -731,7 +765,7 @@ declare namespace Office { */ interface GetBindingDataOptions { /** - * The expected shape of the selection. Use Office.CoercionType or text value. Default: The original, uncoerced type of the binding. + * The expected shape of the selection. Use {@link Office.CoercionType} or text value. Default: The original, uncoerced type of the binding. */ coercionType?: Office.CoercionType | string /** @@ -775,8 +809,9 @@ declare namespace Office { */ interface SetBindingDataOptions { /** - * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. Example: [{cells: Office.Table.Data, format: {fontColor: "yellow"}}, - {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}] + * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. + * + * Example: `[{cells: Office.Table.Data, format: {fontColor: "yellow"}}, {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}]` */ cellFormat?: Array /** @@ -800,7 +835,7 @@ declare namespace Office { */ startColumn?: number /** - * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. Example: {bandedRows: true, filterButton: false} + * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. Example: `{bandedRows: true, filterButton: false}` */ tableOptions?: object /** @@ -920,7 +955,7 @@ declare namespace Office { */ valueFormat?: Office.ValueFormat | string /** - * Specify whether to get only the visible (that is, filtered-in) data or all the data. Useful when filtering data. Use Office.FilterType or string equivalent. This parameter is ignored in Word documents. + * Specify whether to get only the visible (that is, filtered-in) data or all the data. Useful when filtering data. Use {@link Office.FilterType} or string equivalent. This parameter is ignored in Word documents. */ filterType?: Office.FilterType | string /** @@ -932,7 +967,7 @@ declare namespace Office { * Provides options for whether to select the location that is navigated to. * * @remarks - * The behavior caused by the options.selectionMode option varies by host: + * The behavior caused by the {@link Office.SelectionMode | options.selectionMode} option varies by host: * * In Excel: Office.SelectionMode.Selected selects all content in the binding, or named item. Office.SelectionMode.None for text bindings, selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). * @@ -942,7 +977,7 @@ declare namespace Office { */ interface GoToByIdOptions { /** - * Specifies whether the location specified by the id parameter is selected (highlighted). Use Office.SelectionMode or string equivalent. See the Remarks for more information. + * Specifies whether the location specified by the id parameter is selected (highlighted). Use {@link Office.SelectionMode} or string equivalent. See the Remarks for more information. */ selectionMode?: Office.SelectionMode | string /** @@ -955,8 +990,9 @@ declare namespace Office { */ interface SetSelectedDataOptions { /** - * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. Example: [{cells: Office.Table.Data, format: {fontColor: "yellow"}}, - {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}] + * Use only with binding type table and when a TableData object is passed for the data parameter. An array of objects that specify a range of columns, rows, or cells and specify, as key-value pairs, the cell formatting to apply to that range. + * + * Example: `[{cells: Office.Table.Data, format: {fontColor: "yellow"}}, {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}]` */ cellFormat?: Array /** @@ -964,7 +1000,7 @@ declare namespace Office { */ coercionType?: Office.CoercionType | string /** - * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. Example: {bandedRows: true, filterButton: false} + * For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. Example: `{bandedRows: true, filterButton: false}` */ tableOptions?: object /** @@ -1028,11 +1064,11 @@ declare namespace Office { controlForegroundColor: string; } /** - * Dialog object returned as part of the displayDialogAsync callback. The object exposes methods for registering event handlers and closing the dialog + * The object that is returned when `UI.displayDialogAsync` is called. It exposes methods for registering event handlers and closing the dialog. */ - interface DialogHandler { + interface Dialog { /** - * When called from an active add-in dialog, asynchronously closes the dialog. + * Called from a parent page to close the corresponding dialog box. */ close(): void; /** @@ -1092,7 +1128,7 @@ declare namespace Office { * Specifies how to coerce data returned or set by the invoked method. * * @remarks - * PowerPoint supports only Office.CoercionType.Text, Office.CoercionType.Image, and Office.CoercionType.SlideRange. Project supports only Office.CoercionType.Text. + * PowerPoint supports only `Office.CoercionType.Text`, `Office.CoercionType.Image`, and `Office.CoercionType.SlideRange`. Project supports only `Office.CoercionType.Text`. * * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ @@ -1126,7 +1162,7 @@ declare namespace Office { */ Ooxml, /** - * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides.For example, {"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]} for a selection of two slides. + * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides.For example, `{"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]}` for a selection of two slides. * @remarks * Only applies to data in PowerPoint when calling the Document.getSelectedData method to get the current slide or selected range of slides. */ @@ -1194,10 +1230,10 @@ declare namespace Office { Text, } /** - * Specifies the kind of event that was raised. Returned by the type property of an EventNameEventArgs object. + * Specifies the kind of event that was raised. Returned by the `type` property of an *EventName*EventArgs object. * * @remarks - * Add-ins for Project support the Office.EventType.ResourceSelectionChanged, Office.EventType.TaskSelectionChanged, and Office.EventType.ViewSelectionChanged event types. + * Add-ins for Project support the `Office.EventType.ResourceSelectionChanged`, `Office.EventType.TaskSelectionChanged`, and `Office.EventType.ViewSelectionChanged` event types. * * Hosts: Access, Excel, PowerPoint, Project, Word */ @@ -1385,6 +1421,8 @@ declare namespace Office { * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. */ interface Binding { + + /** * Get the Document object associated with the binding. * @@ -1479,9 +1517,9 @@ declare namespace Office { */ interface Bindings { /** - * Gets a Document object that represents the document associated with this set of bindings. + * Gets an {@link Office.Document} object that represents the document associated with this set of bindings. * - *remarks + * @remarks * Hosts: Access, Excel, Word */ document: Document; @@ -1499,14 +1537,14 @@ declare namespace Office { * * Note: In Excel, when specifying a table as a named item, you must fully qualify the name to include the worksheet name in the name of the table in this format: "Sheet1!Table1" * - * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other than the Rich Text content control.) + * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other than the Rich Text content control). * * By default, a content control has no Title value assigned. To assign a meaningful name in the Word UI, after inserting a Rich Text content control from the Controls group on the Developer tab of the ribbon, use the Properties command in the Controls group to display the Content Control Properties dialog box. Then set the Title property of the content control to the name you want to reference from your code. * * Note: In Word, if there are multiple Rich Text content controls with the same Title property value (name), and you try to bind to one these content controls with this method (by specifying its name as the itemName parameter), the operation will fail. * * @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel." - * @param bindingType The Office BindingType for the data. The method returns null if the selected object cannot be coerced into the specified type. + * @param bindingType The {@link Office.BindingType} for the data. The method returns null if the selected object cannot be coerced into the specified type. * @param options Provides options for configuring the binding that is created. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1712,7 +1750,7 @@ declare namespace Office { setXmlAsync(xml: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** - * Represents a single CustomXMLPart in a CustomXMLParts collection. + * Represents a single CustomXMLPart in an {@link Office.CustomXmlParts} collection. * * @remarks * Hosts: Word @@ -1739,7 +1777,7 @@ declare namespace Office { */ id: string; /** - * Gets the set of namespace prefix mappings (CustomXMLPrefixMappings) used against the current CustomXMLPart. + * Gets the set of namespace prefix mappings ({@link Office.CustomXmlPrefixMappings}) used against the current CustomXMLPart. * * @remarks * Hosts: Word @@ -1755,9 +1793,9 @@ declare namespace Office { * * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * - * @param eventType Specifies the type of event to add. Required. For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param eventType Specifies the type of event to add. Required. For a CustomXmlPart object event, the eventType parameter can be specified as `Office.EventType.DataNodeDeleted`, `Office.EventType.DataNodeInserted`, `Office.EventType.DataNodeReplaced`, or the corresponding text values of these enumerations. * @param handler The event handler function to add, whose only parameter is of type NodeDeletedEventArgs, NodeInsertedEventArgs, or NodeReplaceEventArgs. Required. - * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.. + * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addHandlerAsync(eventType: EventType, handler: (result: any) => void, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -1806,7 +1844,7 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * @param eventType Specifies the type of event to remove. Required.For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param eventType Specifies the type of event to remove. Required.For a CustomXmlPart object event, the eventType parameter can be specified as `Office.EventType.DataNodeDeleted`, `Office.EventType.DataNodeInserted`, `Office.EventType.DataNodeReplaced`, or the corresponding text values of these enumerations. * @param options Provides options to determine which event handler or handlers are removed. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1843,7 +1881,7 @@ declare namespace Office { * Available in Requirement set: CustomXmlParts * * @param id The GUID of the custom XML part, including opening and closing braces. - * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.. + * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getByIdAsync(id: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -1928,7 +1966,7 @@ declare namespace Office { * @remarks * Hosts: Access, Excel, Word * - * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use Office.context.document in your script. + * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use `Office.context.document` in your script. */ bindings: Bindings; /** @@ -1969,8 +2007,8 @@ declare namespace Office { * * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * - * @param eventType For a Document object event, the eventType parameter can be specified as Office.EventType.Document.SelectionChanged or Office.EventType.Document.ActiveViewChanged, or the corresponding text value of this enumeration. - * @param handler The event handler function to add, whose only parameter is of type DocumentSelectionChangedEventArgs. Required. + * @param eventType For a Document object event, the eventType parameter can be specified as `Office.EventType.Document.SelectionChanged` or `Office.EventType.Document.ActiveViewChanged`, or the corresponding text value of this enumeration. + * @param handler The event handler function to add, whose only parameter is of type {@link Office.DocumentSelectionChangedEventArgs}. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1985,7 +2023,7 @@ declare namespace Office { * * Can trigger an event when the view changes. * - * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.. + * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getActiveViewAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -1999,15 +2037,15 @@ declare namespace Office { * * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to 65536 (64 KB). * - * The fileType parameter can be specified by using the FileType enumeration or text values. But the possible values vary with the host: + * The fileType parameter can be specified by using the {@link Office.FileType} enumeration or text values. But the possible values vary with the host: * - * Excel Online, Win32, Mac, and iOS: Office.FileType.Compressed + * Excel Online, Win32, Mac, and iOS: `Office.FileType.Compressed` * - * PowerPoint on Windows desktop, Mac, and iPad, and PowerPoint Online: Office.FileType.Compressed, Office.FileType.Pdf + * PowerPoint on Windows desktop, Mac, and iPad, and PowerPoint Online: `Office.FileType.Compressed`, `Office.FileType.Pdf` * - * Word on Windows desktop, Word on Mac, and Word Online: Office.FileType.Compressed, Office.FileType.Pdf, Office.FileType.Text + * Word on Windows desktop, Word on Mac, and Word Online: `Office.FileType.Compressed`, `Office.FileType.Pdf`, `Office.FileType.Text` * - * Word on iPad: Office.FileType.Compressed, Office.FileType.Text + * Word on iPad: `Office.FileType.Compressed`, `Office.FileType.Text` * * @param fileType The format in which the file will be returned * @param options Provides options for setting the size of slices that the document will be divided into. @@ -2022,7 +2060,7 @@ declare namespace Office { * * Available in Requirement set: not in a set * - * You get the file's URL with the url property ( asyncResult.value.url). + * You get the file's URL with the url property (`asyncResult.value.url`). * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2038,17 +2076,17 @@ declare namespace Office { * * The possible values for the coercionType parameter vary by the host: * - * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online only: Office.CoercionType.Text (string) + * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online only: `Office.CoercionType.Text` (string) * - * Excel, Word, and Word Online only: Office.CoercionType.Matrix (array of arrays) + * Excel, Word, and Word Online only: `Office.CoercionType.Matrix` (array of arrays) * - * Access, Excel, Word, and Word Online only: Office.CoercionType.Table (TableData object) + * Access, Excel, Word, and Word Online only: `Office.CoercionType.Table` (TableData object) * - * Word only: Office.CoercionType.Html + * Word only: `Office.CoercionType.Html` * - * Word and Word Online only: Office.CoercionType.Ooxml (Office Open XML) + * Word and Word Online only: `Office.CoercionType.Ooxml` (Office Open XML) * - * PowerPoint and PowerPoint Online only: Office.CoercionType.SlideRange + * PowerPoint and PowerPoint Online only: `Office.CoercionType.SlideRange` * * @param coercionType The type of data structure to return. * @param options Provides options for customizing what data is returned and how it is formatted. @@ -2088,7 +2126,7 @@ declare namespace Office { * Available in Requirement set: DocumentEvents * * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. - * @param options Provides options to determine which event handler or handlers are removed. * + * @param options Provides options to determine which event handler or handlers are removed. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ removeHandlerAsync(eventType: EventType, options?: RemoveHandlerOptions, callback?: (result: AsyncResult) => void): void; @@ -2114,7 +2152,7 @@ declare namespace Office { * * Office.CoercionType.Image: Excel, Word, PowerPoint * - * @param data The data to be set. Either a string or CoercionType value, 2d array or TableData object. + * @param data The data to be set. Either a string or {@link Office.CoercionType} value, 2d array or TableData object. * @param options Provides options for how to insert data to the selection. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -2179,11 +2217,11 @@ declare namespace Office { */ interface DocumentSelectionChangedEventArgs { /** - * Gets a Document object that represents the document that raised the SelectionChanged event. + * Gets an {@link Office.Document} object that represents the document that raised the SelectionChanged event. */ document: Document; /** - * Get an EventType enumeration value that identifies the kind of event that was raised. + * Get an {@link Office.EventType} enumeration value that identifies the kind of event that was raised. */ type: EventType; } @@ -2262,15 +2300,15 @@ declare namespace Office { url: string } /** - * Represents a binding in two dimensions of rows and columns. - * - * @remarks - * Hosts: Excel, Word - * - * Available in Requirement set: MatrixBindings - * - * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. - */ + * Represents a binding in two dimensions of rows and columns. + * + * @remarks + * Hosts: Excel, Word + * + * Available in Requirement set: MatrixBindings + * + * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + */ interface MatrixBinding extends Binding { /** * Gets the number of columns in the matrix data structure, as an integer value. @@ -2453,7 +2491,7 @@ declare namespace Office { */ interface Slice { /** - * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * Gets the raw data of the file slice in `Office.FileType.Text` ("text") or `Office.FileType.Compressed` ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. * * @remarks * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. @@ -2652,7 +2690,7 @@ declare namespace Office { setTableOptionsAsync(tableOptions: any, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** - * Represents the data in a table or a TableBinding. + * Represents the data in a table or a {@link Office.TableBinding}. * * @remarks * Hosts: Excel, Word @@ -2664,6 +2702,7 @@ declare namespace Office { constructor(); /** * Gets or sets the headers of the table. + * * @remarks * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers for a two-column table you would set the header property to [['header1', 'header2']]. * @@ -2680,6 +2719,7 @@ declare namespace Office { headers: any[]; /** * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are no rows. + * * @remarks * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. * @@ -2723,7 +2763,7 @@ declare namespace Office { * * Available in Requirement set: TextBindings * - * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. It does not implement any additional properties or methods of its own. + * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the {@link Office.Binding} object. It does not implement any additional properties or methods of its own. */ interface TextBinding extends Binding { } /** @@ -4836,15 +4876,15 @@ declare namespace Office { /** * The attachment is a file */ - File, + File = "file", /** * The attachment is an Exchange item */ - Item, + Item = "item", /** * The attachment is stored in a cloud location, such as OneDrive. The id property of the attachment contains a URL to the file. */ - Cloud + Cloud = "cloud" } /** * Specifies the day of week or type of day. @@ -4908,31 +4948,31 @@ declare namespace Office { /** * Specifies that the entity is a meeting suggestion. */ - MeetingSuggestion, + MeetingSuggestion = "meetingSuggestion", /** * Specifies that the entity is a task suggestion. */ - TaskSuggestion, + TaskSuggestion = "taskSuggestion", /** * Specifies that the entity is a postal address. */ - Address, + Address = "address", /** * Specifies that the entity is an SMTP email address. */ - EmailAddress, + EmailAddress = "emailAddress", /** * Specifies that the entity is an Internet URL. */ - Url, + Url = "url", /** * Specifies that the entity is a US phone number. */ - PhoneNumber, + PhoneNumber = "phoneNumber", /** * Specifies that the entity is a contact. */ - Contact + Contact = "contact" } /** * Specifies the notification message type for an appointment or message. @@ -4946,15 +4986,15 @@ declare namespace Office { /** * The notificationMessage is a progress indicator. */ - ProgressIndicator, + ProgressIndicator = "progressIndicator", /** * The notificationMessage is an informational message. */ - InformationalMessage, + InformationalMessage = "informationalMessage", /** * The notificationMessage is an error message. */ - ErrorMessage + ErrorMessage = "errorMessage" } /** * Specifies an item's type. @@ -4968,11 +5008,11 @@ declare namespace Office { /** * An email, meeting request, meeting response, or meeting cancellation. */ - Message, + Message = "message", /** * An appointment item. */ - Appointment + Appointment = "appointment" } /** * Specifies the month. @@ -5044,19 +5084,19 @@ declare namespace Office { /** * Specifies that the recipient is a distribution list containing a list of email addresses. */ - DistributionList, + DistributionList = "distributionList", /** * Specifies that the recipient is an SMTP email address that is on the Exchange server. */ - User, + User = "user", /** * Specifies that the recipient is an SMTP email address that is not on the Exchange server. */ - ExternalUser, + ExternalUser = "externalUser", /** * Specifies that the recipient is not one of the other recipient types. */ - Other + Other = "other" } /** * Specifies the time zone applied to the recurrence. @@ -5656,23 +5696,23 @@ declare namespace Office { /** * There has been no response from the attendee. */ - None, + None = "none", /** * The attendee is the meeting organizer. */ - Organizer, + Organizer = "organizer", /** * The meeting request was tentatively accepted by the attendee. */ - Tentative, + Tentative = "tentative", /** * The meeting request was accepted by the attendee. */ - Accepted, + Accepted = "accepted", /** * The meeting request was declined by the attendee. */ - Declined + Declined = "declined" } /** * Specifies the version of the REST API that corresponds to a REST-formatted item ID. @@ -5686,15 +5726,15 @@ declare namespace Office { /** * Version 1.0. */ - v1_0, + v1_0 = "v1.0", /** * Version 2.0. */ - v2_0, + v2_0 = "v2.0", /** * Beta. */ - Beta + Beta = "beta" } /** * Specifies the week of the month. @@ -5727,9 +5767,6 @@ declare namespace Office { Last = "last" } } - interface AsyncContextOptions { - asyncContext?: any; - } interface CoercionTypeOptions { coercionType?: CoercionType; } @@ -5857,12 +5894,17 @@ declare namespace Office { * * @remarks * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * * Applicable Outlook mode: Compose + * * Errors: DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters. * * In addition to the main signature, this method also has these signatures: + * * prependAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + * * prependAsync(data: string, callback: (result: AsyncResult) => void): void; + * * prependAsync(data: string): void; * * @param data The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. @@ -5883,7 +5925,9 @@ declare namespace Office { * * @remarks * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * * Applicable Outlook mode: Compose + * * Errors: DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters. * * @param data The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. @@ -5946,9 +5990,12 @@ declare namespace Office { * InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text. * * In addition to the main signature, this method also has these signatures: + * * setAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + * * setAsync(data: string, callback: (result: AsyncResult) => void): void; - * setAsync(data: string): void; * + * + * setAsync(data: string): void; * * @param data The string that will replace the existing body. The string is limited to 1,000,000 characters. * @param options Optional. An object literal that contains one or more of the following properties. @@ -6044,10 +6091,13 @@ declare namespace Office { * InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text. * * In addition to the main signature, this method also has these signatures: + * * setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + * * setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; - * setSelectedDataAsync(data: string): void; * - * * + * + * setSelectedDataAsync(data: string): void; + * * @param data The string that will replace the existing body. The string is limited to 1,000,000 characters. * @param options Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. @@ -6126,7 +6176,7 @@ declare namespace Office { /** * Represents a contact stored on the server. Read mode only. * - * The list of contacts associated with an email message or appointment is returned in the contacts property of the Entities object that is returned by the getEntities or getEntitiesByType method of the active item. + * The list of contacts associated with an email message or appointment is returned in the contacts property of the {@link Office.Entities} object that is returned by the getEntities or getEntitiesByType method of the active item. * * [Api set: Mailbox 1.0] * @@ -6416,7 +6466,7 @@ declare namespace Office { * * The getAsync method starts an asynchronous call to the Exchange server to get the from value of a message. * - * The from value of the item is provided as an EmailAddressDetails in the asyncResult.value property. + * The from value of the item is provided as an {@link Office.EmailAddressDetails} in the asyncResult.value property. * * [Api set: Mailbox Preview] * @@ -6426,6 +6476,7 @@ declare namespace Office { * Applicable Outlook mode: Compose * * In addition to this signature, the method also has the following signatures: + * * getAsync(callback?: (result: AsyncResult) => void): void; * * @param options An object literal that contains one or more of the following properties. @@ -6454,22 +6505,22 @@ declare namespace Office { } /** + * The subclass of {@link Office.Item} dealing with apppointments. + * * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. */ interface Appointment extends Item { } /** - * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. + * The appointment organizer mode of {@link Office.Item | Office.context.mailbox.item}. + * + * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of **Office.context.mailbox.item**. Refer to the Object Model pages for more information. */ interface AppointmentCompose extends Appointment, ItemCompose { /** * Gets or sets the date and time that the appointment is to end. * - * The end property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. - * - * *Compose mode* - * - * The end property returns a Time object. + * The end property is an {@link Office.Time} object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. * * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. * @@ -6479,15 +6530,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Organizer */ end: Time; /** - * Gets or sets the location of an appointment. - * - * *Compose mode* - * - * The location property returns a Location object that provides methods that are used to get and set the location of the appointment. + * Gets or sets the {@link Office.Location} of an appointment. The location property returns a Location object that provides methods that are used to get and set the location of the appointment. * * [Api set: Mailbox 1.0] * @@ -6495,15 +6542,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Organizer */ location: Location; /** - * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. - * - * *Compose mode* - * - * The optionalAttendees property returns a Recipients object that provides methods to get or update the optional attendees for a meeting. + * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. The optionalAttendees property returns an {@link Office.Recipients} object that provides methods to get or update the optional attendees for a meeting. * * [Api set: Mailbox 1.0] * @@ -6511,15 +6554,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Organizer */ optionalAttendees: Recipients; /** - * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. - * - * *Compose mode* - * - * The requiredAttendees property returns a Recipients object that provides methods to get or update the required attendees for a meeting. + * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. The requiredAttendees property returns an {@link Office.Recipients} object that provides methods to get or update the required attendees for a meeting. * * [Api set: Mailbox 1.0] * @@ -6527,17 +6566,13 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Organizer */ requiredAttendees: Recipients; /** * Gets or sets the date and time that the appointment is to begin. * - * The start property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. - * - * *Compose mode* - * - * The start property returns a Time object. + * The start property is an {@link Office.Time} object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. * * When you use the Time.setAsync method to set the start time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. * @@ -6547,20 +6582,863 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Organizer */ start: Time; + + // Repeated Item fields // + + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + body: Body; + /** + * Gets the date and time that an item was created. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + dateTimeCreated: Date; + /** + * Gets the date and time that an item was last modified. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * Note: This member is not supported in Outlook for iOS or Outlook for Android. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + dateTimeModifed: Date; + /** + * Gets the type of item that an instance represents. + * + * The itemType property returns one of the ItemType enumeration values, indicating whether the item object instance is a message or an appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + itemType: Office.MailboxEnums.ItemType; + /** + * Gets the notification messages for an item. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + notificationMessages: NotificationMessages; + + /** + * Gets or sets the recurrence pattern of an appointment. + * + * The recurrence property returns a recurrence object for recurring appointments or meetings requests if an item is a series or an instance in a series. null is returned for single appointments and meeting requests of single appointments. + * + * Note: Meeting requests have an itemClass value of IPM.Schedule.Meeting.Request. + * + * Note: If the recurrence object is null, this indicates that the object is a single appointment or a meeting request of a single appointment and NOT a part of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + recurrence: Recurrence; + + /** + * Gets the id of the series that an instance belongs to. + * + * In OWA and Outlook, the seriesId returns the Exchange Web Services (EWS) ID of the parent (series) item that this item belongs to. However, in iOS and Android, the seriesId returns the REST ID of the parent item. + * + * Note: The identifier returned by the seriesId property is the same as the Exchange Web Services item identifier. The seriesId property is not identical to the Outlook IDs used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api | Use the Outlook REST APIs from an Outlook add-in}. + * + * The seriesId property returns null for items that do not have parent items such as single appointments, series items, or meeting requests and returns undefined for any other items that are not meeting requests. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + seriesId: string; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * In addition to this signature, the method also has the following signatures: + * + * addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * Applicable Outlook mode: Appointment Organizer + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + * + * In addition to this signature, the method also has the following signatures: + * + * removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Gets or sets the description that appears in the subject field of an item. + * + * The subject property gets or sets the entire subject of the item, as sent by the email server. + * + * The subject property returns a Subject object that provides methods to get and set the subject. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + */ + subject: Subject; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * In addition to this signature, the method also has the following signatures: + * + * addFileAttachmentAsync(uri: string, attachmentName: string): void; + * + * addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void; + * + * addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + */ + addFileAttachmentAsync(uri: string, attachmentName: string): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * In addition to the main signature, this method also has these signatures: + * + * addItemAttachmentAsync(itemId: any, attachmentName: string): void; + * + * addItemAttachmentAsync(itemId: any, attachmentName: string, options: AsyncContextOptions): void; + * + * addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string): void; + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string, options: AsyncContextOptions): void; + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; + + /** + * Closes the current item that is being composed + * + * The behaviors of the close method depends on the current state of the item being composed. If the item has unsaved changes, the client prompts the user to save, discard, or close the action. + * + * In the Outlook desktop client, if the message is an inline reply, the close method has no effect. + * + * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, discard, or cancel even if no changes have occurred since the item was last saved. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: Restricted + * + * Applicable Outlook mode: Appointment Organizer + */ + close(): void; + /** + * Gets initialization data passed when the add-in is activated by an actionable message. + * + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Organizer + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + */ + getInitializationContextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Asynchronously returns selected data from the subject or body of a message. + * + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * + * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * + * [Api set: Mailbox 1.0] + * + * @returns + * The selected data as a string with format determined by coercionType. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + */ + getSelectedDataAsync(coercionType: CoercionType, options: AsyncContextOptions, callback: (result: AsyncResult) => void): void; + /** + * Asynchronously returns selected data from the subject or body of a message. + * + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * + * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * + * [Api set: Mailbox 1.0] + * + * @returns + * The selected data as a string with format determined by coercionType. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + */ + getSelectedDataAsync(coercionType: CoercionType, callback: (result: AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * In addition to this signature, the method also has the following signatures: + * + * removeAttachmentAsync(attachmentIndex: string): void; + * + * removeAttachmentAsync(attachmentIndex: string, options: AsyncContextOptions): void; + * + * removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentIndex: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + */ + removeAttachmentAsync(attachmentIndex: string): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + */ + removeAttachmentAsync(attachmentIndex: string, options: AsyncContextOptions): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; + + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * In addition to this signature, the method also has the following signatures: + * + * saveAsync(): void; + * + * saveAsync(options: AsyncContextOptions): void; + * + * saveAsync(callback: (result: AsyncResult) => void): void; + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + saveAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + */ + saveAsync(): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + */ + saveAsync(options: AsyncContextOptions): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + saveAsync(callback: (result: AsyncResult) => void): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * In addition to this signature, the method also has the following signatures: + * + * setSelectedDataAsync(data: string): void; + * + * setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + * + * setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + setSelectedDataAsync(data: string, options?: AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + */ + setSelectedDataAsync(data: string): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + */ + setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Appointment Organizer + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } /** - * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. + * The appointment attendee mode of {@link Office.Item | Office.context.mailbox.item}. + * + * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of **Office.context.mailbox.item**. Refer to the Object Model pages for more information. */ interface AppointmentRead extends Appointment, ItemRead { /** * Gets the date and time that the appointment is to end. * - * The end property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. - * - * The end property returns a Date object. + * The end property is a Date object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the end property value to the client's local date and time. * * When you use the Time.setAsync method to set the end time, you should use the convertToUtcClientTime method to convert the local time on the client to UTC for the server. * @@ -6570,7 +7448,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Attendee */ end: Date; /** @@ -6584,13 +7462,13 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Attendee */ location: string; /** * Provides access to the optional attendees of an event. The type of object and level of access depends on the mode of the current item. * - * The optionalAttendees property returns an array that contains an EmailAddressDetails object for each optional attendee to the meeting. + * The optionalAttendees property returns an array that contains an {@link Office.EmailAddressDetails} object for each optional attendee to the meeting. * * [Api set: Mailbox 1.0] * @@ -6598,7 +7476,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Attendee */ optionalAttendees: EmailAddressDetails[]; /** @@ -6610,13 +7488,13 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Read + * Applicable Outlook mode: Appointment Attendee */ organizer: EmailAddressDetails; /** * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. * - * The requiredAttendees property returns an array that contains an EmailAddressDetails object for each required attendee to the meeting. + * The requiredAttendees property returns an array that contains an {@link Office.EmailAddressDetails} object for each required attendee to the meeting. * * [Api set: Mailbox 1.0] * @@ -6624,15 +7502,13 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Attendee */ requiredAttendees: EmailAddressDetails[]; /** * Gets the date and time that the appointment is to begin. * - * The start property is expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. - * - * The start property returns a Date object. + * The start property is a Date object expressed as a Coordinated Universal Time (UTC) date and time value. You can use the convertToLocalClientTime method to convert the value to the client's local date and time. * * [Api set: Mailbox 1.0] * @@ -6640,9 +7516,536 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Appointment Attendee */ start: Date; + + // Repeated Item Fields // + + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + body: Body; + /** + * Gets the date and time that an item was created. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + dateTimeCreated: Date; + /** + * Gets the date and time that an item was last modified. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * Note: This member is not supported in Outlook for iOS or Outlook for Android. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + dateTimeModifed: Date; + /** + * Gets the type of item that an instance represents. + * + * The itemType property returns one of the ItemType enumeration values, indicating whether the item object instance is a message or an appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + itemType: Office.MailboxEnums.ItemType; + /** + * Gets the notification messages for an item. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + notificationMessages: NotificationMessages; + + /** + * Gets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. + * + * The recurrence property returns a recurrence object for recurring appointments or meetings requests if an item is a series or an instance in a series. null is returned for single appointments and meeting requests of single appointments. + * + * Note: Meeting requests have an itemClass value of IPM.Schedule.Meeting.Request. + * + * Note: If the recurrence object is null, this indicates that the object is a single appointment or a meeting request of a single appointment and NOT a part of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + recurrence: Recurrence; + + /** + * Gets the id of the series that an instance belongs to. + * + * In OWA and Outlook, the seriesId returns the Exchange Web Services (EWS) ID of the parent (series) item that this item belongs to. However, in iOS and Android, the seriesId returns the REST ID of the parent item. + * + * Note: The identifier returned by the seriesId property is the same as the Exchange Web Services item identifier. The seriesId property is not identical to the Outlook IDs used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api | Use the Outlook REST APIs from an Outlook add-in}. + * + * The seriesId property returns null for items that do not have parent items such as single appointments, series items, or meeting requests and returns undefined for any other items that are not meeting requests. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + seriesId: string; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * In addition to this signature, the method also has the following signatures: + * + * addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * In addition to this signature, the method also has the following signatures: + * + * removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Gets an array of attachments for the item. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + */ + attachments: AttachmentDetails[]; + /** + * Gets the Exchange Web Services item class of the selected item. + * + + * + * You can create custom message classes that extends a default message class, for example, a custom appointment message class IPM.Appointment.Contoso. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. + * + * |Type|Description|item class| + * |-----------|------------|------------| + * |Appointment items|These are calendar items of the item class IPM.Appointment or IPM.Appointment.Occurence.|IPM.Appointment,IPM.Appointment.Occurence| + * |Message items|These include email messages that have the default message class IPM.Note, and meeting requests, responses, and cancellations, that use IPM.Schedule.Meeting as the base message class.|IPM.Note,IPM.Schedule.Meeting.Request,IPM.Schedule.Meeting.Neg,IPM.Schedule.Meeting.Pos,IPM.Schedule.Meeting.Tent,IPM.Schedule.Meeting.Canceled| + */ + itemClass: string; + /** + * Gets the Exchange Web Services item identifier for the current item. + * + * The itemId property is not available in compose mode. If an item identifier is required, the saveAsync method can be used to save the item to the store, which will return the item identifier in the AsyncResult.value parameter in the callback function. + * + * Note: The identifier returned by the itemId property is the same as the Exchange Web Services item identifier. The itemId property is not identical to the Outlook Entry ID or the ID used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see Use the Outlook REST APIs from an Outlook add-in. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + itemId: string; + /** + * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). + * + * The normalizedSubject property gets the subject of the item, with any standard prefixes (such as RE: and FW:) that are added by email programs. To get the subject of the item with the prefixes intact, use the subject property. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + normalizedSubject: string; + /** + * Gets the description that appears in the subject field of an item. + * + * The subject property gets or sets the entire subject of the item, as sent by the email server. + * + * The subject property returns a string. Use the normalizedSubject property to get the subject minus any leading prefixes such as RE: and FW:. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + subject: string; + /** + * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the selected appointment. + * + * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. + * + * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. + * + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param formData A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB + * OR + * An {@link Office.ReplyFormData} object that contains body or attachment data and a callback function + */ + displayReplyAllForm(formData: string | ReplyFormData): void; + /** + * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. + * + * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. + * + * If any of the string parameters exceed their limits, displayReplyForm throws an exception. + * + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param formData A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB. + * OR + * An {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. + */ + displayReplyForm(formData: string | ReplyFormData): void; + /** + * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. + * + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * In addition to this signature, the method also has the following signatures: + * + * getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + */ + getInitializationContextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. + * + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + */ + getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + /** + * Gets the entities found in the selected item. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + getEntities(): Entities; + /** + * Gets an array of all the entities of the specified entity type found in the selected item. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @param entityType One of the EntityType enumeration values. + * + * @returns + * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present on the item, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: Restricted + * + * Applicable Outlook mode: Appointment Attendee + * + * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the following table. + * + * |Value of entityType|Type of objects in returned array|Required Permission Level| + * |-------|-----------|----------| + * |Address|String|Restricted| + * |Contact|Contact|ReadItem| + * |EmailAddress|String|ReadItem| + * |MeetingSuggestion|MeetingSuggestion|ReadItem| + * |PhoneNumber|PhoneNumber|Restricted| + * |TaskSuggestion|TaskSuggestion|ReadItem| + * |URL|String|Restricted| + */ + getEntitiesByType(entityType: Office.MailboxEnums.EntityType): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; + /** + * Returns well-known entities in the selected item that pass the named filter defined in the manifest XML file. + * + * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element in the manifest XML file with the specified FilterName element value. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param name The name of the ItemHasKnownEntity rule element that defines the filter to match. + * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, the method returns null. If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, the method return an empty array. + */ + getFilteredEntitiesByName(name: string): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; + /** + * Returns string values in the selected item that match the regular expressions defined in the manifest XML file. + * + * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @returns + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + getRegExMatches(): any; + /** + * Returns string values in the selected item that match the named regular expression defined in the manifest XML file. + * + * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule element in the manifest XML file with the specified RegExName element value. + * + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @returns + * An array that contains the strings that match the regular expression defined in the manifest XML file. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param name The name of the ItemHasRegularExpressionMatch rule element that defines the filter to match. + */ + getRegExMatchesByName(name: string): string[]; + /** + * Gets the entities found in a highlighted match a user has selected. Highlighted matches apply to contextual add-ins. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.6] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + * + * @param name The name of the ItemHasRegularExpressionMatch rule element that defines the filter to match. + */ + getSelectedEntities(): Entities; + /** + * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. Highlighted matches apply to contextual add-ins. + * + * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.6] + * + * @returns + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Appointment Attendee + */ + getSelectedRegExMatches(): any; } interface AppointmentForm { @@ -6791,7 +8194,7 @@ declare namespace Office { } /** - * The item namespace is used to access the currently selected message, meeting request, or appointment. You can determine the type of the item by using the itemType property. + * The item namespace is used to access the currently selected message, meeting request, or appointment. You can determine the type of the item by using the `itemType` property. * * [Api set: Mailbox 1.0] * @@ -6918,6 +8321,7 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to this signature, the method also has the following signatures: + * * addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; * * @param eventType The event that should invoke the handler. @@ -6981,6 +8385,7 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to this signature, the method also has the following signatures: + * * removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; * * @param eventType The event that should invoke the handler. @@ -7011,7 +8416,9 @@ declare namespace Office { removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; } /** - * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. + * The compose mode of {@link Office.Item | Office.context.mailbox.item}. + * + * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of **Office.context.mailbox.item**. Refer to the Object Model pages for more information. */ interface ItemCompose extends Item { /** @@ -7053,8 +8460,11 @@ declare namespace Office { * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. * * In addition to this signature, the method also has the following signatures: + * * addFileAttachmentAsync(uri: string, attachmentName: string): void; + * * addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void; + * * addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; * * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. @@ -7169,8 +8579,11 @@ declare namespace Office { * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. * * In addition to the main signature, this method also has these signatures: + * * addItemAttachmentAsync(itemId: any, attachmentName: string): void; + * * addItemAttachmentAsync(itemId: any, attachmentName: string, options: AsyncContextOptions): void; + * * addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; * * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. @@ -7294,34 +8707,7 @@ declare namespace Office { * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. */ getInitializationContextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; - /** - * Asynchronously returns selected data from the subject or body of a message. - * - * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. - * - * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. - * - * [Api set: Mailbox 1.0] - * - * @returns - * The selected data as a string with format determined by coercionType. - * - * @remarks - * - * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem - * - * Applicable Outlook mode: Compose - * - * In addition to this signature, the method also has these signatures: - * getSelectedDataAsync(coercionType: CoercionType, callback: (result: AsyncResult) => void): void; - * - * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @param options An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. - */ - getSelectedDataAsync(coercionType: CoercionType, options: AsyncContextOptions, callback: (result: AsyncResult) => void): void; - /** + /** * Asynchronously returns selected data from the subject or body of a message. * * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. @@ -7343,6 +8729,30 @@ declare namespace Office { * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. */ getSelectedDataAsync(coercionType: CoercionType, callback: (result: AsyncResult) => void): void; + /** + * Asynchronously returns selected data from the subject or body of a message. + * + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * + * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * + * [Api set: Mailbox 1.0] + * + * @returns + * The selected data as a string with format determined by coercionType. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Compose + * + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + */ + getSelectedDataAsync(coercionType: CoercionType, options: AsyncContextOptions, callback: (result: AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -7359,8 +8769,11 @@ declare namespace Office { * Errors: InvalidAttachmentId - The attachment identifier does not exist. * * In addition to this signature, the method also has the following signatures: + * * removeAttachmentAsync(attachmentIndex: string): void; + * * removeAttachmentAsync(attachmentIndex: string, options: AsyncContextOptions): void; + * * removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; * * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. @@ -7453,8 +8866,11 @@ declare namespace Office { * Errors: InvalidAttachmentId - The attachment identifier does not exist. * * In addition to this signature, the method also has the following signatures: + * * saveAsync(): void; + * * saveAsync(options: AsyncContextOptions): void; + * * saveAsync(callback: (result: AsyncResult) => void): void; * * @param options Optional. An object literal that contains one or more of the following properties. @@ -7562,11 +8978,14 @@ declare namespace Office { * Errors: InvalidAttachmentId - The attachment identifier does not exist. * * In addition to this signature, the method also has the following signatures: + * * setSelectedDataAsync(data: string): void; + * * setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + * * setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; * - * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. * @param options Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. @@ -7633,11 +9052,13 @@ declare namespace Office { setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } /** - * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. + * The read mode of {@link Office.Item | Office.context.mailbox.item}. + * + * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of **Office.context.mailbox.item**. Refer to the Object Model pages for more information. */ interface ItemRead extends Item { /** - * Gets an array of attachments for the item. Read mode only. + * Gets an array of attachments for the item. * * [Api set: Mailbox 1.0] * @@ -7652,9 +9073,8 @@ declare namespace Office { */ attachments: AttachmentDetails[]; /** - * Gets the Exchange Web Services item class of the selected item. Read mode only. + * Gets the Exchange Web Services item class of the selected item. * - * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. * * You can create custom message classes that extends a default message class, for example, a custom appointment message class IPM.Appointment.Contoso. * @@ -7662,18 +9082,20 @@ declare namespace Office { * * @remarks * - * |Type|Description|Item Class| - * |-----------|------------|------------| - * |Appointment items|These are calendar items of the item class IPM.Appointment or IPM.Appointment.Occurence.|IPM.Appointment,IPM.Appointment.Occurence| - * |Message items|These include email messages that have the default message class IPM.Note, and meeting requests, responses, and cancellations, that use IPM.Schedule.Meeting as the base message class.|IPM.Note,IPM.Schedule.Meeting.Request,IPM.Schedule.Meeting.Neg,IPM.Schedule.Meeting.Pos,IPM.Schedule.Meeting.Tent,IPM.Schedule.Meeting.Canceled| - * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * * Applicable Outlook mode: Read + * + * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. + * + * |Type|Description|item class| + * |-----------|------------|------------| + * |Appointment items|These are calendar items of the item class IPM.Appointment or IPM.Appointment.Occurence.|IPM.Appointment,IPM.Appointment.Occurence| + * |Message items|These include email messages that have the default message class IPM.Note, and meeting requests, responses, and cancellations, that use IPM.Schedule.Meeting as the base message class.|IPM.Note,IPM.Schedule.Meeting.Request,IPM.Schedule.Meeting.Neg,IPM.Schedule.Meeting.Pos,IPM.Schedule.Meeting.Tent,IPM.Schedule.Meeting.Canceled| */ itemClass: string; /** - * Gets the Exchange Web Services item identifier for the current item. Read mode only. + * Gets the Exchange Web Services item identifier for the current item. * * The itemId property is not available in compose mode. If an item identifier is required, the saveAsync method can be used to save the item to the store, which will return the item identifier in the AsyncResult.value parameter in the callback function. * @@ -7689,7 +9111,7 @@ declare namespace Office { */ itemId: string; /** - * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). Read mode only. + * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). * * The normalizedSubject property gets the subject of the item, with any standard prefixes (such as RE: and FW:) that are added by email programs. To get the subject of the item with the prefixes intact, use the subject property. * @@ -7738,7 +9160,7 @@ declare namespace Office { * * @param formData A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB * OR - * A ReplyFormData object that contains body or attachment data and a callback function + * An {@link Office.ReplyFormData} object that contains body or attachment data and a callback function */ displayReplyAllForm(formData: string | ReplyFormData): void; /** @@ -7762,7 +9184,7 @@ declare namespace Office { * * @param formData A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB. * OR - * A ReplyFormData object that contains body or attachment data and a callback function. + * An {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. */ displayReplyForm(formData: string | ReplyFormData): void; /** @@ -7779,6 +9201,7 @@ declare namespace Office { * Applicable Outlook mode: Read * * In addition to this signature, the method also has the following signatures: + * * getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; * * @param options Optional. An object literal that contains one or more of the following properties. @@ -7822,11 +9245,16 @@ declare namespace Office { * Note: This method is not supported in Outlook for iOS or Outlook for Android. * * [Api set: Mailbox 1.0] + * + * @param entityType One of the EntityType enumeration values. * * @returns * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present on the item, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. * * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: Restricted + * + * Applicable Outlook mode: Read * * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the following table. * @@ -7839,12 +9267,6 @@ declare namespace Office { * |PhoneNumber|PhoneNumber|Restricted| * |TaskSuggestion|TaskSuggestion|ReadItem| * |URL|String|Restricted| - * - * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: Restricted - * - * Applicable Outlook mode: Read - * - * @param entityType One of the EntityType enumeration values. */ getEntitiesByType(entityType: Office.MailboxEnums.EntityType): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; /** @@ -7949,7 +9371,9 @@ declare namespace Office { getSelectedRegExMatches(): any; } /** - * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. + * A subclass of {@link Office.Item} for messages. + * + * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of **Office.context.mailbox.item**. Refer to the Object Model pages for more information. */ interface Message extends Item { /** @@ -7971,11 +9395,13 @@ declare namespace Office { } /** - * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. + * The message compose mode of {@link Office.Item | Office.context.mailbox.item}. + * + * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of **Office.context.mailbox.item**. Refer to the Object Model pages for more information. */ interface MessageCompose extends Message, ItemCompose { /** - * Gets an object that provides methods to get or update the recipients on the Bcc (blind carbon copy) line of a message. Compose mode only. + * Gets an object that provides methods to get or update the recipients on the Bcc (blind carbon copy) line of a message. * * [Api set: Mailbox 1.1] * @@ -7983,15 +9409,13 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose + * Applicable Outlook mode: Message Compose */ bcc: Recipients; /** * Provides access to the Cc (carbon copy) recipients of a message. The type of object and level of access depends on the mode of the current item. * - * *Compose mode* - * - * The cc property returns a Recipients object that provides methods to get or update the recipients on the Cc line of the message. + * The cc property returns a {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of the message. * * [Api set: Mailbox 1.0] * @@ -7999,7 +9423,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Message Compose */ cc: Recipients; /** @@ -8015,7 +9439,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Read + * Applicable Outlook mode: Message Compose */ from: From; /** @@ -8029,11 +9453,856 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Message Compose */ to: Recipients; + + // Repeated Item Fields // + + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + body: Body; + /** + * Gets the date and time that an item was created. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + dateTimeCreated: Date; + /** + * Gets the date and time that an item was last modified. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * Note: This member is not supported in Outlook for iOS or Outlook for Android. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + dateTimeModifed: Date; + /** + * Gets the type of item that an instance represents. + * + * The itemType property returns one of the ItemType enumeration values, indicating whether the item object instance is a message or an appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + itemType: Office.MailboxEnums.ItemType; + /** + * Gets the notification messages for an item. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + notificationMessages: NotificationMessages; + + /** + * Gets or sets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. Read and compose modes for appointment items. Read mode for meeting request items. + * + * The recurrence property returns a recurrence object for recurring appointments or meetings requests if an item is a series or an instance in a series. null is returned for single appointments and meeting requests of single appointments. undefined is returned for messages that are not meeting requests. + * + * Note: Meeting requests have an itemClass value of IPM.Schedule.Meeting.Request. + * + * Note: If the recurrence object is null, this indicates that the object is a single appointment or a meeting request of a single appointment and NOT a part of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + recurrence: Recurrence; + + /** + * Gets the id of the series that an instance belongs to. + * + * In OWA and Outlook, the seriesId returns the Exchange Web Services (EWS) ID of the parent (series) item that this item belongs to. However, in iOS and Android, the seriesId returns the REST ID of the parent item. + * + * Note: The identifier returned by the seriesId property is the same as the Exchange Web Services item identifier. The seriesId property is not identical to the Outlook IDs used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api | Use the Outlook REST APIs from an Outlook add-in}. + * + * The seriesId property returns null for items that do not have parent items such as single appointments, series items, or meeting requests and returns undefined for any other items that are not meeting requests. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + seriesId: string; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + * + * In addition to this signature, the method also has the following signatures: + * + * addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + * + * In addition to this signature, the method also has the following signatures: + * + * removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Gets or sets the description that appears in the subject field of an item. + * + * The subject property gets or sets the entire subject of the item, as sent by the email server. + * + * The subject property returns a Subject object that provides methods to get and set the subject. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + */ + subject: Subject; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * In addition to this signature, the method also has the following signatures: + * + * addFileAttachmentAsync(uri: string, attachmentName: string): void; + * + * addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void; + * + * addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + */ + addFileAttachmentAsync(uri: string, attachmentName: string): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * inInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void; + /** + * Adds a file to a message or appointment as an attachment. + * + * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * AttachmentSizeExceeded - The attachment is larger than allowed. + * + * FileTypeNotSupported - The attachment has an extension that is not allowed. + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type asyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void; + + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * In addition to the main signature, this method also has these signatures: + * + * addItemAttachmentAsync(itemId: any, attachmentName: string): void; + * + * addItemAttachmentAsync(itemId: any, attachmentName: string, options: AsyncContextOptions): void; + * + * addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string): void; + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string, options: AsyncContextOptions): void; + /** + * Adds an Exchange item, such as a message, as an attachment to the message or appointment. + * + * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed. + * + * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. + * + * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that you are editing; however, this is not supported and is not recommended. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: + * + * NumberOfAttachmentsExceeded - The message or appointment has too many attachments. + * + * @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters. + * @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. + */ + addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void; + + /** + * Closes the current item that is being composed + * + * The behaviors of the close method depends on the current state of the item being composed. If the item has unsaved changes, the client prompts the user to save, discard, or close the action. + * + * In the Outlook desktop client, if the message is an inline reply, the close method has no effect. + * + * Note: In Outlook on the web, if the item is an appointment and it has previously been saved using saveAsync, the user is prompted to save, discard, or cancel even if no changes have occurred since the item was last saved. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: Restricted + * + * Applicable Outlook mode: Message Compose + */ + close(): void; + /** + * Gets initialization data passed when the add-in is activated by an actionable message. + * + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Compose + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + */ + getInitializationContextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Asynchronously returns selected data from the subject or body of a message. + * + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * + * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * + * [Api set: Mailbox 1.0] + * + * @returns + * The selected data as a string with format determined by coercionType. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + */ + getSelectedDataAsync(coercionType: CoercionType, callback: (result: AsyncResult) => void): void; + /** + * Asynchronously returns selected data from the subject or body of a message. + * + * If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error. + * + * To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject. + * + * [Api set: Mailbox 1.0] + * + * @returns + * The selected data as a string with format determined by coercionType. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. If HTML, the method returns the selected text, whether it is plaintext or HTML. + * @param options An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + */ + getSelectedDataAsync(coercionType: CoercionType, options: AsyncContextOptions, callback: (result: AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * In addition to this signature, the method also has the following signatures: + * + * removeAttachmentAsync(attachmentIndex: string): void; + * + * removeAttachmentAsync(attachmentIndex: string, options: AsyncContextOptions): void; + * + * removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentIndex: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + */ + removeAttachmentAsync(attachmentIndex: string): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + */ + removeAttachmentAsync(attachmentIndex: string, options: AsyncContextOptions): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void; + + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * In addition to this signature, the method also has the following signatures: + * + * saveAsync(): void; + * + * saveAsync(options: AsyncContextOptions): void; + * + * saveAsync(callback: (result: AsyncResult) => void): void; + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + saveAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + */ + saveAsync(): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + */ + saveAsync(options: AsyncContextOptions): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. In Outlook Web App or Outlook in online mode, the item is saved to the server. In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. Saving an existing appointment will send an update to added or removed attendees. + * + * Note: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error. + * + * Note: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + saveAsync(callback: (result: AsyncResult) => void): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * In addition to this signature, the method also has the following signatures: + * + * setSelectedDataAsync(data: string): void; + * + * setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + * + * setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + setSelectedDataAsync(data: string, options?: AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult) => void): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + */ + setSelectedDataAsync(data: string): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * coercionType: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; if the field is text, then plain text is used. + */ + setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void; + /** + * Asynchronously inserts data into the body or subject of a message. + * + * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. After insertion, the cursor is placed at the end of the inserted content. + * + * [Api set: Mailbox 1.2] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem + * + * Applicable Outlook mode: Message Compose + * + * Errors: InvalidAttachmentId - The attachment identifier does not exist. + * + * @param data The data to be inserted. Data is not to exceed 1,000,000 characters. If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void; } /** + * The message read mode of {@link Office.Item | Office.context.mailbox.item}. + * * Important: This is an internal Outlook object, not directly exposed through existing interfaces. You should treat this as a mode of Office.context.mailbox.item. Refer to the Object Model pages for more information. */ interface MessageRead extends Message, ItemRead { @@ -8048,7 +10317,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Message Read */ cc: EmailAddressDetails[]; /** @@ -8066,11 +10335,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Read + * Applicable Outlook mode: Message Read */ from: EmailAddressDetails; /** - * Gets the Internet message identifier for an email message. Read mode only. + * Gets the Internet message identifier for an email message. * * [Api set: Mailbox 1.0] * @@ -8078,11 +10347,11 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Read + * Applicable Outlook mode: Message Read */ internetMessageId: string; /** - * Gets the email address of the sender of an email message. Read mode only. + * Gets the email address of the sender of an email message. * * The from and sender properties represent the same person unless the message is sent by a delegate. In that case, the from property represents the delegator, and the sender property represents the delegate. * @@ -8094,7 +10363,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Read + * Applicable Outlook mode: Message Read */ sender: EmailAddressDetails; /** @@ -8108,9 +10377,536 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem * - * Applicable Outlook mode: Compose or read + * Applicable Outlook mode: Message Read */ to: EmailAddressDetails[]; + + // Repeated Item Fields // + + /** + * Gets an object that provides methods for manipulating the body of an item. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + body: Body; + /** + * Gets the date and time that an item was created. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + dateTimeCreated: Date; + /** + * Gets the date and time that an item was last modified. Read mode only. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * Note: This member is not supported in Outlook for iOS or Outlook for Android. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + dateTimeModifed: Date; + /** + * Gets the type of item that an instance represents. + * + * The itemType property returns one of the ItemType enumeration values, indicating whether the item object instance is a message or an appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + itemType: Office.MailboxEnums.ItemType; + /** + * Gets the notification messages for an item. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Compose or read + */ + notificationMessages: NotificationMessages; + + /** + * Gets the recurrence pattern of an appointment. Gets the recurrence pattern of a meeting request. Read and compose modes for appointment items. Read mode for meeting request items. + * + * The recurrence property returns a recurrence object for recurring appointments or meetings requests if an item is a series or an instance in a series. null is returned for single appointments and meeting requests of single appointments. undefined is returned for messages that are not meeting requests. + * + * Note: Meeting requests have an itemClass value of IPM.Schedule.Meeting.Request. + * + * Note: If the recurrence object is null, this indicates that the object is a single appointment or a meeting request of a single appointment and NOT a part of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + recurrence: Recurrence; + + /** + * Gets the id of the series that an instance belongs to. + * + * In OWA and Outlook, the seriesId returns the Exchange Web Services (EWS) ID of the parent (series) item that this item belongs to. However, in iOS and Android, the seriesId returns the REST ID of the parent item. + * + * Note: The identifier returned by the seriesId property is the same as the Exchange Web Services item identifier. The seriesId property is not identical to the Outlook IDs used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see {@link https://docs.microsoft.com/outlook/add-ins/use-rest-api | Use the Outlook REST APIs from an Outlook add-in}. + * + * The seriesId property returns null for items that do not have parent items such as single appointments, series items, or meeting requests and returns undefined for any other items that are not meeting requests. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + seriesId: string; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * In addition to this signature, the method also has the following signatures: + * + * addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Adds an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Asynchronously loads custom properties for this add-in on the selected item. + * + * Custom properties are stored as key/value pairs on a per-app, per-item basis. This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * + * The custom properties are provided as a CustomProperties object in the asyncResult.value property. This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to the server. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. + * @param userContext Optional. Developers can provide any object they wish to access in the callback function. This object can be accessed by the asyncResult.asyncContext property in the callback function. + */ + loadCustomPropertiesAsync(callback: (result: AsyncResult) => void, userContext?: any): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * In addition to this signature, the method also has the following signatures: + * + * removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; + + /** + * Removes an event handler for a supported event. + * + * Currently the only supported event type is Office.EventType.RecurrencePatternChanged, which is invoked when the user changes the recurrence pattern of a series. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param eventType The event that should invoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + */ + removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Gets an array of attachments for the item. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * Note: Certain types of files are blocked by Outlook due to potential security issues and are therefore not returned. For more information, see {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}. + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + */ + attachments: AttachmentDetails[]; + /** + * Gets the Exchange Web Services item class of the selected item. + * + * You can create custom message classes that extends a default message class, for example, a custom appointment message class IPM.Appointment.Contoso. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * The itemClass property specifies the message class of the selected item. The following are the default message classes for the message or appointment item. + * + * |Type|Description|Item Class| + * |-----------|------------|------------| + * |Appointment items|These are calendar items of the item class IPM.Appointment or IPM.Appointment.Occurence.|IPM.Appointment,IPM.Appointment.Occurence| + * |Message items|These include email messages that have the default message class IPM.Note, and meeting requests, responses, and cancellations, that use IPM.Schedule.Meeting as the base message class.|IPM.Note,IPM.Schedule.Meeting.Request,IPM.Schedule.Meeting.Neg,IPM.Schedule.Meeting.Pos,IPM.Schedule.Meeting.Tent,IPM.Schedule.Meeting.Canceled| + */ + itemClass: string; + /** + * Gets the Exchange Web Services item identifier for the current item. + * + * The itemId property is not available in compose mode. If an item identifier is required, the saveAsync method can be used to save the item to the store, which will return the item identifier in the AsyncResult.value parameter in the callback function. + * + * Note: The identifier returned by the itemId property is the same as the Exchange Web Services item identifier. The itemId property is not identical to the Outlook Entry ID or the ID used by the Outlook REST API. Before making REST API calls using this value, it should be converted using Office.context.mailbox.convertToRestId. For more details, see Use the Outlook REST APIs from an Outlook add-in. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + itemId: string; + /** + * Gets the subject of an item, with all prefixes removed (including RE: and FWD:). + * + * The normalizedSubject property gets the subject of the item, with any standard prefixes (such as RE: and FW:) that are added by email programs. To get the subject of the item with the prefixes intact, use the subject property. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + normalizedSubject: string; + /** + * Gets the description that appears in the subject field of an item. + * + * The subject property gets or sets the entire subject of the item, as sent by the email server. + * + * The subject property returns a string. Use the normalizedSubject property to get the subject minus any leading prefixes such as RE: and FW:. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + subject: string; + /** + * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the selected appointment. + * + * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. + * + * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. + * + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param formData A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB + * OR + * An {@link Office.ReplyFormData} object that contains body or attachment data and a callback function + */ + displayReplyAllForm(formData: string | ReplyFormData): void; + /** + * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. + * + * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. + * + * If any of the string parameters exceed their limits, displayReplyForm throws an exception. + * + * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. If this isn't possible, then no error message is thrown. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param formData A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB. + * OR + * An {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. + */ + displayReplyForm(formData: string | ReplyFormData): void; + /** + * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. + * + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * In addition to this signature, the method also has the following signatures: + * + * getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + */ + getInitializationContextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. + * + * Note: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. On success, the initialization data is provided in the asyncResult.value property as a string. If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError. + */ + getInitializationContextAsync(callback?: (result: AsyncResult) => void): void; + /** + * Gets the entities found in the selected item. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + getEntities(): Entities; + /** + * Gets an array of all the entities of the specified entity type found in the selected item. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @param entityType One of the EntityType enumeration values. + * + * @returns + * If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present on the item, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: Restricted + * + * Applicable Outlook mode: Message Read + * + * While the minimum permission level to use this method is Restricted, some entity types require ReadItem to access, as specified in the following table. + * + * |Value of entityType|Type of objects in returned array|Required Permission Level| + * |-------|-----------|----------| + * |Address|String|Restricted| + * |Contact|Contact|ReadItem| + * |EmailAddress|String|ReadItem| + * |MeetingSuggestion|MeetingSuggestion|ReadItem| + * |PhoneNumber|PhoneNumber|Restricted| + * |TaskSuggestion|TaskSuggestion|ReadItem| + * |URL|String|Restricted| + */ + getEntitiesByType(entityType: Office.MailboxEnums.EntityType): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; + /** + * Returns well-known entities in the selected item that pass the named filter defined in the manifest XML file. + * + * The getFilteredEntitiesByName method returns the entities that match the regular expression defined in the ItemHasKnownEntity rule element in the manifest XML file with the specified FilterName element value. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param name The name of the ItemHasKnownEntity rule element that defines the filter to match. + * @returns If there is no ItemHasKnownEntity element in the manifest with a FilterName element value that matches the name parameter, the method returns null. If the name parameter does match an ItemHasKnownEntity element in the manifest, but there are no entities in the current item that match, the method return an empty array. + */ + getFilteredEntitiesByName(name: string): (string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion)[]; + /** + * Returns string values in the selected item that match the regular expressions defined in the manifest XML file. + * + * The getRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @returns + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + getRegExMatches(): any; + /** + * Returns string values in the selected item that match the named regular expression defined in the manifest XML file. + * + * The getRegExMatchesByName method returns the strings that match the regular expression defined in the ItemHasRegularExpressionMatch rule element in the manifest XML file with the specified RegExName element value. + * + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.0] + * + * @returns + * An array that contains the strings that match the regular expression defined in the manifest XML file. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param name The name of the ItemHasRegularExpressionMatch rule element that defines the filter to match. + */ + getRegExMatchesByName(name: string): string[]; + /** + * Gets the entities found in a highlighted match a user has selected. Highlighted matches apply to contextual add-ins. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.6] + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + * + * @param name The name of the ItemHasRegularExpressionMatch rule element that defines the filter to match. + */ + getSelectedEntities(): Entities; + /** + * Returns string values in a highlighted match that match the regular expressions defined in the manifest XML file. Highlighted matches apply to contextual add-ins. + * + * The getSelectedRegExMatches method returns the strings that match the regular expression defined in each ItemHasRegularExpressionMatch or ItemHasKnownEntity rule element in the manifest XML file. For an ItemHasRegularExpressionMatch rule, a matching string has to occur in the property of the item that is specified by that rule. The PropertyName simple type defines the supported properties. + * + * If you specify an ItemHasRegularExpressionMatch rule on the body property of an item, the regular expression should further filter the body and should not attempt to return the entire body of the item. Using a regular expression such as .* to obtain the entire body of an item does not always return the expected results. Instead, use the Body.getAsync method to retrieve the entire body. + * + * Note: This method is not supported in Outlook for iOS or Outlook for Android. + * + * [Api set: Mailbox 1.6] + * + * @returns + * An object that contains arrays of strings that match the regular expressions defined in the manifest XML file. The name of each array is equal to the corresponding value of the RegExName attribute of the matching ItemHasRegularExpressionMatch rule or the FilterName attribute of the matching ItemHasKnownEntity rule. + * + * @remarks + * + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Message Read + */ + getSelectedRegExMatches(): any; } /** @@ -8186,6 +10982,7 @@ declare namespace Office { * Applicable Outlook mode: Compose * * In addition to this signature, the method also has the following signatures: + * * getAsync(callback: (result: AsyncResult) => void): void; * */ @@ -8225,8 +11022,11 @@ declare namespace Office { * Errors: DataExceedsMaximumSize - The location parameter is longer than 255 characters. * * In addition to this signature, the method also has the following signatures: + * * setAsync(location: string): void; + * * setAsync(location: string, options: AsyncContextOptions): void; + * * setAsync(location: string, callback: (result: AsyncResult) => void): void; */ setAsync(location: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -8304,6 +11104,27 @@ declare namespace Office { * Applicable Outlook mode: Compose or read */ interface Mailbox { + /** + * Provides diagnostic information to an Outlook add-in. + * + * Contains the following members: + * + * - hostName (string): A string that represents the name of the host application. It be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp. + * + * - hostVersion (string): A string that represents the version of either the host application or the Exchange Server. If the mail add-in is running on the Outlook desktop client or Outlook for iOS, the hostVersion property returns the version of the host application, Outlook. In Outlook Web App, the property returns the version of the Exchange Server. An example is the string 15.0.468.0. + * + * - OWAView (string): A string that represents the current view of Outlook Web App. If the host application is not Outlook Web App, then accessing this property results in undefined. Outlook Web App has three views (OneColumn - displayed when the screen is narrow, TwoColumns - displayed when the screen is wider, and ThreeColumns - displayed when the screen is wide.) that correspond to the width of the screen and the window, and the number of columns that can be displayed. + * + * More information is under {@link Office.Diagnostics}. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem + * + * Applicable Outlook mode: Compose or read + */ + diagnostics: Diagnostics; /** * Gets the URL of the Exchange Web Services (EWS) endpoint for this email account. Read mode only. * @@ -8348,6 +11169,12 @@ declare namespace Office { * Applicable Outlook mode: Compose or read */ restUrl: string; + /** + * Information about the user associated with the mailbox. This includes their account type, display name, email adddress, and time zone. + * + * More information is under {@link Office.UserProfile} + */ + userProfile: UserProfile; /** * Adds an event handler for a supported event. * @@ -8366,7 +11193,7 @@ declare namespace Office { * @param options Optional. Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: EventType, handler: (type: EventType) => void, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Converts an item ID formatted for REST into EWS format. * @@ -8528,9 +11355,9 @@ declare namespace Office { * Applicable Outlook mode: Read * * @param parameters A dictionary containing all values to be filled in for the user in the new form. All parameters are optional. - * toRecipients: An array of strings containing the email addresses or an array containing an EmailAddressDetails object for each of the recipients on the To line. The array is limited to a maximum of 100 entries. - * ccRecipients: An array of strings containing the email addresses or an array containing an EmailAddressDetails object for each of the recipients on the Cc line. The array is limited to a maximum of 100 entries. - * bccRecipients: An array of strings containing the email addresses or an array containing an EmailAddressDetails object for each of the recipients on the Bcc line. The array is limited to a maximum of 100 entries. + * toRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object for each of the recipients on the To line. The array is limited to a maximum of 100 entries. + * ccRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object for each of the recipients on the Cc line. The array is limited to a maximum of 100 entries. + * bccRecipients: An array of strings containing the email addresses or an array containing an {@link Office.EmailAddressDetails} object for each of the recipients on the Bcc line. The array is limited to a maximum of 100 entries. * subject: A string containing the subject of the message. The string is limited to a maximum of 255 characters. * htmlBody: The HTML body of the message. The body content is limited to a maximum size of 32 KB. * attachments: An array of JSON objects that are either file or item attachments. @@ -8569,7 +11396,9 @@ declare namespace Office { * Applicable Outlook mode: Compose and read * * In addition to this signature, the method has the following signature: + * * getCallbackTokenAsync(callback: (result: AsyncResult) => void): void; + * * getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; * * @param options An object literal that contains one or more of the following properties. @@ -8665,7 +11494,7 @@ declare namespace Office { * * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set the encoding value to ISO-8859-1. * - * + * `` * * You do not need to set the encoding value when your mail app is running in Outlook on the web. You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. * @@ -8740,7 +11569,7 @@ declare namespace Office { */ key?: string; /** - * Specifies the Office.MailboxEnums.ItemNotificationMessageType of message. If type is ProgressIndicator or ErrorMessage, an icon is automatically supplied and the message is not persistent. Therefore the icon and persistent properties are not valid for these types of messages. Including them will result in an ArgumentException. If type is ProgressIndicator, the developer should remove or replace the progress indicator when the action is complete. + * Specifies the ItemNotificationMessageType of message. If type is ProgressIndicator or ErrorMessage, an icon is automatically supplied and the message is not persistent. Therefore the icon and persistent properties are not valid for these types of messages. Including them will result in an ArgumentException. If type is ProgressIndicator, the developer should remove or replace the progress indicator when the action is complete. */ type: Office.MailboxEnums.ItemNotificationMessageType; /** @@ -8786,8 +11615,11 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to this signature, the method also has the following signatures: + * * addAsync(key: string, JSONmessage: NotificationMessageDetails): void; + * * addAsync(key: string, JSONmessage: NotificationMessageDetails, options: AsyncContextOptions): void; + * * addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void; * */ @@ -8854,6 +11686,7 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to the main signature, this method also has these signatures: + * * getAllAsync(callback: (result: AsyncResult) => void): void; * * @param options Optional. An object literal that contains one or more of the following properties. @@ -8885,9 +11718,12 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to the main signature, this method also has these signatures: + * * removeAsync(key: string): void; + * * removeAsync(key: string, options: AsyncContextOptions): void; - * removeAsync(key: string, callback: (result: AsyncResult) => void): void; * + * + * removeAsync(key: string, callback: (result: AsyncResult) => void): void; * * @param key The key for the notification message to remove. * @param options Optional. An object literal that contains one or more of the following properties. @@ -8950,8 +11786,11 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to the main signature, this method also has these signatures: + * * replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void; + * * replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options: AsyncContextOptions): void; + * * replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void; * * @param key The key for the notification message to replace. It can't be longer than 32 characters. @@ -9069,8 +11908,11 @@ declare namespace Office { * Errors: NumberOfRecipientsExceeded - The number of recipients exceeded 100 entries. * * In addition to the main signature, this method also has these signatures: + * * addAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; + * * addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: AsyncContextOptions): void; + * * addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void; * * @param recipients The recipients to add to the recipients list. @@ -9109,9 +11951,9 @@ declare namespace Office { * * - Strings containing SMTP email addresses * - * - EmailUser objects + * - {@link Office.EmailUser} objects * - * - EmailAddressDetails objects + * - {@link Office.EmailAddressDetails} objects * * [Api set: Mailbox 1.1] * @@ -9134,9 +11976,9 @@ declare namespace Office { * * - Strings containing SMTP email addresses * - * - EmailUser objects + * - {@link Office.EmailUser} objects * - * - EmailAddressDetails objects + * - {@link Office.EmailAddressDetails} objects * * [Api set: Mailbox 1.1] * @@ -9154,7 +11996,7 @@ declare namespace Office { /** * Gets a recipient list for an appointment or message. * - * When the call completes, the asyncResult.value property will contain an array of EmailAddressDetails objects. + * When the call completes, the asyncResult.value property will contain an array of{@link Office.EmailAddressDetails} objects. * * [Api set: Mailbox 1.1] * @@ -9164,6 +12006,7 @@ declare namespace Office { * Applicable Outlook mode: Compose * * In addition to the main signature, this method also has these signatures: + * * getAsync(callback: (result: AsyncResult) => void): void; * * @param options An object literal that contains one or more of the following properties. @@ -9174,7 +12017,7 @@ declare namespace Office { /** * Gets a recipient list for an appointment or message. * - * When the call completes, the asyncResult.value property will contain an array of EmailAddressDetails objects. + * When the call completes, the asyncResult.value property will contain an array of {@link Office.EmailAddressDetails} objects. * * [Api set: Mailbox 1.1] * @@ -9195,9 +12038,9 @@ declare namespace Office { * * - Strings containing SMTP email addresses * - * - EmailUser objects + * - {@link Office.EmailUser} objects * - * - EmailAddressDetails objects + * - {@link Office.EmailAddressDetails} objects * * [Api set: Mailbox 1.1] * @@ -9209,8 +12052,11 @@ declare namespace Office { * Errors: NumberOfRecipientsExceeded - The number of recipients exceeded 100 entries. * * In addition to the main signature, this method also has these signatures: + * * setAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; + * * setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: AsyncContextOptions): void; + * * setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void; * * @param recipients The recipients to add to the recipients list. @@ -9228,9 +12074,9 @@ declare namespace Office { * * - Strings containing SMTP email addresses * - * - EmailUser objects + * - {@link Office.EmailUser} objects * - * - EmailAddressDetails objects + * - {@link Office.EmailAddressDetails} objects * * [Api set: Mailbox 1.1] * @@ -9253,9 +12099,9 @@ declare namespace Office { * * - Strings containing SMTP email addresses * - * - EmailUser objects + * - {@link Office.EmailUser} objects * - * - EmailAddressDetails objects + * - {@link Office.EmailAddressDetails} objects * * [Api set: Mailbox 1.1] * @@ -9280,9 +12126,9 @@ declare namespace Office { * * - Strings containing SMTP email addresses * - * - EmailUser objects + * - {@link Office.EmailUser} objects * - * - EmailAddressDetails objects + * - {@link Office.EmailAddressDetails} objects * * [Api set: Mailbox 1.1] * @@ -9361,7 +12207,7 @@ declare namespace Office { recurrenceType: MailboxEnums.RecurrenceType; /** - * This object enables you to manage the start and end dates of the recurring appointment series and the usual start and end times of instances. **This object is not in UTC time.** Instead, it is set in the time zone specified by the recurrenceTimeZone value or defaulted to the item's time zone. + * The {@link Office.SeriesTime} object enables you to manage the start and end dates of the recurring appointment series and the usual start and end times of instances. **This object is not in UTC time.** Instead, it is set in the time zone specified by the recurrenceTimeZone value or defaulted to the item's time zone. * * [Api set: Mailbox Preview] * @@ -9387,6 +12233,7 @@ declare namespace Office { * Applicable Outlook mode: Compose or read * * In addition to the main signature, this method also has these signatures: + * * getAsync(callback?: (result: AsyncResult) => void): void; * * @param options Optional. An object literal that contains one or more of the following properties. @@ -9428,6 +12275,7 @@ declare namespace Office { * Errors: InvalidEndTime - The appointment end time is before its start time. * * In addition to the main signature, this method also has these signatures: + * * setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult) => void): void; * * @param recurrencePattern A recurrence object. @@ -9535,7 +12383,7 @@ declare namespace Office { */ htmlBody?: string; /** - * An array of ReplyFormAttachments that are either file or item attachments. + * An array of {@link Office.ReplyFormAttachment} that are either file or item attachments. */ attachments?: ReplyFormAttachment[]; /** @@ -9724,6 +12572,7 @@ declare namespace Office { * Errors: Invalid date format - The date is not in an acceptable format. * * In addition to the main signature, this method also has these signatures: + * * setEndDate(date: string): void; * Where date is the end date of the recurring appointment series represented in the {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD". * @@ -9760,6 +12609,7 @@ declare namespace Office { * Errors: Invalid date format - The date is not in an acceptable format. * * In addition to the main signature, this method also has these signatures: + * * setStartDate(date: string): void; * Where date is the start date of the recurring appointment series represented in the {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD". * @@ -9798,6 +12648,7 @@ declare namespace Office { * Errors: Invalid time format - The time is not in an acceptable format. * * In addition to the main signature, this method also has these signatures: + * * setStartTime(time: string): void; * Where time is the start time of all instances represented by standard datetime string format: "THH:mm:ss:mmm". * @@ -9847,6 +12698,7 @@ declare namespace Office { * Applicable Outlook mode: Compose * * In addition to the main signature, this method also has these signatures: + * * getAsync(callback: (result: AsyncResult) => void): void; * * @param options An object literal that contains one or more of the following properties. @@ -9883,8 +12735,11 @@ declare namespace Office { * Errors: DataExceedsMaximumSize - The subject parameter is longer than 255 characters. * * In addition to the main signature, this method also has these signatures: + * * setAsync(subject: string): void; + * * setAsync(subject: string, options: AsyncContextOptions): void; + * * setAsync(subject: string, callback: (result: AsyncResult) => void): void; * * @param subject The subject of the appointment or message. The string is limited to 255 characters. @@ -9995,6 +12850,7 @@ declare namespace Office { * Applicable Outlook mode: Compose * * In addition to the main signature, this method also has these signatures: + * * getAsync(callback: (result: AsyncResult) => void): void; * * @param options An object literal that contains one or more of the following properties. @@ -10034,8 +12890,11 @@ declare namespace Office { * Errors: InvalidEndTime - The appointment end time is before the appointment start time. * * In addition to the main signature, this method also has these signatures: + * * setAsync(dateTime: Date): void; + * * setAsync(dateTime: Date, options: AsyncContextOptions): void; + * * setAsync(dateTime: Date, callback: (result: AsyncResult) => void): void; * * @param dateTime A date-time object in Coordinated Universal Time (UTC). @@ -10107,6 +12966,8 @@ declare namespace Office { } /** + * Information about the user associated with the mailbox. This includes their account type, display name, email adddress, and time zone. + * * [Api set: Mailbox 1.0] * * @remarks @@ -10188,11 +13049,11 @@ declare namespace Office { //////////////////////////////////////////////////////////////// declare namespace OfficeExtension { - /** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling "context.sync()". */ + /** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling `context.sync()`. */ class ClientObject { /** The request context associated with the object */ context: ClientRequestContext; - /** Returns a boolean value for whether the corresponding object is a null object. You must call "context.sync()" before reading the isNullObject property. */ + /** Returns a boolean value for whether the corresponding object is a null object. You must call `context.sync()` before reading the isNullObject property. */ isNullObject: boolean; } } @@ -10221,7 +13082,7 @@ declare namespace OfficeExtension { pendingStatements: string[]; } - /** An abstract RequestContext object that facilitates requests to the host Office application. The "Excel.run" and "Word.run" methods provide a request context. */ + /** An abstract RequestContext object that facilitates requests to the host Office application. The `Excel.run and `Word.run` methods provide a request context. */ class ClientRequestContext { constructor(url?: string); @@ -10231,23 +13092,24 @@ declare namespace OfficeExtension { /** Request headers */ requestHeaders: { [name: string]: string }; - /** Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ + /** Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties. */ load(object: ClientObject, option?: string | string[] | LoadOption): void; /** * Queues up a command to recursively load the specified properties of the object and its navigation properties. - * You must call "context.sync()" before reading the properties. + * + * You must call `context.sync()` before reading the properties. * * @param object The object to be loaded. - * @param options The key-value pairing of load options for the types, such as { "Workbook": "worksheets,tables", "Worksheet": "tables", "Tables": "name" } + * @param options The key-value pairing of load options for the types, such as `{ "Workbook": "worksheets,tables", "Worksheet": "tables", "Tables": "name" }` * @param maxDepth The maximum recursive depth. */ loadRecursive(object: ClientObject, options: { [typeName: string]: string | string[] | LoadOption }, maxDepth?: number): void; - /** Adds a trace message to the queue. If the promise returned by "context.sync()" is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */ + /** Adds a trace message to the queue. If the promise returned by `context.sync()` is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */ trace(message: string): void; - /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code.�This method returns a promise, which is resolved when the synchronization is complete. */ + /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code. This method returns a promise, which is resolved when the synchronization is complete. */ sync(passThroughValue?: T): Promise; /** Debug information */ @@ -10270,9 +13132,9 @@ declare namespace OfficeExtension { } declare namespace OfficeExtension { - /** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */ + /** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after `context.sync()` is invoked. */ class ClientResult { - /** The value of the result that is retrieved from the document after "context.sync()" is invoked. */ + /** The value of the result that is retrieved from the document after `context.sync()` is invoked. */ value: T; } } @@ -10324,7 +13186,7 @@ declare namespace OfficeExtension { fullStatements?: string[]; } - /** The error object returned by "context.sync()", if a promise is rejected due to an error while processing the request. */ + /** The error object returned by `context.sync()`, if a promise is rejected due to an error while processing the request. */ class Error { /** Error name: "OfficeExtension.Error".*/ name: string; @@ -10334,9 +13196,9 @@ declare namespace OfficeExtension { stack: string; /** Error code string, such as "InvalidArgument". */ code: string; - /** Trace messages (if any) that were added via a "context.trace()" invocation before calling "context.sync()". If there was an error, this contains all trace messages that were executed before the error occurred. These messages can help you monitor the program execution sequence and detect the case of the error. */ + /** Trace messages (if any) that were added via a `context.trace()` invocation before calling `context.sync()`. If there was an error, this contains all trace messages that were executed before the error occurred. These messages can help you monitor the program execution sequence and detect the case of the error. */ traceMessages: Array; - /** Debug info (useful for detailed logging of the error, i.e., via JSON.stringify(...)). */ + /** Debug info (useful for detailed logging of the error, i.e., via `JSON.stringify(...)`). */ debugInfo: DebugInfo; /** Inner error, if applicable. */ innerError: Error; @@ -10361,7 +13223,7 @@ declare namespace OfficeExtension { } declare namespace OfficeExtension { - /** A Promise object that represents a deferred interaction with the host Office application. The publicly-consumable OfficeExtension.Promise is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a browser-provided native Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */ + /** A Promise object that represents a deferred interaction with the host Office application. The publicly-consumable {@link Office.OfficeExtension.Promise} is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a browser-provided native Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */ const Promise: Office.IPromiseConstructor; type IPromise = Promise; } @@ -10373,9 +13235,9 @@ declare namespace OfficeExtension { add(object: ClientObject): void; /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ add(objects: ClientObject[]): void; - /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ + /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */ remove(object: ClientObject): void; - /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ + /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */ remove(objects: ClientObject[]): void; } } @@ -10633,45 +13495,45 @@ declare namespace Excel { } /** * Executes a batch script that performs actions on the Excel object model, using a new RequestContext. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(batch: (context: Excel.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Excel object model, using a new remote RequestContext. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. * @param requestInfo - The URL of the remote workbook and the request headers to be sent. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(requestInfo: OfficeExtension.RequestUrlAndHeaderInfo | Session, batch: (context: Excel.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param contextObject - A previously-created object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param contextObject - A previously-created object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by `context.sync()`. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Excel.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Excel object model, using the RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by `context.sync()`. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Excel object model, using the remote RequestContext of a previously-created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. * @param requestInfo - The URL of the remote workbook and the request headers to be sent. - * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param object - A previously-created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by `context.sync()`. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(requestInfo: OfficeExtension.RequestUrlAndHeaderInfo | Session, object: OfficeExtension.ClientObject, batch: (context: Excel.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Excel object model, using the RequestContext of previously-created API objects. - * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by `context.sync()`. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Excel object model, using the remote RequestContext of previously-created API objects. * @param requestInfo - The URL of the remote workbook and the request headers to be sent. - * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. + * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by `context.sync()`. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of `context.sync()`). The context parameter facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the RequestContext is required to get access to the Excel object model from the add-in. */ function run(requestInfo: OfficeExtension.RequestUrlAndHeaderInfo | Session, objects: OfficeExtension.ClientObject[], batch: (context: Excel.RequestContext) => Promise): Promise; /** diff --git a/types/pigpio/index.d.ts b/types/pigpio/index.d.ts index ea9a312286..79d0ebe0f9 100644 --- a/types/pigpio/index.d.ts +++ b/types/pigpio/index.d.ts @@ -160,15 +160,21 @@ export class Gpio extends NodeJS.EventEmitter { disableInterrupt(): Gpio; /** - * Enables alerts for the GPIO. + * Enables alerts for the GPIO. Returns this. */ enableAlert(): Gpio; /** - * Disables aterts for the GPIO. + * Disables aterts for the GPIO. Returns this. */ disableAlert(): Gpio; + /** + * Sets a glitch filter on a GPIO. Returns this. + * @param steady Time, in microseconds, during which the level must be stable. Maximum value: 300000 + */ + glitchFilter(steady: number): Gpio; + /*----------------------* * mode *----------------------*/ @@ -410,3 +416,11 @@ export function terminate(): void; * @param peripheral an unsigned integer specifying the peripheral for timing (CLOCK_PWM or CLOCK_PCM) */ export function configureClock(microseconds: number, peripheral: number): void; + +/** + * Configures pigpio to use the specified socket port. + * The default setting is to use port 8888. + * If configureSocketPort is called, it must be called before creating Gpio objects. + * @param port an unsigned integer specifying the pigpio socket port number + */ +export function configureSocketPort(port: number): void; diff --git a/types/pigpio/pigpio-tests.ts b/types/pigpio/pigpio-tests.ts index a4679e57f9..90e7d4485d 100644 --- a/types/pigpio/pigpio-tests.ts +++ b/types/pigpio/pigpio-tests.ts @@ -5,6 +5,7 @@ import * as assert from 'assert'; const Gpio = pigpio.Gpio; pigpio.configureClock(1, pigpio.CLOCK_PWM); + pigpio.configureSocketPort(23456); const led = new Gpio(18, { mode: Gpio.OUTPUT, @@ -878,3 +879,37 @@ import * as assert from 'assert'; clearInterval(iv); }, 2000); })(); + +(function gpio_glitch_filter(): void { + const Gpio = pigpio.Gpio; + const input = new Gpio(7, { + mode: Gpio.INPUT, + pullUpDown: Gpio.PUD_OFF, + alert: true + }); + const output = new Gpio(8, { + mode: Gpio.OUTPUT + }); + let count = 0; + + output.digitalWrite(0); + input.glitchFilter(50); + input.on('alert', (level, tick) => { + if (level === 1) { + count++; + console.log(' rising edge, count=' + count); + } + }); + + output.trigger(30, 1); // alert function should not be executed (blocked by glitchFilter) + + setTimeout(() => { + output.trigger(70, 1); // alert function should be executed + }, 500); + + setTimeout(() => { + assert.strictEqual(count, 1, 'expected 1 alert function call instead of ' + count); + console.log(" success..."); + process.exit(0); + }, 1000); +})(); diff --git a/types/postmark/index.d.ts b/types/postmark/index.d.ts index 8a054e17e0..24810299a7 100644 --- a/types/postmark/index.d.ts +++ b/types/postmark/index.d.ts @@ -1,216 +1,668 @@ -// Type definitions for postmark 1.3 +// Type definitions for postmark 1.4 // Project: http://wildbit.github.io/postmark.js // Definitions by: Ben Bayard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -interface PostmarkError { - status: number; - message: string; - code: number; -} - -interface PostmarkMessageHeader { - Name: string; - Value: string; -} - -interface PostmarkAttachment { - Content: string; - Name: string; - ContentType: string; -} - -interface Filter { - count: number; - offset: number; -} - -interface PostmarkMessageWithTemplate { - To: string; - From: string; - Cc?: string; - Bcc?: string; - ReplyTo?: string; - TemplateId?: string; - TemplateModel?: any; - Tag?: string; - Subject?: string; - TrackOpens?: boolean; - TrackLinks?: string; - Headers?: PostmarkMessageHeader[]; -} - -interface PostmarkMessage { - To: string; - From: string; - Cc?: string; - Bcc?: string; - ReplyTo?: string; - Tag?: string; - Subject?: string; - HTMLBody?: string; - TextBody?: string; - TrackOpens?: boolean; - TrackLinks?: string; - Headers?: PostmarkMessageHeader[]; - Attachments?: PostmarkAttachment[]; -} - -interface Sender { - Color: string; - RawEmailEnabled: boolean; - SmtpApiActivated: boolean; - DeliveryHookUrl: string; - InboundHookUrl: string; - BounceHookUrl: boolean; - IncludeBounceContentInHook: boolean; - OpenHookUrl: boolean; - PostFirstOpenOnly: boolean; - TrackOpens: boolean; - TrackLinks: string; - InboundDomain: string; - InboundSpamThreshold: number; -} - -interface TemplateValidator { - Subject: string; - HtmlBody: string; - TextBody: string; - TestRenderModel?: T; - InlineCssForHtmlTestRender?: boolean; -} - -type PostmarkCallback = ((e: PostmarkError, ret: T) => void) | undefined; - -interface SimpleOptions { - ssl: boolean; - requestHost: string; -} - -interface Options extends SimpleOptions { - requestFactory( - options: SimpleOptions - ): ( - path?: string, - type?: string, - content?: PostmarkMessage, - callback?: PostmarkCallback - ) => any; -} - -declare class Client { - constructor(serverKey: string, options?: Partial); - send(message: PostmarkMessage, callback: PostmarkCallback): void; - sendEmailWithTemplate( - message: PostmarkMessageWithTemplate, - callback: PostmarkCallback - ): void; - batch(message: PostmarkMessage[], callback: PostmarkCallback): void; - sendEmail(message: PostmarkMessage, callback: PostmarkCallback): void; - sendEmailBatch(message: PostmarkMessage[], callback: PostmarkCallback): void; - getDeliveryStatistics(callback: PostmarkCallback): void; - getBounces(filter: Partial, callback: PostmarkCallback): void; - getBounce(id: number, callback: PostmarkCallback): void; - getBounceDump(id: number, callback: PostmarkCallback): void; - activateBounce(id: number, callback: PostmarkCallback): void; - getBounceTags(callback: PostmarkCallback): void; - getServer(callback: PostmarkCallback): void; - editServer(options: Pick, callback: PostmarkCallback): void; - getOutboundMessages(filter: Partial, callback: PostmarkCallback): void; - getOutboundMessageDetails(id: number, callback: PostmarkCallback): void; - getMessageOpens(filter: Partial, callback: PostmarkCallback): void; - getMessageOpensForSingleMessage(id: number, filter: Partial, callback: PostmarkCallback): void; - getInboundMessages(filter: Partial, callback: PostmarkCallback): void; - getInboundMessageDetails(id: number, callback: PostmarkCallback): void; - bypassBlockedInboundMessage(id: number, callback: PostmarkCallback): void; - retryInboundHookForMessage(id: number, callback: PostmarkCallback): void; - getOuboundOverview(filter: Partial, callback: PostmarkCallback): void; - validateTemplate(templateObject: TemplateValidator, callback: PostmarkCallback): void; -} - -interface CreateSignature { - FromEmail: string; - Name: string; - ReplyToEmail?: string; - ReturnPathDomain?: string; -} - -interface CreateServer { - Name: string; - Color?: string; - RawEmailEnabled?: boolean; - SmtpApiActivated?: boolean; - DeliveryHookUrl?: string; - InboundHookUrl?: string; - BounceHookUrl?: string; - IncludeBounceContentInHook?: boolean; - OpenHookUrl?: string; - PostFirstOpenOnly?: boolean; - TrackOpens?: boolean; - TrackLinks?: string; - InboundDomain?: string; - InboundSpamThreshold?: number; -} - -interface CreateDomain { - Name: string; - ReturnPathDomain?: string; -} - -declare class AdminClient { - constructor(apiKey: string, options: Partial); - listSenderSignatures(query: Partial, callback: PostmarkCallback): void; - createSenderSignature(options: CreateSignature, callback: PostmarkCallback): void; - editSenderSignature( - id: number, - options: Partial>, - callback: PostmarkCallback - ): void; - deleteSenderSignature(id: number, callback: PostmarkCallback): void; - resendSenderSignatureConfirmation(id: number, callback: PostmarkCallback): void; - verifySenderSignatureSPF(id: number, callback: PostmarkCallback): void; - requestNewDKIMForSenderSignature(id: number, callback: PostmarkCallback): void; - getServer(id: number, callback: PostmarkCallback): void; - createServer(options: CreateServer, callback: PostmarkCallback): void; - editServer( - id: number, - options: Pick, - callback: PostmarkCallback - ): void; - deleteServer(id: number, callback: PostmarkCallback): void; - listServers(query: Partial, callback: PostmarkCallback): void; - listDomains(query: Partial, callback: PostmarkCallback): void; - getDomain(id: number, callback: PostmarkCallback): void; - createDomain( - options: CreateDomain, - callback: PostmarkCallback - ): void; - editDomain( - id: number, - options: Pick, - callback: PostmarkCallback - ): void; - deleteDomain(id: number, callback: PostmarkCallback): void; - verifyDomainSPF(id: number, callback: PostmarkCallback): void; - rotateDKIMForDomain(id: number, callback: PostmarkCallback): void; -} - -interface ClientClass { - new(serverKey: string, options: Partial): Client; -} - -interface AdminClientClass { - new(apiKey: string, options: Partial): AdminClient; -} - -interface Postmark { - (apiKey: string, options: Partial): void; - defaults: Options; - Client: ClientClass; - AdminClient: AdminClientClass; -} - -declare var postmark: Postmark; +// TypeScript Version: 2.4 export = postmark; + +declare const postmark: Postmark.Postmark; +declare namespace Postmark { + const defaults: Options; + + interface PostmarkError { + status: number; + message: string; + code: number; + } + + interface PostmarkMessageHeader { + Name: string; + Value: string; + } + + interface PostmarkAttachment { + Content: string; + Name: string; + ContentType: string; + } + + interface Filter { + count?: number; + offset?: number; + } + + interface PostmarkMessageWithTemplate { + To: string; + From: string; + Cc?: string; + Bcc?: string; + ReplyTo?: string; + TemplateId?: string; + TemplateModel?: any; + Tag?: string; + Subject?: string; + TrackOpens?: boolean; + TrackLinks?: string; + Headers?: PostmarkMessageHeader[]; + } + + interface PostmarkMessage { + To: string; + From: string; + Cc?: string; + Bcc?: string; + ReplyTo?: string; + Tag?: string; + Subject?: string; + HTMLBody?: string; + TextBody?: string; + TrackOpens?: boolean; + TrackLinks?: string; + Headers?: PostmarkMessageHeader[]; + Attachments?: PostmarkAttachment[]; + } + + interface Sender { + Color: string; + RawEmailEnabled: boolean; + SmtpApiActivated: boolean; + DeliveryHookUrl: string; + InboundHookUrl: string; + BounceHookUrl: boolean; + IncludeBounceContentInHook: boolean; + OpenHookUrl: boolean; + PostFirstOpenOnly: boolean; + TrackOpens: boolean; + TrackLinks: string; + InboundDomain: string; + InboundSpamThreshold: number; + } + + interface TemplateValidator { + Subject: string; + HtmlBody: string; + TextBody: string; + TestRenderModel?: T; + InlineCssForHtmlTestRender?: boolean; + } + + type PostmarkCallback = ((e: PostmarkError, ret: T) => undefined) | undefined; + + interface SimpleOptions { + ssl: boolean; + requestHost: string; + } + + interface Options extends SimpleOptions { + requestFactory( + options: SimpleOptions + ): ( + path?: string, + type?: string, + content?: PostmarkMessage, + callback?: PostmarkCallback + ) => any; + } + + class Client { + constructor(serverKey: string, options?: Partial); + + send(message: PostmarkMessage): Promise; + send(message: PostmarkMessage, callback: PostmarkCallback): undefined; + + sendEmailWithTemplate(message: PostmarkMessageWithTemplate): Promise; + sendEmailWithTemplate(message: PostmarkMessageWithTemplate, callback: PostmarkCallback): undefined; + + batch(message: PostmarkMessage[]): Promise; + batch(message: PostmarkMessage[], callback: PostmarkCallback): undefined; + + sendEmail(message: PostmarkMessage): Promise; + sendEmail(message: PostmarkMessage, callback: PostmarkCallback): undefined; + + sendEmailBatch(message: PostmarkMessage[]): Promise; + sendEmailBatch(message: PostmarkMessage[], callback: PostmarkCallback): undefined; + + // stats + getDeliveryStatistics(): Promise; + getDeliveryStatistics(callback: PostmarkCallback): undefined; + + // bounces + getBounces(filter: BounceFilter): Promise; + getBounces(filter: BounceFilter, callback?: PostmarkCallback): undefined; + + getBounce(id: number): Promise; + getBounce(id: number, callback?: PostmarkCallback): undefined; + + getBounceDump(id: number): Promise; + getBounceDump(id: number, callback?: PostmarkCallback): undefined; + + activateBounce(id: number): Promise; + activateBounce(id: number, callback?: PostmarkCallback): undefined; + + getBounceTags(): Promise; + getBounceTags(callback?: PostmarkCallback): undefined; + + // server + getServer(): Promise; + getServer(callback?: PostmarkCallback): undefined; + + editServer(server: Partial): Promise; + editServer(server: Partial, callback?: PostmarkCallback): undefined; + + // message info + getOutboundMessages(filter: OutboundMessageFilter): Promise; + getOutboundMessages(filter: OutboundMessageFilter, callback?: PostmarkCallback): undefined; + + getOutboundMessageDetails(id: number): Promise; + getOutboundMessageDetails(id: number, callback?: PostmarkCallback): undefined; + + getMessageOpens(filter: OpenMessageFilter): Promise; + getMessageOpens(filter: OpenMessageFilter, callback?: PostmarkCallback): undefined; + + getMessageOpensForSingleMessage(id: number, filter: Filter): Promise; + getMessageOpensForSingleMessage(id: number, filter: Filter, callback?: PostmarkCallback): undefined; + + getInboundMessages(filter: InboundMessageFilter): Promise; + getInboundMessages(filter: InboundMessageFilter, callback?: PostmarkCallback): undefined; + + getInboundMessageDetails(id: number): Promise; + getInboundMessageDetails(id: number, callback?: PostmarkCallback): undefined; + + bypassBlockedInboundMessage(id: number): Promise; + bypassBlockedInboundMessage(id: number, callback?: PostmarkCallback): undefined; + + getOuboundOverview(filter: BaseFilter): Promise; + getOuboundOverview(filter: BaseFilter, callback?: PostmarkCallback): undefined; + + retryInboundHookForMessage(id: number): Promise; + retryInboundHookForMessage(id: number, callback?: PostmarkCallback): undefined; + + // templates + getTemplate(id: number): Promise