diff --git a/types/acc-wizard/index.d.ts b/types/acc-wizard/index.d.ts index 9c20bf3e5f..d96ef1a93a 100644 --- a/types/acc-wizard/index.d.ts +++ b/types/acc-wizard/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sathomas/acc-wizard // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface AccWizardOptions { /** @@ -110,4 +111,4 @@ interface AccWizardOptions { */ interface JQuery { accwizard(options?: AccWizardOptions): void; -} \ No newline at end of file +} diff --git a/types/adal/index.d.ts b/types/adal/index.d.ts index 552ca468aa..2150716b17 100644 --- a/types/adal/index.d.ts +++ b/types/adal/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/AzureAD/azure-activedirectory-library-for-js // Definitions by: mmaitre314 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare var AuthenticationContext: adal.AuthenticationContextStatic; declare var Logging: adal.Logging; diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts index 8d309e9e81..cbf1ba70a3 100644 --- a/types/alexa-sdk/alexa-sdk-tests.ts +++ b/types/alexa-sdk/alexa-sdk-tests.ts @@ -1,21 +1,19 @@ -/// - import * as Alexa from "alexa-sdk"; -exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) { +const handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => { let alexa = Alexa.handler(event, context); alexa.registerHandlers(handlers); alexa.execute(); }; let handlers: Alexa.Handlers = { - 'LaunchRequest': function () { + 'LaunchRequest': function() { this.emit('SayHello'); }, - 'HelloWorldIntent': function () { + 'HelloWorldIntent': function() { this.emit('SayHello'); }, - 'SayHello': function () { + 'SayHello': function() { this.emit(':tell', 'Hello World!'); } }; diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index c19892425d..256d3fee9a 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,17 +1,19 @@ -// Type definitions for Alexa SDK for Node.js v1.1.0 +// Type definitions for Alexa SDK for Node.js 1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs -// Definitions by: Pete Beegle , Huw +// Definitions by: Pete Beegle +// Huw +// pascalwhoop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; +export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void ): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; -export var StateString: string; +export let StateString: string; -type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; -type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; +export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; -interface AlexaObject extends Handler { +export interface AlexaObject extends Handler { _event: any; _context: any; _callback: any; @@ -24,11 +26,11 @@ interface AlexaObject extends Handler { execute: () => void; } -interface Handlers { +export interface Handlers { [intent: string]: (this: Handler) => void; } -interface Handler { +export interface Handler { on: any; emit(event: string, ...args: any[]): boolean; emitWithState: any; @@ -39,9 +41,10 @@ interface Handler { context: any; name: any; isOverriden: any; + t: (token: string) => void; } -interface Context { +export interface Context { callbackWaitsForEmptyEventLoop: boolean; logGroupName: string; logStreamName: string; @@ -52,13 +55,13 @@ interface Context { awsRequestId: string; } -interface RequestBody { +export interface RequestBody { version: string; session: Session; request: LaunchRequest | IntentRequest | SessionEndedRequest; } -interface Session { +export interface Session { new: boolean; sessionId: string; attributes: any; @@ -66,64 +69,64 @@ interface Session { user: SessionUser; } -interface SessionApplication { +export interface SessionApplication { applicationId: string; } -interface SessionUser { +export interface SessionUser { userId: string; accessToken: string; } -interface LaunchRequest extends IRequest { } +export interface LaunchRequest extends Request { } -interface IntentRequest extends IRequest { +export interface IntentRequest extends Request { dialogState: DialogStates; intent: Intent; } -interface SlotValue { +export interface SlotValue { confirmationStatus: ConfirmationStatuses; name: string; value?: any; } -interface Intent { +export interface Intent { confirmationStatus: ConfirmationStatuses; name: string; slots: Record; } -interface SessionEndedRequest extends IRequest { +export interface SessionEndedRequest extends Request { reason: string; } -interface IRequest { +export interface Request { type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; requestId: string; timeStamp: string; } -interface ResponseBody { +export interface ResponseBody { version: string; sessionAttributes?: any; response: Response; } -interface Response { +export interface Response { outputSpeech?: OutputSpeech; card?: Card; reprompt?: Reprompt; shouldEndSession: boolean; } -interface OutputSpeech { +export interface OutputSpeech { type: "PlainText" | "SSML"; text?: string; ssml?: string; } -interface Card { +export interface Card { type: "Simple" | "Standard" | "LinkAccount"; title?: string; content?: string; @@ -131,11 +134,11 @@ interface Card { image?: Image; } -interface Image { +export interface Image { smallImageUrl: string; largeImageUrl: string; } -interface Reprompt { +export interface Reprompt { outputSpeech: OutputSpeech; } diff --git a/types/alexa-sdk/tslint.json b/types/alexa-sdk/tslint.json new file mode 100644 index 0000000000..0c1ca3b5b4 --- /dev/null +++ b/types/alexa-sdk/tslint.json @@ -0,0 +1,9 @@ +{ "extends": "dtslint/dt.json", + "rules": { + "object-literal-shorthand": false, + "object-literal-key-quote": false, + "no-empty-interface": false, + "prefer-method-signature": false, + "object-literal-key-quotes": false + } +} diff --git a/types/amazon-product-api/amazon-product-api-tests.ts b/types/amazon-product-api/amazon-product-api-tests.ts index e173d76f36..0a02153236 100644 --- a/types/amazon-product-api/amazon-product-api-tests.ts +++ b/types/amazon-product-api/amazon-product-api-tests.ts @@ -1,5 +1,5 @@ - -/// +declare var console: { log(s: string): void }; +declare var process: { env: any }; import amazon = require('amazon-product-api'); diff --git a/types/amplify-deferred/index.d.ts b/types/amplify-deferred/index.d.ts index c6d2940930..fd738e9cbe 100644 --- a/types/amplify-deferred/index.d.ts +++ b/types/amplify-deferred/index.d.ts @@ -2,6 +2,7 @@ // Project: http://amplifyjs.com/ // Definitions by: Jonas Eriksson , Laurentiu Stamate // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/amplify/index.d.ts b/types/amplify/index.d.ts index f88c754264..2c3e2e1e5a 100644 --- a/types/amplify/index.d.ts +++ b/types/amplify/index.d.ts @@ -2,6 +2,7 @@ // Project: http://amplifyjs.com/ // Definitions by: Jonas Eriksson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-agility/index.d.ts b/types/angular-agility/index.d.ts index 2ff1fcf1f2..df5d2782ad 100644 --- a/types/angular-agility/index.d.ts +++ b/types/angular-agility/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/AngularAgility/AngularAgility // Definitions by: Roland Zwaga // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-animate/index.d.ts b/types/angular-animate/index.d.ts index 219fb05b01..7e3202bc0e 100644 --- a/types/angular-animate/index.d.ts +++ b/types/angular-animate/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-bootstrap-calendar/index.d.ts b/types/angular-bootstrap-calendar/index.d.ts index a451ee9b03..1b393fa78a 100644 --- a/types/angular-bootstrap-calendar/index.d.ts +++ b/types/angular-bootstrap-calendar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mattlewis92/angular-bootstrap-calendar // Definitions by: Egor Komarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as moment from 'moment'; import * as angular from 'angular'; diff --git a/types/angular-breadcrumb/index.d.ts b/types/angular-breadcrumb/index.d.ts index acc5f159f0..bdc4b57abe 100644 --- a/types/angular-breadcrumb/index.d.ts +++ b/types/angular-breadcrumb/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ncuillery/angular-breadcrumb // Definitions by: Marc Talary // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-clipboard/index.d.ts b/types/angular-clipboard/index.d.ts index bb2d93ce49..0f59feaf56 100644 --- a/types/angular-clipboard/index.d.ts +++ b/types/angular-clipboard/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/omichelsen/angular-clipboard // Definitions by: Bradford Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /** * Definition of the Clipboard Service diff --git a/types/angular-cookie/index.d.ts b/types/angular-cookie/index.d.ts index 8f03fc7c11..0bacb1e2fb 100644 --- a/types/angular-cookie/index.d.ts +++ b/types/angular-cookie/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ivpusic/angular-cookie // Definitions by: Borislav Zhivkov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-cookies/index.d.ts b/types/angular-cookies/index.d.ts index e71d636f73..502e83a2e9 100644 --- a/types/angular-cookies/index.d.ts +++ b/types/angular-cookies/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Diego Vilar , Anthony Ciccarello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare var _: string; export = _; @@ -87,4 +88,4 @@ declare module 'angular' { remove(key: string): void; } } -} \ No newline at end of file +} diff --git a/types/angular-deferred-bootstrap/index.d.ts b/types/angular-deferred-bootstrap/index.d.ts index c01059cf25..df489e48ee 100644 --- a/types/angular-deferred-bootstrap/index.d.ts +++ b/types/angular-deferred-bootstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/philippd/angular-deferred-bootstrap // Definitions by: Markus Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -17,4 +18,4 @@ declare module angular { module?: string, resolve: any } -} \ No newline at end of file +} diff --git a/types/angular-dialog-service/index.d.ts b/types/angular-dialog-service/index.d.ts index 7d667c032c..36791262c4 100644 --- a/types/angular-dialog-service/index.d.ts +++ b/types/angular-dialog-service/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/m-e-conroy/angular-dialog-service // Definitions by: William Comartin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angular-dynamic-locale/index.d.ts b/types/angular-dynamic-locale/index.d.ts index 4ee0e6eb89..1aa14d4c3b 100644 --- a/types/angular-dynamic-locale/index.d.ts +++ b/types/angular-dynamic-locale/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/lgalfaso/angular-dynamic-locale // Definitions by: Stephen Lautier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-feature-flags/index.d.ts b/types/angular-feature-flags/index.d.ts index 06cb6f5add..2335bf0eba 100644 --- a/types/angular-feature-flags/index.d.ts +++ b/types/angular-feature-flags/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mjt01/angular-feature-flags // Definitions by: Borislav Zhivkov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -39,4 +40,4 @@ declare module "angular" { set(flagsPromise: angular.IPromise | angular.IHttpPromise): void; } } -} \ No newline at end of file +} diff --git a/types/angular-file-saver/index.d.ts b/types/angular-file-saver/index.d.ts index 2fb846eef4..cee78df620 100644 --- a/types/angular-file-saver/index.d.ts +++ b/types/angular-file-saver/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alferov/angular-file-saver // Definitions by: Donald Nairn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from 'angular'; declare module 'angular' { diff --git a/types/angular-formly/index.d.ts b/types/angular-formly/index.d.ts index d37228fb79..8bcab28800 100644 --- a/types/angular-formly/index.d.ts +++ b/types/angular-formly/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/formly-js/angular-formly // Definitions by: Scott Hatcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-fullscreen/index.d.ts b/types/angular-fullscreen/index.d.ts index fb6502079a..6dd6eeaefe 100644 --- a/types/angular-fullscreen/index.d.ts +++ b/types/angular-fullscreen/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/fabiobiondi/angular-fullscreen // Definitions by: Julien Paroche // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/angular-fullscreen +// TypeScript Version: 2.3 /// diff --git a/types/angular-gettext/index.d.ts b/types/angular-gettext/index.d.ts index 224f5032e0..107d9e10e2 100644 --- a/types/angular-gettext/index.d.ts +++ b/types/angular-gettext/index.d.ts @@ -2,6 +2,7 @@ // Project: https://angular-gettext.rocketeer.be/ // Definitions by: Ákos Lukács // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-google-analytics/index.d.ts b/types/angular-google-analytics/index.d.ts index 51a2d7eb7e..065815ce8b 100644 --- a/types/angular-google-analytics/index.d.ts +++ b/types/angular-google-analytics/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/revolunet/angular-google-analytics // Definitions by: Cyril Schumacher , Thomas Fuchs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// import * as angular from 'angular'; diff --git a/types/angular-growl-v2/index.d.ts b/types/angular-growl-v2/index.d.ts index cf4b134d02..9cab9f66f8 100644 --- a/types/angular-growl-v2/index.d.ts +++ b/types/angular-growl-v2/index.d.ts @@ -2,6 +2,7 @@ // Project: http://janstevens.github.io/angular-growl-2 // Definitions by: Tadeusz Hucal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-hotkeys/index.d.ts b/types/angular-hotkeys/index.d.ts index 4515afca67..3db766706a 100644 --- a/types/angular-hotkeys/index.d.ts +++ b/types/angular-hotkeys/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chieffancypants/angular-hotkeys // Definitions by: Jason Zhao , Stefan Steinhart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 //readme written by David Valentine diff --git a/types/angular-http-auth/index.d.ts b/types/angular-http-auth/index.d.ts index 803ea36ae2..c5cf28b40a 100644 --- a/types/angular-http-auth/index.d.ts +++ b/types/angular-http-auth/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/witoldsz/angular-http-auth // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-httpi/index.d.ts b/types/angular-httpi/index.d.ts index 15cea5994a..126c04eeca 100644 --- a/types/angular-httpi/index.d.ts +++ b/types/angular-httpi/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bennadel/httpi // Definitions by: Andrew Camilleri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-idle/index.d.ts b/types/angular-idle/index.d.ts index 782d3b4ec2..25880fa7c2 100644 --- a/types/angular-idle/index.d.ts +++ b/types/angular-idle/index.d.ts @@ -2,6 +2,7 @@ // Project: http://hackedbychinese.github.io/ng-idle/ // Definitions by: mthamil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-jwt/index.d.ts b/types/angular-jwt/index.d.ts index fd58699c79..c0d9408901 100644 --- a/types/angular-jwt/index.d.ts +++ b/types/angular-jwt/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/auth0/angular-jwt // Definitions by: Reto Rezzonico // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-load/index.d.ts b/types/angular-load/index.d.ts index 8e7c22b6b6..1e4d3ddf97 100644 --- a/types/angular-load/index.d.ts +++ b/types/angular-load/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/urish/angular-load // Definitions by: david-gang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-loading-bar/index.d.ts b/types/angular-loading-bar/index.d.ts index 464974631d..1639ab115b 100644 --- a/types/angular-loading-bar/index.d.ts +++ b/types/angular-loading-bar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chieffancypants/angular-loading-bar // Definitions by: Stephen Lautier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-local-storage/index.d.ts b/types/angular-local-storage/index.d.ts index f403126d7a..faa99065da 100644 --- a/types/angular-local-storage/index.d.ts +++ b/types/angular-local-storage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/grevory/angular-local-storage // Definitions by: Ken Fukuyama // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-localforage/index.d.ts b/types/angular-localforage/index.d.ts index b37b27e7ee..c9159e5e1f 100644 --- a/types/angular-localforage/index.d.ts +++ b/types/angular-localforage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ocombe/angular-localForage // Definitions by: Stefan Steinhart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angular-locker/index.d.ts b/types/angular-locker/index.d.ts index b3395b223d..0fd1d0a472 100644 --- a/types/angular-locker/index.d.ts +++ b/types/angular-locker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tymondesigns/angular-locker // Definitions by: Niko Kovačič // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 93b92290e4..58e1ae5dd6 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular/material // Definitions by: Blake Bigelow , Peter Hajdu , Davide Donadello , Geert Jansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from 'angular'; diff --git a/types/angular-media-queries/index.d.ts b/types/angular-media-queries/index.d.ts index a1f1cc820e..49c0e7450d 100644 --- a/types/angular-media-queries/index.d.ts +++ b/types/angular-media-queries/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jacopotarantino/angular-match-media // Definitions by: Joao Monteiro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -32,4 +33,4 @@ declare module 'angular' { when(list: Array | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean; } } -} \ No newline at end of file +} diff --git a/types/angular-meteor/index.d.ts b/types/angular-meteor/index.d.ts index 29bacb2e83..c842dd2cf0 100644 --- a/types/angular-meteor/index.d.ts +++ b/types/angular-meteor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Urigo/angular-meteor // Definitions by: Peter Grman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-mocks/index.d.ts b/types/angular-mocks/index.d.ts index 8b94fab445..14571e2eba 100644 --- a/types/angular-mocks/index.d.ts +++ b/types/angular-mocks/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Diego Vilar , Tony Curtis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angular-modal/index.d.ts b/types/angular-modal/index.d.ts index 8e11eab613..40106e955e 100644 --- a/types/angular-modal/index.d.ts +++ b/types/angular-modal/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/btford/angular-modal // Definitions by: Paul Lessing // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angular-notifications/index.d.ts b/types/angular-notifications/index.d.ts index 1f33a7c840..8e6a109ebc 100644 --- a/types/angular-notifications/index.d.ts +++ b/types/angular-notifications/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/DerekRies/angular-notifications // Definitions by: Tomasz Ducin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-notify/index.d.ts b/types/angular-notify/index.d.ts index 1053b41b2f..526547f838 100644 --- a/types/angular-notify/index.d.ts +++ b/types/angular-notify/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/cgross/angular-notify // Definitions by: Suwato // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-odata-resources/index.d.ts b/types/angular-odata-resources/index.d.ts index 3af2573bf8..c999de4506 100644 --- a/types/angular-odata-resources/index.d.ts +++ b/types/angular-odata-resources/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/devnixs/ODataAngularResources // Definitions by: Raphael ATALLAH // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-permission/index.d.ts b/types/angular-permission/index.d.ts index 28781cb5df..7c9d4b5500 100644 --- a/types/angular-permission/index.d.ts +++ b/types/angular-permission/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Narzerus/angular-permission // Definitions by: Voislav Mishevski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angular-promise-tracker/index.d.ts b/types/angular-promise-tracker/index.d.ts index b8957eab3d..ec2f7fd498 100644 --- a/types/angular-promise-tracker/index.d.ts +++ b/types/angular-promise-tracker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ajoslin/angular-promise-tracker // Definitions by: Rufus Linke // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-q-spread/index.d.ts b/types/angular-q-spread/index.d.ts index 57f6327071..d6da2499c5 100644 --- a/types/angular-q-spread/index.d.ts +++ b/types/angular-q-spread/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/angular-q-spread // Definitions by: rafw87 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as a from "angular"; diff --git a/types/angular-resource/index.d.ts b/types/angular-resource/index.d.ts index 8880827de2..6b33790de5 100644 --- a/types/angular-resource/index.d.ts +++ b/types/angular-resource/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Diego Vilar , Michael Jess // Definitions: https://github.com/daptiv/DefinitelyTyped +// TypeScript Version: 2.3 declare var _: string; export = _; diff --git a/types/angular-route/index.d.ts b/types/angular-route/index.d.ts index 98ba467b66..29c59f955c 100644 --- a/types/angular-route/index.d.ts +++ b/types/angular-route/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Jonathan Park // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare var _: string; export = _; @@ -154,4 +155,4 @@ declare module 'angular' { when(path: string, route: IRoute): IRouteProvider; } } -} \ No newline at end of file +} diff --git a/types/angular-sanitize/index.d.ts b/types/angular-sanitize/index.d.ts index 8e4936b4b4..89273b42fb 100644 --- a/types/angular-sanitize/index.d.ts +++ b/types/angular-sanitize/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare var _: string; export = _; @@ -46,4 +47,4 @@ declare module 'angular' { (name: 'linky'): angular.sanitize.filter.ILinky; } } -} \ No newline at end of file +} diff --git a/types/angular-scenario/index.d.ts b/types/angular-scenario/index.d.ts index c5804ffd80..ad86b62c4c 100644 --- a/types/angular-scenario/index.d.ts +++ b/types/angular-scenario/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: RomanoLindano // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-scroll/index.d.ts b/types/angular-scroll/index.d.ts index 3361dd31c0..7b8e42bae5 100644 --- a/types/angular-scroll/index.d.ts +++ b/types/angular-scroll/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/oblador/angular-scroll // Definitions by: Sam Herrmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-signalr-hub/index.d.ts b/types/angular-signalr-hub/index.d.ts index 02238f5244..780fbdff76 100644 --- a/types/angular-signalr-hub/index.d.ts +++ b/types/angular-signalr-hub/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/JustMaier/angular-signalr-hub // Definitions by: Adam Santaniello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angular-spinner/index.d.ts b/types/angular-spinner/index.d.ts index e7710e60e2..78d70e5efe 100644 --- a/types/angular-spinner/index.d.ts +++ b/types/angular-spinner/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/urish/angular-spinner // Definitions by: Marcin Biegała // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /** * SpinnerService diff --git a/types/angular-storage/index.d.ts b/types/angular-storage/index.d.ts index be705f20d1..8021ba2f5e 100644 --- a/types/angular-storage/index.d.ts +++ b/types/angular-storage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/auth0/angular-storage // Definitions by: Matthew DeKrey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-strap/index.d.ts b/types/angular-strap/index.d.ts index 3f279619dc..2b31f00148 100644 --- a/types/angular-strap/index.d.ts +++ b/types/angular-strap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://mgcrea.github.io/angular-strap/ // Definitions by: Sam Herrmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-toastr/index.d.ts b/types/angular-toastr/index.d.ts index 83c42045d1..eddccb4021 100644 --- a/types/angular-toastr/index.d.ts +++ b/types/angular-toastr/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Foxandxss/angular-toastr // Definitions by: Niko Kovačič , Troy McKinnon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-toasty/index.d.ts b/types/angular-toasty/index.d.ts index 10596c2b5f..8794b2aab9 100644 --- a/types/angular-toasty/index.d.ts +++ b/types/angular-toasty/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/invertase/angular-toasty // Definitions by: Dominik Muench // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-touchspin/index.d.ts b/types/angular-touchspin/index.d.ts index 4827cf97bb..305a033275 100644 --- a/types/angular-touchspin/index.d.ts +++ b/types/angular-touchspin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nkovacic/angular-touchspin // Definitions by: Niko Kovačič // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -39,4 +40,4 @@ declare module "angular" { defaults(touchSpinOptions: ITouchSpinOptions): void; } } -} \ No newline at end of file +} diff --git a/types/angular-translate/index.d.ts b/types/angular-translate/index.d.ts index 3caf9dc054..55c74629a8 100644 --- a/types/angular-translate/index.d.ts +++ b/types/angular-translate/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/PascalPrecht/angular-translate // Definitions by: Michel Salib // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-ui-bootstrap/index.d.ts b/types/angular-ui-bootstrap/index.d.ts index c09d8cfbb6..7eca42520d 100644 --- a/types/angular-ui-bootstrap/index.d.ts +++ b/types/angular-ui-bootstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular-ui/bootstrap // Definitions by: Brian Surowiec , Ryan Southgate // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-ui-notification/index.d.ts b/types/angular-ui-notification/index.d.ts index e239f6b11d..85c16ec243 100644 --- a/types/angular-ui-notification/index.d.ts +++ b/types/angular-ui-notification/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alexcrack/angular-ui-notification // Definitions by: Kamil Rojewski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-ui-router-default/index.d.ts b/types/angular-ui-router-default/index.d.ts index 0b62245406..98bb93b51b 100644 --- a/types/angular-ui-router-default/index.d.ts +++ b/types/angular-ui-router-default/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nonplus/angular-ui-router-default // Definitions by: Stepan Riha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as aur from "angular-ui-router"; diff --git a/types/angular-ui-router-uib-modal/index.d.ts b/types/angular-ui-router-uib-modal/index.d.ts index 931a2cbd29..b0abfdb031 100644 --- a/types/angular-ui-router-uib-modal/index.d.ts +++ b/types/angular-ui-router-uib-modal/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nonplus/angular-ui-router-uib-modal // Definitions by: Stepan Riha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as auir from "angular-ui-router"; diff --git a/types/angular-ui-router/index.d.ts b/types/angular-ui-router/index.d.ts index 380b4bfed6..f0b8ffd00b 100644 --- a/types/angular-ui-router/index.d.ts +++ b/types/angular-ui-router/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular-ui/ui-router // Definitions by: Michel Salib , Ivan Matiishyn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from 'angular'; diff --git a/types/angular-ui-scroll/index.d.ts b/types/angular-ui-scroll/index.d.ts index b1510f1b06..92fbb3ffcc 100644 --- a/types/angular-ui-scroll/index.d.ts +++ b/types/angular-ui-scroll/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular-ui/ui-scroll // Definitions by: Mark Nadig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-ui-sortable/index.d.ts b/types/angular-ui-sortable/index.d.ts index fa27cf9b49..c364246dba 100644 --- a/types/angular-ui-sortable/index.d.ts +++ b/types/angular-ui-sortable/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular-ui/ui-sortable // Definitions by: Thodoris Greasidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-ui-tree/index.d.ts b/types/angular-ui-tree/index.d.ts index d40dfc93d7..0c2a215b39 100644 --- a/types/angular-ui-tree/index.d.ts +++ b/types/angular-ui-tree/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular-ui-tree/angular-ui-tree // Definitions by: Calvin Fernandez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular-websocket/index.d.ts b/types/angular-websocket/index.d.ts index 9c2c93ea09..b7b3f55093 100644 --- a/types/angular-websocket/index.d.ts +++ b/types/angular-websocket/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/AngularClass/angular-websocket // Definitions by: Nick Veys // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as ng from "angular"; diff --git a/types/angular-wizard/index.d.ts b/types/angular-wizard/index.d.ts index 81af2e80c7..33fa8b2b0a 100644 --- a/types/angular-wizard/index.d.ts +++ b/types/angular-wizard/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mgonto/angular-wizard // Definitions by: Marko Jurisic , Ronald Wildenberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 import * as angular from 'angular'; diff --git a/types/angular-xeditable/index.d.ts b/types/angular-xeditable/index.d.ts index a0069f6764..7a5f99ba61 100644 --- a/types/angular-xeditable/index.d.ts +++ b/types/angular-xeditable/index.d.ts @@ -2,6 +2,7 @@ // Project: https://vitalets.github.io/angular-xeditable/ // Definitions by: Joao Monteiro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from "angular"; diff --git a/types/angular.throttle/index.d.ts b/types/angular.throttle/index.d.ts index c82d54ae44..c5b9e1bca4 100644 --- a/types/angular.throttle/index.d.ts +++ b/types/angular.throttle/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/BaggersIO/angular.throttle // Definitions by: Stefan Steinhart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 5913568fdc..d0e2d978dc 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularjs.org // Definitions by: Diego Vilar , Georgii Dolzhykov , Caleb St-Denis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angularfire/index.d.ts b/types/angularfire/index.d.ts index 5b86018eac..e27cbf5721 100644 --- a/types/angularfire/index.d.ts +++ b/types/angularfire/index.d.ts @@ -2,6 +2,7 @@ // Project: http://angularfire.com // Definitions by: Dénes Harmath // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/angularlocalstorage/index.d.ts b/types/angularlocalstorage/index.d.ts index 34293b218b..67b84b925e 100644 --- a/types/angularlocalstorage/index.d.ts +++ b/types/angularlocalstorage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/agrublev/angularLocalStorage // Definitions by: Horiuchi_H // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/angulartics/index.d.ts b/types/angulartics/index.d.ts index c7bc860ebd..0d9ba1f17f 100644 --- a/types/angulartics/index.d.ts +++ b/types/angulartics/index.d.ts @@ -2,6 +2,7 @@ // Project: http://luisfarzati.github.io/angulartics/ // Definitions by: Steven Fan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from 'angular'; diff --git a/types/arcgis-js-api/arcgis-js-api-tests.ts b/types/arcgis-js-api/arcgis-js-api-tests.ts index d5dfb99406..d2b961df66 100644 --- a/types/arcgis-js-api/arcgis-js-api-tests.ts +++ b/types/arcgis-js-api/arcgis-js-api-tests.ts @@ -15,7 +15,7 @@ class MapController { }); this.map = new Map({ - basemap: "topo" + basemap: { title: "topo" } }); let view = new MapView({ diff --git a/types/asana/asana-tests.ts b/types/asana/asana-tests.ts index 3bef3e2c07..0f12c97b0c 100644 --- a/types/asana/asana-tests.ts +++ b/types/asana/asana-tests.ts @@ -1,7 +1,6 @@ -/// - import * as asana from 'asana'; -import * as util from 'util'; +declare var console: { log(x: any): void }; +declare var process: { env: { ASANA_API_KEY: string } }; let version: string = asana.VERSION; @@ -95,9 +94,6 @@ client.users.me() task.assignee_status === 'new'; }) .then((list: any) => { - console.log(util.inspect(list, { - colors: true, - depth: null - })); + console.log(list); }); diff --git a/types/asyncblock/asyncblock-tests.ts b/types/asyncblock/asyncblock-tests.ts index 472ec80a1b..d93c9fc07a 100644 --- a/types/asyncblock/asyncblock-tests.ts +++ b/types/asyncblock/asyncblock-tests.ts @@ -32,7 +32,7 @@ asyncblock((flow) => { //Wait for a large number of tasks for(var i = 0; i < 100; i++){ //Add each task in parallel with i as the key - fs.readFile(paths[i], 'utf8', flow.add(i)); + fs.readFile(paths[i], 'utf8', flow.add(i)); } //Wait for all the tasks to finish. Results is an object of the form {key1: value1, key2: value2, ...} @@ -76,7 +76,7 @@ asyncblock.nostack((flow) => { fs.readFile('path2', 'utf8', flow.add('second')); //Wait until done reading the first and second files, then write them to another file - fs.writeFile('path3', flow.wait('first') + flow.wait('second'), flow.add()); + fs.writeFile('path3', flow.wait('first') + flow.wait('second'), flow.add()); flow.wait(); //Wait on all outstanding tasks fs.readFile('path3', 'utf8', flow.add('data')); diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 1b141fb492..5987f4901d 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1,5 +1,3 @@ -/// - import path = require("path"); import _atom = require("atom"); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 05c9794eec..30aa6b881b 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -2,6 +2,7 @@ // Project: https://atom.io/ // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/auth0-angular/index.d.ts b/types/auth0-angular/index.d.ts index 16203813e1..0bc8e7b34d 100644 --- a/types/auth0-angular/index.d.ts +++ b/types/auth0-angular/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/auth0/auth0-angular // Definitions by: Matt Emory // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index 8b81e6f7b2..5356dc605a 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -97,6 +97,8 @@ webAuth.renewAuth({ // Renewed tokens or error }); +webAuth.renewAuth({}, (err, authResult) => {}); + webAuth.renewAuth({ nonce: '123', state: '456', @@ -105,6 +107,14 @@ webAuth.renewAuth({ // Renewed tokens or error }); +webAuth.renewAuth({ + audience: 'urn:site:demo:blog', + redirectUri: 'http://page.com/callback', + usePostMessage: true +}, (err, authResult) => { + +}); + webAuth.changePassword({connection: 'the_connection', email: 'me@example.com', password: '123456' @@ -175,7 +185,7 @@ authentication.buildAuthorizeUrl({ connection_scope: 'scope1,scope2' }); -authentication.buildLogoutUrl('asdfasdfds'); +authentication.buildLogoutUrl({ clientID: 'asdfasdfds' }); authentication.buildLogoutUrl(); authentication.userInfo('abcd1234', (err, data) => { //user info retrieved diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index ff2e2e935d..e44092a9c8 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -643,6 +643,7 @@ interface RenewAuthOptions { nonce?: string; scope?: string; audience?: string; + usePostMessage?: boolean; postMessageDataType?: string; } diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index ca84cd350d..2980555a6d 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Simon Ramsay , Yoriki Yamaguchi +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Yoriki Yamaguchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // API Gateway "event" diff --git a/types/backbone-associations/index.d.ts b/types/backbone-associations/index.d.ts index 84532c482d..9d0aa36614 100644 --- a/types/backbone-associations/index.d.ts +++ b/types/backbone-associations/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/dhruvaray/backbone-associations/ // Definitions by: Craig Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from 'backbone'; diff --git a/types/backbone-fetch-cache/index.d.ts b/types/backbone-fetch-cache/index.d.ts index 0067bb4443..c5e8d84426 100644 --- a/types/backbone-fetch-cache/index.d.ts +++ b/types/backbone-fetch-cache/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/madglory/backbone-fetch-cache // Definitions by: delphinus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from "backbone"; diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index f985a52d8f..b51c46f1d7 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -2,6 +2,7 @@ // Project: http://backbonerelational.org/ // Definitions by: Eirik Hoem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/backbone.layoutmanager/index.d.ts b/types/backbone.layoutmanager/index.d.ts index a5c469eb1b..f4eb340e7c 100644 --- a/types/backbone.layoutmanager/index.d.ts +++ b/types/backbone.layoutmanager/index.d.ts @@ -2,6 +2,7 @@ // Project: http://layoutmanager.org/ // Definitions by: He Jiang // Definitions: https://github.com/hejiang2000/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/backbone.localstorage/index.d.ts b/types/backbone.localstorage/index.d.ts index d08d546ec2..9fd089cdec 100644 --- a/types/backbone.localstorage/index.d.ts +++ b/types/backbone.localstorage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jeromegn/Backbone.localStorage // Definitions by: Louis Grignon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from 'backbone'; diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 93b82355db..8b3d338293 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/marionettejs/ // Definitions by: Zeeshan Hamid , Natan Vivo , Sven Tschui // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from 'backbone'; import * as Radio from 'backbone.radio'; diff --git a/types/backbone.paginator/index.d.ts b/types/backbone.paginator/index.d.ts index 521ccda8bf..fc7c39e995 100644 --- a/types/backbone.paginator/index.d.ts +++ b/types/backbone.paginator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/backbone-paginator/backbone.paginator // Definitions by: Nyamazing // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from 'backbone'; diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index 7596722342..61c996f6de 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/marionettejs/backbone.radio // Definitions by: Peter Palotas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from 'backbone'; diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 975d7f33c9..f151b2f42e 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -2,6 +2,7 @@ // Project: http://backbonejs.org/ // Definitions by: Boris Yankov , Natan Vivo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/backgrid/index.d.ts b/types/backgrid/index.d.ts index 83dc86bcbe..fdf7785b59 100644 --- a/types/backgrid/index.d.ts +++ b/types/backgrid/index.d.ts @@ -2,6 +2,7 @@ // Project: http://backgridjs.com/ // Definitions by: Jeremy Lujan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Backbone from 'backbone'; diff --git a/types/baconjs/index.d.ts b/types/baconjs/index.d.ts index 0550d6ec48..5b85bfb38e 100644 --- a/types/baconjs/index.d.ts +++ b/types/baconjs/index.d.ts @@ -2,6 +2,7 @@ // Project: https://baconjs.github.io/ // Definitions by: Alexander Matsievsky , Joonas Javanainen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/bardjs/index.d.ts b/types/bardjs/index.d.ts index d8a5bfd9f0..5f2a5a1863 100644 --- a/types/bardjs/index.d.ts +++ b/types/bardjs/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/wardbell/bardjs // Definitions by: Andrew Archibald // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/bootbox/index.d.ts b/types/bootbox/index.d.ts index 28d30e2ba0..7007d80feb 100644 --- a/types/bootbox/index.d.ts +++ b/types/bootbox/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/makeusabrew/bootbox // Definitions by: Vincent Bortone , Kon Pik , Anup Kattel , Dominik Schroeter , Troy McKinnon , Stanny Nuytkens // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootpag/index.d.ts b/types/bootpag/index.d.ts index 2063cf5b93..20fee59ff2 100644 --- a/types/bootpag/index.d.ts +++ b/types/bootpag/index.d.ts @@ -2,6 +2,7 @@ // Project: http://botmonster.com/jquery-bootpag/ // Definitions by: MAF.DAP / Romain Deneau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap-datepicker/index.d.ts b/types/bootstrap-datepicker/index.d.ts index 61da347f24..9287ee1ba3 100644 --- a/types/bootstrap-datepicker/index.d.ts +++ b/types/bootstrap-datepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/eternicode/bootstrap-datepicker // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap-fileinput/index.d.ts b/types/bootstrap-fileinput/index.d.ts index b7dcd6fd16..8a7df2dbbc 100644 --- a/types/bootstrap-fileinput/index.d.ts +++ b/types/bootstrap-fileinput/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kartik-v/bootstrap-fileinput // Definitions by: Ché Coxshall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -1036,4 +1037,4 @@ declare module BootstrapFileInput { */ indicatorLoadingTitle: string; } -} \ No newline at end of file +} diff --git a/types/bootstrap-maxlength/index.d.ts b/types/bootstrap-maxlength/index.d.ts index fefe196dff..e1fd71deb8 100644 --- a/types/bootstrap-maxlength/index.d.ts +++ b/types/bootstrap-maxlength/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mimo84/bootstrap-maxlength // Definitions by: Dan Manastireanu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap-notify/index.d.ts b/types/bootstrap-notify/index.d.ts index c6939a7c2c..441bb33c39 100644 --- a/types/bootstrap-notify/index.d.ts +++ b/types/bootstrap-notify/index.d.ts @@ -2,6 +2,7 @@ // Project: http://bootstrap-notify.remabledesigns.com/ // Definitions by: Blake Niemyjski , Robert McIntosh , Robert Voica // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -62,4 +63,4 @@ interface NotifyReturn { $ele: JQueryStatic; close: () => void; update: (command: string, update: any) => void; -} \ No newline at end of file +} diff --git a/types/bootstrap-select/index.d.ts b/types/bootstrap-select/index.d.ts index 5f511685ba..95dd32b348 100644 --- a/types/bootstrap-select/index.d.ts +++ b/types/bootstrap-select/index.d.ts @@ -2,6 +2,7 @@ // Project: https://silviomoreto.github.io/bootstrap-select/ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap-slider/bootstrap-slider-tests.ts b/types/bootstrap-slider/bootstrap-slider-tests.ts index df143d4c72..0f5af284ea 100644 --- a/types/bootstrap-slider/bootstrap-slider-tests.ts +++ b/types/bootstrap-slider/bootstrap-slider-tests.ts @@ -1,3 +1,5 @@ +import $ = require('jquery'); + $(function() { // examples from http://seiyria.github.io/bootstrap-slider/ diff --git a/types/bootstrap-slider/index.d.ts b/types/bootstrap-slider/index.d.ts index 9ed5c440c3..f2fc21c9df 100644 --- a/types/bootstrap-slider/index.d.ts +++ b/types/bootstrap-slider/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Daniel Beckwith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - interface SliderOptions { /** * Default: '' diff --git a/types/bootstrap-slider/tsconfig.json b/types/bootstrap-slider/tsconfig.json index 7c807ad0d1..f5e65153f5 100644 --- a/types/bootstrap-slider/tsconfig.json +++ b/types/bootstrap-slider/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "bootstrap-slider-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/bootstrap-switch/index.d.ts b/types/bootstrap-switch/index.d.ts index 670c50c73c..329a58fa53 100644 --- a/types/bootstrap-switch/index.d.ts +++ b/types/bootstrap-switch/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.bootstrap-switch.org/ // Definitions by: John M. Baughman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /** * bootstrap-switch - v3.3.2 Copyright (c) 2012-2013 Mattia Larentis diff --git a/types/bootstrap-table/index.d.ts b/types/bootstrap-table/index.d.ts index 5ed1b5e529..e70ada9e38 100644 --- a/types/bootstrap-table/index.d.ts +++ b/types/bootstrap-table/index.d.ts @@ -2,6 +2,7 @@ // Project: http://bootstrap-table.wenzhixin.net.cn/ // Definitions by: Talat Baig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap-touchspin/index.d.ts b/types/bootstrap-touchspin/index.d.ts index 3026560f02..126cdd36f3 100644 --- a/types/bootstrap-touchspin/index.d.ts +++ b/types/bootstrap-touchspin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.virtuosoft.eu/code/bootstrap-touchspin/ // Definitions by: Albin Sunnanbo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap-validator/index.d.ts b/types/bootstrap-validator/index.d.ts index 92dee2c310..e9f2073d70 100644 --- a/types/bootstrap-validator/index.d.ts +++ b/types/bootstrap-validator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/1000hz/bootstrap-validator // Definitions by: Brady Liles // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap.paginator/index.d.ts b/types/bootstrap.paginator/index.d.ts index 52aedd0656..b79e7bca0a 100644 --- a/types/bootstrap.paginator/index.d.ts +++ b/types/bootstrap.paginator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/lyonlai/bootstrap-paginator // Definitions by: derikwhittaker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bootstrap.timepicker/index.d.ts b/types/bootstrap.timepicker/index.d.ts index 417f385526..f0cc7f472b 100644 --- a/types/bootstrap.timepicker/index.d.ts +++ b/types/bootstrap.timepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jdewit/bootstrap-timepicker // Definitions by: derikwhittaker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -44,6 +45,6 @@ interface JQuery { timepicker(options: TimepickerOptions): JQuery; } -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { +interface JQueryEventObject { time?: TimepickerTime; } diff --git a/types/bootstrap.v3.datetimepicker/index.d.ts b/types/bootstrap.v3.datetimepicker/index.d.ts index f37a42b67d..0dee893fc5 100644 --- a/types/bootstrap.v3.datetimepicker/index.d.ts +++ b/types/bootstrap.v3.datetimepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: http://eonasdan.github.io/bootstrap-datetimepicker // Definitions by: Katona Péter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // based on the previous version created by Jesica N. Fera /** diff --git a/types/bootstrap.v3.datetimepicker/v3/index.d.ts b/types/bootstrap.v3.datetimepicker/v3/index.d.ts index 2c69607cb9..ecfa6d44c1 100644 --- a/types/bootstrap.v3.datetimepicker/v3/index.d.ts +++ b/types/bootstrap.v3.datetimepicker/v3/index.d.ts @@ -2,6 +2,7 @@ // Project: http://eonasdan.github.io/bootstrap-datetimepicker // Definitions by: Jesica N. Fera // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /** * bootstrap-datetimepicker.js 3.0.0 Copyright (c) 2014 Jonathan Peterson diff --git a/types/bootstrap/index.d.ts b/types/bootstrap/index.d.ts index 4a7d9676be..53d9b45b37 100644 --- a/types/bootstrap/index.d.ts +++ b/types/bootstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: http://twitter.github.com/bootstrap/ // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/bounce.js/bounce.js-tests.ts b/types/bounce.js/bounce.js-tests.ts index afa0cdcae2..eaf736dee5 100644 --- a/types/bounce.js/bounce.js-tests.ts +++ b/types/bounce.js/bounce.js-tests.ts @@ -2,7 +2,6 @@ import Bounce from 'bounce.js'; -import * as $ from 'jquery'; function test_chaining_transformations() { var bounce = new Bounce(); diff --git a/types/bounce.js/index.d.ts b/types/bounce.js/index.d.ts index 250fef1a51..0db872fb30 100644 --- a/types/bounce.js/index.d.ts +++ b/types/bounce.js/index.d.ts @@ -2,6 +2,7 @@ // Project: http://github.com/tictail/bounce.js // Definitions by: Cherry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/browser-sync/browser-sync-tests.ts b/types/browser-sync/browser-sync-tests.ts index 43d68326ea..c20f27236a 100644 --- a/types/browser-sync/browser-sync-tests.ts +++ b/types/browser-sync/browser-sync-tests.ts @@ -82,7 +82,7 @@ var has = browserSync.has("My server"); var bs = browserSync.create(); bs.init({ - server: "./app" + server: { index: "./app" } }); bs.reload(); diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index fcf339b3c3..cbdcc83e0a 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -2,71 +2,92 @@ * Created by Bruno Grieder */ -import * as Queue from "bull" +import * as Redis from "ioredis"; +import * as Queue from "bull"; -var videoQueue = Queue( 'video transcoding', 6379, '127.0.0.1' ); -var audioQueue = Queue( 'audio transcoding', 6379, '127.0.0.1' ); -var imageQueue = Queue( 'image transcoding', 6379, '127.0.0.1' ); - -videoQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { +const videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379'); +const audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object +const imageQueue = new Queue('image transcoding'); +videoQueue.process((job, done) => { // job.data contains the custom data passed when the job was created // job.jobId contains id of this job. // transcode video asynchronously and report progress - job.progress( 42 ); + job.progress(42); // call done when finished done(); // or give a error if error - done( Error( 'error transcoding' ) ); + done(new Error('error transcoding')); // or pass it a result - done( null, { framerate: 29.5 /* etc... */ } ); + done(null, { framerate: 29.5 /* etc... */ }); // If the job throws an unhandled exception it is also handled correctly - throw (Error( 'some unexpected error' )); -} ); + throw new Error('some unexpected error'); +}); -audioQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { +audioQueue.process((job, done) => { // transcode audio asynchronously and report progress - job.progress( 42 ); + job.progress(42); // call done when finished done(); // or give a error if error - done( Error( 'error transcoding' ) ); + done(new Error('error transcoding')); // or pass it a result - done( null, { samplerate: 48000 /* etc... */ } ); + done(null, { samplerate: 48000 /* etc... */ }); // If the job throws an unhandled exception it is also handled correctly - throw (Error( 'some unexpected error' )); -} ); + throw new Error('some unexpected error'); +}); -imageQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { +imageQueue.process((job, done) => { // transcode image asynchronously and report progress - job.progress( 42 ); + job.progress(42); // call done when finished done(); // or give a error if error - done( Error( 'error transcoding' ) ); + done(new Error('error transcoding')); // or pass it a result - done( null, { width: 1280, height: 720 /* etc... */ } ); + done(null, { width: 1280, height: 720 /* etc... */ }); // If the job throws an unhandled exception it is also handled correctly - throw (Error( 'some unexpected error' )); -} ); + throw new Error('some unexpected error'); +}); -videoQueue.add( { video: 'http://example.com/video1.mov' } ); -audioQueue.add( { audio: 'http://example.com/audio1.mp3' } ); -imageQueue.add( { image: 'http://example.com/image1.tiff' } ); +videoQueue.add({video: 'http://example.com/video1.mov'}); +audioQueue.add({audio: 'http://example.com/audio1.mp3'}); +imageQueue.add({image: 'http://example.com/image1.tiff'}); +////////////////////////////////////////////////////////////////////////////////// +// +// Re-using Redis Connections +// +////////////////////////////////////////////////////////////////////////////////// + +const client = new Redis(); +const subscriber = new Redis(); + +const pdfQueue = new Queue('pdf transcoding', { + createClient: (type: string, options: Redis.RedisOptions) => { + switch (type) { + case 'client': + return client; + case 'subscriber': + return subscriber; + default: + return new Redis(options); + } + } +}); ////////////////////////////////////////////////////////////////////////////////// // @@ -74,42 +95,38 @@ imageQueue.add( { image: 'http://example.com/image1.tiff' } ); // ////////////////////////////////////////////////////////////////////////////////// -const fetchVideo = ( url: string ): Promise => { return null } -const transcodeVideo = ( data: any ): Promise => { return null } +pdfQueue.process((job) => { + // Processors can also return promises instead of using the done callback + return Promise.resolve(); +}); -interface VideoJob extends Queue.Job { - data: {url: string} -} - - -videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done callback! - // Simply return a promise - fetchVideo( job.data.url ).then( transcodeVideo ); - - // Handles promise rejection - Promise.reject( new Error( 'error transcoding' ) ); - - // Passes the value the promise is resolved with to the "completed" event - Promise.resolve( { framerate: 29.5 /* etc... */ } ); - - // same as - Promise.reject( new Error( 'some unexpected error' ) ); - - // If the job throws an unhandled exception it is also handled correctly - throw new Error( 'some unexpected error' ); -} ); - - -var addVideo1Job = videoQueue.add( { video: 'http://example.com/video1.mov' } ); - -addVideo1Job.then((video1Job) => { +videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) +.then((video1Job) => { // When job has successfully be placed in the queue the job is returned // then wait for completion return video1Job.finished(); }) .then(() => { - // video1Job completed successfully + // completed successfully }) .catch((err) => { // error }); + +////////////////////////////////////////////////////////////////////////////////// +// +// Typed Event Handlers +// +////////////////////////////////////////////////////////////////////////////////// + +pdfQueue +.on('error', (err: Error) => undefined) +.on('active', (job: Queue.Job, jobPromise: Queue.JobPromise) => jobPromise.cancel()) +.on('active', (job: Queue.Job) => undefined) +.on('stalled', (job: Queue.Job) => undefined) +.on('progress', (job: Queue.Job) => undefined) +.on('completed', (job: Queue.Job) => undefined) +.on('failed', (job: Queue.Job) => undefined) +.on('paused', () => undefined) +.on('resumed', () => undefined) +.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatus) => undefined); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 3c89655101..82a31a4ff3 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -1,316 +1,414 @@ -// Type definitions for bull 2.1.2 +// Type definitions for bull 3.0 // Project: https://github.com/OptimalBits/bull -// Definitions by: Bruno Grieder , Cameron Crothers +// Definitions by: Bruno Grieder +// Cameron Crothers +// Marshall Cottrell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as Redis from "ioredis"; -declare module "bull" { +/** + * This is the Queue constructor. + * It creates a new Queue that is persisted in Redis. + * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. + */ +declare const Bull: { + // tslint:disable:unified-signatures + (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + (queueName: string, url?: string): Bull.Queue; + new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + new (queueName: string, url?: string): Bull.Queue; + // tslint:enable:unified-signatures +}; - import * as Redis from "redis"; - - /** - * This is the Queue constructor. - * It creates a new Queue that is persisted in Redis. - * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. - */ - function Bull(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): Bull.Queue; - - namespace Bull { - - export interface DoneCallback { - (error?: Error, value?: any): void - } - - export interface Job { - - jobId: string - - /** - * The custom data passed when the job was created - */ - data: Object; - - /** - * Report progress on a job - */ - progress(value: any): Promise; - - /** - * Removes a Job from the queue from all the lists where it may be included. - * @returns {Promise} A promise that resolves when the job is removed. - */ - remove(): Promise; - - /** - * Rerun a Job that has failed. - * @returns {Promise} A promise that resolves when the job is scheduled for retry. - */ - retry(): Promise; - - /** - * Returns a promise the resolves when the job has been finished. - * TODO: Add a watchdog to check if the job has finished periodically. - * since pubsub does not give any guarantees. - */ - finished(): Promise; - } - - export interface Backoff { - - /** - * Backoff type, which can be either `fixed` or `exponential` - */ - type: string - - /** - * Backoff delay, in milliseconds - */ - delay: number; - } - - export interface AddOptions { - /** - * An amount of miliseconds to wait until this job can be processed. - * Note that for accurate delays, both server and clients should have their clocks synchronized - */ - delay?: number; - - /** - * A number of attempts to retry if the job fails [optional] - */ - attempts?: number; - - /** - * Backoff setting for automatic retries if the job fails - */ - backoff?: number | Backoff - - /** - * A boolean which, if true, adds the job to the right - * of the queue instead of the left (default false) - */ - lifo?: boolean; - - /** - * The number of milliseconds after which the job should be fail with a timeout error - */ - timeout?: number; - } - - export interface Queue { - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * The done callback can be called with an Error instance, to signal that the job did not complete successfully, - * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. - * Errors will be passed as a second argument to the "failed" event; - * results, as a second argument to the "completed" event. - * - * concurrency: Bull will then call you handler in parallel respecting this max number. - */ - process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * The done callback can be called with an Error instance, to signal that the job did not complete successfully, - * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. - * Errors will be passed as a second argument to the "failed" event; - * results, as a second argument to the "completed" event. - */ - process(callback: (job: Job, done: DoneCallback) => void): void; - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * A promise must be returned to signal job completion. - * If the promise is rejected, the error will be passed as a second argument to the "failed" event. - * If it is resolved, its value will be the "completed" event's second argument. - * - * concurrency: Bull will then call you handler in parallel respecting this max number. - */ - process(concurrency: number, callback: (job: Job) => void): Promise; - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * A promise must be returned to signal job completion. - * If the promise is rejected, the error will be passed as a second argument to the "failed" event. - * If it is resolved, its value will be the "completed" event's second argument. - */ - process(callback: (job: Job) => void): Promise; - - // process(callback: (job: Job, done?: DoneCallback) => void): Promise; - - /** - * Creates a new job and adds it to the queue. - * If the queue is empty the job will be executed directly, - * otherwise it will be placed in the queue and executed as soon as possible. - */ - add(data: Object, opts?: AddOptions): Promise; - - /** - * Returns a promise that resolves when the queue is paused. - * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. - * A paused queue will not process new jobs until resumed, - * but current jobs being processed will continue until they are finalized. - * - * Pausing a queue that is already paused does nothing. - */ - pause(): Promise; - - /** - * Returns a promise that resolves when the queue is resumed after being paused. - * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. - * - * Resuming a queue that is not paused does nothing. - */ - resume(): Promise; - - /** - * Returns a promise that returns the number of jobs in the queue, waiting or paused. - * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. - */ - count(): Promise; - - /** - * Empties a queue deleting all the input lists and associated jobs. - */ - empty(): Promise; - - /** - * Closes the underlying redis client. Use this to perform a graceful shutdown. - * - * `close` can be called from anywhere, with one caveat: - * if called from within a job handler the queue won't close until after the job has been processed - */ - close(): Promise; - - /** - * Returns a promise that will return the job instance associated with the jobId parameter. - * If the specified job cannot be located, the promise callback parameter will be set to null. - */ - getJob(jobId: string): Promise; - - /** - * Tells the queue remove all jobs created outside of a grace period in milliseconds. - * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. - */ - clean(gracePeriod: number, jobsState?: string): Promise; - - /** - * Listens to queue events - * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' - */ - on(eventName: string, callback: EventCallback): void; - } - - interface EventCallback { - (...args: any[]): void - } - - interface ReadyEventCallback extends EventCallback { - (): void; - } - - interface ErrorEventCallback extends EventCallback { - (error: Error): void; - } - - interface JobPromise { - /** - * Abort this job - */ - cancel(): void - } - - interface ActiveEventCallback extends EventCallback { - (job: Job, jobPromise: JobPromise): void; - } - - interface ProgressEventCallback extends EventCallback { - (job: Job, progress: any): void; - } - - interface CompletedEventCallback extends EventCallback { - (job: Job, result: Object): void; - } - - interface FailedEventCallback extends EventCallback { - (job: Job, error: Error): void; - } - - interface PausedEventCallback extends EventCallback { - (): void; - } - - interface ResumedEventCallback extends EventCallback { - (job?: Job): void; - } +declare namespace Bull { + interface QueueOptions { + /** + * Options passed directly to the `ioredis` constructor + */ + redis?: Redis.RedisOptions; /** - * @see clean() for details + * When specified, the `Queue` will use this function to create new `ioredis` client connections. + * This is useful if you want to re-use connections. */ - interface CleanedEventCallback extends EventCallback { - (jobs: Job[], type: string): void; - } + createClient?(type: 'client' | 'subscriber', redisOpts?: Redis.RedisOptions): Redis.Redis; + + /** + * Prefix to use for all redis keys + */ + prefix?: string; + + settings?: AdvancedSettings; } - export = Bull; -} + interface AdvancedSettings { + /** + * Key expiration time for job locks + */ + lockDuration?: number; -declare module "bull/lib/priority-queue" { + /** + * How often check for stalled jobs (use 0 for never checking) + */ + stalledInterval?: number; - import * as Bull from "bull"; - import * as Redis from "redis"; + /** + * Max amount of times a stalled job will be re-processed + */ + maxStalledCount?: number; - /** - * This is the Queue constructor of priority queue. - * - * It works same a normal queue, with same function and parameters. - * The only difference is that the Queue#add() allow an options opts.priority - * that could take ["low", "normal", "medium", "hight", "critical"]. If no options provider, "normal" will be taken. - * - * The priority queue will process more often highter priority jobs than lower. - */ - function PQueue(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): PQueue.PriorityQueue; + /** + * Poll interval for delayed jobs and added jobs + */ + guardInterval?: number; - namespace PQueue { - - export interface AddOptions extends Bull.AddOptions { - - /** - * "low", "normal", "medium", "high", "critical" - */ - priority?: string; - } - - - export interface PriorityQueue extends Bull.Queue { - - /** - * Creates a new job and adds it to the queue. - * If the queue is empty the job will be executed directly, - * otherwise it will be placed in the queue and executed as soon as possible. - */ - add(data: Object, opts?: PQueue.AddOptions): Promise; - - } + /** + * Delay before processing next job in case of internal error + */ + retryProcessDelay?: number; } - export = PQueue; + type DoneCallback = (error?: Error | null, value?: any) => void; + + type JobId = number | string; + + interface Job { + id: JobId; + + /** + * The custom data passed when the job was created + */ + data: any; + + /** + * Report progress on a job + */ + progress(value: any): Promise; + + /** + * Removes a job from the queue and from any lists it may be included in. + * @returns {Promise} A promise that resolves when the job is removed. + */ + remove(): Promise; + + /** + * Re-run a job that has failed. + * @returns {Promise} A promise that resolves when the job is scheduled for retry. + */ + retry(): Promise; + + /** + * Returns a promise the resolves when the job has been finished. + * TODO: Add a watchdog to check if the job has finished periodically. + * since pubsub does not give any guarantees. + */ + finished(): Promise; + } + + type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed'; + + interface BackoffOptions { + /** + * Backoff type, which can be either `fixed` or `exponential` + */ + type: 'fixed' | 'exponential'; + + /** + * Backoff delay, in milliseconds + */ + delay: number; + } + + interface RepeatOptions { + /** + * Cron pattern specifying when the job should execute + */ + cron: string; + + /** + * Timezone + */ + tz?: string; + + /** + * End date when the repeat job should stop repeating + */ + endDate?: Date | string | number; + } + + interface JobOptions { + /** + * Optional priority value. ranges from 1 (highest priority) to MAX_INT (lowest priority). + * Note that using priorities has a slight impact on performance, so do not use it if not required + */ + priority?: number; + + /** + * An amount of miliseconds to wait until this job can be processed. + * Note that for accurate delays, both server and clients should have their clocks synchronized. [optional] + */ + delay?: number; + + /** + * The total number of attempts to try the job until it completes + */ + attempts?: number; + + /** + * Repeat job according to a cron specification + */ + repeat?: RepeatOptions; + + /** + * Backoff setting for automatic retries if the job fails + */ + backoff?: number | BackoffOptions; + + /** + * A boolean which, if true, adds the job to the right + * of the queue instead of the left (default false) + */ + lifo?: boolean; + + /** + * The number of milliseconds after which the job should be fail with a timeout error + */ + timeout?: number; + + /** + * Override the job ID - by default, the job ID is a unique + * integer, but you can use this setting to override it. + * If you use this option, it is up to you to ensure the + * jobId is unique. If you attempt to add a job with an id that + * already exists, it will not be added. + */ + jobId?: JobId; + + /** + * A boolean which, if true, removes the job when it successfully completes. + * Default behavior is to keep the job in the completed set. + */ + removeOnComplete?: boolean; + + /** + * A boolean which, if true, removes the job when it fails after all attempts + * Default behavior is to keep the job in the completed set. + */ + removeOnFail?: boolean; + } + + interface JobCounts { + wait: number; + active: number; + completed: number; + failed: number; + delayed: number; + } + + interface Queue { + /** + * Returns a promise that resolves when Redis is connected and the queue is ready to accept jobs. + * This replaces the `ready` event emitted on Queue in previous verisons. + */ + isReady(): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + */ + process(callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job) => void): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + */ + process(callback: (job: Job) => void): Promise; + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: any, opts?: JobOptions): Promise; + + /** + * Returns a promise that resolves when the queue is paused. + * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. + * A paused queue will not process new jobs until resumed, + * but current jobs being processed will continue until they are finalized. + * + * Pausing a queue that is already paused does nothing. + */ + pause(): Promise; + + /** + * Returns a promise that resolves when the queue is resumed after being paused. + * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * Resuming a queue that is not paused does nothing. + */ + resume(): Promise; + + /** + * Returns a promise that returns the number of jobs in the queue, waiting or paused. + * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. + */ + count(): Promise; + + /** + * Empties a queue deleting all the input lists and associated jobs. + */ + empty(): Promise; + + /** + * Closes the underlying redis client. Use this to perform a graceful shutdown. + * + * `close` can be called from anywhere, with one caveat: + * if called from within a job handler the queue won't close until after the job has been processed + */ + close(): Promise; + + /** + * Returns a promise that will return the job instance associated with the jobId parameter. + * If the specified job cannot be located, the promise callback parameter will be set to null. + */ + getJob(jobId: JobId): Promise; + + /** + * Returns a promise that resolves with the job counts for the given queue + */ + getJobCounts(): Promise; + + /** + * Tells the queue remove all jobs created outside of a grace period in milliseconds. + * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + */ + clean(grace: number, status?: JobStatus, limit?: number): Promise; + + // tslint:disable:unified-signatures + + /** + * Listens to queue events + */ + on(event: string, callback: (...args: any[]) => void): this; + + /** + * An error occured + */ + on(event: 'error', callback: ErrorEventCallback): this; + + /** + * A job has started. You can use `jobPromise.cancel()` to abort it + */ + on(event: 'active', callback: ActiveEventCallback): this; + + /** + * A job has been marked as stalled. + * This is useful for debugging job workers that crash or pause the event loop. + */ + on(event: 'stalled', callback: StalledEventCallback): this; + + /** + * A job's progress was updated + */ + on(event: 'progress', callback: ProgressEventCallback): this; + + /** + * A job successfully completed with a `result` + */ + on(event: 'completed', callback: CompletedEventCallback): this; + + /** + * A job failed with `err` as the reason + */ + on(event: 'failed', callback: FailedEventCallback): this; + + /** + * The queue has been paused + */ + on(event: 'paused', callback: EventCallback): this; + + /** + * The queue has been resumed + */ + on(event: 'resumed', callback: EventCallback): this; + + /** + * Old jobs have been cleaned from the queue. + * `jobs` is an array of jobs that were removed, and `type` is the type of those jobs. + * + * @see Queue#clean() for details + */ + on(event: 'cleaned', callback: CleanedEventCallback): this; + + // tslint:enable:unified-signatures + } + + type EventCallback = () => void; + + type ErrorEventCallback = (error: Error) => void; + + interface JobPromise { + /** + * Abort this job + */ + cancel(): void; + } + + type ActiveEventCallback = (job: Job, jobPromise?: JobPromise) => void; + + type StalledEventCallback = (job: Job) => void; + + type ProgressEventCallback = (job: Job, progress: any) => void; + + type CompletedEventCallback = (job: Job, result: any) => void; + + type FailedEventCallback = (job: Job, error: Error) => void; + + type CleanedEventCallback = (jobs: Job[], status: JobStatus) => void; } + +export = Bull; diff --git a/types/bull/tsconfig.json b/types/bull/tsconfig.json index 56a53750f3..0751a977c1 100644 --- a/types/bull/tsconfig.json +++ b/types/bull/tsconfig.json @@ -1,16 +1,12 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": [ "es6" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": [ "../" ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/bull/tslint.json b/types/bull/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/bull/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/bull/v2/bull-tests.tsx b/types/bull/v2/bull-tests.tsx new file mode 100644 index 0000000000..fcf339b3c3 --- /dev/null +++ b/types/bull/v2/bull-tests.tsx @@ -0,0 +1,115 @@ +/** + * Created by Bruno Grieder + */ + +import * as Queue from "bull" + +var videoQueue = Queue( 'video transcoding', 6379, '127.0.0.1' ); +var audioQueue = Queue( 'audio transcoding', 6379, '127.0.0.1' ); +var imageQueue = Queue( 'image transcoding', 6379, '127.0.0.1' ); + +videoQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + + // job.data contains the custom data passed when the job was created + // job.jobId contains id of this job. + + // transcode video asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { framerate: 29.5 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +audioQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode audio asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { samplerate: 48000 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +imageQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode image asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { width: 1280, height: 720 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +videoQueue.add( { video: 'http://example.com/video1.mov' } ); +audioQueue.add( { audio: 'http://example.com/audio1.mp3' } ); +imageQueue.add( { image: 'http://example.com/image1.tiff' } ); + + +////////////////////////////////////////////////////////////////////////////////// +// +// Using Promises +// +////////////////////////////////////////////////////////////////////////////////// + +const fetchVideo = ( url: string ): Promise => { return null } +const transcodeVideo = ( data: any ): Promise => { return null } + +interface VideoJob extends Queue.Job { + data: {url: string} +} + + +videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done callback! + // Simply return a promise + fetchVideo( job.data.url ).then( transcodeVideo ); + + // Handles promise rejection + Promise.reject( new Error( 'error transcoding' ) ); + + // Passes the value the promise is resolved with to the "completed" event + Promise.resolve( { framerate: 29.5 /* etc... */ } ); + + // same as + Promise.reject( new Error( 'some unexpected error' ) ); + + // If the job throws an unhandled exception it is also handled correctly + throw new Error( 'some unexpected error' ); +} ); + + +var addVideo1Job = videoQueue.add( { video: 'http://example.com/video1.mov' } ); + +addVideo1Job.then((video1Job) => { + // When job has successfully be placed in the queue the job is returned + // then wait for completion + return video1Job.finished(); +}) +.then(() => { + // video1Job completed successfully +}) +.catch((err) => { + // error +}); diff --git a/types/bull/v2/index.d.ts b/types/bull/v2/index.d.ts new file mode 100644 index 0000000000..3c89655101 --- /dev/null +++ b/types/bull/v2/index.d.ts @@ -0,0 +1,316 @@ +// Type definitions for bull 2.1.2 +// Project: https://github.com/OptimalBits/bull +// Definitions by: Bruno Grieder , Cameron Crothers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "bull" { + + import * as Redis from "redis"; + + /** + * This is the Queue constructor. + * It creates a new Queue that is persisted in Redis. + * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. + */ + function Bull(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): Bull.Queue; + + namespace Bull { + + export interface DoneCallback { + (error?: Error, value?: any): void + } + + export interface Job { + + jobId: string + + /** + * The custom data passed when the job was created + */ + data: Object; + + /** + * Report progress on a job + */ + progress(value: any): Promise; + + /** + * Removes a Job from the queue from all the lists where it may be included. + * @returns {Promise} A promise that resolves when the job is removed. + */ + remove(): Promise; + + /** + * Rerun a Job that has failed. + * @returns {Promise} A promise that resolves when the job is scheduled for retry. + */ + retry(): Promise; + + /** + * Returns a promise the resolves when the job has been finished. + * TODO: Add a watchdog to check if the job has finished periodically. + * since pubsub does not give any guarantees. + */ + finished(): Promise; + } + + export interface Backoff { + + /** + * Backoff type, which can be either `fixed` or `exponential` + */ + type: string + + /** + * Backoff delay, in milliseconds + */ + delay: number; + } + + export interface AddOptions { + /** + * An amount of miliseconds to wait until this job can be processed. + * Note that for accurate delays, both server and clients should have their clocks synchronized + */ + delay?: number; + + /** + * A number of attempts to retry if the job fails [optional] + */ + attempts?: number; + + /** + * Backoff setting for automatic retries if the job fails + */ + backoff?: number | Backoff + + /** + * A boolean which, if true, adds the job to the right + * of the queue instead of the left (default false) + */ + lifo?: boolean; + + /** + * The number of milliseconds after which the job should be fail with a timeout error + */ + timeout?: number; + } + + export interface Queue { + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + */ + process(callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job) => void): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + */ + process(callback: (job: Job) => void): Promise; + + // process(callback: (job: Job, done?: DoneCallback) => void): Promise; + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: AddOptions): Promise; + + /** + * Returns a promise that resolves when the queue is paused. + * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. + * A paused queue will not process new jobs until resumed, + * but current jobs being processed will continue until they are finalized. + * + * Pausing a queue that is already paused does nothing. + */ + pause(): Promise; + + /** + * Returns a promise that resolves when the queue is resumed after being paused. + * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * Resuming a queue that is not paused does nothing. + */ + resume(): Promise; + + /** + * Returns a promise that returns the number of jobs in the queue, waiting or paused. + * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. + */ + count(): Promise; + + /** + * Empties a queue deleting all the input lists and associated jobs. + */ + empty(): Promise; + + /** + * Closes the underlying redis client. Use this to perform a graceful shutdown. + * + * `close` can be called from anywhere, with one caveat: + * if called from within a job handler the queue won't close until after the job has been processed + */ + close(): Promise; + + /** + * Returns a promise that will return the job instance associated with the jobId parameter. + * If the specified job cannot be located, the promise callback parameter will be set to null. + */ + getJob(jobId: string): Promise; + + /** + * Tells the queue remove all jobs created outside of a grace period in milliseconds. + * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + */ + clean(gracePeriod: number, jobsState?: string): Promise; + + /** + * Listens to queue events + * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' + */ + on(eventName: string, callback: EventCallback): void; + } + + interface EventCallback { + (...args: any[]): void + } + + interface ReadyEventCallback extends EventCallback { + (): void; + } + + interface ErrorEventCallback extends EventCallback { + (error: Error): void; + } + + interface JobPromise { + /** + * Abort this job + */ + cancel(): void + } + + interface ActiveEventCallback extends EventCallback { + (job: Job, jobPromise: JobPromise): void; + } + + interface ProgressEventCallback extends EventCallback { + (job: Job, progress: any): void; + } + + interface CompletedEventCallback extends EventCallback { + (job: Job, result: Object): void; + } + + interface FailedEventCallback extends EventCallback { + (job: Job, error: Error): void; + } + + interface PausedEventCallback extends EventCallback { + (): void; + } + + interface ResumedEventCallback extends EventCallback { + (job?: Job): void; + } + + /** + * @see clean() for details + */ + interface CleanedEventCallback extends EventCallback { + (jobs: Job[], type: string): void; + } + } + + export = Bull; +} + +declare module "bull/lib/priority-queue" { + + import * as Bull from "bull"; + import * as Redis from "redis"; + + /** + * This is the Queue constructor of priority queue. + * + * It works same a normal queue, with same function and parameters. + * The only difference is that the Queue#add() allow an options opts.priority + * that could take ["low", "normal", "medium", "hight", "critical"]. If no options provider, "normal" will be taken. + * + * The priority queue will process more often highter priority jobs than lower. + */ + function PQueue(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): PQueue.PriorityQueue; + + namespace PQueue { + + export interface AddOptions extends Bull.AddOptions { + + /** + * "low", "normal", "medium", "high", "critical" + */ + priority?: string; + } + + + export interface PriorityQueue extends Bull.Queue { + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: PQueue.AddOptions): Promise; + + } + } + + export = PQueue; +} diff --git a/types/bull/v2/tsconfig.json b/types/bull/v2/tsconfig.json new file mode 100644 index 0000000000..12445fc199 --- /dev/null +++ b/types/bull/v2/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ "es6" ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ "../../" ], + "types": [], + "paths": { + "bull": [ "bull/v2" ], + "bull/*": [ "bull/v2/*" ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bull-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/bunnymq/bunnymq-tests.ts b/types/bunnymq/bunnymq-tests.ts index 4105363f25..960c0b6949 100644 --- a/types/bunnymq/bunnymq-tests.ts +++ b/types/bunnymq/bunnymq-tests.ts @@ -1,34 +1,27 @@ import * as bunnymq from "bunnymq"; // Basic usage -var instance = bunnymq({ host: 'amqp://localhost' }); +const instance = bunnymq({ host: "amqp://localhost" }); // Publisher -instance.producer.produce('queue:name', 'Hello World!'); +instance.publish("queue:name", "message"); +instance.producer.produce("queue:name", "message"); + // Subscriber -instance.consumer.consume('queue:name', message => { }); +instance.subscribe("queue:name", (message: string) => "response"); +instance.consumer.consume("queue:name", (message: string) => "response"); // RPC Support -instance.producer.produce('queue:name', { message: 'content' }, { rpc: true }) - .then(function (consumerResponse) { - console.log(consumerResponse); - }); - -// Routing keys -instance.producer.produce('queue:name', { message: 'content' }, { routingKey: 'my-routing-key' }); +instance.publish("queue:name", { message: "content" }, { routingKey: "my-routing-key", rpc: true, timeout: 1000 }).then((consumerResponse: string) => "response"); +instance.producer.produce("queue:name", { message: "content" }, { rpc: true, routingKey: "my-routing-key", timeout: 1000 }); // Config -var custom = bunnymq({ - host: 'amqp://localhost', - //number of fetched messages at once on the channel +const instanceWithCustomOptions = bunnymq({ + host: "amqp://localhost", prefetch: 5, - //requeue put back message into the broker if consumer crashes/trigger exception requeue: true, - //time between two reconnect (ms) timeout: 1000, - consumerSuffix: '', - //generate a hostname so we can track this connection on the broker (rabbitmq management plugin) + consumerSuffix: "", hostname: "", - //the transport to use to debug. if provided, bunnymq will show some logs transport: new Object() -}); \ No newline at end of file +}); diff --git a/types/bunnymq/index.d.ts b/types/bunnymq/index.d.ts index 1167db21ed..c4c0a770e1 100644 --- a/types/bunnymq/index.d.ts +++ b/types/bunnymq/index.d.ts @@ -1,120 +1,98 @@ -// Type definitions for node-bunnymq 2.2.1 +// Type definitions for node-bunnymq 2.3 // Project: https://github.com/dial-once/node-bunnymq // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "bunnymq" { - namespace bunnymq { - export type ConsumerCallback = (message: Object) => void; +declare function bunnymq(options?: bunnymq.Options): bunnymq.Instance; +declare namespace bunnymq { + type ConsumerCallback = (...args: any[]) => T; + type LoggerOutput = (format: any, ...args: any[]) => void; - /** - * Consumer. - * @interface - */ - export interface Consumer { - /** - * Handle messages from a named queue. - * @param {string} queue A named queue. - * @param {ConsumerCallback} callback A callback. - */ - consume(queue: string, callback: ConsumerCallback): void; - } - - /** - * bunnymq instance. - * @interface - */ - export interface Instance { - /** - * Consumer. - * @type {Consumer} - */ - consumer: Consumer; - - /** - * Producer. - * @type {Producer} - */ - producer: Producer; - } - - /** - * Options. - * @interface - */ - export interface Options { - /** - * Consumer suffix. - * @type {string} - */ - consumerSuffix?: string; - - /** - * Host. - * @type {string} - */ - host?: string; - - /** - * Hostname. - * @type {string} - */ - hostname?: string; - - /** - * Number of fetched messages at once on the channel. - * @type {number} - */ - prefetch?: number; - - /** - * Requeue put back message into the broker if consumer crashes/trigger exception. - * @type {boolean} - */ - requeue?: boolean; - - /** - * Time between two reconnect (in milliseconds). - * @type {number} - */ - timeout?: number; - - /** - * Transport. - * @type {any} - */ - transport?: any; - } - - /** - * Producer. - * @inteface - */ - export interface Producer { - /** - * Send messages to a named queue. - * @param {string} queue A named queue. - * @param {Object} message A message. - * @return {Object} The consumer response. - */ - produce(queue: string, message: Object, options?: ProducerOptions): PromiseLike; - } - - /** - * Options for producer. - * @interface - */ - export interface ProducerOptions { - routingKey?: string; - rpc?: boolean; - } + interface Connection { + [address: string]: any; + startedAt: string; } - /** - * Constructor. - * @param {Options} [options] Options. - * @return {Instance} A instance of bunnymq. - */ - function bunnymq(options?: bunnymq.Options): bunnymq.Instance; - export = bunnymq; + interface Consumer { + /** + * Handle messages from a named queue. + * + * @param {string} queue A named queue. + * @param {ConsumerCallback} callback A callback. + */ + consume(queue: string, callback: ConsumerCallback): void; + } + + interface Instance { + connection: Connection; + consumer: Consumer; + producer: Producer; + + /** + * Subscriber to handle messages from a named queue. + * + * @param {string} queue A named queue. + * @param {ConsumerCallback} callback A callback. + */ + subscribe(queueName: string, callback: ConsumerCallback): void; + + /** + * Publisher to send messages to a named queue. + * + * @type {Producer} + * @return {Promise} The consumer response. + */ + publish(queueName: string, message: any, options?: ProducerOptions): Promise; + } + + interface Logger { + debug: LoggerOutput; + error: LoggerOutput; + info: LoggerOutput; + log: LoggerOutput; + warn: LoggerOutput; + } + + interface Options { + consumerSuffix?: string; + host?: string; + hostname?: string; + + /** + * Number of fetched messages at once on the channel. + * + * @type {number} + */ + prefetch?: number; + + /** + * Requeue put back message into the broker if consumer crashes/trigger exception. + * + * @type {boolean} + */ + requeue?: boolean; + rpcTimeout?: number; + timeout?: number; + transport?: any; + } + + interface Producer { + /** + * Send messages to a named queue. + * + * @param {string} queue A named queue. + * @param {any} message A message. + * @return {Promise} The consumer response. + */ + produce(queue: string, message: any, options?: ProducerOptions): Promise; + } + + interface ProducerOptions { + routingKey?: string; + rpc?: boolean; + timeout?: number; + } } + +export = bunnymq; +export as namespace bunnymq; diff --git a/types/bunnymq/tslint.json b/types/bunnymq/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bunnymq/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/c3/c3-tests.ts b/types/c3/c3-tests.ts index 58f45d3df5..029946c710 100644 --- a/types/c3/c3-tests.ts +++ b/types/c3/c3-tests.ts @@ -1,11 +1,9 @@ - - ////////////////// // Doc Examples ////////////////// function chart_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, bindto: "#myContainer", size: { @@ -24,27 +22,27 @@ function chart_examples() { transition: { duration: 500 }, - oninit: function() { /* code*/ }, - onrendered: function() { /* code*/ }, - onmouseover: function() { /* code*/ }, - onmouseout: function() { /* code*/ }, - onresize: function() { /* code*/ }, - onresized: function() { /* code*/ } + oninit: () => { /* code*/ }, + onrendered: () => { /* code*/ }, + onmouseover: () => { /* code*/ }, + onmouseout: () => { /* code*/ }, + onresize: () => { /* code*/ }, + onresized: () => { /* code*/ } }); - var chart2 = c3.generate({ + let chart2 = c3.generate({ bindto: document.getElementById("myContainer"), data: {} }); - var chart3 = c3.generate({ + let chart3 = c3.generate({ bindto: d3.select("#myContainer"), data: {} }); } function data_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: { url: "/data/c3_test.csv", json: [ @@ -102,9 +100,9 @@ function data_examples() { labels: true, order: "asc", regions: { - data1: [{ "start": 1, "end": 2, "style": "dashed" }, { "start": 3 }], + data1: [{ start: 1, end: 2, style: "dashed" }, { start: 3 }], }, - color: function(color, d) { return "#ff0000"; }, + color: (color, d) => "#ff0000", colors: { data1: "#ff0000" /* ... */ @@ -120,24 +118,24 @@ function data_examples() { grouped: true, multiple: true, draggable: true, - isselectable: function(d) { return true; } + isselectable: (d) => true }, - onclick: function(d, element) { /* code */ }, - onmouseover: function(d) { /* code */ }, - onmouseout: function(d) { /* code */ } + onclick: (d, element) => { /* code */ }, + onmouseover: (d) => { /* code */ }, + onmouseout: (d) => { /* code */ } } }); - var chart2 = c3.generate({ + let chart2 = c3.generate({ data: { - labels: { format: function(v, id, i, j) { /* code */ } }, + labels: { format: (v, id, i, j) => { /* code */ } }, hide: ["data1"] } }); } function axis_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, axis: { rotated: true, @@ -148,7 +146,7 @@ function axis_examples() { categories: ["Category 1", "Category 2"], tick: { centered: true, - format: function(x: Date) { return x.getFullYear(); }, + format: (x: Date) => x.getFullYear(), culling: false, count: 5, fit: true, @@ -209,7 +207,7 @@ function axis_examples() { } }); - var chart2 = c3.generate({ + let chart2 = c3.generate({ data: {}, axis: { x: { @@ -229,7 +227,7 @@ function axis_examples() { position: "outer-middle", }, tick: { - format: function(d) { return "$" + d; } + format: (d) => "$" + d } }, y2: { @@ -243,7 +241,7 @@ function axis_examples() { } function grid_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, grid: { x: { @@ -267,7 +265,7 @@ function grid_examples() { } function region_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, regions: [ { axis: "x", start: 1, end: 4, class: "region-1-4" }, @@ -276,7 +274,7 @@ function region_examples() { } function legend_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, legend: { show: true, @@ -289,14 +287,14 @@ function legend_examples() { step: undefined }, item: { - onclick: function(id) { /* code */ }, - onmouseover: function(id) { /* code */ }, - onmouseout: function(id) { /* code */ }, + onclick: (id) => { /* code */ }, + onmouseover: (id) => { /* code */ }, + onmouseout: (id) => { /* code */ }, } } }); - var chart2 = c3.generate({ + let chart2 = c3.generate({ data: {}, legend: { hide: "data1", @@ -309,7 +307,7 @@ function legend_examples() { } }); - var chart3 = c3.generate({ + let chart3 = c3.generate({ data: {}, legend: { hide: ["data1", "data2"] @@ -318,34 +316,34 @@ function legend_examples() { } function subchart_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, subchart: { show: true, size: { height: 20 }, - onbrush: function(domain) { /* code */ } + onbrush: (domain) => { /* code */ } } }); } function zoom_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, zoom: { enabled: false, rescale: true, extent: [1, 100], // enable more zooming - onzoom: function(domain) { /* code */ }, - onzoomstart: function(event) { /* code */ }, - onzoomend: function(domain) { /* code */ } + onzoom: (domain) => { /* code */ }, + onzoomstart: (event) => { /* code */ }, + onzoomend: (domain) => { /* code */ } } }); } function point_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, point: { show: false, @@ -364,7 +362,7 @@ function point_examples() { } function line_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, line: { connectNull: true, @@ -376,7 +374,7 @@ function line_examples() { } function area_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, area: { zerobased: false @@ -385,7 +383,7 @@ function area_examples() { } function bar_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, bar: { width: 10, @@ -393,7 +391,7 @@ function bar_examples() { } }); - var chart2 = c3.generate({ + let chart2 = c3.generate({ data: {}, bar: { width: { @@ -405,12 +403,12 @@ function bar_examples() { } function pie_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, pie: { label: { show: false, - format: function(value, ratio, id) { + format: (value, ratio, id) => { return d3.format("$")(value); }, threshold: 0.1 @@ -421,12 +419,12 @@ function pie_examples() { } function donut_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, donut: { label: { show: false, - format: function(value, ratio, id) { + format: (value, ratio, id) => { return d3.format("$")(value); }, threshold: 0.05 @@ -439,12 +437,12 @@ function donut_examples() { } function gauge_examples() { - var chart = c3.generate({ + let chart = c3.generate({ data: {}, gauge: { label: { show: false, - format: function(value, ratio) { + format: (value, ratio) => { return d3.format("$")(value); } }, @@ -462,8 +460,7 @@ function gauge_examples() { ///////////////// function simple_multiple() { - - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -481,10 +478,10 @@ function simple_multiple() { chart.unload({ ids: "data1" }); -}; +} function timeseries() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", xFormat: "%Y%m%d", // 'xFormat' can be used as custom format of 'x' @@ -506,7 +503,7 @@ function timeseries() { } function chart_spline() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -518,7 +515,7 @@ function chart_spline() { } function simple_xy() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -531,11 +528,11 @@ function simple_xy() { } function simple_xy_multiple() { - var chart = c3.generate({ + let chart = c3.generate({ data: { xs: { - "data1": "x1", - "data2": "x2", + data1: "x1", + data2: "x2", }, columns: [ ["x1", 10, 30, 45, 50, 70, 100], @@ -548,22 +545,22 @@ function simple_xy_multiple() { } function simple_regions() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], ["data2", 50, 20, 10, 40, 15, 25] ], regions: { - "data1": [{ "start": 1, "end": 2, "style": "dashed" }, { "start": 3 }], // currently 'dashed' style only - "data2": [{ "end": 3 }] + data1: [{ start: 1, end: 2, style: "dashed" }, { start: 3 }], // currently 'dashed' style only + data2: [{ end: 3 }] } } }); } function chart_step() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 300, 350, 300, 0, 0, 100], @@ -578,7 +575,7 @@ function chart_step() { } function area_chart() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 300, 350, 300, 0, 0, 0], @@ -593,7 +590,7 @@ function area_chart() { } function chart_area_stacked() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 300, 350, 300, 0, 0, 120], @@ -610,7 +607,7 @@ function chart_area_stacked() { } function chart_bar() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -624,13 +621,13 @@ function chart_bar() { max: 50 // this limits maximum width of bar to 50px } // or - //width: 100 // this makes bar width 100px + // width: 100 // this makes bar width 100px } }); } function chart_bar_stacked() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", -30, 200, 200, 400, -150, 250], @@ -651,7 +648,7 @@ function chart_bar_stacked() { } function chart_scatter() { - var chart = c3.generate({ + let chart = c3.generate({ data: { xs: { setosa: "setosa_x", @@ -659,10 +656,14 @@ function chart_scatter() { }, // iris data from R columns: [ - ["setosa_x", 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3.0, 3.0, 4.0, 4.4, 3.9, 3.5, 3.8, 3.8, 3.4, 3.7, 3.6, 3.3, 3.4, 3.0, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, 4.1, 4.2, 3.1, 3.2, 3.5, 3.6, 3.0, 3.4, 3.5, 2.3, 3.2, 3.5, 3.8, 3.0, 3.8, 3.2, 3.7, 3.3], - ["versicolor_x", 3.2, 3.2, 3.1, 2.3, 2.8, 2.8, 3.3, 2.4, 2.9, 2.7, 2.0, 3.0, 2.2, 2.9, 2.9, 3.1, 3.0, 2.7, 2.2, 2.5, 3.2, 2.8, 2.5, 2.8, 2.9, 3.0, 2.8, 3.0, 2.9, 2.6, 2.4, 2.4, 2.7, 2.7, 3.0, 3.4, 3.1, 2.3, 3.0, 2.5, 2.6, 3.0, 2.6, 2.3, 2.7, 3.0, 2.9, 2.9, 2.5, 2.8], - ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], - ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3], + ["setosa_x", 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3.0, 3.0, 4.0, 4.4, 3.9, 3.5, 3.8, 3.8, 3.4, 3.7, 3.6, 3.3, 3.4, 3.0, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, + 4.1, 4.2, 3.1, 3.2, 3.5, 3.6, 3.0, 3.4, 3.5, 2.3, 3.2, 3.5, 3.8, 3.0, 3.8, 3.2, 3.7, 3.3], + ["versicolor_x", 3.2, 3.2, 3.1, 2.3, 2.8, 2.8, 3.3, 2.4, 2.9, 2.7, 2.0, 3.0, 2.2, 2.9, 2.9, 3.1, 3.0, 2.7, 2.2, 2.5, 3.2, 2.8, 2.5, 2.8, 2.9, 3.0, 2.8, 3.0, 2.9, 2.6, 2.4, + 2.4, 2.7, 2.7, 3.0, 3.4, 3.1, 2.3, 3.0, 2.5, 2.6, 3.0, 2.6, 2.3, 2.7, 3.0, 2.9, 2.9, 2.5, 2.8], + ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, + 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], + ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, + 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3], ], type: "scatter" }, @@ -681,7 +682,7 @@ function chart_scatter() { } function chart_pie() { - var chart = c3.generate({ + let chart = c3.generate({ data: { // iris data from R columns: [ @@ -689,24 +690,24 @@ function chart_pie() { ["data2", 120], ], type: "pie", - onclick: function(d, i) { console.log("onclick", d, i); }, - onmouseover: function(d, i) { console.log("onmouseover", d, i); }, - onmouseout: function(d, i) { console.log("onmouseout", d, i); } + onclick: (d, i) => { console.log("onclick", d, i); }, + onmouseover: (d, i) => { console.log("onmouseover", d, i); }, + onmouseout: (d, i) => { console.log("onmouseout", d, i); } } }); } function chart_donut() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30], ["data2", 120], ], type: "donut", - onclick: function(d, i) { console.log("onclick", d, i); }, - onmouseover: function(d, i) { console.log("onmouseover", d, i); }, - onmouseout: function(d, i) { console.log("onmouseout", d, i); } + onclick: (d, i) => { console.log("onclick", d, i); }, + onmouseover: (d, i) => { console.log("onmouseover", d, i); }, + onmouseout: (d, i) => { console.log("onmouseout", d, i); } }, donut: { title: "Iris Petal Width" @@ -715,19 +716,19 @@ function chart_donut() { } function gauge_chart() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data", 91.4] ], type: "gauge", - onclick: function(d, i) { console.log("onclick", d, i); }, - onmouseover: function(d, i) { console.log("onmouseover", d, i); }, - onmouseout: function(d, i) { console.log("onmouseout", d, i); } + onclick: (d, i) => { console.log("onclick", d, i); }, + onmouseover: (d, i) => { console.log("onmouseover", d, i); }, + onmouseout: (d, i) => { console.log("onmouseout", d, i); } }, gauge: { label: { - format: function(value, ratio) { + format: (value, ratio) => { return value; }, show: false // to turn off the min/max labels. @@ -752,7 +753,7 @@ function gauge_chart() { } function chart_combination() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -780,7 +781,7 @@ function chart_combination() { //////////////////// function categorized() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250, 50, 100, 250] @@ -796,7 +797,7 @@ function categorized() { } function axes_rotated() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -813,7 +814,7 @@ function axes_rotated() { } function axes_y2() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -833,7 +834,7 @@ function axes_y2() { } function axes_x_tick_format() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -845,8 +846,8 @@ function axes_x_tick_format() { x: { type: "timeseries", tick: { - format: function(x: Date) { return x.getFullYear(); } - //format: '%Y' // format string is also available for timeseries data + format: (x: Date) => x.getFullYear() + // format: '%Y' // format string is also available for timeseries data } } } @@ -854,7 +855,7 @@ function axes_x_tick_format() { } function axes_x_tick_count() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -875,7 +876,7 @@ function axes_x_tick_count() { } function axes_x_tick_values() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -896,7 +897,7 @@ function axes_x_tick_values() { } function axes_x_tick_culling() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250] @@ -918,7 +919,7 @@ function axes_x_tick_culling() { } function axes_x_tick_fit() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -939,7 +940,7 @@ function axes_x_tick_fit() { } function axes_x_localtime() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", xFormat: "%Y", @@ -965,11 +966,12 @@ function axes_x_localtime() { } function axes_x_tick_rotate() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ - ["x", "www.somesitename1.com", "www.somesitename2.com", "www.somesitename3.com", "www.somesitename4.com", "www.somesitename5.com", "www.somesitename6.com", "www.somesitename7.com", "www.somesitename8.com", "www.somesitename9.com", "www.somesitename10.com", "www.somesitename11.com", "www.somesitename12.com"], + ["x", "www.somesitename1.com", "www.somesitename2.com", "www.somesitename3.com", "www.somesitename4.com", "www.somesitename5.com", "www.somesitename6.com", "www.somesitename7.com", + "www.somesitename8.com", "www.somesitename9.com", "www.somesitename10.com", "www.somesitename11.com", "www.somesitename12.com"], ["pv", 90, 100, 140, 200, 100, 400, 90, 100, 140, 200, 100, 400], ], type: "bar" @@ -988,7 +990,7 @@ function axes_x_tick_rotate() { } function axes_y_tick_format() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 2500] @@ -998,7 +1000,7 @@ function axes_y_tick_format() { y: { tick: { format: d3.format("$,") - // format: function (d) { return "$" + d; } + // format: (d) => { return "$" + d; } } } } @@ -1006,7 +1008,7 @@ function axes_y_tick_format() { } function axes_y_padding() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1030,7 +1032,7 @@ function axes_y_padding() { } function axes_y_range() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1048,7 +1050,7 @@ function axes_y_range() { } function axes_label() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250], @@ -1074,7 +1076,7 @@ function axes_label() { } function axes_label_position() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample1", 30, 200, 100, 400, 150, 250], @@ -1132,7 +1134,7 @@ function axes_label_position() { /////////////////// function data_columned() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -1144,7 +1146,7 @@ function data_columned() { } function data_rowed() { - var chart = c3.generate({ + let chart = c3.generate({ data: { rows: [ ["data1", "data2", "data3"], @@ -1160,7 +1162,7 @@ function data_rowed() { } function data_json() { - var chart = c3.generate({ + let chart = c3.generate({ data: { json: { data1: [30, 20, 50, 40, 60, 50], @@ -1170,7 +1172,7 @@ function data_json() { } }); - setTimeout(function() { + setTimeout(() => { chart = c3.generate({ data: { json: [ @@ -1192,7 +1194,7 @@ function data_json() { }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.load({ json: [ { name: "www.site1.com", upload: 800, download: 500, total: 400 }, @@ -1208,13 +1210,13 @@ function data_json() { } function data_url() { - var chart = c3.generate({ + let chart = c3.generate({ data: { url: "/data/c3_test.csv" } }); - setTimeout(function() { + setTimeout(() => { c3.generate({ data: { url: "/data/c3_test.json", @@ -1225,7 +1227,7 @@ function data_url() { } function data_stringx() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -1245,7 +1247,7 @@ function data_stringx() { } }); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["x", "www.siteA.com", "www.siteB.com", "www.siteC.com", "www.siteD.com"], @@ -1255,7 +1257,7 @@ function data_stringx() { }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["x", "www.siteE.com", "www.siteF.com", "www.siteG.com"], @@ -1265,7 +1267,7 @@ function data_stringx() { }); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["x", "www.site1.com", "www.site2.com", "www.site3.com", "www.site4.com"], @@ -1275,7 +1277,7 @@ function data_stringx() { }); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["download", 30, 30, 20, 170], @@ -1284,7 +1286,7 @@ function data_stringx() { }); }, 4000); - setTimeout(function() { + setTimeout(() => { chart.load({ url: "/data/c3_string_x.csv" }); @@ -1292,20 +1294,20 @@ function data_stringx() { } function data_load() { - var chart = c3.generate({ + let chart = c3.generate({ data: { url: "/data/c3_test.csv", type: "line" } }); - setTimeout(function() { + setTimeout(() => { chart.load({ url: "/data/c3_test2.csv" }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data1", 130, 120, 150, 140, 160, 150], @@ -1315,7 +1317,7 @@ function data_load() { }); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.load({ rows: [ ["data2", "data3"], @@ -1330,7 +1332,7 @@ function data_load() { }); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data4", 30, 20, 50, 40, 60, 50, 100, 200] @@ -1339,13 +1341,13 @@ function data_load() { }); }, 4000); - setTimeout(function() { + setTimeout(() => { chart.unload({ ids: "data4" }); }, 5000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data2", null, 30, 20, 50, 40, 60, 50] @@ -1353,11 +1355,11 @@ function data_load() { }); }, 6000); - setTimeout(function() { + setTimeout(() => { chart.unload(); }, 7000); - setTimeout(function() { + setTimeout(() => { chart.load({ rows: [ ["data4", "data2", "data3"], @@ -1372,7 +1374,7 @@ function data_load() { }); }, 8000); - setTimeout(function() { + setTimeout(() => { chart.load({ rows: [ ["data5", "data6"], @@ -1387,7 +1389,7 @@ function data_load() { }); }, 9000); - setTimeout(function() { + setTimeout(() => { chart.unload({ ids: ["data2", "data3"] }); @@ -1395,7 +1397,7 @@ function data_load() { } function data_name() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1410,7 +1412,7 @@ function data_name() { } function data_color() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -1423,7 +1425,7 @@ function data_color() { data2: "#00ff00", data3: "#0000ff" }, - color: function(color, d) { + color: (color, d) => { // d will be 'id' when called for legends return d.id && d.id === "data3" ? d3.rgb(color).darker(d.value / 150) : color; } @@ -1432,7 +1434,7 @@ function data_color() { } function data_order() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 130, 200, 320, 400, 530, 750], @@ -1454,7 +1456,7 @@ function data_order() { } }); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data4", 1200, 1300, 1450, 1600, 1520, 1820], @@ -1462,7 +1464,7 @@ function data_order() { }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data5", 200, 300, 450, 600, 520, 820], @@ -1470,13 +1472,13 @@ function data_order() { }); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.groups([["data1", "data2", "data3", "data4", "data5"]]); }, 3000); } function data_label() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, -200, -100, 400, 150, 250], @@ -1498,7 +1500,7 @@ function data_label() { } function data_label_format() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, -200, -100, 400, 150, 250], @@ -1530,7 +1532,7 @@ function data_label_format() { /////////////////// function options_gridline() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250, 120, 200] @@ -1548,7 +1550,7 @@ function options_gridline() { } function grid_x_lines() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1567,7 +1569,7 @@ function grid_x_lines() { } function grid_y_lines() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250], @@ -1599,7 +1601,7 @@ function grid_y_lines() { /////////////////// function region() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250, 400], @@ -1629,7 +1631,7 @@ function region() { } function region_timeseries() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "date", columns: [ @@ -1655,7 +1657,7 @@ function region_timeseries() { ///////////////////// function options_subchart() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1668,10 +1670,11 @@ function options_subchart() { } function interaction_zoom() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ - ["sample", 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 150, 250, 150, 200, 170, 240, 100, 150, 250, 150, 200, 170, 240, 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 350, 220, 250, 300, 270, 140, 150, 90, 150, 50, 120, 70, 40] + ["sample", 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 150, 250, 150, 200, 170, 240, 100, 150, 250, 150, 200, 170, 240, 30, 200, 100, 400, 150, 250, 150, + 200, 170, 240, 350, 150, 100, 400, 350, 220, 250, 300, 270, 140, 150, 90, 150, 50, 120, 70, 40] ] }, zoom: { @@ -1685,7 +1688,7 @@ function interaction_zoom() { ///////////////////// function options_legend() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1698,7 +1701,7 @@ function options_legend() { } function legend_position() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1710,7 +1713,7 @@ function legend_position() { } }); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data3", 130, 150, 200, 300, 200, 100] @@ -1718,23 +1721,23 @@ function legend_position() { }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.unload({ ids: "data1" }); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("pie"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("line"); }, 4000); } function legend_custom() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 100], @@ -1755,21 +1758,22 @@ function legend_custom() { d3.select(".container").insert("div", ".chart").attr("class", "legend").selectAll("span") .data(["data1", "data2", "data3"]) .enter().append("span") - .attr("data-id", function(id) { return id; }) - .html(function(id) { return id; }) - .each(function(id) { + .attr("data-id", (id) => id) + .html((id) => id) + .each((id) => { + // this is most likely the wrong context now + // tslint:disable-next-line d3.select(this).style("background-color", chart.color(id)); }) - .on("mouseover", function(id) { + .on("mouseover", (id) => { chart.focus(id); }) - .on("mouseout", function(id) { + .on("mouseout", (id) => { chart.revert(); }) - .on("click", function(id) { + .on("click", (id) => { chart.toggle(id); }); - } ///////////////////// @@ -1777,7 +1781,7 @@ function legend_custom() { ///////////////////// function tooltip_show() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1791,7 +1795,7 @@ function tooltip_show() { } function tooltip_grouped() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1806,7 +1810,7 @@ function tooltip_grouped() { } function tooltip_format() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30000, 20000, 10000, 40000, 15000, 250000], @@ -1831,9 +1835,9 @@ function tooltip_format() { }, tooltip: { format: { - title: function(d: any) { return "Data " + d; }, - value: function(value: any, ratio: any, id: any) { - var format = id === "data1" ? d3.format(",") : d3.format("$"); + title: (d: any) => "Data " + d, + value: (value: any, ratio: any, id: any) => { + let format = id === "data1" ? d3.format(",") : d3.format("$"); return format(value); } // value: d3.format(",") // apply this format to both y and y2 @@ -1847,7 +1851,7 @@ function tooltip_format() { //////////////////////// function options_size() { - var chart = c3.generate({ + let chart = c3.generate({ size: { height: 240, width: 480 @@ -1861,7 +1865,7 @@ function options_size() { } function options_padding() { - var chart = c3.generate({ + let chart = c3.generate({ padding: { top: 40, right: 100, @@ -1877,7 +1881,7 @@ function options_padding() { } function options_color() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1889,13 +1893,14 @@ function options_color() { ] }, color: { - pattern: ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"] + pattern: ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", + "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"] } }); } function transition_duration() { - var chart = c3.generate({ + let chart = c3.generate({ data: { url: "/data/c3_test.csv" }, @@ -1904,13 +1909,13 @@ function transition_duration() { } }); - setTimeout(function() { + setTimeout(() => { chart.load({ url: "/data/c3_test2.csv" }); }, 500); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -1920,7 +1925,7 @@ function transition_duration() { }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.load({ rows: [ ["data1", "data2", "data3"], @@ -1934,7 +1939,7 @@ function transition_duration() { }); }, 1500); - setTimeout(function() { + setTimeout(() => { chart.load({ columns: [ ["data1", null, 30, 20, 50, 40, 60, 50, 100, 200] @@ -1948,7 +1953,7 @@ function transition_duration() { ///////////////////////////// function point_show() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1966,7 +1971,7 @@ function point_show() { //////////////////////////// function pie_label_format() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30], @@ -1976,7 +1981,7 @@ function pie_label_format() { }, pie: { label: { - format: function(value: any, ratio: any, id: any) { + format: (value: any, ratio: any, id: any) => { return d3.format("$")(value); } } @@ -1989,7 +1994,7 @@ function pie_label_format() { ///////////////////// function api_flow() { - var chart = c3.generate({ + let chart = c3.generate({ data: { x: "x", columns: [ @@ -2009,7 +2014,7 @@ function api_flow() { } }); - setTimeout(function() { + setTimeout(() => { chart.flow({ columns: [ ["x", "2013-01-11", "2013-01-21"], @@ -2018,7 +2023,7 @@ function api_flow() { ["data3", 200, 120], ], duration: 1500, - done: function() { + done: () => { chart.flow({ columns: [ ["x", "2013-02-11", "2013-02-12", "2013-02-13", "2013-02-14"], @@ -2028,7 +2033,7 @@ function api_flow() { ], length: 0, duration: 1500, - done: function() { + done: () => { chart.flow({ columns: [ ["x", "2013-03-01", "2013-03-02"], @@ -2038,7 +2043,7 @@ function api_flow() { ], length: 2, duration: 1500, - done: function() { + done: () => { chart.flow({ columns: [ ["x", "2013-03-21", "2013-04-01"], @@ -2059,7 +2064,7 @@ function api_flow() { } function api_data_name() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2072,17 +2077,17 @@ function api_data_name() { } }); - setTimeout(function() { + setTimeout(() => { chart.data.names({ data1: "New name for data1", data2: "New name for data2" }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.data.names({ data1: "New name for data1 again" }); }, 2000); } function api_data_color() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -2099,7 +2104,7 @@ function api_data_color() { } }); - setTimeout(function() { + setTimeout(() => { chart.data.colors({ data1: d3.rgb("#ff0000").darker(1), data2: d3.rgb("#00ff00").darker(1), @@ -2107,7 +2112,7 @@ function api_data_color() { }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.data.colors({ data1: d3.rgb("#ff0000").darker(2), data2: d3.rgb("#00ff00").darker(2), @@ -2117,7 +2122,7 @@ function api_data_color() { } function api_axis_label() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2139,17 +2144,17 @@ function api_axis_label() { } }); - setTimeout(function() { + setTimeout(() => { chart.axis.labels({ y2: "New Y2 Axis Label" }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.axis.labels({ y: "New Y Axis Label", y2: "New Y2 Axis Label Again" }); }, 2000); } function api_axis_range() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2167,45 +2172,45 @@ function api_axis_range() { } }); - setTimeout(function() { + setTimeout(() => { chart.axis.max(500); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.axis.min(-500); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.axis.max({ y: 600, y2: 100 }); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.axis.min({ y: -600, y2: -100 }); }, 4000); - setTimeout(function() { + setTimeout(() => { chart.axis.range({ max: 1000, min: -1000 }); }, 5000); - setTimeout(function() { + setTimeout(() => { chart.axis.range({ max: { y: 600, y2: 100 }, min: { y: -100, y2: 0 } }); }, 6000); - setTimeout(function() { + setTimeout(() => { chart.axis.max({ x: 10 }); }, 7000); - setTimeout(function() { + setTimeout(() => { chart.axis.min({ x: -10 }); }, 8000); - setTimeout(function() { + setTimeout(() => { chart.axis.range({ max: { x: 5 }, min: { x: 0 } }); }, 9000); } function api_resize() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2214,21 +2219,21 @@ function api_resize() { } }); - setTimeout(function() { + setTimeout(() => { chart.resize({ height: 100, width: 300 }); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.resize({ height: 200 }); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.resize(); }, 3000); } function api_grid_x() { - var chart = c3.generate({ + let chart = c3.generate({ bindto: "#chart", data: { columns: [ @@ -2237,31 +2242,31 @@ function api_grid_x() { } }); - setTimeout(function() { + setTimeout(() => { chart.xgrids([{ value: 1, text: "Label 1" }, { value: 4, text: "Label 4" }]); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.xgrids([{ value: 2, text: "Label 2" }]); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.xgrids.add([{ value: 3, text: "Label 3", class: "hoge" }]); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.xgrids.remove({ value: 2 }); }, 4000); - setTimeout(function() { + setTimeout(() => { chart.xgrids.remove({ class: "hoge" }); }, 5000); - setTimeout(function() { + setTimeout(() => { chart.xgrids([{ value: 1, text: "Label 1" }, { value: 4, text: "Label 4" }]); }, 6000); - setTimeout(function() { + setTimeout(() => { chart.xgrids.remove(); }, 7000); } @@ -2271,7 +2276,7 @@ function api_grid_x() { ///////////////////// function transform_line() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2281,25 +2286,25 @@ function transform_line() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("line", "data1"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("line", "data2"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("bar"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("line"); }, 4000); } function transform_spline() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2309,25 +2314,25 @@ function transform_spline() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("spline", "data1"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("spline", "data2"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("bar"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("spline"); }, 4000); } function transform_bar() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2337,25 +2342,25 @@ function transform_bar() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("bar", "data1"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("bar", "data2"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("line"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("bar"); }, 4000); } function transform_area() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2365,25 +2370,25 @@ function transform_area() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("area", "data1"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("area", "data2"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("bar"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("area"); }, 4000); } function transform_areaspline() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2393,25 +2398,25 @@ function transform_areaspline() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("area-spline", "data1"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("area-spline", "data2"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("bar"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("area-spline"); }, 4000); } function transform_scatter() { - var chart = c3.generate({ + let chart = c3.generate({ data: { xs: { setosa: "setosa_x", @@ -2419,10 +2424,14 @@ function transform_scatter() { }, // iris data from R columns: [ - ["setosa_x", 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3.0, 3.0, 4.0, 4.4, 3.9, 3.5, 3.8, 3.8, 3.4, 3.7, 3.6, 3.3, 3.4, 3.0, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, 4.1, 4.2, 3.1, 3.2, 3.5, 3.6, 3.0, 3.4, 3.5, 2.3, 3.2, 3.5, 3.8, 3.0, 3.8, 3.2, 3.7, 3.3], - ["versicolor_x", 3.2, 3.2, 3.1, 2.3, 2.8, 2.8, 3.3, 2.4, 2.9, 2.7, 2.0, 3.0, 2.2, 2.9, 2.9, 3.1, 3.0, 2.7, 2.2, 2.5, 3.2, 2.8, 2.5, 2.8, 2.9, 3.0, 2.8, 3.0, 2.9, 2.6, 2.4, 2.4, 2.7, 2.7, 3.0, 3.4, 3.1, 2.3, 3.0, 2.5, 2.6, 3.0, 2.6, 2.3, 2.7, 3.0, 2.9, 2.9, 2.5, 2.8], - ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], - ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3], + ["setosa_x", 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3.0, 3.0, 4.0, 4.4, 3.9, 3.5, 3.8, 3.8, 3.4, 3.7, 3.6, 3.3, 3.4, 3.0, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, + 4.1, 4.2, 3.1, 3.2, 3.5, 3.6, 3.0, 3.4, 3.5, 2.3, 3.2, 3.5, 3.8, 3.0, 3.8, 3.2, 3.7, 3.3], + ["versicolor_x", 3.2, 3.2, 3.1, 2.3, 2.8, 2.8, 3.3, 2.4, 2.9, 2.7, 2.0, 3.0, 2.2, 2.9, 2.9, 3.1, 3.0, 2.7, 2.2, 2.5, 3.2, 2.8, 2.5, 2.8, 2.9, 3.0, 2.8, 3.0, 2.9, 2.6, 2.4, 2.4, + 2.7, 2.7, 3.0, 3.4, 3.1, 2.3, 3.0, 2.5, 2.6, 3.0, 2.6, 2.3, 2.7, 3.0, 2.9, 2.9, 2.5, 2.8], + ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, + 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2], + ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, + 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3], ], type: "pie" }, @@ -2439,21 +2448,21 @@ function transform_scatter() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("scatter"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("pie"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("scatter"); }, 3000); } function transform_pie() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2462,21 +2471,21 @@ function transform_pie() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("pie"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("line"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("pie"); }, 3000); } function transform_donut() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2485,19 +2494,19 @@ function transform_donut() { } }); - setTimeout(function() { + setTimeout(() => { chart.transform("donut"); }, 1000); - setTimeout(function() { + setTimeout(() => { chart.transform("line"); }, 2000); - setTimeout(function() { + setTimeout(() => { chart.transform("pie"); }, 3000); - setTimeout(function() { + setTimeout(() => { chart.transform("donut"); }, 4000); } @@ -2507,7 +2516,7 @@ function transform_donut() { ///////////////////// function style_region() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -2521,7 +2530,7 @@ function style_region() { } function style_grid() { - var chart = c3.generate({ + let chart = c3.generate({ data: { columns: [ ["data1", 100, 200, 1000, 900, 500] @@ -2537,3 +2546,19 @@ function style_grid() { } }); } + +// set colors via function +c3.generate({ + bindto: '#chart', + data: { + columns: [ + ['data1', ...[]], + ], + type: 'bar', + colors: { + data1: (d: any) => { + return d.value > 90 ? 'green' : 'orange'; + } + } + } +}); diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 47fc5c3986..2d0c4381d6 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -1,32 +1,37 @@ -// Type definitions for C3js v0.4 +// Type definitions for C3js 0.4 // Project: http://c3js.org/ // Definitions by: Marc Climent // Gerin Jacob +// Bernd Hacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as d3 from "d3"; +/* tslint:disable:export-just-namespace */ + export = c3; export as namespace c3; declare namespace c3 { - - type PrimitiveArray = Array; + type PrimitiveArray = Array; type FormatFunction = (v: any, id: string, i: number, j: number) => void; interface TargetIds { ids: ArrayOrString; } - type ArrayOrString = Array | string; + type ArrayOrString = string[] | string; interface ChartConfiguration { /** - * The CSS selector or the element which the chart will be set to. D3 selection object can be specified. If other chart is set already, it will be replaced with the new one (only one chart can be set in one element). + * The CSS selector or the element which the chart will be set to. D3 selection object can be specified. If other chart is set already, it will be replaced with the new one (only one chart + * can be set in one element). * If this option is not specified, the chart will be generated but not be set. Instead, we can access the element by chart.element and set it by ourselves. - * Note: When chart is not binded, c3 starts observing if chart.element is binded by MutationObserver. In this case, polyfill is required in IE9 and IE10 becuase they do not support MutationObserver. On the other hand, if chart always will be binded, polyfill will not be required because MutationObserver will never be called. + * Note: When chart is not binded, c3 starts observing if chart.element is binded by MutationObserver. In this case, polyfill is required in IE9 and IE10 becuase they do not support + * MutationObserver. On the other hand, if chart always will be binded, polyfill will not be required because MutationObserver will never be called. */ - bindto?: string | HTMLElement | d3.Selection; + bindto?: string | HTMLElement | d3.Selection | null; size?: { /** * The desired width of the chart element. @@ -64,7 +69,7 @@ declare namespace c3 { /** * Set custom color pattern. */ - pattern?: Array; + pattern?: string[]; threshold?: any; // Undocumented }; @@ -87,32 +92,32 @@ declare namespace c3 { /** * Set a callback to execute when the chart is initialized. */ - oninit?: () => void; + oninit?(): void; /** * Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is redrawed. */ - onrendered?: () => void; + onrendered?(): void; /** * Set a callback to execute when mouse enters the chart. */ - onmouseover?: () => void; + onmouseover?(): void; /** * Set a callback to execute when mouse leaves the chart. */ - onmouseout?: () => void; + onmouseout?(): void; /** * Set a callback to execute when user resizes the screen. */ - onresize?: () => void; + onresize?(): void; /** * Set a callback to execute when screen resize finished. */ - onresized?: () => void; + onresized?(): void; data: Data; @@ -123,9 +128,10 @@ declare namespace c3 { /** * Show rectangles inside the chart. * This option accepts array including object that has axis, start, end and class. The keys start, end and class are optional. - * axis must be x, y or y2. start and end should be the value where regions start and end. If not specified, the edge values will be used. If timeseries x axis, date string, Date object and unixtime integer can be used. If class is set, the region element will have it as class. + * axis must be x, y or y2. start and end should be the value where regions start and end. If not specified, the edge values will be used. If timeseries x axis, date string, Date object and + * unixtime integer can be used. If class is set, the region element will have it as class. */ - regions?: Array; + regions?: RegionOptions[]; legend?: LegendOptions; @@ -147,8 +153,8 @@ declare namespace c3 { * Change step type for step chart. 'step', 'step-before' and 'step-after' can be used. */ step?: { - type: string; - }; + type: string; + }; }; area?: { @@ -187,7 +193,7 @@ declare namespace c3 { /** * Set formatter for the label on each pie piece. */ - format?: (value: number, ratio: number, id: string) => string; + format?(value: number, ratio: number, id: string): string; /** * Set threshold to show/hide labels. */ @@ -208,7 +214,7 @@ declare namespace c3 { /** * Set formatter for the label on each donut piece. */ - format?: (value: number, ratio: number, id: string) => string; + format?(value: number, ratio: number, id: string): string; /** * Set threshold to show/hide labels. */ @@ -237,7 +243,7 @@ declare namespace c3 { /** * Set formatter for the label on gauge. */ - format?: (value: any, ratio: number) => string; + format?(value: any, ratio: number): string; }; /** * Enable or disable expanding gauge. @@ -279,15 +285,15 @@ declare namespace c3 { /** * Parse a JSON object for data. */ - json?: Object; + json?: {}; /** * Load data from a multidimensional array, with the first element containing the data names, the following containing related data in that order. */ - rows?: Array; + rows?: PrimitiveArray[]; /* * Load data from a multidimensional array, with each element containing an array consisting of a datum name and associated data values. */ - columns?: Array; + columns?: PrimitiveArray[]; /** * Used if loading JSON via data.url */ @@ -295,10 +301,11 @@ declare namespace c3 { /** * Choose which JSON object keys correspond to desired data. */ - keys?: { x?: string; value: Array; }; + keys?: { x?: string; value: string[]; }; /** * Specify the key of x values in the data. - * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data on the key will be used for category names. + * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data + * on the key will be used for category names. */ x?: string; /** @@ -311,8 +318,8 @@ declare namespace c3 { * Default is %Y-%m-%d */ xFormat?: string; - //xLocaltime?: any; - //xSort?: any; + // xLocaltime?: any; + // xSort?: any; /** * Set custom data name. */ @@ -325,7 +332,7 @@ declare namespace c3 { /** * Set groups for the data for stacking. */ - groups?: Array>; + groups?: string[][]; /** * Set y axis the data related to. y and y2 can be used. */ @@ -355,30 +362,33 @@ declare namespace c3 { { format: { [key: string]: FormatFunction } }; /** * Define the order of the data. - * This option changes the order of stacking the data and pieces of pie/donut. If null specified, it will be the order the data loaded. If function specified, it will be used to sort the data and it will recieve the data as argument. + * This option changes the order of stacking the data and pieces of pie/donut. If null specified, it will be the order the data loaded. If function specified, it will be used to sort the data + * and it will recieve the data as argument. * Available Values: desc, asc, function (data1, data2) { ... }, null */ order?: string | ((...data: string[]) => void); /** * Define regions for each data. - * The values must be an array for each data and it should include an object that has start, end, style. If start is not set, the start will be the first data point. If end is not set, the end will be the last data point. + * The values must be an array for each data and it should include an object that has start, end, style. If start is not set, the start will be the first data point. If end is not set, the + * end will be the last data point. * Currently this option supports only line chart and dashed style. If this option specified, the line will be dashed only in the regions. */ regions?: { [key: string]: any }; /** * Set color converter function. - * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00'). + * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that + * represents color (e.g. '#00ff00'). */ - color?: (color: string, d: any) => string | d3.Rgb; + color?(color: string, d: any): string | d3.Rgb; /** * Set color for each data. */ - colors?: { [key: string]: string | d3.Rgb }; + colors?: { [key: string]: string | d3.Rgb | ((d: any) => string | d3.Rgb) }; /** * Hide each data when the chart appears. * If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden. */ - hide?: boolean | Array; + hide?: boolean | string[]; /** * Set text displayed when empty data. */ @@ -389,30 +399,30 @@ declare namespace c3 { grouped?: boolean; multiple?: boolean; draggable?: boolean; - isselectable?: (d?: any) => boolean; + isselectable?(d?: any): boolean; }; /** * Set a callback for click event on each data point. * This callback will be called when each data point clicked and will receive d and element as the arguments. * - d is the data clicked and element is the element clicked. In this callback, this will be the Chart object. */ - onclick?: (d: any, element: any) => void; + onclick?(d: any, element: any): void; /** * Set a callback for mouseover event on each data point. * This callback will be called when mouse cursor moves onto each data point and will receive d as the argument. * - d is the data where mouse cursor moves onto. In this callback, this will be the Chart object. */ - onmouseover?: (d: any, element?: any) => void; + onmouseover?(d: any, element?: any): void; /** * Set a callback for mouseout event on each data point. * This callback will be called when mouse cursor moves out each data point and will receive d as the argument. * - d is the data where mouse cursor moves out. In this callback, this will be the Chart object. */ - onmouseout?: (d: any, element?: any) => void; + onmouseout?(d: any, element?: any): void; - onselected?: (d: any, element?: any) => void; + onselected?(d: any, element?: any): void; - onunselected?: (d: any, element?: any) => void; + onunselected?(d: any, element?: any): void; } interface Axis { @@ -443,7 +453,7 @@ declare namespace c3 { * Set category names on category axis. * This must be an array that includes category names in string. If category names are included in the date by data.x option, this is not required. */ - categories?: Array; + categories?: string[]; tick?: XTickConfiguration; /** @@ -456,7 +466,8 @@ declare namespace c3 { min?: number; /** * Set padding for x axis. - * If this option is set, the range of x axis will increase/decrease according to the values. If no padding is needed in the ragen of x axis, 0 should be set. On category axis, this option will be ignored. + * If this option is set, the range of x axis will increase/decrease according to the values. If no padding is needed in the ragen of x axis, 0 should be set. On category axis, this option + * will be ignored. */ padding?: { left?: number; @@ -470,10 +481,11 @@ declare namespace c3 { /** * Set default extent for subchart and zoom. This can be an array or function that returns an array. */ - extent?: Array | (() => Array); + extent?: number[] | (() => number[]); /** * Set label on x axis. - * You can set x axis label and change its position by this option. string and object can be passed and we can change the poisiton by passing object that has position key. Available position differs according to the axis direction (vertical or horizontal). If string set, the position will be the default. + * You can set x axis label and change its position by this option. string and object can be passed and we can change the poisiton by passing object that has position key. Available position + * differs according to the axis direction (vertical or horizontal). If string set, the position will be the default. * Valid horizontal positions: inner-right (Default), inner-center, inner-left, outer-right, outer-center, outer-left * Valid vertical positions: inner-top, inner-middle, inner-bottom, outer-top, outer-middle, outer-bottom */ @@ -524,8 +536,7 @@ declare namespace c3 { /** * Set default range of y axis. This option set the default value for y axis when there is no data on init. */ - default?: Array; - + default?: number[]; } interface XTickConfiguration { @@ -538,14 +549,15 @@ declare namespace c3 { */ format?: string | ((x: number | Date) => string | number); /** - * Setting for culling ticks. - * If true is set, the ticks will be culled, then only limitted tick text will be shown. This option does not hide the tick lines. If false is set, all of ticks will be shown. - */ + * Setting for culling ticks. + * If true is set, the ticks will be culled, then only limitted tick text will be shown. This option does not hide the tick lines. If false is set, all of ticks will be shown. + */ culling?: boolean | CullingConfiguration; /** * The number of x axis ticks to show. - * This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will have rough second value). - */ + * This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will + * have rough second value). + */ count?: number; /** * Fit x axis ticks. @@ -554,9 +566,10 @@ declare namespace c3 { fit?: boolean; /** * Set the x values of ticks manually. - * If this option is provided, the position of the ticks will be determined based on those values. This option works with timeseries data and the x values will be parsed accoding to the type of the value and data.xFormat option. + * If this option is provided, the position of the ticks will be determined based on those values. This option works with timeseries data and the x values will be parsed accoding to the type + * of the value and data.xFormat option. */ - values?: Array | Array; + values?: number[] | string[]; /** * Rotate x axis tick text. If you set negative value, it will rotate to opposite direction. */ @@ -573,7 +586,7 @@ declare namespace c3 { * Set formatter for y axis tick text. * This option accepts d3.format object as well as a function you define. */ - format?: (x: number) => string; + format?(x: number): string; /** * Show or hide outer tick. */ @@ -581,18 +594,18 @@ declare namespace c3 { /** * Set the y values of ticks manually. */ - values?: Array; + values?: number[]; /** * The number of y axis ticks to show. * The position of the ticks will be calculated precisely, so the values on the ticks will not be rounded nicely. In the case, axis.y.tick.format or axis.y.tick.values will be helpful. - */ + */ count?: number; } interface CullingConfiguration { /** - * The number of tick texts will be adjusted to less than this value. - */ + * The number of tick texts will be adjusted to less than this value. + */ max: number; } @@ -607,7 +620,7 @@ declare namespace c3 { * This option accepts array including object that has value, text, position and class. text, position and class are optional. For position, start, middle and end (default) are available. * If x axis is category axis, value can be category name. If x axis is timeseries axis, value can be date string, Date object and unixtime integer. */ - lines?: Array; + lines?: LineOptions[]; }; y?: { /** @@ -618,7 +631,7 @@ declare namespace c3 { * Show additional grid lines along y axis. * This option accepts array including object that has value, text, position and class. */ - lines?: Array; + lines?: LineOptions[]; }; } @@ -670,15 +683,15 @@ declare namespace c3 { /** * Set click event handler to the legend item. */ - onclick?: (id: any) => void; + onclick?(id: any): void; /** * Set mouseover event handler to the legend item. */ - onmouseover?: (id: any) => void; + onmouseover?(id: any): void; /** * Set mouseout event handler to the legend item. */ - onmouseout?: (id: any) => void; + onmouseout?(id: any): void; }; } @@ -695,27 +708,28 @@ declare namespace c3 { /** * Set format for the title of tooltip. Specified function receives x of the data point to show. */ - title?: (x: any) => string; + title?(x: any): string; /** - * Set format for the name of each data in tooltip. Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge. + * Set format for the name of each data in tooltip. Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not + * donut/pie/gauge. */ - name?: (name: string, ratio: number, id: string, index: number) => string; + name?(name: string, ratio: number, id: string, index: number): string; /** * Set format for the value of each data in tooltip. * Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge. * If undefined returned, the row of that value will be skipped. */ - value?: (value: any, ratio: number, id: string, index: number) => string; + value?(value: any, ratio: number, id: string, index: number): string; }; /** * Set custom position for the tooltip. This option can be used to modify the tooltip position by returning object that has top and left. */ - position?: (data: any, width: number, height: number, element: any) => { top: number; left: number }; + position?(data: any, width: number, height: number, element: any): { top: number; left: number }; /** * Set custom HTML for the tooltip. * Specified function receives data, defaultTitleFormat, defaultValueFormat and color of the data point to show. If tooltip.grouped is true, data includes multiple data points. */ - contents?: (data: any, defaultTitleFormat: string, defaultValueFormat: string, color: any) => string; + contents?(data: any, defaultTitleFormat: string, defaultValueFormat: string, color: any): string; } interface SubchartOptions { @@ -733,7 +747,7 @@ declare namespace c3 { * Set callback for brush event. * Specified function receives the current zoomed x domain. */ - onbrush?: (domain: any) => void; + onbrush?(domain: any): void; } interface ZoomOptions { @@ -752,15 +766,15 @@ declare namespace c3 { /** * Set callback that is called when the chart is zooming. Specified function receives the zoomed domain. */ - onzoom?: (domain: any) => void; + onzoom?(domain: any): void; /** * Set callback that is called when zooming starts. Specified function receives the zoom event. */ - onzoomstart?: (event: Event) => void; + onzoomstart?(event: Event): void; /** * Set callback that is called when zooming ends. Specified function receives the zoomed domain. */ - onzoomend?: (domain: any) => void; + onzoomend?(domain: any): void; } interface PointOptions { @@ -839,23 +853,24 @@ declare namespace c3 { * If type or types given, the type of targets will be updated. type must be String and types must be Object. * If unload given, data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. * If done given, the specified function will be called after data loded. - * NOTE: unload should be used if some data needs to be unloaded simultaneously. If you call unload API soon after/before load instead of unload param, chart will not be rendered properly because of cancel of animation. + * NOTE: unload should be used if some data needs to be unloaded simultaneously. If you call unload API soon after/before load instead of unload param, chart will not be rendered properly + * because of cancel of animation. * NOTE: done will be called after data loaded, but it's not after rendering. It's because rendering will finish after some transition and there is some time lag between loading and rendering. */ load(args: { url?: string; - json?: Object; - keys?: { x?: string; value: Array; } - rows?: Array; - columns?: Array; + json?: {}; + keys?: { x?: string; value: string[]; } + rows?: PrimitiveArray[]; + columns?: PrimitiveArray[]; classes?: { [key: string]: string }; - categories?: Array; + categories?: string[]; axes?: { [key: string]: string }; colors?: { [key: string]: string | d3.Rgb }; type?: string; types?: { [key: string]: string }; unload?: boolean | ArrayOrString; - done?: () => any; + done?(): any; }): void; /** * Unload data to the chart. @@ -868,21 +883,22 @@ declare namespace c3 { unload(targetIds?: TargetIds, done?: () => any): any; /** * Flow data to the chart. By this API, you can append new data points to the chart. - * If json, rows and columns given, the data will be loaded. If data that has the same target id is given, the chart will be appended. Otherwise, new target will be added. One of these is required when calling. If json specified, keys is required as well as data.json + * If json, rows and columns given, the data will be loaded. If data that has the same target id is given, the chart will be appended. Otherwise, new target will be added. One of these is + * required when calling. If json specified, keys is required as well as data.json * If to is given, the lower x edge will move to that point. If not given, the lower x edge will move by the number of given data points. * If length is given, the lower x edge will move by the number of this argument. * If duration is given, the duration of the transition will be specified value. If not given, transition.duration will be used as default. * If done is given, the specified function will be called when flow ends. */ flow(args: { - json?: Object; - keys?: { x?: string; value: Array; } - rows?: Array; - columns?: Array; + json?: {}; + keys?: { x?: string; value: string[]; } + rows?: PrimitiveArray[]; + columns?: PrimitiveArray[]; to?: any; length?: number; duration?: number; - done?: () => any; + done?(): any; }): void; /** * Change data point state to selected. By this API, you can select data points. To use this API, data.selection.enabled needs to be set true. @@ -890,13 +906,13 @@ declare namespace c3 { * @param indices Specify indices to be selected. If this argument is not given, all data points will be the candidate. * @param resetOthers If this argument is set true, the data points that are not specified by ids, indices will be unselected. */ - select(ids?: Array, indices?: Array, resetOthers?: boolean): void; + select(ids?: string[], indices?: number[], resetOthers?: boolean): void; /** * Change data point state to unselected. By this API, you can unselect data points. To use this API, data.selection.enabled needs to be set true. * @param ids Specify target ids to be unselected. If this argument is not given, all targets will be the candidate. * @param indices Specify indices to be unselected. If this argument is not given, all data points will be the candidate. */ - unselect(ids?: Array, indices?: Array): void; + unselect(ids?: string[], indices?: number[]): void; /** * Get selected data points. By this API, you can get selected data points information. To use this API, data.selection.enabled needs to be set true. * @param targetId You can filter the result by giving target id that you want to get. If not given, all of data points will be returned. @@ -912,7 +928,7 @@ declare namespace c3 { * Update groups for the targets. * @param groups This argument needs to be an Array that includes one or more Array that includes target ids to be grouped. */ - groups(groups: Array>): void; + groups(groups: string[][]): void; xgrids: GridOperations; @@ -923,15 +939,16 @@ declare namespace c3 { * Update regions. * @param regions Regions will be replaced with this argument. The format of this argument is the same as regions. */ - (regions: Array): void; + (regions: any[]): void; /** * Add new region. This API adds new region instead of replacing like regions. * @param grids New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added. */ - add(regions: Array | Object): void; + add(regions: any[] | {}): void; /** * Remove regions. This API removes regions. - * @param args This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be removed. + * @param args This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be + * removed. */ remove(args?: { value?: number | string; class?: string }): void; }; @@ -951,7 +968,7 @@ declare namespace c3 { * Get values of the data loaded in the chart. * @param targetIds This API returns the values of specified target. If this argument is not given, null will be retruned. */ - values(targetIds?: ArrayOrString): Array; + values(targetIds?: ArrayOrString): any[]; /** * Get and set names of the data loaded in the chart. * @param names If this argument is given, the names of data will be updated. If not given, the current names will be returned. The format of this argument is the same as data.names. @@ -980,7 +997,7 @@ declare namespace c3 { * Get and set the categories * @param categories: Value of the categories to update */ - categories(categories?: Array): Array; + categories(categories?: string[]): string[]; /** * Get the color for the specified targetId @@ -1025,12 +1042,14 @@ declare namespace c3 { legend: { /** * Show legend for each target. - * @param targetIds If targetIds is given, specified target's legend will be shown. If only one target is the candidate, String can be passed. If no argument is given, all of target's legend will be shown. + * @param targetIds If targetIds is given, specified target's legend will be shown. If only one target is the candidate, String can be passed. If no argument is given, all of target's + * legend will be shown. */ show(targetIds?: ArrayOrString): void; /** * Hide legend for each target. - * @param targetIds If targetIds is given, specified target's legend will be hidden. If only one target is the candidate, String can be passed. If no argument is given, all of target's legend will be hidden. + * @param targetIds If targetIds is given, specified target's legend will be hidden. If only one target is the candidate, String can be passed. If no argument is given, all of target's + * legend will be hidden. */ hide(targetIds?: ArrayOrString): void; }; @@ -1040,7 +1059,7 @@ declare namespace c3 { * Zoom by giving x domain. * @param domain If domain is given, the chart will be zoomed to the given domain. If no argument is given, the current zoomed domain will be returned. */ - (domain?: Array): Array; + (domain?: number[]): number[]; /** * Enable and disable zooming. @@ -1076,18 +1095,19 @@ declare namespace c3 { * Update the x/y grid lines. * @param grids X/Y grid lines will be replaced with this argument. The format of this argument is the same as grid.x.lines or grid.y.lines. */ - (grids: Array): void; + (grids: any[]): void; /** * Add x/y grid lines. This API adds new x/y grid lines instead of replacing like xgrids. * @param grids New x/y grid lines will be added. The format of this argument is the same as grid.x.lines or grid.y.lines and it's possible to give an Object if only one line will be added. */ - add(grids: Array | Object): void; + add(grids: any[] | {}): void; /** * Remove x/y grid lines. This API removes x/y grid lines. - * @param args This argument should include value or class. If value is given, the x/y grid lines that have specified x/y value will be removed. If class is given, the x/y grid lines that have specified class will be removed. If args is not given, all of x/y grid lines will be removed. + * @param args This argument should include value or class. If value is given, the x/y grid lines that have specified x/y value will be removed. If class is given, the x/y grid lines that + * have specified class will be removed. If args is not given, all of x/y grid lines will be removed. */ remove(args?: { class?: string; value?: number | string }): void; } - export function generate(config: ChartConfiguration): ChartAPI; + function generate(config: ChartConfiguration): ChartAPI; } diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json index 640f7156af..e94921ceb7 100644 --- a/types/c3/tsconfig.json +++ b/types/c3/tsconfig.json @@ -6,8 +6,8 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/c3/tslint.json b/types/c3/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/c3/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/cal-heatmap/index.d.ts b/types/cal-heatmap/index.d.ts index 194d9fa128..f4b9f4df4f 100644 --- a/types/cal-heatmap/index.d.ts +++ b/types/cal-heatmap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/wa0x6e/cal-heatmap // Definitions by: Chris Baker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as d3 from "d3"; diff --git a/types/chai-jquery/index.d.ts b/types/chai-jquery/index.d.ts index 839a57a370..453336b08b 100644 --- a/types/chai-jquery/index.d.ts +++ b/types/chai-jquery/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chaijs/chai-jquery // Definitions by: Kazi Manzur Rashid // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/chai-string/chai-string-tests.ts b/types/chai-string/chai-string-tests.ts index 16f32760f8..615a6c1f95 100644 --- a/types/chai-string/chai-string-tests.ts +++ b/types/chai-string/chai-string-tests.ts @@ -1,12 +1,11 @@ /// -/// var should = chai.should(); var assert = chai.assert; var expect = chai.expect; -var chai_string = require('chai-string'); +import chai_string = require("chai-string"); chai.use(chai_string); describe('chai-string', function() { diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 85e16c4f63..69353163cd 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -1343,7 +1343,7 @@ suite('assert', () => { assert.lengthOf([1, 2, 3], 3); assert.lengthOf('foobar', 6); assert.lengthOf('foobar', 5); - assert.lengthOf(1, 5); + assert.lengthOf({ length: 1 }, 5); }); test('match', () => { diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 2b38efaa25..b9ffd7a8f6 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -1,15 +1,17 @@ -import { Chart, LinearChartData } from 'chart.js'; +import { Chart, ChartData } from 'chart.js'; -//alternative: -//import chartjs = require('chart.js'); +// alternative: +// import chartjs = require('chart.js'); // => chartjs.Chart -var chart = new Chart(new CanvasRenderingContext2D(), { +let chart: Chart = new Chart(new CanvasRenderingContext2D(), { type: 'bar', - data: { + data: { labels: ['group 1'], datasets: [ { + backgroundColor: '#000000', + borderWidth: 1, label: 'test', data: [1] } diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ec8a7c0c03..f56623e7b4 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -1,7 +1,9 @@ -// Type definitions for Chart.js 2.4.0 +// Type definitions for Chart.js 2.4 // Project: https://github.com/nnnick/Chart.js // Definitions by: Alberto Nuti +// Fabien Lavocat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -22,63 +24,63 @@ declare class Chart { toBase64: () => string; generateLegend: () => {}; getElementAtEvent: (e: any) => {}; - getElementsAtEvent: (e: any) => {}[]; - getDatasetAtEvent: (e: any) => {}[]; + getElementsAtEvent: (e: any) => Array<{}>; + getDatasetAtEvent: (e: any) => Array<{}>; static pluginService: PluginServiceStatic; static defaults: { global: Chart.ChartOptions; - } + }; } declare class PluginServiceStatic { register(plugin?: PluginServiceRegistrationOptions): void; } -declare interface PluginServiceRegistrationOptions { - beforeInit?: (chartInstance: Chart) => void, - afterInit?: (chartInstance: Chart) => void, +interface PluginServiceRegistrationOptions { + beforeInit?(chartInstance: Chart): void; + afterInit?(chartInstance: Chart): void; - resize?: (chartInstance: Chart, newChartSize: Size) => void, + resize?(chartInstance: Chart, newChartSize: Size): void; - beforeUpdate?: (chartInstance: Chart) => void, - afterScaleUpdate?: (chartInstance: Chart) => void, - beforeDatasetsUpdate?: (chartInstance: Chart) => void, - afterDatasetsUpdate?: (chartInstance: Chart) => void, - afterUpdate?: (chartInstance: Chart) => void, + beforeUpdate?(chartInstance: Chart): void; + afterScaleUpdate?(chartInstance: Chart): void; + beforeDatasetsUpdate?(chartInstance: Chart): void; + afterDatasetsUpdate?(chartInstance: Chart): void; + afterUpdate?(chartInstance: Chart): void; // This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw // to do something on each animation frame - beforeRender?: (chartInstance: Chart) => void, + beforeRender?(chartInstance: Chart): void; // Easing is for animation - beforeDraw?: (chartInstance: Chart, easing: string) => void, - afterDraw?: (chartInstance: Chart, easing: string) => void, + beforeDraw?(chartInstance: Chart, easing: string): void; + afterDraw?(chartInstance: Chart, easing: string): void; // Before the datasets are drawn but after scales are drawn - beforeDatasetsDraw?: (chartInstance: Chart, easing: string) => void, - afterDatasetsDraw?: (chartInstance: Chart, easing: string) => void, + beforeDatasetsDraw?(chartInstance: Chart, easing: string): void; + afterDatasetsDraw?(chartInstance: Chart, easing: string): void; - destroy?: (chartInstance: Chart) => void, + destroy?(chartInstance: Chart): void; // Called when an event occurs on the chart - beforeEvent?: (chartInstance: Chart, event: Event) => void, - afterEvent?: (chartInstance: Chart, event: Event) => void + beforeEvent?(chartInstance: Chart, event: Event): void; + afterEvent?(chartInstance: Chart, event: Event): void; } -declare interface Size { +interface Size { height: number; width: number; } declare namespace Chart { - export type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; + type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; - export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; + type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; - export type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear'; + type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear'; - export type PositionType = 'left' | 'right' | 'top' | 'bottom'; + type PositionType = 'left' | 'right' | 'top' | 'bottom'; - export interface ChartLegendItem { + interface ChartLegendItem { text?: string; fillStyle?: string; hidden?: boolean; @@ -90,58 +92,54 @@ declare namespace Chart { strokeStyle?: string; } - export interface ChartTooltipItem { + interface ChartTooltipItem { xLabel?: string; yLabel?: string; datasetIndex?: number; index?: number; } - export interface ChartTooltipCallback { - beforeTitle?: (item?: ChartTooltipItem[], data?: any) => void; - title?: (item?: ChartTooltipItem[], data?: any) => void; - afterTitle?: (item?: ChartTooltipItem[], data?: any) => void; - beforeBody?: (item?: ChartTooltipItem[], data?: any) => void; - beforeLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - label?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - afterLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - afterBody?: (item?: ChartTooltipItem[], data?: any) => void; - beforeFooter?: (item?: ChartTooltipItem[], data?: any) => void; - footer?: (item?: ChartTooltipItem[], data?: any) => void; - afterFooter?: (item?: ChartTooltipItem[], data?: any) => void; + interface ChartTooltipCallback { + beforeTitle?(item?: ChartTooltipItem[], data?: any): void; + title?(item?: ChartTooltipItem[], data?: any): void; + afterTitle?(item?: ChartTooltipItem[], data?: any): void; + beforeBody?(item?: ChartTooltipItem[], data?: any): void; + beforeLabel?(tooltipItem?: ChartTooltipItem, data?: any): void; + label?(tooltipItem?: ChartTooltipItem, data?: any): void; + afterLabel?(tooltipItem?: ChartTooltipItem, data?: any): void; + afterBody?(item?: ChartTooltipItem[], data?: any): void; + beforeFooter?(item?: ChartTooltipItem[], data?: any): void; + footer?(item?: ChartTooltipItem[], data?: any): void; + afterFooter?(item?: ChartTooltipItem[], data?: any): void; } - export interface ChartAnimationParameter { + interface ChartAnimationParameter { chartInstance?: any; animationObject?: any; } - export interface ChartPoint { + interface ChartPoint { x?: number | string | Date; y?: number; } - export interface ChartConfiguration { + interface ChartConfiguration { type?: ChartType | string; data?: ChartData; options?: ChartOptions; } - export interface ChartData { - - } - - export interface LinearChartData extends ChartData { + interface ChartData { labels?: string[]; datasets?: ChartDataSets[]; } - export interface ChartOptions { + interface ChartOptions { responsive?: boolean; responsiveAnimationDuration?: number; maintainAspectRatio?: boolean; events?: string[]; - onClick?: (any?: any) => any; + onClick?(any?: any): any; title?: ChartTitleOptions; legend?: ChartLegendOptions; tooltips?: ChartTooltipOptions; @@ -152,14 +150,14 @@ declare namespace Chart { cutoutPercentage?: number; } - export interface ChartFontOptions { + interface ChartFontOptions { defaultFontColor?: ChartColor; defaultFontFamily?: string; defaultFontSize?: number; defaultFontStyle?: string; } - export interface ChartTitleOptions { + interface ChartTitleOptions { display?: boolean; position?: string; fullWdith?: boolean; @@ -171,27 +169,27 @@ declare namespace Chart { text?: string; } - export interface ChartLegendOptions { + interface ChartLegendOptions { display?: boolean; position?: string; fullWidth?: boolean; - onClick?: (event: any, legendItem: any) => void; + onClick?(event: any, legendItem: any): void; labels?: ChartLegendLabelOptions; } - export interface ChartLegendLabelOptions { + interface ChartLegendLabelOptions { boxWidth?: number; fontSize?: number; fontStyle?: number; fontColor?: ChartColor; fontFamily?: string; padding?: number; - generateLabels?: (chart: any) => any; + generateLabels?(chart: any): any; } - export interface ChartTooltipOptions { + interface ChartTooltipOptions { enabled?: boolean; - custom?: (a: any) => void; + custom?(a: any): void; mode?: string; backgroundColor?: ChartColor; titleFontFamily?: string; @@ -219,42 +217,42 @@ declare namespace Chart { callbacks?: ChartTooltipCallback; } - export interface ChartHoverOptions { + interface ChartHoverOptions { mode?: string; animationDuration?: number; - onHover?: (active: any) => void; + onHover?(active: any): void; } - export interface ChartAnimationObject { + interface ChartAnimationObject { currentStep?: number; numSteps?: number; easing?: string; - render?: (arg: any) => void; - onAnimationProgress?: (arg: any) => void; - onAnimationComplete?: (arg: any) => void; + render?(arg: any): void; + onAnimationProgress?(arg: any): void; + onAnimationComplete?(arg: any): void; } - export interface ChartAnimationOptions { + interface ChartAnimationOptions { duration?: number; easing?: string; - onProgress?: (chart: any) => void; - onComplete?: (chart: any) => void; + onProgress?(chart: any): void; + onComplete?(chart: any): void; } - export interface ChartElementsOptions { + interface ChartElementsOptions { point?: ChartPointOptions; line?: ChartLineOptions; arc?: ChartArcOptions; rectangle?: ChartRectangleOptions; } - export interface ChartArcOptions { + interface ChartArcOptions { backgroundColor?: ChartColor; borderColor?: ChartColor; borderWidth?: number; } - export interface ChartLineOptions { + interface ChartLineOptions { tension?: number; backgroundColor?: ChartColor; borderWidth?: number; @@ -263,9 +261,12 @@ declare namespace Chart { borderDash?: any[]; borderDashOffset?: number; borderJoinStyle?: string; + capBezierPoints?: boolean; + fill?: 'zero' | 'top' | 'bottom' | boolean; + stepped?: boolean; } - export interface ChartPointOptions { + interface ChartPointOptions { radius?: number; pointStyle?: string; backgroundColor?: ChartColor; @@ -276,13 +277,13 @@ declare namespace Chart { hoverBorderWidth?: number; } - export interface ChartRectangleOptions { + interface ChartRectangleOptions { backgroundColor?: ChartColor; borderWidth?: number; borderColor?: ChartColor; borderSkipped?: string; } - export interface GridLineOptions { + interface GridLineOptions { display?: boolean; color?: ChartColor; lineWidth?: number; @@ -295,7 +296,7 @@ declare namespace Chart { offsetGridLines?: boolean; } - export interface ScaleTitleOptions { + interface ScaleTitleOptions { display?: boolean; labelString?: string; fontColor?: ChartColor; @@ -304,9 +305,9 @@ declare namespace Chart { fontStyle?: string; } - export interface TickOptions { + interface TickOptions { autoSkip?: boolean; - callback?: (value: any, index: any, values: any) => string; + callback?(value: any, index: any, values: any): string; display?: boolean; fontColor?: ChartColor; fontFamily?: string; @@ -321,28 +322,28 @@ declare namespace Chart { min?: any; max?: any; } - export interface AngleLineOptions { + interface AngleLineOptions { display?: boolean; color?: ChartColor; lineWidth?: number; } - export interface PointLabelOptions { - callback?: (arg: any) => any; + interface PointLabelOptions { + callback?(arg: any): any; fontColor?: ChartColor; fontFamily?: string; fontSize?: number; fontStyle?: string; } - export interface TickOptions { + interface TickOptions { backdropColor?: ChartColor; backdropPaddingX?: number; backdropPaddingY?: number; maxTicksLimit?: number; showLabelBackdrop?: boolean; } - export interface LinearTickOptions extends TickOptions { + interface LinearTickOptions extends TickOptions { beginAtZero?: boolean; min?: number; max?: number; @@ -352,15 +353,15 @@ declare namespace Chart { suggestedMax?: number; } - export interface LogarithmicTickOptions extends TickOptions { + interface LogarithmicTickOptions extends TickOptions { min?: number; max?: number; } type ChartColor = string | CanvasGradient | CanvasPattern; - export interface ChartDataSets { - backgroundColor?: ChartColor; + interface ChartDataSets { + backgroundColor?: ChartColor | ChartColor[]; borderWidth?: number; borderColor?: ChartColor; borderCapStyle?: string; @@ -385,24 +386,24 @@ declare namespace Chart { yAxisID?: string; } - export interface ChartScales { + interface ChartScales { type?: ScaleType | string; display?: boolean; position?: PositionType | string; - beforeUpdate?: (scale?: any) => void; - beforeSetDimension?: (scale?: any) => void; - beforeDataLimits?: (scale?: any) => void; - beforeBuildTicks?: (scale?: any) => void; - beforeTickToLabelConversion?: (scale?: any) => void; - beforeCalculateTickRotation?: (scale?: any) => void; - beforeFit?: (scale?: any) => void; - afterUpdate?: (scale?: any) => void; - afterSetDimension?: (scale?: any) => void; - afterDataLimits?: (scale?: any) => void; - afterBuildTicks?: (scale?: any) => void; - afterTickToLabelConversion?: (scale?: any) => void; - afterCalculateTickRotation?: (scale?: any) => void; - afterFit?: (scale?: any) => void; + beforeUpdate?(scale?: any): void; + beforeSetDimension?(scale?: any): void; + beforeDataLimits?(scale?: any): void; + beforeBuildTicks?(scale?: any): void; + beforeTickToLabelConversion?(scale?: any): void; + beforeCalculateTickRotation?(scale?: any): void; + beforeFit?(scale?: any): void; + afterUpdate?(scale?: any): void; + afterSetDimension?(scale?: any): void; + afterDataLimits?(scale?: any): void; + afterBuildTicks?(scale?: any): void; + afterTickToLabelConversion?(scale?: any): void; + afterCalculateTickRotation?(scale?: any): void; + afterFit?(scale?: any): void; gridLines?: GridLineOptions; scaleLabel?: ScaleTitleOptions; ticks?: TickOptions; @@ -410,7 +411,7 @@ declare namespace Chart { yAxes?: ChartYAxe[]; } - export interface CommonAxe { + interface CommonAxe { type?: ScaleType | string; display?: boolean; id?: string; @@ -422,24 +423,25 @@ declare namespace Chart { scaleLabel?: ScaleTitleOptions; } - export interface ChartXAxe extends CommonAxe { + interface ChartXAxe extends CommonAxe { categoryPercentage?: number; barPercentage?: number; time?: TimeScale; } - export interface ChartYAxe extends CommonAxe { + // tslint:disable-next-line no-empty-interface + interface ChartYAxe extends CommonAxe { } - export interface LinearScale extends ChartScales { + interface LinearScale extends ChartScales { ticks?: LinearTickOptions; } - export interface LogarithmicScale extends ChartScales { + interface LogarithmicScale extends ChartScales { ticks?: LogarithmicTickOptions; } - export interface TimeDisplayFormat { + interface TimeDisplayFormat { millisecond?: string; second?: string; minute?: string; @@ -451,7 +453,7 @@ declare namespace Chart { year?: string; } - export interface TimeScale extends ChartScales { + interface TimeScale extends ChartScales { displayFormats?: TimeDisplayFormat; isoWeekday?: boolean; max?: string; @@ -464,7 +466,7 @@ declare namespace Chart { minUnit?: TimeUnit; } - export interface RadialLinearScale { + interface RadialLinearScale { lineArc?: boolean; angleLines?: AngleLineOptions; pointLabels?: PointLabelOptions; diff --git a/types/chart.js/tslint.json b/types/chart.js/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/chart.js/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} diff --git a/types/chosen-js/index.d.ts b/types/chosen-js/index.d.ts index c7ffa437bc..221eefb3d3 100644 --- a/types/chosen-js/index.d.ts +++ b/types/chosen-js/index.d.ts @@ -2,6 +2,7 @@ // Project: http://harvesthq.github.com/chosen/ // Definitions by: Boris Yankov , denis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 8fe0f9b993..ee61cf5575 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -2,6 +2,7 @@ // Project: http://developer.chrome.com/extensions/ // Definitions by: Matthew Kimber , otiai10 , couven92 , RReverser , sreimer15 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index ffe1ece74d..b7b7868ba3 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -80,7 +80,7 @@ function bookmarksExample() { 'Add': function () { chrome.bookmarks.create({ parentId: bookmarkNode.id, - title: $('#title').val(), url: $('#url').val() + title: $('#title').val() as string, url: $('#url').val() as string }); $('#bookmarks').empty(); $(this).dialog('destroy'); @@ -100,9 +100,9 @@ function bookmarksExample() { show: 'slide', buttons: { 'Save': function () { chrome.bookmarks.update(String(bookmarkNode.id), { - title: edit.val() + title: edit.val() as string }); - anchor.text(edit.val()); + anchor.text(edit.val() as string); options.show(); $(this).dialog('destroy'); }, diff --git a/types/chrome/tsconfig.json b/types/chrome/tsconfig.json index 2512d73c9d..96c0c31496 100644 --- a/types/chrome/tsconfig.json +++ b/types/chrome/tsconfig.json @@ -23,4 +23,4 @@ "test/index.ts", "test/chrome-app.ts" ] -} \ No newline at end of file +} diff --git a/types/chui/chui-tests.ts b/types/chui/chui-tests.ts index 5e1e549dc7..f37ab7caf0 100644 --- a/types/chui/chui-tests.ts +++ b/types/chui/chui-tests.ts @@ -1,4 +1,4 @@ -/// +import $ = require('jquery'); $(function() { @@ -94,4 +94,4 @@ $(function() { $('#mySwitch').UISwitch(); $('#myRangeControl').UIRange(); -}); \ No newline at end of file +}); diff --git a/types/chui/index.d.ts b/types/chui/index.d.ts index 4bf597e869..7042edd4bd 100644 --- a/types/chui/index.d.ts +++ b/types/chui/index.d.ts @@ -1545,4 +1545,4 @@ interface JQueryKeyEventObject extends JQueryInputEventObject { } interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { -} \ No newline at end of file +} diff --git a/types/chui/tsconfig.json b/types/chui/tsconfig.json index a3163f3e43..08c1f7740e 100644 --- a/types/chui/tsconfig.json +++ b/types/chui/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "chui-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/clndr/clndr-tests.ts b/types/clndr/clndr-tests.ts index 07bff7f9e4..d0939c3e80 100644 --- a/types/clndr/clndr-tests.ts +++ b/types/clndr/clndr-tests.ts @@ -1,4 +1,5 @@ import * as Clndr from 'clndr'; +import $ = require('jquery'); const options: Clndr.ClndrOptions = { template: '', diff --git a/types/clndr/index.d.ts b/types/clndr/index.d.ts index 3e9fbbb09c..2c01d82518 100644 --- a/types/clndr/index.d.ts +++ b/types/clndr/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: jasperjn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - import * as moment from 'moment'; export as namespace Clndr; diff --git a/types/clndr/tsconfig.json b/types/clndr/tsconfig.json index 8e68c59399..e2791aa5f0 100644 --- a/types/clndr/tsconfig.json +++ b/types/clndr/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "clndr-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/commangular/index.d.ts b/types/commangular/index.d.ts index 06126ac64f..4eb9d07230 100644 --- a/types/commangular/index.d.ts +++ b/types/commangular/index.d.ts @@ -2,6 +2,7 @@ // Project: http://commangular.org // Definitions by: Hiraash Thawfeek // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -270,4 +271,4 @@ declare module angular { } -} \ No newline at end of file +} diff --git a/types/connect-redis/connect-redis-tests.ts b/types/connect-redis/connect-redis-tests.ts index 3c50074117..11cd583a74 100644 --- a/types/connect-redis/connect-redis-tests.ts +++ b/types/connect-redis/connect-redis-tests.ts @@ -2,3 +2,9 @@ import * as connectRedis from "connect-redis"; import * as session from "express-session"; let RedisStore = connectRedis(session); +const store = new RedisStore({ + host: 'localhost', + port: 6379, + logErrors: error => console.warn(error), + scanCount: 80, +}); diff --git a/types/connect-redis/index.d.ts b/types/connect-redis/index.d.ts index f66314a083..b5084609a2 100644 --- a/types/connect-redis/index.d.ts +++ b/types/connect-redis/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-redis // Project: https://npmjs.com/package/connect-redis // Definitions by: Xavier Stouder +// Albert Kurniawan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -32,6 +33,8 @@ declare module "connect-redis" { prefix?: string; unref?: boolean; serializer?: Serializer | JSON; + logErrors?: boolean | ((error: string) => void); + scanCount?: number; } interface Serializer { stringify: Function; diff --git a/types/copy-paste/copy-paste-tests.ts b/types/copy-paste/copy-paste-tests.ts index 24ab6c5d95..8b17d67ace 100644 --- a/types/copy-paste/copy-paste-tests.ts +++ b/types/copy-paste/copy-paste-tests.ts @@ -1,5 +1,3 @@ -/// - import * as CopyPaste from 'copy-paste'; class TestClass {} diff --git a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts index 1c62521293..dbad990b8d 100644 --- a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts +++ b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts @@ -1,5 +1,29 @@ -window.addEventListener('batterystatus', - (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); }); +function eventCallBack(ev: BatteryStatusEvent) { + console.log('Battery level is ' + ev.level); +} +window.addEventListener('batterystatus', (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); }); +window.addEventListener('batterystatus', (ev) => { console.log('Battery level is ' + ev.level); }); +window.addEventListener('batterycritical', (ev) => { console.log('Battery is critical: ' + ev.level); }); +window.addEventListener('batterylow', (ev) => { console.log('Battery is low: ' + ev.level); }); -window.addEventListener('batterycritical', - () => { alert('Battery is critical low!'); }); \ No newline at end of file +window.addEventListener('baterystatus', eventCallBack); +window.addEventListener('batterycritical', eventCallBack); +window.addEventListener('batterylow', eventCallBack); + +window.removeEventListener('batterystatus', eventCallBack); +window.removeEventListener('batterycritical', eventCallBack); +window.removeEventListener('batterylow', eventCallBack); + +window.addEventListener('batterycritical', () => { alert('Battery is critical low!'); }); +window.addEventListener('batterylow', () => { alert('Battery is low!'); }); + +function batteryCriticalCallback() { + alert('Battery is critical low!'); +} + +function batteryLowCallback() { + alert('Battery is critical low!'); +} + +window.addEventListener('batterycritical', batteryCriticalCallback); +window.addEventListener('batterylow', batteryLowCallback); \ No newline at end of file diff --git a/types/cordova-plugin-battery-status/index.d.ts b/types/cordova-plugin-battery-status/index.d.ts index 9baedc8cb0..0cdf729d30 100644 --- a/types/cordova-plugin-battery-status/index.d.ts +++ b/types/cordova-plugin-battery-status/index.d.ts @@ -4,116 +4,28 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. +// Licensed under the MIT license. +// TypeScript Version: 2.3 + +interface WindowEventMap { + /** + * batterystatus: event fires when the percentage of battery charge changes by at least 1 percent, or if the device is plugged in or unplugged. + */ + "batterystatus" : BatteryStatusEvent; + /** + * batterycritical: event fires when the percentage of battery charge has reached the critical battery threshold. The value is device-specific. + */ + "batterycritical": BatteryStatusEvent; + /** + * batterylow: event fires when the percentage of battery charge has reached the low battery threshold, device-specific value. + */ + "batterylow": BatteryStatusEvent; +} interface Window { onbatterystatus: (type: BatteryStatusEvent) => void; onbatterycritical: (type: BatteryStatusEvent) => void; onbatterylow: (type: BatteryStatusEvent) => void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; } /** Object, that passed into battery event listener */ diff --git a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts index cef288c921..d717e85ea4 100644 --- a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts +++ b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts @@ -5,7 +5,28 @@ // is similar to native window.open signature, so the compiler can's // select proper overload, but we cast result to InAppBrowser manually. var iab = window.open('google.com', '_self'); + iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); }); +iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); }); +iab.addEventListener('loadstop', (ev) => { console.log('loadstop' + ev.code); }); +iab.addEventListener('loaderror', (ev) => { console.log('loaderror' + ev.code); }); +iab.addEventListener('exit', (ev) => { console.log('exit' + ev.code); }); + +function inAppBrowserCallBack(ev: InAppBrowserEvent) { + console.log('InAppBrowser callback ' + ev.url); +} + +iab.addEventListener('loadstart', inAppBrowserCallBack); +iab.addEventListener('loadstart', inAppBrowserCallBack); +iab.addEventListener('loadstop', inAppBrowserCallBack); +iab.addEventListener('loaderror', inAppBrowserCallBack); +iab.addEventListener('exit', inAppBrowserCallBack); + +iab.removeEventListener('loadstart', inAppBrowserCallBack); +iab.removeEventListener('loadstop', inAppBrowserCallBack); +iab.removeEventListener('loaderror', inAppBrowserCallBack); +iab.removeEventListener('exit', inAppBrowserCallBack); + iab.show(); iab.executeScript( { code: "console.log('Injected script in action')" }, diff --git a/types/cordova-plugin-inappbrowser/index.d.ts b/types/cordova-plugin-inappbrowser/index.d.ts index ea3d3adba8..91dc61314f 100644 --- a/types/cordova-plugin-inappbrowser/index.d.ts +++ b/types/cordova-plugin-inappbrowser/index.d.ts @@ -5,6 +5,7 @@ // // Copyright (c) Microsoft Open Technologies Inc // Licensed under the MIT license. +// TypeScript Version: 2.3 interface Window { /** @@ -57,59 +58,14 @@ interface InAppBrowser extends Window { // addEventListener overloads /** * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. + * @param type loadstart: event fires when the InAppBrowser starts to load a URL. * loadstop: event fires when the InAppBrowser finishes loading a URL. * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. * exit: event fires when the InAppBrowser window is closed. * @param callback the function that executes when the event fires. The function is * passed an InAppBrowserEvent object as a parameter. */ - addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an Event object as a parameter. - */ - addEventListener(type: string, callback: (event: Event) => void): void; + addEventListener(type: "loadstart" | "loadstop" | "loaderror" | "exit", callback: (event: InAppBrowserEvent) => void): void; // removeEventListener overloads /** * Removes a listener for an event from the InAppBrowser. @@ -121,51 +77,7 @@ interface InAppBrowser extends Window { * @param callback the function that executes when the event fires. The function is * passed an InAppBrowserEvent object as a parameter. */ - removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an Event object as a parameter. - */ - removeEventListener(type: string, callback: (event: Event) => void): void; + removeEventListener(type: "loadstart" | "loadstop" | "loaderror" | "exit", callback: (event: InAppBrowserEvent) => void): void; /** Closes the InAppBrowser window. */ close(): void; /** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */ diff --git a/types/country-select-js/index.d.ts b/types/country-select-js/index.d.ts index 72c33489c2..8ed28a224c 100644 --- a/types/country-select-js/index.d.ts +++ b/types/country-select-js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mrmarkfrench/country-select-js // Definitions by: Humberto Rocha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/create-error/create-error-tests.ts b/types/create-error/create-error-tests.ts index 51cdab4381..7a635b8dc6 100644 --- a/types/create-error/create-error-tests.ts +++ b/types/create-error/create-error-tests.ts @@ -1,9 +1,9 @@ - -/// /// +declare function equal(a: T, b: T): void; +declare function deepEqual(a: T, b: T): void; + import * as createError from 'create-error'; -import * as assert from 'assert'; // Example taken from https://github.com/tgriesser/create-error/blob/0.3.1/README.md#use @@ -23,14 +23,12 @@ sub instanceof SubCustomError // true sub instanceof MyCustomError // true sub instanceof Error // true -assert.deepEqual(sub.messages, []) // true -assert.equal(sub.someVal, 'value') // true +deepEqual(sub.messages, []) // true +equal(sub.someVal, 'value') // true // Taken and adapted from https://github.com/tgriesser/create-error/blob/0.3.1/test/index.js -var equal = assert.equal; -var deepEqual = assert.deepEqual; describe('create-error', function() { diff --git a/types/css-modules-require-hook/css-modules-require-hook-tests.ts b/types/css-modules-require-hook/css-modules-require-hook-tests.ts index 93da1326bd..9a7325ab0c 100644 --- a/types/css-modules-require-hook/css-modules-require-hook-tests.ts +++ b/types/css-modules-require-hook/css-modules-require-hook-tests.ts @@ -1,7 +1,4 @@ -/// - import * as hook from 'css-modules-require-hook'; -import * as path from 'path'; // // https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#usage @@ -170,4 +167,4 @@ hook({ mode: 'pure' }); // https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#rootdir-string // -hook({ rootDir: path.resolve('./my-folder') }); +hook({ rootDir: './my-folder' }); diff --git a/types/d3-sankey/d3-sankey-tests.ts b/types/d3-sankey/d3-sankey-tests.ts index c270011528..abf61775b8 100644 --- a/types/d3-sankey/d3-sankey-tests.ts +++ b/types/d3-sankey/d3-sankey-tests.ts @@ -7,7 +7,7 @@ */ import * as d3Sankey from 'd3-sankey'; -import {select, Selection} from 'd3-selection'; +import { select, Selection } from 'd3-selection'; import { Link } from 'd3-shape'; // --------------------------------------------------------------------------- @@ -18,38 +18,44 @@ import { Link } from 'd3-shape'; // the Sankey layout generator. The latter are reflected in the SankeyNode and SankeyLink interfaces provided // by the definitions file interface SNodeExtra { - nodeId: number; - name: string; + name: string; +} + +interface SNodeExtraCustomId { + nodeId: string; + name: string; } interface SLinkExtra { - uom: string; + uom: string; } // For convenience type SNode = d3Sankey.SankeyNode; +type SNodeCustomId = d3Sankey.SankeyNode; type SLink = d3Sankey.SankeyLink; +type SLinkCustomId = d3Sankey.SankeyLink; interface DAG { - customNodes: SNode[]; - customLinks: SLink[]; + customNodes: SNode[]; + customLinks: SLink[]; } -const graph: DAG = { +interface DAGCustomId { + customNodes: SNodeCustomId[]; + customLinks: SLinkCustomId[]; +} + +const graphDefault: DAG = { customNodes: [{ - nodeId: 0, name: "node0" }, { - nodeId: 1, name: "node1" }, { - nodeId: 2, name: "node2" }, { - nodeId: 3, name: "node3" }, { - nodeId: 4, name: "node4" }], customLinks: [{ @@ -90,6 +96,61 @@ const graph: DAG = { }] }; +const graphCustomId: DAGCustomId = { + customNodes: [{ + nodeId: "n0", + name: "node0" + }, { + nodeId: "n1", + name: "node1" + }, { + nodeId: "n2", + name: "node2" + }, { + nodeId: "n3", + name: "node3" + }, { + nodeId: "n4", + name: "node4" + }], + customLinks: [{ + source: "n0", + target: "n2", + value: 2, + uom: 'Widget(s)' + }, { + source: "n1", + target: "n2", + value: 2, + uom: 'Widget(s)' + }, { + source: "n1", + target: "n3", + value: 2, + uom: 'Widget(s)' + }, { + source: "n0", + target: "n4", + value: 2, + uom: 'Widget(s)' + }, { + source: "n2", + target: "n3", + value: 2, + uom: 'Widget(s)' + }, { + source: "n2", + target: "n4", + value: 2, + uom: 'Widget(s)' + }, { + source: "n3", + target: "n4", + value: 4, + uom: 'Widget(s)' + }] +}; + let sNodes: SNode[]; let sLinks: SLink[]; @@ -109,6 +170,7 @@ let sGraph: d3Sankey.SankeyGraph; let slgDefault: d3Sankey.SankeyLayout, {}, {}> = d3Sankey.sankey(); let slgDAG: d3Sankey.SankeyLayout = d3Sankey.sankey(); +let slgDAGCustomId: d3Sankey.SankeyLayout = d3Sankey.sankey(); // --------------------------------------------------------------------------- // NodeWidth @@ -175,6 +237,54 @@ slgDAG = slgDAG.iterations(40); num = slgDAG.iterations(); +// --------------------------------------------------------------------------- +// Node Id +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +slgDAGCustomId = slgDAGCustomId.nodeId((d) => { + const node: SNodeCustomId = d; + return d.nodeId; +}); + +// Get ----------------------------------------------------------------------- + +let nodeIdAccessor: (d: SNodeCustomId) => string | number; + +nodeIdAccessor = slgDAGCustomId.nodeId(); + +// --------------------------------------------------------------------------- +// Node Alignment +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +declare const testNode: SNode; + +// Test pre-defined alignment functions +slgDAG = slgDAG.nodeAlign(d3Sankey.sankeyLeft); +num = d3Sankey.sankeyLeft(testNode, 10); +slgDAG = slgDAG.nodeAlign(d3Sankey.sankeyRight); +num = d3Sankey.sankeyRight(testNode, 10); +slgDAG = slgDAG.nodeAlign(d3Sankey.sankeyCenter); +num = d3Sankey.sankeyCenter(testNode, 10); +slgDAG = slgDAG.nodeAlign(d3Sankey.sankeyJustify); +num = d3Sankey.sankeyJustify(testNode, 10); + +// Test custom +slgDAG = slgDAG.nodeAlign((node, maxN) => { + const n: SNode = node; + const mN: number = maxN; + return node.depth || 0; +}); + +// Get ----------------------------------------------------------------------- + +let nodeAlignmentFn: (d: SNode, n: number) => number; + +nodeAlignmentFn = slgDAG.nodeAlign(); + // --------------------------------------------------------------------------- // Nodes // --------------------------------------------------------------------------- @@ -182,7 +292,7 @@ num = slgDAG.iterations(); // Set ----------------------------------------------------------------------- // Use array and test return type for chainability -slgDAG = slgDAG.nodes(graph.customNodes); +slgDAG = slgDAG.nodes(graphDefault.customNodes); // Use accessor function and test return type for chainability slgDAG = slgDAG.nodes(d => d.customNodes); @@ -198,7 +308,7 @@ let nodesAccessor: (d: DAG) => SNode[] = slgDAG.nodes(); // Set ----------------------------------------------------------------------- // test return type for chainability -slgDAG = slgDAG.links(graph.customLinks); +slgDAG = slgDAG.links(graphDefault.customLinks); // Use accessor function and test return type for chainability slgDAG = slgDAG.links(d => d.customLinks); @@ -211,9 +321,9 @@ let linksAccessor: (d: DAG) => SLink[] = slgDAG.links(); // Compute Initial Layout // --------------------------------------------------------------------------- -sGraph = slgDAG(graph); +sGraph = slgDAG(graphDefault); // With additional arguments, although here unused. -sGraph = slgDAG(graph, "foo", 50); +sGraph = slgDAG(graphDefault, "foo", 50); // --------------------------------------------------------------------------- // Update Layout @@ -255,7 +365,6 @@ let sNode = sNodes[0]; // User-specified extra properties: -num = sNode.nodeId; str = sNode.name; // Sankey Layout calculated (if layout has been run, otherwise undefined): @@ -267,6 +376,7 @@ numMaybe = sNode.y1; numMaybe = sNode.value; numMaybe = sNode.index; numMaybe = sNode.depth; +numMaybe = sNode.height; let linksArrMaybe: SLink[] | undefined; @@ -290,10 +400,10 @@ num = sLink.value; // layout(...) was invoked, the source and target nodes may be numbers // objects without the Sankey layout coordinates, or objects with calculated // information -let numOrSankeyNode: number | SNode; +let numStringOrSankeyNode: number | string | SNode; -numOrSankeyNode = sLink.source; -numOrSankeyNode = sLink.target; +numStringOrSankeyNode = sLink.source; +numStringOrSankeyNode = sLink.target; // Sankey Layout calculated (if layout has been run, otherwise undefined): diff --git a/types/d3-sankey/index.d.ts b/types/d3-sankey/index.d.ts index 55c2934c13..46a80b2671 100644 --- a/types/d3-sankey/index.d.ts +++ b/types/d3-sankey/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-sankey module 0.6 +// Type definitions for D3JS d3-sankey module 0.7 // Project: https://github.com/d3/d3-sankey/ // Definitions by: Tom Wanzek , Alex Ford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 0.6 +// Last module patch version validated against: 0.7 import { Link } from 'd3-shape'; @@ -50,6 +50,10 @@ export interface SankeyNodeMinimal { /** - * Link's source node. For convenience, when initializing a Sankey layout, + * Link's source node. For convenience, when initializing a Sankey layout using the default node id accessor, * source may be the zero-based index of the corresponding node in the nodes array - * returned by the nodes accessor of the Sankey layout generator rather than object references. + * returned by the nodes accessor of the Sankey layout generator rather than object references. Alternatively, + * the Sankey layout can be configured with a custom node ID accessor to resolve the source node of the link upon initialization. * * Once the Sankey generator is invoked to return the Sankey graph object, * the numeric index will be replaced with the corresponding source node object. */ - source: number | SankeyNode; + source: number | string | SankeyNode; /** - * Link's target node. For convenience, when initializing a Sankey layout, + * Link's target node. For convenience, when initializing a Sankey layout using the default node id accessor, * target may be the zero-based index of the corresponding node in the nodes array - * returned by the nodes accessor of the Sankey layout generator rather than object references. + * returned by the nodes accessor of the Sankey layout generator rather than object references. Alternatively, + * the Sankey layout can be configured with a custom node ID accessor to resolve the target node of the link upon initialization. * * Once the Sankey generator is invoked to return the Sankey graph object, * the numeric index will be replaced with the corresponding target node object. */ - target: number | SankeyNode; + target: number | string | SankeyNode; /** * Link's numeric value */ @@ -244,6 +250,34 @@ export interface SankeyLayout Array>): this; + /** + * Return the current node id accessor. + * The default accessor is a function being passed in a Sankey layout node and returning its numeric node.index. + */ + nodeId(): (node: SankeyNode) => string | number; + /** + * Set the node id accessor to the specified function and return this Sankey layout generator. + * + * The default accessor is a function being passed in a Sankey layout node and returning its numeric node.index. + * The default id accessor allows each link’s source and target to be specified as a zero-based index into the nodes array. + * + * @param nodeId A node id accessor function being passed a node in the Sankey graph and returning its id. + */ + nodeId(nodeId: (node: SankeyNode) => string | number): this; + + /** + * Return the current node alignment method, which defaults to d3.sankeyLeft. + */ + nodeAlign(): (node: SankeyNode, n: number) => number; + /** + * Set the node alignment method the specified function and return this Sankey layout generator. + * + * @param nodeAlign A node alignment function which is evaluated for each input node in order, + * being passed the current node and the total depth n of the graph (one plus the maximum node.depth), + * and must return an integer between 0 and n - 1 that indicates the desired horizontal position of the node in the generated Sankey diagram. + */ + nodeAlign(nodeAlign: (node: SankeyNode, n: number) => number): this; + /** * Return the current node width, which defaults to 24. */ @@ -346,6 +380,44 @@ export function sankey(): SankeyLayout; +/** + * Compute the horizontal node position of a node in a Sankey layout with left alignment. + * Returns (node.depth) to indicate the desired horizontal position of the node in the generated Sankey diagram. + * + * @param node Sankey node for which to calculate the horizontal node position. + * @param n Total depth n of the graph (one plus the maximum node.depth) + */ +export function sankeyLeft(node: SankeyNode<{}, {}>, n: number): number; + +/** + * Compute the horizontal node position of a node in a Sankey layout with right alignment. + * Returns (n - 1 - node.height) to indicate the desired horizontal position of the node in the generated Sankey diagram. + * + * @param node Sankey node for which to calculate the horizontal node position. + * @param n Total depth n of the graph (one plus the maximum node.depth) + */ +export function sankeyRight(node: SankeyNode<{}, {}>, n: number): number; + +/** + * Compute the horizontal node position of a node in a Sankey layout with center alignment. + * Like d3.sankeyLeft, except that nodes without any incoming links are moved as right as possible. + * Returns an integer between 0 and n - 1 that indicates the desired horizontal position of the node in the generated Sankey diagram. + * + * @param node Sankey node for which to calculate the horizontal node position. + * @param n Total depth n of the graph (one plus the maximum node.depth) + */ +export function sankeyCenter(node: SankeyNode<{}, {}>, n: number): number; + +/** + * Compute the horizontal node position of a node in a Sankey layout with justified alignment. + * Like d3.sankeyLeft, except that nodes without any outgoing links are moved to the far right. + * Returns an integer between 0 and n - 1 that indicates the desired horizontal position of the node in the generated Sankey diagram. + * + * @param node Sankey node for which to calculate the horizontal node position. + * @param n Total depth n of the graph (one plus the maximum node.depth) + */ +export function sankeyJustify(node: SankeyNode<{}, {}>, n: number): number; + /** * Get a horizontal link shape suitable for a Sankey diagram. * Source and target accessors are pre-configured and work with the diff --git a/types/datatables.net-buttons/index.d.ts b/types/datatables.net-buttons/index.d.ts index ba4aa75654..a5b32c1bf6 100644 --- a/types/datatables.net-buttons/index.d.ts +++ b/types/datatables.net-buttons/index.d.ts @@ -2,6 +2,7 @@ // Project: http://datatables.net/extensions/buttons/ // Definitions by: Sam Germano , Jim Hartford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index 838ca9131c..ada38d5a21 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -410,7 +410,7 @@ $(document).ready(function () { .on('change', function () { dt .column(0) - .search($(this).val()) + .search($(this).val() as string) .draw(); }); // Get the search data for the first column and add to the select list @@ -547,7 +547,7 @@ $(document).ready(function () { .on('change', function () { dt .column(colIdx) - .search($(this).val()) + .search($(this).val() as string) .draw(); }); @@ -631,7 +631,7 @@ $(document).ready(function () { .on('change', function () { dt .column(0) - .search($(this).val()) + .search($(this).val() as string) .draw(); }); @@ -715,7 +715,7 @@ $(document).ready(function () { .on('change', function () { dt .column(colIdx) - .search($(this).val()) + .search($(this).val() as string) .draw(); }); diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index c0aaf9cc6c..bb55b54722 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.datatables.net // Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // missing: // - Static methods that are defined in JQueryStatic.fn are not typed. diff --git a/types/daterangepicker/index.d.ts b/types/daterangepicker/index.d.ts index 600e8b3d5f..3846ea2472 100644 --- a/types/daterangepicker/index.d.ts +++ b/types/daterangepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.daterangepicker.com/ // Definitions by: SirMartin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// import moment = require("moment"); diff --git a/types/df-visible/index.d.ts b/types/df-visible/index.d.ts index f7303a46ae..5b26722151 100644 --- a/types/df-visible/index.d.ts +++ b/types/df-visible/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/customd/jquery-visible // Definitions by: Andrey Lipatkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/docopt/docopt-tests.ts b/types/docopt/docopt-tests.ts index e4850d4ea1..8d68355b27 100644 --- a/types/docopt/docopt-tests.ts +++ b/types/docopt/docopt-tests.ts @@ -1,5 +1,4 @@ - -/// +import docopt = require("docopt"); var doc = ` Usage: @@ -7,5 +6,4 @@ Usage: quick_example.coffee serial [--baud=9600] [--timeout=] quick_example.coffee -h | --help | --version `; -var {docopt} = require('docopt'); -console.log(docopt(doc, { version: '0.1.1rc' })); +docopt(doc, { version: '0.1.1rc' }); diff --git a/types/dotdotdot/index.d.ts b/types/dotdotdot/index.d.ts index 3ab0f52945..f8b4b4b5f4 100644 --- a/types/dotdotdot/index.d.ts +++ b/types/dotdotdot/index.d.ts @@ -2,6 +2,7 @@ // Project: http://dotdotdot.frebsite.nl/ // Definitions by: Milan Jaros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface JQuery { /** diff --git a/types/dropzone/index.d.ts b/types/dropzone/index.d.ts index 905fa53ab9..703172072f 100644 --- a/types/dropzone/index.d.ts +++ b/types/dropzone/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.dropzonejs.com/ // Definitions by: Natan Vivo , Andy Hawkins , Vasya Aksyonov , Simon Huber , Sebastiaan de Rooij // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/dts-bundle/dts-bundle-tests.ts b/types/dts-bundle/dts-bundle-tests.ts index ef8fae6044..29ce2e359c 100644 --- a/types/dts-bundle/dts-bundle-tests.ts +++ b/types/dts-bundle/dts-bundle-tests.ts @@ -1,9 +1,6 @@ -/// import dts = require("dts-bundle"); -import os = require("os"); var opts = { - // Required // name of module likein package.json @@ -34,7 +31,7 @@ var opts = { // - default: false removeSource: false, // newline to use in output file - newline: os.EOL, + newline: "\n", // indentation to use in output file // - default 4 spaces indent: ' ', diff --git a/types/durandal/index.d.ts b/types/durandal/index.d.ts index b95bcb1271..85dbb86e93 100644 --- a/types/durandal/index.d.ts +++ b/types/durandal/index.d.ts @@ -2,6 +2,7 @@ // Project: http://durandaljs.com // Definitions by: Blue Spire // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /** * Durandal 2.1.0 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved. diff --git a/types/durandal/v1/index.d.ts b/types/durandal/v1/index.d.ts index 92896b61b5..2b8ae5db1f 100644 --- a/types/durandal/v1/index.d.ts +++ b/types/durandal/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: http://durandaljs.com // Definitions by: Evan Larsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/dw-bxslider-4/index.d.ts b/types/dw-bxslider-4/index.d.ts index eb33295767..c7003dcf46 100644 --- a/types/dw-bxslider-4/index.d.ts +++ b/types/dw-bxslider-4/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/stevenwanderski/bxslider-4 // Definitions by: Piotr Sałkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -620,4 +621,4 @@ interface JQuery { * @param options */ bxSlider(options?:bxSliderOptions): bxSlider; -} \ No newline at end of file +} diff --git a/types/dynatable/index.d.ts b/types/dynatable/index.d.ts index 774b617674..b9e1be607f 100644 --- a/types/dynatable/index.d.ts +++ b/types/dynatable/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.dynatable.com/ // Definitions by: François Massart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/each/each-tests.ts b/types/each/each-tests.ts index 89f5e81ccb..55f257925a 100644 --- a/types/each/each-tests.ts +++ b/types/each/each-tests.ts @@ -1,5 +1,4 @@ - -/// +import EachReq = require("each"); function testEach() { var EachStaticClass: EachStatic = function (array: any[]) { @@ -36,6 +35,5 @@ function testEach() { var each: Each = EachStaticClass([1, 2, 3]); - var EachReq: EachStatic = require("each"); var each: Each = EachReq([4, 5, 6]); } diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index cae7001218..c7d5521f1c 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,5 +1,7 @@ /* tslint:disable */ +import $ = require('jquery'); + module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { @@ -596,7 +598,7 @@ module GridComponent { -var columns = ["Vegie-spread", "Tofuaa", "Alice Mutton", "Konbu", "Fltemysost"] +var columns = ["Vegie-spread", "Tofuaa", "Alice Mutton", "Konbu", "Fløtemysost"] var itemSource: any[] = []; for (var i = 0; i < columns.length; i++) { for (var j = 0; j < 6; j++) { @@ -760,7 +762,7 @@ var world_map= { "type": "Feature", "properties": { "admin": "Switzerland", "name": "Switzerland", "continent": "Europe" }, "geometry": { "type": "Polygon", "coordinates": [[[9.594226108446346, 47.525058091820256], [9.632931756232974, 47.347601223329974], [9.479969516649019, 47.102809963563367], [9.932448357796657, 46.920728054382948], [10.442701450246627, 46.893546250997424], [10.36337812667861, 46.483571275409851], [9.922836541390378, 46.314899400409182], [9.182881707403054, 46.440214748716976], [8.966305779667804, 46.036931871111186], [8.489952426801322, 46.005150865251672], [8.316629672894377, 46.163642483090847], [7.755992058959832, 45.824490057959302], [7.273850945676655, 45.776947740250769], [6.843592970414504, 45.991146552100595], [6.500099724970424, 46.429672756529428], [6.022609490593537, 46.272989813820466], [6.037388950229, 46.725778713561859], [6.768713820023605, 47.287708238303686], [6.736571079138058, 47.541801255882838], [7.192202182655505, 47.449765529971003], [7.466759067422228, 47.620581976911794], [8.31730146651415, 47.613579820336255], [8.522611932009765, 47.830827541691285], [9.594226108446346, 47.525058091820256]]] } }, { "type": "Feature", "properties": { "admin": "Chile", "name": "Chile", "continent": "South America" }, "geometry": { "type": "MultiPolygon", "coordinates": [[[[-68.634010227583147, -52.636370458874353], [-68.633349999999879, -54.8695], [-67.56244, -54.87001], [-66.95992, -54.89681], [-67.291029999999878, -55.30124], [-68.148629999999841, -55.61183], [-68.639990810811796, -55.580017999086877], [-69.2321, -55.49906], [-69.95809, -55.19843], [-71.00568, -55.05383], [-72.2639, -54.49514], [-73.2852, -53.957519999999874], [-74.66253, -52.83749], [-73.8381, -53.04743], [-72.43418, -53.7154], [-71.10773, -54.07433], [-70.591779999999787, -53.61583], [-70.26748, -52.93123], [-69.345649999999878, -52.5183], [-68.634010227583147, -52.636370458874353]]], [[[-68.219913092711224, -21.49434661223183], [-67.828179897722634, -22.872918796482178], [-67.106673550063604, -22.735924574476392], [-66.985233934177629, -22.986348565362825], [-67.328442959244128, -24.025303236590908], [-68.417652960876111, -24.518554782816874], [-68.386001146097342, -26.185016371365229], [-68.594799770772667, -26.50690886811126], [-68.295541551370391, -26.899339694935787], [-69.001234910748266, -27.521213881136127], [-69.656130337183143, -28.459141127233686], [-70.013550381129861, -29.367922865518544], [-69.919008348251921, -30.336339206668306], [-70.535068935819439, -31.365010267870279], [-70.074399380153622, -33.09120981214803], [-69.814776984319209, -33.273886000299839], [-69.817309129501453, -34.193571465798279], [-70.388049485949082, -35.169687595359441], [-70.364769253201658, -36.005088799789931], [-71.121880662709771, -36.65812387466233], [-71.118625047475419, -37.576827487947192], [-70.814664272734703, -38.552995293940732], [-71.413516608349042, -38.916022230791107], [-71.680761277946445, -39.808164157878061], [-71.915734015577542, -40.832339369470716], [-71.746803758415453, -42.051386407235988], [-72.148898078078517, -42.254888197601375], [-71.915423956983901, -43.408564548517404], [-71.464056159130493, -43.787611179378324], [-71.793622606071935, -44.207172133156099], [-71.329800788036195, -44.407521661151677], [-71.222778896759721, -44.784242852559409], [-71.659315558545316, -44.973688653341434], [-71.552009446891233, -45.560732924177117], [-71.917258470330196, -46.884838148791786], [-72.44735531278026, -47.738532810253517], [-72.331160854771937, -48.244238376661819], [-72.648247443314929, -48.878618259476774], [-73.415435757120022, -49.318436374712952], [-73.328050910114456, -50.378785088909865], [-72.975746832964617, -50.741450290734299], [-72.309973517532342, -50.677009779666342], [-72.329403856074023, -51.425956312872394], [-71.914803839796321, -52.009022305865912], [-69.498362189396076, -52.142760912637236], [-68.571545376241332, -52.299443855346247], [-69.461284349226617, -52.291950772663924], [-69.94277950710611, -52.537930590373243], [-70.8451016913545, -52.899200528525711], [-71.006332160105217, -53.833252042201345], [-71.429794684520928, -53.856454760300373], [-72.557942877884855, -53.531410001184447], [-73.702756720662862, -52.835069268607249], [-73.702756720662862, -52.835070076051487], [-74.946763475225154, -52.262753588419017], [-75.260026007778507, -51.62935475037321], [-74.976632453089806, -51.043395684615675], [-75.47975419788348, -50.378371677451547], [-75.608015102831942, -48.673772881871784], [-75.182769741502128, -47.711919447623153], [-74.126580980104677, -46.939253431995084], [-75.644395311165439, -46.647643324572016], [-74.69215369332305, -45.76397633238097], [-74.351709357384252, -44.10304412208788], [-73.240356004515192, -44.454960625995611], [-72.717803921179765, -42.383355808278985], [-73.388899909138232, -42.117532240569567], [-73.701335618774834, -43.365776462579738], [-74.33194312203257, -43.224958184584395], [-74.017957119427152, -41.794812920906828], [-73.677099372029943, -39.942212823243111], [-73.217592536090663, -39.258688653318508], [-73.505559455037044, -38.282882582351064], [-73.588060879191076, -37.156284681956016], [-73.166717088499283, -37.123780206044351], [-72.553136969681717, -35.508840020491022], [-71.861732143832555, -33.909092706031522], [-71.438450486929895, -32.418899428030819], [-71.668720669222424, -30.920644626592516], [-71.370082567007714, -30.095682061484997], [-71.48989437527645, -28.861442152625909], [-70.905123867461569, -27.640379734001193], [-70.724953986275963, -25.705924167587209], [-70.403965827095035, -23.628996677344542], [-70.091245897080668, -21.393319187101223], [-70.164419725205974, -19.756468194256183], [-70.372572394477714, -18.347975355708879], [-69.858443569605797, -18.092693780187027], [-69.590423753523979, -17.580011895419286], [-69.100246955019401, -18.260125420812653], [-68.966818406841824, -18.981683444904089], [-68.442225104430918, -19.405068454671419], [-68.757167121033703, -20.37265797290447], [-68.219913092711224, -21.49434661223183]]]] } }, { "type": "Feature", "properties": { "admin": "China", "name": "China", "continent": "Asia" }, "geometry": { "type": "MultiPolygon", "coordinates": [[[[110.339187860151526, 18.678395087147603], [109.475209588663702, 18.19770091396861], [108.655207961056135, 18.507681993071397], [108.626217482540426, 19.367887885001974], [109.119055617308007, 19.821038519769385], [110.211598748822837, 20.101253973872073], [110.786550734502228, 20.077534491450077], [111.01005130416462, 19.695929877190732], [110.570646600386794, 19.255879218009305], [110.339187860151526, 18.678395087147603]]], [[[127.657407261262378, 49.760270494172929], [129.397817824420429, 49.440600084015429], [130.58229332898236, 48.729687404976112], [130.987281528853828, 47.790132351261391], [132.506671991099495, 47.788969631534876], [133.373595819228001, 48.183441677434914], [135.026311476786702, 48.478229885443902], [134.500813836810607, 47.578439846377833], [134.112362095272601, 47.212467352886719], [133.76964399631288, 46.116926988299056], [133.097126906466428, 45.14406647397216], [131.883454217659562, 45.32116160743643], [131.025212030156069, 44.967953192721573], [131.288555129115537, 44.111519680348252], [131.144687941614848, 42.929989732426932], [130.633866408409801, 42.903014634770543], [130.640015903852429, 42.39500946712527], [129.994267205933227, 42.985386867843793], [129.596668735879462, 42.424981797854592], [128.05221520397231, 41.994284572917984], [128.208433058790717, 41.466771552082534], [127.343782993683021, 41.503151760415953], [126.869083286649854, 41.816569322266155], [126.18204511932943, 41.107336127276362], [125.079941847840587, 40.569823716792449], [124.265624627785314, 39.928493353834135], [122.86757042856101, 39.637787583976255], [122.131387974130917, 39.170451768544623], [121.054554478032856, 38.89747101496291], [121.585994907722466, 39.360853583324136], [121.376757033372641, 39.750261338859524], [122.168595005381007, 40.422442531896046], [121.640358514493528, 40.946389878903304], [120.768628778161954, 40.593388169917596], [119.639602085449056, 39.898055935214209], [119.023463983233015, 39.252333075511096], [118.042748651197897, 39.204273993479674], [117.532702264477052, 38.73763580988409], [118.05969852098967, 38.061475531561051], [118.878149855628351, 37.897325344385898], [118.911636183753501, 37.448463853498723], [119.702802362142037, 37.156388658185072], [120.823457472823648, 37.870427761377968], [121.711258579597938, 37.481123358707165], [122.357937453298462, 37.454484157860684], [122.519994744965814, 36.930614325501828], [121.104163853033029, 36.651329047180432], [120.63700890511457, 36.111439520811125], [119.66456180224607, 35.609790554337728], [119.151208123858567, 34.909859117160458], [120.227524855633717, 34.360331936168613], [120.620369093916565, 33.37672272392512], [121.229014113450219, 32.460318711877186], [121.908145786630044, 31.692174384074683], [121.891919386890336, 30.949351508095098], [121.264257440273298, 30.676267401648712], [121.503519321784722, 30.14291494396425], [122.092113885589086, 29.832520453403156], [121.93842817595305, 29.018022365834803], [121.684438511238469, 28.225512600206677], [121.125661248866436, 28.135673122667178], [120.395473260582307, 27.053206895449385], [119.585496860839555, 25.740780544532605], [118.656871372554519, 24.547390855400234], [117.281606479970833, 23.624501451099714], [115.890735304835118, 22.782873236578094], [114.763827345846209, 22.668074042241663], [114.152546828265656, 22.223760077396204], [113.806779819800752, 22.548339748621423], [113.241077915501592, 22.051367499270462], [111.843592157032447, 21.550493679281512], [110.78546552942413, 21.39714386645533], [110.444039341271662, 20.34103261970639], [109.88986128137357, 20.282457383703441], [109.627655063924635, 21.008227037026725], [109.864488153118316, 21.395050970947516], [108.522812941524421, 21.715212307211821], [108.050180291782979, 21.552379869060101], [107.043420037872636, 21.8118989120299], [106.567273390735352, 22.21820486092474], [106.725403273548466, 22.794267889898375], [105.811247186305209, 22.976892401617899], [105.329209425886631, 23.352063300056976], [104.476858351664475, 22.819150092046918], [103.504514601660503, 22.703756618739217], [102.706992222100155, 22.708795070887696], [102.170435825613552, 22.464753119389336], [101.652017856861576, 22.318198757409554], [101.803119744882906, 21.174366766845051], [101.27002566936001, 21.201651923095167], [101.180005324307558, 21.436572984294052], [101.150032993578236, 21.849984442629015], [100.416537713627349, 21.558839423096654], [99.983489211021549, 21.742936713136451], [99.240898878987196, 22.118314317304559], [99.53199222208741, 22.949038804612591], [98.898749220782804, 23.142722072842581], [98.66026248575578, 24.063286037690002], [97.604719679762027, 23.897404690033049], [97.724609002679131, 25.083637193293036], [98.671838006589212, 25.91870250091349], [98.712093947344556, 26.743535874940243], [98.682690057370507, 27.508812160750658], [98.246230910233351, 27.747221381129172], [97.91198774616943, 28.335945136014367], [97.327113885490007, 28.261582749946339], [96.248833449287829, 28.411030992134467], [96.586590610747521, 28.830979519154361], [96.117678664131006, 29.452802028922513], [95.404802280664626, 29.031716620392157], [94.565990431702929, 29.27743805593996], [93.413347609432662, 28.640629380807233], [92.503118931043616, 27.896876329046442], [91.696656528696693, 27.771741848251615], [91.258853794319876, 28.040614325466343], [90.730513950567797, 28.064953925075738], [90.015828891971182, 28.296438503527177], [89.475810174521158, 28.042758897406365], [88.814248488320573, 27.299315904239389], [88.730325962278528, 28.086864732367552], [88.120440708369941, 27.876541652939572], [86.954517043000635, 27.974261786403524], [85.823319940131526, 28.203575954698742], [85.011638218123053, 28.642773952747369], [84.23457970575015, 28.839893703724691], [83.89899295444674, 29.320226141877633], [83.337115106137176, 29.463731594352193], [82.327512648450877, 30.115268052688204], [81.525804477874786, 30.422716986608659], [81.111256138029276, 30.183480943313402], [79.721366815107118, 30.882714748654728], [78.738894484374001, 31.515906073527045], [78.458446486326025, 32.61816437431272], [79.176128777995544, 32.483779812137747], [79.208891636068543, 32.994394639613738], [78.811086460285722, 33.506198025032397], [78.912268914713209, 34.321936346975768], [77.83745079947461, 35.494009507787794], [76.192848341785705, 35.89840342868785], [75.896897414050173, 36.666806138651872], [75.158027785140987, 37.133030910789152], [74.980002475895404, 37.419990139305888], [74.829985792952144, 37.990007025701445], [74.864815708316783, 38.378846340481587], [74.25751427602269, 38.606506862943476], [73.928852166646394, 38.505815334622717], [73.675379266254836, 39.431236884105566], [73.960013055318427, 39.660008449861714], [73.822243686828315, 39.893973497063136], [74.776862420556043, 40.366425279291619], [75.467827996730719, 40.56207225194867], [76.526368035797432, 40.427946071935132], [76.90448449087711, 41.066485907549648], [78.187196893226044, 41.185315863604799], [78.543660923175253, 41.582242540038713], [80.119430373051401, 42.12394074153822], [80.259990268885318, 42.34999929459908], [80.180150180994374, 42.920067857426844], [80.866206496101213, 43.180362046881008], [79.966106398441426, 44.917516994804622], [81.947070753918084, 45.317027492853143], [82.458925815769035, 45.539649563166499], [83.180483839860543, 47.330031236350735], [85.164290399113213, 47.000955715516099], [85.720483839870667, 47.452969468773077], [85.76823286330837, 48.455750637396896], [86.59877648310335, 48.549181626980605], [87.359970330762692, 49.214980780629148], [87.751264276076668, 49.297197984405464], [88.013832228551678, 48.599462795600594], [88.854297723346747, 48.069081732773007], [90.280825636763893, 47.693549099307901], [90.970809360724957, 46.88814606382293], [90.585768263718307, 45.719716091487491], [90.945539585334316, 45.286073309910243], [92.133890822318222, 45.115075995456429], [93.480733677141316, 44.97547211362], [94.688928664125356, 44.352331854828456], [95.306875441471504, 44.241330878265458], [95.762454868556688, 43.319449164394619], [96.349395786527808, 42.725635280928643], [97.451757440177971, 42.74888967546007], [99.515817498779995, 42.524691473961688], [100.845865513108279, 42.663804429691417], [101.833040399179936, 42.51487295182627], [103.312278273534787, 41.907468166667613], [104.522281935649005, 41.90834666601662], [104.964993931093431, 41.597409572916334], [106.129315627061658, 42.134327704428891], [107.744772576937976, 42.481515814781908], [109.243595819131428, 42.519446316084149], [110.412103306115299, 42.871233628911014], [111.129682244920218, 43.406834011400171], [111.82958784388137, 43.743118394539486], [111.667737257943202, 44.073175767587706], [111.348376906379428, 44.457441718110047], [111.87330610560025, 45.102079372735112], [112.436062453258842, 45.01164561622425], [113.463906691544196, 44.808893134127111], [114.46033165899604, 45.339816799493875], [115.985096470200133, 45.727235012386004], [116.717868280098855, 46.38820241961524], [117.421701287914246, 46.67273285581421], [118.874325799638711, 46.805412095723646], [119.663269891438745, 46.692679958678944], [119.772823927897562, 47.048058783550132], [118.866574334794947, 47.747060044946195], [118.064142694166719, 48.06673045510373], [117.295507440257438, 47.697709052107385], [116.308952671373234, 47.853410142602812], [115.742837355615734, 47.726544501326273], [115.485282017073018, 48.135382595403442], [116.191802199367601, 49.134598090199056], [116.67880089728618, 49.888531399121398], [117.879244419426371, 49.510983384796944], [119.288460728025839, 50.142882798862033], [119.279365675942358, 50.582907619827282], [120.182049595216924, 51.64356639261802], [120.738191359541972, 51.964115302124547], [120.725789015791975, 52.516226304730814], [120.177088657716865, 52.753886216841195], [121.003084751470226, 53.251401068731226], [122.245747918792858, 53.431725979213681], [123.571506789240843, 53.458804429734627], [125.068211297710434, 53.161044826868832], [125.946348911646169, 52.792798570356936], [126.564399041856959, 51.784255479532689], [126.939156528837657, 51.353894151405896], [127.287455682484904, 50.739797268265434], [127.657407261262378, 49.760270494172929]]]] } }, - { "type": "Feature", "properties": { "admin": "Ivory Coast", "name": "Cte d'Ivoire", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[-2.856125047202397, 4.994475816259508], [-3.311084357100071, 4.984295559098014], [-4.008819545904941, 5.179813340674314], [-4.64991736491791, 5.168263658057084], [-5.834496222344525, 4.993700669775135], [-6.528769090185845, 4.705087795425015], [-7.518941209330434, 4.338288479017307], [-7.712159389669749, 4.364565944837721], [-7.63536821128403, 5.188159084489455], [-7.53971513511176, 5.313345241716517], [-7.570152553731686, 5.707352199725903], [-7.993692592795879, 6.126189683451541], [-8.311347622094017, 6.193033148621081], [-8.602880214868618, 6.467564195171659], [-8.385451626000572, 6.911800645368742], [-8.485445522485348, 7.395207831243068], [-8.439298468448696, 7.686042792181736], [-8.280703497744936, 7.687179673692156], [-8.221792364932197, 8.123328762235571], [-8.299048631208562, 8.316443589710302], [-8.203498907900878, 8.455453192575446], [-7.832100389019186, 8.575704250518625], [-8.079113735374348, 9.376223863152033], [-8.309616461612249, 9.789531968622439], [-8.22933712404682, 10.129020290563897], [-8.029943610048617, 10.206534939001711], [-7.89958980959237, 10.297382106970824], [-7.622759161804808, 10.147236232946792], [-6.850506557635057, 10.138993841996237], [-6.666460944027547, 10.430810655148447], [-6.493965013037267, 10.411302801958268], [-6.205222947606429, 10.524060777219132], [-6.050452032892266, 10.096360785355442], [-5.816926235365286, 10.222554633012191], [-5.404341599946973, 10.370736802609144], [-4.954653286143098, 10.152713934769732], [-4.779883592131966, 9.821984768101741], [-4.330246954760383, 9.610834865757139], [-3.980449184576684, 9.862344061721698], [-3.511898972986272, 9.900326239456216], [-2.827496303712706, 9.642460842319775], [-2.56218950032624, 8.219627793811481], [-2.983584967450326, 7.379704901555511], [-3.244370083011261, 6.2504715031135], [-2.810701463217839, 5.389051215024109], [-2.856125047202397, 4.994475816259508]]] } }, + { "type": "Feature", "properties": { "admin": "Ivory Coast", "name": "Côte d'Ivoire", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[-2.856125047202397, 4.994475816259508], [-3.311084357100071, 4.984295559098014], [-4.008819545904941, 5.179813340674314], [-4.64991736491791, 5.168263658057084], [-5.834496222344525, 4.993700669775135], [-6.528769090185845, 4.705087795425015], [-7.518941209330434, 4.338288479017307], [-7.712159389669749, 4.364565944837721], [-7.63536821128403, 5.188159084489455], [-7.53971513511176, 5.313345241716517], [-7.570152553731686, 5.707352199725903], [-7.993692592795879, 6.126189683451541], [-8.311347622094017, 6.193033148621081], [-8.602880214868618, 6.467564195171659], [-8.385451626000572, 6.911800645368742], [-8.485445522485348, 7.395207831243068], [-8.439298468448696, 7.686042792181736], [-8.280703497744936, 7.687179673692156], [-8.221792364932197, 8.123328762235571], [-8.299048631208562, 8.316443589710302], [-8.203498907900878, 8.455453192575446], [-7.832100389019186, 8.575704250518625], [-8.079113735374348, 9.376223863152033], [-8.309616461612249, 9.789531968622439], [-8.22933712404682, 10.129020290563897], [-8.029943610048617, 10.206534939001711], [-7.89958980959237, 10.297382106970824], [-7.622759161804808, 10.147236232946792], [-6.850506557635057, 10.138993841996237], [-6.666460944027547, 10.430810655148447], [-6.493965013037267, 10.411302801958268], [-6.205222947606429, 10.524060777219132], [-6.050452032892266, 10.096360785355442], [-5.816926235365286, 10.222554633012191], [-5.404341599946973, 10.370736802609144], [-4.954653286143098, 10.152713934769732], [-4.779883592131966, 9.821984768101741], [-4.330246954760383, 9.610834865757139], [-3.980449184576684, 9.862344061721698], [-3.511898972986272, 9.900326239456216], [-2.827496303712706, 9.642460842319775], [-2.56218950032624, 8.219627793811481], [-2.983584967450326, 7.379704901555511], [-3.244370083011261, 6.2504715031135], [-2.810701463217839, 5.389051215024109], [-2.856125047202397, 4.994475816259508]]] } }, { "type": "Feature", "properties": { "admin": "Cameroon", "name": "Cameroon", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[13.07582238124675, 2.267097072759014], [12.951333855855605, 2.321615708826939], [12.359380323952218, 2.19281220133945], [11.751665480199787, 2.326757513839993], [11.276449008843711, 2.261050930180871], [9.649158155972627, 2.283866075037735], [9.795195753629455, 3.073404445809117], [9.404366896205998, 3.734526882335202], [8.948115675501068, 3.904128933117135], [8.744923943729416, 4.352215277519959], [8.488815545290889, 4.495617377129917], [8.500287713259693, 4.771982937026847], [8.757532993208626, 5.47966583904791], [9.233162876023043, 6.444490668153334], [9.522705926154398, 6.453482367372116], [10.118276808318255, 7.038769639509879], [10.497375115611417, 7.055357774275562], [11.058787876030349, 6.644426784690593], [11.745774366918509, 6.981382961449753], [11.839308709366801, 7.397042344589434], [12.063946160539556, 7.799808457872301], [12.218872104550597, 8.305824082874322], [12.753671502339214, 8.717762762888993], [12.955467970438971, 9.417771714714702], [13.1675997249971, 9.64062632897341], [13.308676385153914, 10.160362046748926], [13.572949659894558, 10.798565985553564], [14.415378859116682, 11.572368882692071], [14.468192172918974, 11.90475169519341], [14.57717776862253, 12.085360826053501], [14.181336297266792, 12.483656927943112], [14.213530714584634, 12.802035427293344], [14.495787387762842, 12.859396267137326], [14.893385857816522, 12.219047756392582], [14.960151808337598, 11.555574042197222], [14.923564894274955, 10.891325181517471], [15.467872755605269, 9.982336737503429], [14.909353875394713, 9.99212942142273], [14.627200555081057, 9.920919297724536], [14.171466098699025, 10.021378282099928], [13.954218377344002, 9.549494940626685], [14.544466586981766, 8.965861314322266], [14.979995558337688, 8.796104234243471], [15.120865512765331, 8.382150173369423], [15.436091749745765, 7.692812404811971], [15.279460483469107, 7.421924546737968], [14.776545444404572, 6.408498033062044], [14.536560092841111, 6.22695872642069], [14.459407179429345, 5.451760565610299], [14.558935988023501, 5.03059764243153], [14.478372430080466, 4.732605495620446], [14.950953403389658, 4.21038930909492], [15.036219516671249, 3.851367295747123], [15.405395948964379, 3.335300604664339], [15.862732374747479, 3.013537298998982], [15.907380812247649, 2.557389431158612], [16.01285241055535, 2.267639675298084], [15.940918816805061, 1.727672634280295], [15.14634199388524, 1.964014797367184], [14.337812534246577, 2.22787466064949], [13.07582238124675, 2.267097072759014]]] } }, { "type": "Feature", "properties": { "admin": "Democratic Republic of the Congo", "name": "Dem. Rep. Congo", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[30.833859897593801, 3.50916596111034], [30.773346795380036, 2.339883327642127], [31.174149204235807, 2.204465236821263], [30.852670118948048, 1.849396470543809], [30.468507521290292, 1.58380544677972], [30.086153598762703, 1.062312730306288], [29.875778842902488, 0.597379868976304], [29.819503208136634, -0.205310153813372], [29.587837762172164, -0.58740569417948], [29.579466180140876, -1.341313164885626], [29.29188683443661, -1.620055840667987], [29.254834832483336, -2.215109958508911], [29.117478875451546, -2.292211195488384], [29.02492638521678, -2.839257907730157], [29.276383904749046, -3.293907159034063], [29.339997592900342, -4.499983412294092], [29.519986606572925, -5.419978936386313], [29.41999271008816, -5.939998874539432], [29.620032179490003, -6.520015150583424], [30.199996779101692, -7.079980970898161], [30.740015496551781, -8.340007419470913], [30.34608605319081, -8.238256524288216], [29.002912225060467, -8.40703175215347], [28.734866570762495, -8.526559340044576], [28.449871046672818, -9.164918308146083], [28.673681674928922, -9.605924981324931], [28.496069777141763, -10.789883721564044], [28.372253045370421, -11.793646742401389], [28.642417433392346, -11.971568698782312], [29.341547885869087, -12.36074391037241], [29.616001417771223, -12.178894545137307], [29.699613885219485, -13.257226657771827], [28.934285922976834, -13.248958428605132], [28.52356163912102, -12.698604424696679], [28.15510867687998, -12.272480564017894], [27.38879886242378, -12.132747491100663], [27.164419793412456, -11.608748467661071], [26.55308759939961, -11.924439792532125], [25.752309604604726, -11.784965101776356], [25.418118116973197, -11.330935967659958], [24.783169793402948, -11.238693536018962], [24.314516228947948, -11.262826429899269], [24.257155389103982, -10.951992689663655], [23.912215203555714, -10.926826267137512], [23.456790805767433, -10.867863457892481], [22.837345411884733, -11.017621758674329], [22.402798292742371, -10.99307545333569], [22.155268182064304, -11.084801120653768], [22.208753289486388, -9.894796237836507], [21.87518191904234, -9.523707777548564], [21.801801385187897, -8.908706556842978], [21.949130893652036, -8.305900974158275], [21.746455926203303, -7.920084730667147], [21.728110792739695, -7.2908724910813], [20.514748162526498, -7.299605808138629], [20.601822950938292, -6.93931772219968], [20.091621534920645, -6.943090101756993], [20.037723016040214, -7.116361179231644], [19.417502475673157, -7.155428562044297], [19.166613396896107, -7.738183688999753], [19.016751743249664, -7.988245944860132], [18.464175652752683, -7.847014255406442], [18.134221632569048, -7.98767750410492], [17.472970004962232, -8.068551120641699], [17.089995965247166, -7.545688978712525], [16.860190870845198, -7.222297865429984], [16.573179965896141, -6.622644545115087], [16.326528354567042, -5.877470391466267], [13.375597364971892, -5.864241224799548], [13.02486941900696, -5.984388929878157], [12.735171339578695, -5.965682061388497], [12.322431674863507, -6.100092461779658], [12.182336866920249, -5.789930515163837], [12.436688266660866, -5.684303887559245], [12.468004184629734, -5.248361504745003], [12.631611769265788, -4.991271254092935], [12.995517205465173, -4.781103203961883], [13.258240187237044, -4.882957452009165], [13.600234816144676, -4.500138441590969], [14.144956088933295, -4.510008640158715], [14.209034864975219, -4.793092136253597], [14.582603794013179, -4.970238946150139], [15.170991652088441, -4.3435071753143], [15.753540073314749, -3.855164890156096], [16.006289503654298, -3.535132744972528], [15.972803175529149, -2.712392266453612], [16.407091912510051, -1.740927015798682], [16.86530683764212, -1.225816338713287], [17.523716261472853, -0.743830254726987], [17.638644646889983, -0.424831638189246], [17.663552687254676, -0.058083998213817], [17.826540154703245, 0.288923244626105], [17.774191928791563, 0.855658677571085], [17.89883548347958, 1.741831976728278], [18.09427575040743, 2.365721543788055], [18.39379235197114, 2.90044342692822], [18.453065219809925, 3.504385891123348], [18.542982211997778, 4.201785183118317], [18.932312452884755, 4.709506130385973], [19.467783644293146, 5.031527818212779], [20.290679152108932, 4.691677761245287], [20.927591180106273, 4.322785549329736], [21.659122755630019, 4.224341945813719], [22.405123732195531, 4.02916006104732], [22.704123569436284, 4.633050848810156], [22.841479526468103, 4.710126247573483], [23.297213982850135, 4.609693101414221], [24.41053104014625, 5.108784084489129], [24.805028924262409, 4.897246608902349], [25.128833449003274, 4.927244777847789], [25.278798455514302, 5.170408229997191], [25.650455356557465, 5.256087754737123], [26.402760857862535, 5.150874538590869], [27.044065382604703, 5.127852688004835], [27.374226108517483, 5.233944403500059], [27.979977247842807, 4.408413397637373], [28.428993768026906, 4.287154649264493], [28.696677687298795, 4.455077215996936], [29.159078403446497, 4.38926727947323], [29.715995314256013, 4.600804755060024], [29.953500197069467, 4.173699042167683], [30.833859897593801, 3.50916596111034]]] } }, { "type": "Feature", "properties": { "admin": "Republic of Congo", "name": "Congo", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[12.995517205465173, -4.781103203961883], [12.620759718484491, -4.438023369976135], [12.318607618873923, -4.606230157086187], [11.914963006242086, -5.037986748884789], [11.093772820691923, -3.978826592630546], [11.855121697648114, -3.42687061932105], [11.478038771214299, -2.765618991714241], [11.820963575903189, -2.514161472181982], [12.495702752338159, -2.391688327650242], [12.575284458067639, -1.948511244315134], [13.109618767965626, -2.428740329603513], [13.992407260807706, -2.470804945489099], [14.299210239324564, -1.998275648612213], [14.425455763413593, -1.333406670744971], [14.316418491277741, -0.552627455247048], [13.843320753645653, 0.038757635901149], [14.276265903386953, 1.196929836426619], [14.026668735417214, 1.395677395021153], [13.282631463278816, 1.31418366129688], [13.003113641012074, 1.830896307783319], [13.07582238124675, 2.267097072759014], [14.337812534246577, 2.22787466064949], [15.14634199388524, 1.964014797367184], [15.940918816805061, 1.727672634280295], [16.01285241055535, 2.267639675298084], [16.537058139724135, 3.198254706226278], [17.133042433346297, 3.728196519379451], [17.809900343505259, 3.560196437998569], [18.453065219809925, 3.504385891123348], [18.39379235197114, 2.90044342692822], [18.09427575040743, 2.365721543788055], [17.89883548347958, 1.741831976728278], [17.774191928791563, 0.855658677571085], [17.826540154703245, 0.288923244626105], [17.663552687254676, -0.058083998213817], [17.638644646889983, -0.424831638189246], [17.523716261472853, -0.743830254726987], [16.86530683764212, -1.225816338713287], [16.407091912510051, -1.740927015798682], [15.972803175529149, -2.712392266453612], [16.006289503654298, -3.535132744972528], [15.753540073314749, -3.855164890156096], [15.170991652088441, -4.3435071753143], [14.582603794013179, -4.970238946150139], [14.209034864975219, -4.793092136253597], [14.144956088933295, -4.510008640158715], [13.600234816144676, -4.500138441590969], [13.258240187237044, -4.882957452009165], [12.995517205465173, -4.781103203961883]]] } }, diff --git a/types/ej.web.all/index.d.ts b/types/ej.web.all/index.d.ts index 61698887b8..ed36a800f6 100644 --- a/types/ej.web.all/index.d.ts +++ b/types/ej.web.all/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - /*! * filename: ej.web.all.d.ts * version : 15.2.0.43 diff --git a/types/ej.web.all/tsconfig.json b/types/ej.web.all/tsconfig.json index 3a1cd27967..0dad85ed26 100644 --- a/types/ej.web.all/tsconfig.json +++ b/types/ej.web.all/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "ej.web.all-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 201f14f156..07a8a0d54f 100644 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Jed Mao // bttf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/ember/v1/index.d.ts b/types/ember/v1/index.d.ts index 095c31a176..91e117f016 100644 --- a/types/ember/v1/index.d.ts +++ b/types/ember/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: http://emberjs.com/ // Definitions by: Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/eonasdan-bootstrap-datetimepicker/index.d.ts b/types/eonasdan-bootstrap-datetimepicker/index.d.ts index 71f973bbe9..63938275b1 100644 --- a/types/eonasdan-bootstrap-datetimepicker/index.d.ts +++ b/types/eonasdan-bootstrap-datetimepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: http://eonasdan.github.io/bootstrap-datetimepicker // Definitions by: Markus Peloso // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/eq.js/index.d.ts b/types/eq.js/index.d.ts index 4f48c092d5..d4b571368c 100644 --- a/types/eq.js/index.d.ts +++ b/types/eq.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Snugug/eq.js // Definitions by: Stephen Lautier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare var eqjs: eq.EqjsStatic; diff --git a/types/execa/execa-tests.ts b/types/execa/execa-tests.ts index 7d5e21e4b4..fd7428d1ae 100644 --- a/types/execa/execa-tests.ts +++ b/types/execa/execa-tests.ts @@ -45,7 +45,7 @@ execa.shell('echo unicorns') { let result: string; result = execa.shellSync('foo').stderr; - result = execa.shellSync('noop', ['foo']).stdout; + result = execa.shellSync('noop', { cwd: 'foo' }).stdout; result = execa.shellSync('foo').stderr; result = execa.shellSync('noop foo').stdout; diff --git a/types/express-handlebars/express-handlebars-tests.ts b/types/express-handlebars/express-handlebars-tests.ts index 4251c985fe..e923542a65 100644 --- a/types/express-handlebars/express-handlebars-tests.ts +++ b/types/express-handlebars/express-handlebars-tests.ts @@ -1,7 +1,3 @@ -/// - - - import express = require('express'); import exphbs = require('express-handlebars'); diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index dd012cab4e..5d1b17b47a 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -197,11 +197,11 @@ interface Request extends http.IncomingMessage, Express.Request { * * @param name */ - get(name: string): string; + get(name: string): string | undefined; - header(name: string): string; + header(name: string): string | undefined; - headers: { [key: string]: string; }; + headers: { [key: string]: string | string[]; }; /** * Check if the given `type(s)` is acceptable, returning diff --git a/types/express-serve-static-core/tsconfig.json b/types/express-serve-static-core/tsconfig.json index 40ee779963..cdb77c3573 100644 --- a/types/express-serve-static-core/tsconfig.json +++ b/types/express-serve-static-core/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/express/express-tests.ts b/types/express/express-tests.ts index 04165d5e09..93d63f45fc 100644 --- a/types/express/express-tests.ts +++ b/types/express/express-tests.ts @@ -1,4 +1,3 @@ -/// import * as express from 'express'; namespace express_tests { @@ -71,6 +70,15 @@ namespace express_tests { language = req.acceptsLanguages(['en', 'ja']); language = req.acceptsLanguages('en', 'ja'); + let existingHeader1 = req.get('existingHeader') as string; + let nonExistingHeader1 = req.get('nonExistingHeader') as undefined; + + let existingHeader2 = req.header('existingHeader') as string; + let nonExistingHeader2 = req.header('nonExistingHeader') as undefined; + + let existingHeader3 = req.headers.existingHeader as string; + let nonExistingHeader3 = req.headers.nonExistingHeader as undefined; + res.send(req.query['token']); }); diff --git a/types/express/index.d.ts b/types/express/index.d.ts index 9b913db473..d48d58c0c9 100644 --- a/types/express/index.d.ts +++ b/types/express/index.d.ts @@ -2,6 +2,7 @@ // Project: http://expressjs.com // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/express/tsconfig.json b/types/express/tsconfig.json index 0fc87c2800..009cb9ec00 100644 --- a/types/express/tsconfig.json +++ b/types/express/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/extend/extend-tests.ts b/types/extend/extend-tests.ts index 12a3147d2a..38e816f020 100644 --- a/types/extend/extend-tests.ts +++ b/types/extend/extend-tests.ts @@ -1,7 +1,5 @@ -/// - -import assert = require('assert'); import extend = require('extend'); +declare function assert(cond: boolean): void; var objectBase = { test: 'base' diff --git a/types/extended-listbox/extended-listbox-tests.ts b/types/extended-listbox/extended-listbox-tests.ts index 4d03ada74e..e3dcba4735 100644 --- a/types/extended-listbox/extended-listbox-tests.ts +++ b/types/extended-listbox/extended-listbox-tests.ts @@ -46,7 +46,7 @@ var id: string = instance.addItem("Test2"); var item: ListboxItem = {}; item.selected = true; item.disabled = false; -item.childItems = ["Test4"]; +item.childItems = [{ text: "Test4" }]; item.groupHeader = false; item.id = "ouetioreit"; item.index = 0; diff --git a/types/extended-listbox/index.d.ts b/types/extended-listbox/index.d.ts index b8495b2f94..e5062510f9 100644 --- a/types/extended-listbox/index.d.ts +++ b/types/extended-listbox/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/code-chris/extended-listbox // Definitions by: Christian Kotzbauer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface ListboxItem { /** display text */ diff --git a/types/fabric/fabric-tests.ts b/types/fabric/fabric-tests.ts index 9966e081d8..5e51bb8035 100644 --- a/types/fabric/fabric-tests.ts +++ b/types/fabric/fabric-tests.ts @@ -547,7 +547,7 @@ function sample8() { if (!fabric.Canvas.supports('toDataURL')) { alert('This browser doesn\'t provide means to serialize canvas to an image'); } else { - window.open(canvas.toDataURL('png')); + window.open(canvas.toDataURL({ format: 'png' })); } }; diff --git a/types/facebook-pixel/facebook-pixel-tests.ts b/types/facebook-pixel/facebook-pixel-tests.ts index c26c8b109d..7a3ab59df1 100644 --- a/types/facebook-pixel/facebook-pixel-tests.ts +++ b/types/facebook-pixel/facebook-pixel-tests.ts @@ -13,7 +13,10 @@ fbq('track', 'Purchase', purchaseParam); // Custom event (can only be used for audience building) -var custom_params = {custom_param: 'custom_value'}; +var custom_params = { + custom_param: 'custom_value', + content_type: 'product' +}; fbq('trackCustom', 'MyCustomEvent', custom_params); // Reach customers that viewed a product in the 'Shoes' category diff --git a/types/fancybox/index.d.ts b/types/fancybox/index.d.ts index 736d096279..cb37de2098 100644 --- a/types/fancybox/index.d.ts +++ b/types/fancybox/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/fancyapps/fancyBox // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/farbtastic/index.d.ts b/types/farbtastic/index.d.ts index c6cf10437b..8cb248a874 100644 --- a/types/farbtastic/index.d.ts +++ b/types/farbtastic/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mattfarina/farbtastic // Definitions by: Matt Brooks // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/featherlight/index.d.ts b/types/featherlight/index.d.ts index 80763aa429..bdedafe36f 100644 --- a/types/featherlight/index.d.ts +++ b/types/featherlight/index.d.ts @@ -2,6 +2,7 @@ // Project: https://noelboss.github.io/featherlight/ // Definitions by: Kaur Kuut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/findup-sync/findup-sync-tests.ts b/types/findup-sync/findup-sync-tests.ts index 86e34040ef..789190dcce 100644 --- a/types/findup-sync/findup-sync-tests.ts +++ b/types/findup-sync/findup-sync-tests.ts @@ -1,6 +1,3 @@ - -/// - import findup = require('findup-sync'); var str: string; diff --git a/types/flexslider/flexslider-tests.ts b/types/flexslider/flexslider-tests.ts index 591e874262..967a351604 100644 --- a/types/flexslider/flexslider-tests.ts +++ b/types/flexslider/flexslider-tests.ts @@ -1,3 +1,5 @@ +import $ = require('jquery'); + // Can also be used with $(document).ready() $(window).load(function() { $('.flexslider').flexslider({ @@ -73,10 +75,10 @@ $(window).load(function() { function ready(player_id: any) { var froogaloop = $(player_id); froogaloop.on('play', function(data) { - $('.flexslider').flexslider("pause"); + $('.flexslider').flexslider({ pauseText: "pause" }); }); froogaloop.on('pause', function(data) { - $('.flexslider').flexslider("play"); + $('.flexslider').flexslider({ playText: "play" }); }); } -}); \ No newline at end of file +}); diff --git a/types/flexslider/index.d.ts b/types/flexslider/index.d.ts index 9767744919..cf38995f94 100644 --- a/types/flexslider/index.d.ts +++ b/types/flexslider/index.d.ts @@ -2,8 +2,7 @@ // Project: https://github.com/woothemes/FlexSlider // Definitions by: Diullei Gomes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// +// TypeScript Version: 2.3 interface SliderObject { //Object: The slider element itself container: Object; //Object: The ul.slides within the slider diff --git a/types/flexslider/tsconfig.json b/types/flexslider/tsconfig.json index f8ba67625d..a2425d596e 100644 --- a/types/flexslider/tsconfig.json +++ b/types/flexslider/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "flexslider-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/flickity/index.d.ts b/types/flickity/index.d.ts index 16b5b7c96f..24a873761d 100644 --- a/types/flickity/index.d.ts +++ b/types/flickity/index.d.ts @@ -2,6 +2,7 @@ // Project: http://flickity.metafizzy.co/ // Definitions by: Chris McGrath // Definitions: https://github.com/clmcgrath/ +// TypeScript Version: 2.3 interface JQuery { diff --git a/types/flight/index.d.ts b/types/flight/index.d.ts index c46ddd0bfa..da88eaa53d 100644 --- a/types/flight/index.d.ts +++ b/types/flight/index.d.ts @@ -2,6 +2,7 @@ // Project: http://flightjs.github.com/flight/ // Definitions by: Jonathan Hedrén // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/flot/index.d.ts b/types/flot/index.d.ts index e4fed6a246..84ab0daeb8 100644 --- a/types/flot/index.d.ts +++ b/types/flot/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.flotcharts.org/ // Definitions by: Matt Burland , Timo Mühlbach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/form-data/form-data-tests.ts b/types/form-data/form-data-tests.ts index 6d1b9d6cb9..93457df3be 100644 --- a/types/form-data/form-data-tests.ts +++ b/types/form-data/form-data-tests.ts @@ -18,7 +18,7 @@ import * as ImportUsingES6Syntax from 'form-data'; () => { var form = new FormData(); - http.request('http://nodejs.org/images/logo.png', function (response) { + http.request({ path: 'http://nodejs.org/images/logo.png' }, function (response) { form.append('my_field', 'my value'); form.append('my_buffer', new Buffer(10)); form.append('my_logo', response); diff --git a/types/form-serializer/index.d.ts b/types/form-serializer/index.d.ts index 20ebb2223f..64c4880b39 100644 --- a/types/form-serializer/index.d.ts +++ b/types/form-serializer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/macek/jquery-serialize-object // Definitions by: Florian Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/foundation-sites/index.d.ts b/types/foundation-sites/index.d.ts index 2357b612b1..0bafdd6ae1 100644 --- a/types/foundation-sites/index.d.ts +++ b/types/foundation-sites/index.d.ts @@ -2,6 +2,7 @@ // Project: http://foundation.zurb.com/ // Definitions by: Sam Vloeberghs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // please also see the typings project and prefer to use it! // typings project: https://github.com/typings/typings diff --git a/types/foundation/index.d.ts b/types/foundation/index.d.ts index 49e9876130..73608604b5 100644 --- a/types/foundation/index.d.ts +++ b/types/foundation/index.d.ts @@ -2,6 +2,7 @@ // Project: http://foundation.zurb.com/ // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/fullcalendar/tsconfig.json b/types/fullcalendar/tsconfig.json index ceb59668c7..e57ff2b39c 100644 --- a/types/fullcalendar/tsconfig.json +++ b/types/fullcalendar/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "fullcalendar-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/fullcalendar/v1/index.d.ts b/types/fullcalendar/v1/index.d.ts index 4c8a5dc65a..63b70c9cc7 100644 --- a/types/fullcalendar/v1/index.d.ts +++ b/types/fullcalendar/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: http://arshaw.com/fullcalendar/ // Definitions by: Neil Stalker , Marcelo Camargo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// import * as moment from "moment"; diff --git a/types/fullcalendar/v1/tsconfig.json b/types/fullcalendar/v1/tsconfig.json index 810979b7a3..2389638d1c 100644 --- a/types/fullcalendar/v1/tsconfig.json +++ b/types/fullcalendar/v1/tsconfig.json @@ -25,4 +25,4 @@ "index.d.ts", "fullcalendar-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/fullpage.js/index.d.ts b/types/fullpage.js/index.d.ts index 7716a3bca8..869a64d6e8 100644 --- a/types/fullpage.js/index.d.ts +++ b/types/fullpage.js/index.d.ts @@ -2,6 +2,7 @@ // Project: http://alvarotrigo.com/fullPage/ // Definitions by: Andrew Roberts // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gamequery/index.d.ts b/types/gamequery/index.d.ts index 4d78bf23df..e45e7f761c 100644 --- a/types/gamequery/index.d.ts +++ b/types/gamequery/index.d.ts @@ -2,6 +2,7 @@ // Project: http://gamequeryjs.com/ // Definitions by: David Laubreiter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi.drive/gapi.drive-tests.ts b/types/gapi.drive/gapi.drive-tests.ts new file mode 100644 index 0000000000..6e6f9d1db1 --- /dev/null +++ b/types/gapi.drive/gapi.drive-tests.ts @@ -0,0 +1,92 @@ +/* Example taken from Google Drive API JavaScript Quickstart https://developers.google.com/drive/v2/web/quickstart/js */ + +{ + // Client ID and API key from the Developer Console + var CLIENT_ID = ''; + + // Authorization scopes required by the API; multiple scopes can be + // included, separated by spaces. + var SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']; + + /** + * Check if current user has authorized this application. + */ + function checkAuth() { + gapi.auth.authorize( + { + 'client_id': CLIENT_ID, + 'scope': SCOPES.join(' '), + 'immediate': true + }, handleAuthResult); + } + + /** + * Handle response from authorization server. + * + * @param {Object} authResult Authorization result. + */ + function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) { + var authorizeDiv = document.getElementById('authorize-div')!; + if (authResult && !authResult.error) { + // Hide auth UI, then load client library. + authorizeDiv.style.display = 'none'; + loadDriveApi(); + } else { + // Show auth UI, allowing the user to initiate authorization by + // clicking authorize button. + authorizeDiv.style.display = 'inline'; + } + } + + /** + * Initiate auth flow in response to user clicking authorize button. + * + * @param {Event} event Button click event. + */ + function handleAuthClick(event: MouseEvent) { + gapi.auth.authorize( + {client_id: CLIENT_ID, scope: SCOPES, immediate: false}, + handleAuthResult); + return false; + } + + + /** + * Load Google Drive client library. + */ + function loadDriveApi() { + gapi.client.load('drive', 'v2', () => null); + } + + /** + * Append a pre element to the body containing the given message + * as its text node. Used to display the results of the API call. + * + * @param {string} message Text to be placed in pre element. + */ + function appendPre(message: string) { + var pre = document.getElementById('content')!; + var textContent = document.createTextNode(message + '\n'); + pre.appendChild(textContent); + } + + /** + * Print files. + */ + function listFiles() { + gapi.client.drive.files.list({ + 'maxResults': 10 + }).then(function(response: any) { + appendPre('Files:'); + var files = response.result.items; + if (files && files.length > 0) { + for (var i = 0; i < files.length; i++) { + var file = files[i]; + appendPre(file.title + ' (' + file.id + ')'); + } + } else { + appendPre('No files found.'); + } + }); + } +} diff --git a/types/gapi.drive/index.d.ts b/types/gapi.drive/index.d.ts new file mode 100644 index 0000000000..ad8c64aa50 --- /dev/null +++ b/types/gapi.drive/index.d.ts @@ -0,0 +1,336 @@ +// Type definitions for Google Drive API v2 +// Project: https://developers.google.com/drive/ +// Definitions by: Sam Baxter +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace gapi.client.drive { + export namespace files { + interface GetParameters { + fileId: string; + acknowledgeAbuse?: boolean; + projection?: string; + revisionId?: string; + supportsTeamDrives?: boolean; + updateViewedDate?: boolean; + } + + export function get(parameters: GetParameters): HttpRequest; + + interface PatchParameters { + fileId: string; + resource?: FileResource + convert?: boolean; + modifiedDateBehavior?: string; + newRevision?: boolean; + ocr?: boolean; + ocrLanguage?: string; + pinned?: boolean; + removeParents?: string; + setModifiedDate?: boolean; + supportsTeamDrives?: boolean; + timedTextLanguage?: string; + timedTextTrackName?: string; + updateViewedData?: boolean; + useContentAsIndexableText?: boolean; + } + + export function patch(parameters: PatchParameters): HttpRequest; + + interface CopyParameters { + fileId: string; + resource?: FileResource; + convert?: boolean; + ocr?: boolean; + ocrLanguage?: string; + pinned?: boolean; + supportsTeamDrives?: boolean; + timedTextLanguage?: string; + timedTextTrackName?: string; + visibility?: string; + } + + export function copy(parameters: CopyParameters): HttpRequest; + + interface ListParameters { + corpora?: string; + corpus?: string; + includeTeamDriveItems?: boolean; + maxResults: number; + orderBy?: string; + pageToken?: string; + projection?: string; + q?: string; + spaces?: string; + supportsTeamDrives?: boolean; + teamDriveId?: string; + } + + export function list(parameters: ListParameters): HttpRequest; + + interface TouchParameters { + fileId: string; + supportsTeamDrives?: boolean; + } + + export function touch(parameters: TouchParameters): HttpRequest; + + interface TrashParameters { + fileId: string; + supportsTeamDrives?: boolean; + } + + export function trash(parameters: TrashParameters): HttpRequest; + + interface UntrashParameters { + fileId: string; + supportsTeamDrives?: boolean; + } + + export function untrash(parameters: UntrashParameters): HttpRequest; + + interface WatchParameters { + fileId: string; + resource?: WatchResource; + revisionId?: string; + supportsTeamDrives?: boolean; + } + + export function watch(parameters: WatchParameters): HttpRequest; + } + + export interface FileResource { + kind: 'drive#file'; + id?: string; + // etag + selfLink?: string; + webContentLink?: string; + webViewLink?: string; + alternateLink?: string; + embedLink?: string; + // openWithLinks + defaultOpenWithLink?: string; + iconLink?: string; + hasThumbnail?: boolean; + thumbnailLink?: string; + thumbnail?: { + image: Uint8Array; + mimType: string; + }; + title?: string; + mimeType?: string; + description?: string; + labels?: { + starred?: boolean; + hidden?: boolean; + trashed?: boolean; + restricted?: boolean; + viewed?: boolean; + modified?: boolean; + }; + createdDate?: Date; + modifiedDate?: Date; + modifiedByMeDate?: Date; + lastViewedByMeDate?: Date; + markedViewedByMeDate?: Date; + sharedWithMeDate?: Date; + version?: number; + sharingUser?: { + kind: 'drive#user'; + displayName?: string; + picture?: { + url: string; + }; + isAuthenticatedUser?: boolean; + permissionId?: string; + emailAddress?: string; + }; + parents?: ParentResource[]; + downloadUrl?: string; + // exportLinks + indexableText?: { + text: string; + }; + userPermission?: PermissionResource; + permissions?: PermissionResource[]; + hasAugmentedPermissions?: boolean; + originalFilename?: string; + fileExtension?: string; + fullFileExtension?: string; + md5Checksum?: string; + fileSize?: number; + quotaBytesUsed?: number; + ownerNames?: string[]; + owners?: { + kind: 'drive#user'; + displayName?: string; + picture?: { + url: string; + }; + isAuthenticatedUser?: boolean; + permissionId?: string; + emailAddress?: string; + }[]; + teamDriveId?: string; + lastModifyingUserName?: string; + lastModifyingUser?: { + kind: 'drive#user'; + displayName?: string; + picture?: { + url: string; + }; + isAuthenticatedUser?: boolean; + permissionId?: string; + emailAddress?: string; + }; + ownedByMe?: boolean; + capabilities?: { + canAddChildren?: boolean; + canChangeRestrictedDownload?: boolean; + canComment?: boolean; + canCopy?: boolean; + canDelete?: boolean; + canDownload?: boolean; + canEdit?: boolean; + canListChildren?: boolean; + canMoveItemIntoTeamDrive?: boolean; + canMoveTeamDriveItem?: boolean; + canReadRevisions?: boolean; + canReadTeamDrive?: boolean; + canRemoveChildren?: boolean; + canRename?: boolean; + canShare?: boolean; + canTrash?: boolean; + canUntrash?: boolean; + }; + editable?: boolean; + canComment?: boolean; + canReadRevisions?: boolean; + shareable?: boolean; + copyable?: boolean; + writersCanShare?: boolean; + shared?: boolean; + explicitlyTrashed?: boolean; + trashingUser?: { + kind: 'drive#user'; + displayName?: string; + picture?: { + url: string; + }; + isAuthenticatedUser?: boolean; + permissionId?: string; + emailAddress?: string; + }; + trashedDate?: Date; + appDataContents?: boolean; + headRevisionId?: string; + properties?: PropertiesResource[]; + folderColorRgb?: string; + imageMediaMetadata?: { + width?: number; + height?: number; + rotation?: number; + location?: { + latitude?: number; + longitude?: number; + altitude?: number; + }; + date?: string; + cameraMake?: string; + cameraModel?: string; + exposureTime?: number; + aperture?: number; + flashUsed?: boolean; + focalLength?: number; + isoSpeed?: number; + meteringMode?: string; + sensor?: string; + exposureMode?: string; + colorSpace?: string; + whiteBalance?: string; + exposureBias?: number; + maxApertureValue?: number; + subjectDistance?: number; + lens?: string; + }; + videoMediaMetadata?: { + width?: number; + height?: number; + durationMillis?: number; + }; + spaces?: string[]; + isAppAuthorized?: boolean; + } + + export interface FileListResource { + kind: 'drive#fileList'; + // etag + selfLink?: string; + nextPageToken?: string; + nextLink?: string; + incompleteSearch?: boolean; + items: FileResource[]; + } + + export interface ParentResource { + kind: 'drive#parentReference'; + id?: string; + selfLink?: string; + parentLink?: string; + isRoot?: boolean; + } + + export interface PermissionResource { + kind: 'drive#permission'; + // etag + id?: string; + selfLink?: string; + name?: string; + emailAddress?: string; + domain?: string; + role?: string; + additionalRoles?: string[]; + type?: string; + value?: string; + authKey?: string; + withLink?: boolean; + photoLink?: string; + expirationDate?: Date; + teamDrivePermissionDetails?: { + teamDrivePermissionType?: string; + role?: string; + additionalRoles?: string[]; + inheritedFrom?: string; + inherited?: boolean; + }[]; + deleted?: boolean; + } + + export interface PropertiesResource { + kind: 'drive$property'; + // etag + selfLink?: string; + key?: string; + visibility?: string; + value?: string; + } + + export interface WatchResource { + id?: string; + expiration?: number; + token?: string; + type?: string; + address?: string; + } + + export interface ChannelResource { + kind: 'api#channel'; + id?: string; + resourceId?: string; + resourceUri?: string; + token?: string; + expiration?: number; + } +} diff --git a/types/gapi.drive/tsconfig.json b/types/gapi.drive/tsconfig.json new file mode 100644 index 0000000000..b66df1103c --- /dev/null +++ b/types/gapi.drive/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gapi.drive-tests.ts" + ] +} diff --git a/types/geopattern/index.d.ts b/types/geopattern/index.d.ts index edd08ad035..5756fbda93 100644 --- a/types/geopattern/index.d.ts +++ b/types/geopattern/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/btmills/geopattern // Definitions by: Gaelan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gijgo/index.d.ts b/types/gijgo/index.d.ts index 2f9604bbef..a76d98dd7f 100644 --- a/types/gijgo/index.d.ts +++ b/types/gijgo/index.d.ts @@ -2,6 +2,7 @@ // Project: http://gijgo.com // Definitions by: Atanas Atanasov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare module Gijgo { diff --git a/types/giraffe/index.d.ts b/types/giraffe/index.d.ts index f9198a7d8b..6b88b5d4b8 100644 --- a/types/giraffe/index.d.ts +++ b/types/giraffe/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/barc/backbone.giraffe // Definitions by: Matt McCray // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/gldatepicker/index.d.ts b/types/gldatepicker/index.d.ts index 1f96e15395..c5b881a0bb 100644 --- a/types/gldatepicker/index.d.ts +++ b/types/gldatepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: http://glad.github.com/glDatePicker/ // Definitions by: Dániel Tar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/glidejs/index.d.ts b/types/glidejs/index.d.ts index 530cd41247..d6ceea389a 100644 --- a/types/glidejs/index.d.ts +++ b/types/glidejs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://glide.jedrzejchalubek.com/ // Definitions by: Milan Jaros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface JQuery { /** diff --git a/types/google-apps-script/google-apps-script.spreadsheet.d.ts b/types/google-apps-script/google-apps-script.spreadsheet.d.ts index 74ca8b2e79..e710fcfb4a 100644 --- a/types/google-apps-script/google-apps-script.spreadsheet.d.ts +++ b/types/google-apps-script/google-apps-script.spreadsheet.d.ts @@ -9,6 +9,11 @@ /// declare namespace GoogleAppsScript { + /** + * This service allows scripts to create, access, and modify Google Sheets files. See also the guide to storing data in spreadsheets. + * + * https://developers.google.com/apps-script/guides/sheets + */ export module Spreadsheet { /** * Styles that can be set on a range using @@ -24,9 +29,25 @@ declare namespace GoogleAppsScript { * sheet.updateChart(chart); */ export interface ContainerInfo { + /** + * The chart's left side will be anchored to this column. + * @returns {Integer} 1-indexed column (i.e. column C will be 3) + */ getAnchorColumn(): Integer; + /** + * The chart's top side will be anchored to this row. + * @returns {Integer} 1-indexed row (i.e. row 5 will return 5) + */ getAnchorRow(): Integer; + /** + * The chart's upper left hand corner will be offset from the anchor column by this many pixels. + * @returns {Integer} the horizontal offset in pixels for the upper left hand corner of the chart + */ getOffsetX(): Integer; + /** + * Chart's upper left hand corner will be offset from the anchor row by this many pixels. + * @returns {Integer} the vertical offset in pixels for the upper left hand corner of the chart + */ getOffsetY(): Integer; } @@ -573,16 +594,31 @@ declare namespace GoogleAppsScript { * Data > Named ranges... menu. */ export interface NamedRange { + /** + * Gets the name of this named range. + */ getName(): string; + /** + * Gets teh range referenced by this named range. + */ getRange(): Range; + /** + * Deletes this named range. + */ remove(): void; + /** + * Sets/updates the name of this named range. + */ setName(name: string): NamedRange; + /** + * Sets/updates the range for this named range. + */ setRange(range: Range): NamedRange; } /** - * - * Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful + * @deprecated + * For spreadsheets created in the newer version of Google Sheets, use the more powerful * Protection class instead. Although this class is deprecated, it will remain * available for compatibility with the older version of Sheets. * Access and modify protected sheets in the older version of Google Sheets. @@ -713,6 +749,7 @@ declare namespace GoogleAppsScript { getBackgrounds(): String[][]; getCell(row: Integer, column: Integer): Range; getColumn(): Integer; + getColumnIndex(): Integer; getDataSourceUrl(): string; getDataTable(): Charts.DataTable; getDataTable(firstRowIsHeader: boolean): Charts.DataTable; @@ -1021,27 +1058,85 @@ declare namespace GoogleAppsScript { * the parent class for the Spreadsheet service. */ export interface SpreadsheetApp { + /** + * An enumeration of the valid styles for setting borders on a Range. + */ BorderStyle: typeof BorderStyle; + /** + * An enumeration representing the data-validation criteria that can be set on a range. + */ DataValidationCriteria: typeof DataValidationCriteria; + /** + * An enumeration representing the parts of a spreadsheet that can be protected from edits. + */ ProtectionType: typeof ProtectionType; + /** + * Creates a new spreadsheet with the given name. + */ create(name: string): Spreadsheet; + /** + * Creates a new spreadsheet with the given name and the specified number of rows and columns. + */ create(name: string, rows: Integer, columns: Integer): Spreadsheet; + /** + * Applies all pending Spreadsheet changes. + */ flush(): void; + /** + * Returns the currently active spreadsheet, or null if there is none. + */ getActive(): Spreadsheet; + /** + * Returns the range of cells that is currently considered active. + */ getActiveRange(): Range; + /** + * Gets the active sheet in a spreadsheet. + */ getActiveSheet(): Sheet; + /** + * Returns the currently active spreadsheet, or null if there is none. + */ getActiveSpreadsheet(): Spreadsheet; + /** + * Returns an instance of the spreadsheet's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. + */ getUi(): Base.Ui; + /** + * Creates a builder for a data-validation rule. + */ newDataValidation(): DataValidationBuilder; + /** + * Opens the spreadsheet that corresponds to the given File object. + */ open(file: Drive.File): Spreadsheet; + /** + * Opens the spreadsheet with the given ID. + */ openById(id: string): Spreadsheet; + /** + * Opens the spreadsheet with the given url. + */ openByUrl(url: string): Spreadsheet; + /** + * Sets the active range for the application. + */ setActiveRange(range: Range): Range; + /** + * Sets the active sheet in a spreadsheet. + */ setActiveSheet(sheet: Sheet): Sheet; + /** + * Sets the active spreadsheet. + */ setActiveSpreadsheet(newActiveSpreadsheet: Spreadsheet): void; } } } +/** + * This class allows users to open Google Sheets files and to create new ones. This class is + * the parent class for the Spreadsheet service. + */ declare var SpreadsheetApp: GoogleAppsScript.Spreadsheet.SpreadsheetApp; diff --git a/types/google-apps-script/google-apps-script.types.d.ts b/types/google-apps-script/google-apps-script.types.d.ts index 5204a8a2a4..3c7bfb550c 100644 --- a/types/google-apps-script/google-apps-script.types.d.ts +++ b/types/google-apps-script/google-apps-script.types.d.ts @@ -8,5 +8,6 @@ declare module GoogleAppsScript { type Byte = number; type Integer = number; type Char = string; + type String = string; type JdbcSQL_XML = any; } diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index e2a4f89922..e2017523ad 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -32,7 +32,7 @@ declare namespace google.maps { export class Map extends MVCObject { constructor(mapDiv: Element|null, opts?: MapOptions); fitBounds(bounds: LatLngBounds|LatLngBoundsLiteral): void; - getBounds(): LatLngBounds; + getBounds(): LatLngBounds|null|undefined; getCenter(): LatLng; getDiv(): Element; getHeading(): number; diff --git a/types/gridstack/index.d.ts b/types/gridstack/index.d.ts index b1c5f14c0f..2406f5e08b 100644 --- a/types/gridstack/index.d.ts +++ b/types/gridstack/index.d.ts @@ -2,6 +2,7 @@ // Project: http://troolee.github.io/gridstack.js/ // Definitions by: Pascal Senn , Ricky Blankenaufulland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface JQuery { gridstack (options: IGridstackOptions): JQuery; diff --git a/types/gulp-shell/gulp-shell-tests.ts b/types/gulp-shell/gulp-shell-tests.ts index 581808670c..17357d6c70 100644 --- a/types/gulp-shell/gulp-shell-tests.ts +++ b/types/gulp-shell/gulp-shell-tests.ts @@ -35,5 +35,5 @@ gulp.task('lint', shell.task('eslint ' + paths.js.join(' '))); gulp.task('default', gulp.parallel('coverage', 'lint')); gulp.task('watch', function () { - gulp.watch(paths.js, ['default']) + gulp.watch(paths.js) }); diff --git a/types/gulp/v3/gulp-tests.ts b/types/gulp/v3/gulp-tests.ts new file mode 100644 index 0000000000..9660b0658a --- /dev/null +++ b/types/gulp/v3/gulp-tests.ts @@ -0,0 +1,68 @@ +import gulp = require("gulp"); +import browserSync = require("browser-sync"); + +var typescript: gulp.GulpPlugin = null; // this would be the TypeScript compiler +var jasmine: gulp.GulpPlugin = null; // this would be the jasmine test runner + +gulp.task('compile', function() +{ + gulp.src("**/*.ts") + .pipe(typescript()) + .pipe(gulp.dest('out')) +}); + +gulp.task('compile2', function(callback: (err?: any) => void) +{ + gulp.src("**/*.ts") + .pipe(typescript()) + .pipe(gulp.dest('out')) + .on('end', callback); +}); + +gulp.task('test', ['compile', 'compile2'], function() +{ + gulp.src("out/test/**/*.js") + .pipe(jasmine()); +}); + +gulp.task('default', ['compile', 'test']); + + + +var opts = {}; + +gulp.watch('*.html', 'compile'); +gulp.watch('*.html', ['compile', 'test']); +gulp.watch('*.html', () => {}); +gulp.watch('*.html', [() => {}, (event) => {}]); +gulp.watch('*.html', ['compile', () => {}]); + +gulp.watch('*.html', opts, 'compile'); +gulp.watch('*.html', opts, ['compile', 'test']); +gulp.watch('*.html', opts, () => {}); +gulp.watch('*.html', opts, [() => {}, (event) => {}]); +gulp.watch('*.html', opts, ['compile', () => {}]); + +gulp.watch(['*.html', '*.ts'], 'compile'); +gulp.watch(['*.html', '*.ts'], ['compile', 'test']); +gulp.watch(['*.html', '*.ts'], () => {}); +gulp.watch(['*.html', '*.ts'], [() => {}, (event) => {}]); +gulp.watch(['*.html', '*.ts'], ['compile', () => {}]); + +gulp.watch(['*.html', '*.ts'], opts, 'compile'); +gulp.watch(['*.html', '*.ts'], opts, ['compile', 'test']); +gulp.watch(['*.html', '*.ts'], opts, () => {}); +gulp.watch(['*.html', '*.ts'], opts, [() => {}, (event) => {}]); +gulp.watch(['*.html', '*.ts'], opts, ['compile', () => {}]); + +var watcher = gulp.watch('*.html', event => { + console.log('Event type: ' + event.type); + console.log('Event path: ' + event.path); +}); + +gulp.task('serve', ['compile'], () => { + var browser = browserSync.create(); + gulp.watch(['*.html', '*.ts'], ['compile', browser.reload]); +}); + +gulp.start('test', 'compile'); diff --git a/types/gulp/v3/index.d.ts b/types/gulp/v3/index.d.ts new file mode 100644 index 0000000000..4abdba21ed --- /dev/null +++ b/types/gulp/v3/index.d.ts @@ -0,0 +1,308 @@ +// Type definitions for Gulp 3.8 +// Project: http://gulpjs.com +// Definitions by: Drew Noakes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +import Orchestrator = require('orchestrator'); +import VinylFile = require('vinyl'); + +declare namespace gulp { + interface Gulp extends Orchestrator { + task(name: string): never; + /** + * Define a task + * @param name The name of the task. + * @param deps An array of task names to be executed and completed before your task will run. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + *
    + *
  • Take in a callback
  • + *
  • Return a stream or a promise
  • + *
+ */ + task(name: string, fn?: Orchestrator.TaskFunc): Gulp; + /** + * Define a task + * @param name The name of the task. + * @param deps An array of task names to be executed and completed before your task will run. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + *
    + *
  • Take in a callback
  • + *
  • Return a stream or a promise
  • + *
+ */ + task(name: string, deps?: string[], fn?: Orchestrator.TaskFunc): Gulp; + + /** + * Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins. + * @param glob Glob or array of globs to read. + * @param opt Options to pass to node-glob through glob-stream. + */ + src: SrcMethod; + /** + * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. + * Folders that don't exist will be created. + * + * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. + * @param opt + */ + dest: DestMethod; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param opt options, that are passed to the gaze library. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + watch: WatchMethod; + } + + interface GulpPlugin { + (...args: any[]): NodeJS.ReadWriteStream; + } + + interface WatchMethod { + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string | string[], fn: (WatchCallback | string)): NodeJS.EventEmitter; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string | string[], fn: (WatchCallback | string)[]): NodeJS.EventEmitter; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param opt options, that are passed to the gaze library. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string | string[], opt: WatchOptions, fn: (WatchCallback | string)): NodeJS.EventEmitter; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param opt options, that are passed to the gaze library. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string | string[], opt: WatchOptions, fn: (WatchCallback | string)[]): NodeJS.EventEmitter; + + } + + interface DestMethod { + /** + * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. + * Folders that don't exist will be created. + * + * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. + * @param opt + */ + (outFolder: string | ((file: VinylFile) => string), opt?: DestOptions): NodeJS.ReadWriteStream; + } + + interface SrcMethod { + /** + * Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins. + * @param glob Glob or array of globs to read. + * @param opt Options to pass to node-glob through glob-stream. + */ + (glob: string | string[], opt?: SrcOptions): NodeJS.ReadWriteStream; + } + + /** + * Options to pass to node-glob through glob-stream. + * Specifies two options in addition to those used by node-glob: + * https://github.com/isaacs/node-glob#options + */ + interface SrcOptions { + /** + * Setting this to false will return file.contents as null + * and not read the file at all. + * Default: true. + */ + read?: boolean; + + /** + * Setting this to false will return file.contents as a stream and not buffer files. + * This is useful when working with large files. + * Note: Plugins might not implement support for streams. + * Default: true. + */ + buffer?: boolean; + + /** + * The base path of a glob. + * + * Default is everything before a glob starts. + */ + base?: string; + + /** + * The current working directory in which to search. + * Defaults to process.cwd(). + */ + cwd?: string; + + /** + * The place where patterns starting with / will be mounted onto. + * Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.) + */ + root?: string; + + /** + * Include .dot files in normal matches and globstar matches. + * Note that an explicit dot in a portion of the pattern will always match dot files. + */ + dot?: boolean; + + /** + * Set to match only fles, not directories. Set this flag to prevent copying empty directories + */ + nodir?: boolean; + + /** + * By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid + * filesystem path is returned. Set this flag to disable that behavior. + */ + nomount?: boolean; + + /** + * Add a / character to directory matches. Note that this requires additional stat calls. + */ + mark?: boolean; + + /** + * Don't sort the results. + */ + nosort?: boolean; + + /** + * Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless + * readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one + * level sooner in the case of cyclical symbolic links. + */ + stat?: boolean; + + /** + * When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr. + * Set the silent option to true to suppress these warnings. + */ + silent?: boolean; + + /** + * When an unusual error is encountered when attempting to read a directory, the process will just continue on in + * search of other matches. Set the strict option to raise an error in these cases. + */ + strict?: boolean; + + /** + * See cache property above. Pass in a previously generated cache object to save some fs calls. + */ + cache?: boolean; + + /** + * A cache of results of filesystem information, to prevent unnecessary stat calls. + * While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the + * options object of another, if you know that the filesystem will not change between calls. + */ + statCache?: boolean; + + /** + * Perform a synchronous glob search. + */ + sync?: boolean; + + /** + * In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set. + * By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior. + */ + nounique?: boolean; + + /** + * Set to never return an empty set, instead returning a set containing the pattern itself. + * This is the default in glob(3). + */ + nonull?: boolean; + + /** + * Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning + * results that are case-insensitively matched anyway, since readdir and stat will not raise an error. + */ + nocase?: boolean; + + /** + * Set to enable debug logging in minimatch and glob. + */ + debug?: boolean; + + /** + * Set to enable debug logging in glob, but not minimatch. + */ + globDebug?: boolean; + } + + interface DestOptions { + /** + * The output folder. Only has an effect if provided output folder is relative. + * Default: process.cwd() + */ + cwd?: string; + + /** + * Octal permission string specifying mode for any folders that need to be created for output folder. + * Default: 0777. + */ + mode?: string; + } + + /** + * Options that are passed to gaze. + * https://github.com/shama/gaze + */ + interface WatchOptions { + /** Interval to pass to fs.watchFile. */ + interval?: number; + /** Delay for events called in succession for the same file/event. */ + debounceDelay?: number; + /** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */ + mode?: string; + /** The current working directory to base file patterns from. Default is process.cwd().. */ + cwd?: string; + } + + interface WatchEvent { + /** The type of change that occurred, either added, changed or deleted. */ + type: string; + /** The path to the file that triggered the event. */ + path: string; + } + + /** + * Callback to be called on each watched file change. + */ + interface WatchCallback { + (event: WatchEvent): void; + } + + interface TaskCallback { + /** + * Defines a task. + * Tasks may be made asynchronous if they are passing a callback or return a promise or a stream. + * @param cb callback used to signal asynchronous completion. Caller includes err in case of error. + */ + (cb?: (err?: any) => void): any; + } +} + +declare var gulp: gulp.Gulp; + +export = gulp; diff --git a/types/gulp/v3/tsconfig.json b/types/gulp/v3/tsconfig.json new file mode 100644 index 0000000000..242192adaa --- /dev/null +++ b/types/gulp/v3/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "gulp": [ + "gulp/v3" + ], + "q": [ + "q/v0" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-tests.ts" + ] +} diff --git a/types/h2o2/h2o2-tests.ts b/types/h2o2/h2o2-tests.ts index f8e88c5c9b..48b05b8aa3 100644 --- a/types/h2o2/h2o2-tests.ts +++ b/types/h2o2/h2o2-tests.ts @@ -95,7 +95,7 @@ server.route({ Wreck.read(res, { json: true }, function (err, payload) { console.log('some payload manipulation if you want to.') - reply(payload).headers = res.headers; + reply(payload).headers = res.headers as any; }); } } @@ -157,7 +157,7 @@ server.route({ Wreck.read(res, { json: true }, function (err: null | Boom.BoomError, payload: any) { console.log('some payload manipulation if you want to.') - reply(payload).headers = res.headers; + reply(payload).headers = res.headers as any; }); } } diff --git a/types/hammerjs/v1/index.d.ts b/types/hammerjs/v1/index.d.ts index e01ea87384..690d079041 100644 --- a/types/hammerjs/v1/index.d.ts +++ b/types/hammerjs/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: http://eightmedia.github.com/hammer.js/ // Definitions by: Boris Yankov , Drew Noakes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index efce9f3dc4..f0ed602864 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -678,6 +678,10 @@ export interface CatboxServerCacheConfiguration extends Catbox.PolicyOptions { * [See docs](https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback) example code includes use of `name` option. But server.cache.provision of `options` says "same as the server cache configuration options.". */ name?: string; + /** + * Additional options to be passed to the Catbox strategy + */ + [s: string]: any; } /** diff --git a/types/hapi/test/route/validate.ts b/types/hapi/test/route/validate.ts index f579bff8a8..cb5c5527ee 100644 --- a/types/hapi/test/route/validate.ts +++ b/types/hapi/test/route/validate.ts @@ -25,7 +25,7 @@ let config: Hapi.RouteAdditionalConfigurationOptions = { }, }; -interface CustomValidationOptions { +interface CustomValidationOptions extends Joi.ValidationOptions { myOption: number; } diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts index 9b3ff44431..0c68c88a45 100644 --- a/types/heredatalens/index.d.ts +++ b/types/heredatalens/index.d.ts @@ -181,7 +181,7 @@ declare namespace H { * @param service {H.datalens.Service} - Data Lens REST API service * @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters */ - constructor(data: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + constructor(data: H.datalens.Service.Data, options?: H.datalens.QueryProvider.Options); /** * Updates the query ID to be used in the next call of the Data Lens REST API. diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 43c50d417c..01360c1bdf 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -28,19 +28,19 @@ function capture(resultContainer: HTMLElement, map: H.Map, ui: H.ui.UI) { * Boilerplate map initialization code starts below: */ // Step 1: initialize communication with the platform -var platform = new H.service.Platform({ +let platform = new H.service.Platform({ app_id: 'DemoAppId01082013GAL', app_code: 'AJKnXv84fjrb0KIHawS0Tg', useHTTPS: true, useCIT: true }); -var defaultLayers = platform.createDefaultLayers(); +let defaultLayers = platform.createDefaultLayers(); -var mapContainer = document.getElementById('map'); +let mapContainer = document.getElementById('map'); // Step 2: initialize a map -var map = new H.Map(mapContainer, defaultLayers.normal.map, { +let map = new H.Map(mapContainer, defaultLayers.normal.map, { // initial center and zoom level of the map zoom: 16, // Champs-Elysees @@ -50,23 +50,22 @@ var map = new H.Map(mapContainer, defaultLayers.normal.map, { // Step 3: make the map interactive // MapEvents enables the event system // Behavior implements default interactions for pan/zoom (also on mobile touch environments) -var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map)); +let behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map)); // Step 4: Create the default UI -var ui = H.ui.UI.createDefault(map, defaultLayers, 'en-US'); - +let ui = H.ui.UI.createDefault(map, defaultLayers, 'en-US'); // Step 6: Create "Capture" button and place for showing the captured area -var resultContainer = document.getElementById('panel'); +let resultContainer = document.getElementById('panel'); // Create container for the "Capture" button -var containerNode = document.createElement('div'); +let containerNode = document.createElement('div'); containerNode.setAttribute('style', 'position:absolute;top:0;left:0;background-color:#fff; padding:10px;'); containerNode.className = 'btn-group'; // Create the "Capture" button -var captureBtn = document.createElement('input'); +let captureBtn = document.createElement('input'); captureBtn.value = 'Capture'; captureBtn.type = 'button'; captureBtn.className = 'btn btn-sm btn-default'; @@ -76,6 +75,13 @@ containerNode.appendChild(captureBtn); mapContainer.appendChild(containerNode); // Step 7: Handle capture button click event -captureBtn.onclick = function() { +captureBtn.onclick = () => { capture(resultContainer, map, ui); -}; \ No newline at end of file +}; + +let icon = new H.map.Icon('svg', { size: 5, crossOrigin: false }); + +let polyline = new H.map.Polyline(new H.geo.Strip()); +// tslint:disable-next-line:array-type +let clipArr: Array>; +clipArr = polyline.clip(new H.geo.Rect(5, 5, 5, 5)); diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index bfdd353dd3..206a932e68 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -1,14 +1,17 @@ -// Type definitions for HERE Maps API for JavaScript 3.0s +// Type definitions for HERE Maps API for JavaScript 3.0 // Project: https://developer.here.com/ // Definitions by: Joshua Efiong +// Bernd Hacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare namespace H { /***** Map *****/ /** - * Map class defines map instance in the application. By creating this object you will initialize a visible map object which is attached to the provided dom element. Map class is an entry point to all operations related to layers, map objects and geo-screen transformations. By specifying options you can initialize map with predefined view. + * Map class defines map instance in the application. By creating this object you will initialize a visible map object which is attached to the provided dom element. + * Map class is an entry point to all operations related to layers, map objects and geo-screen transformations. By specifying options you can initialize map with predefined view. */ - export class Map extends H.util.EventTarget { + class Map extends H.util.EventTarget { /** * Constructor * @param element {Element} - html element into which the map will be rendered @@ -81,7 +84,8 @@ declare namespace H { getCameraDataForBounds(rect: H.geo.Rect): H.map.ViewModel.CameraData; /** - * This method returns current map viewport. Viewport can be used to modify padding and margin which will reflect the position of the viewport center and the amount of extra data loaded (for margin) + * This method returns current map viewport. + * Viewport can be used to modify padding and margin which will reflect the position of the viewport center and the amount of extra data loaded (for margin) * @returns {H.map.ViewPort} */ getViewPort(): H.map.ViewPort; @@ -105,7 +109,8 @@ declare namespace H { getImprint(): H.map.Imprint; /** - * This method captures desired region of the map and objects on it. Result is returned as an HTML5 Canvas element. Origin of coordinate system for capturing is in the top left corner of the viewport. + * This method captures desired region of the map and objects on it. Result is returned as an HTML5 Canvas element. + * Origin of coordinate system for capturing is in the top left corner of the viewport. * @param callback {function(HTMLCanvasElement=)} - Callback function to call once result of the capturing is ready * @param opt_capturables {Array=} - Collection of "capturable" element(s) to draw into the resulting canvas * @param opt_x1 {number=} - The X coordinate of the left edge of the capturing rectangle defaults to 0 @@ -113,7 +118,7 @@ declare namespace H { * @param opt_x2 {number=} - The X coordinate of the right edge of the capturing rectangle defaults to viewport width * @param opt_y2 {number=} - The Y coordinate of the bottom edge of the capturing rectangle defaults to viewport height */ - capture(callback?: (canvas: HTMLCanvasElement) => void, opt_capturables?: Array, opt_x1?: number, opt_y1?: number, opt_x2?: number, opt_y2?: number): void; + capture(callback?: (canvas: HTMLCanvasElement) => void, opt_capturables?: H.util.ICapturable[], opt_x1?: number, opt_y1?: number, opt_x2?: number, opt_y2?: number): void; /** * This method sets the rendering engine type for the map. Rendering engine is responsible for displaying i.e tiles and data on the map. @@ -123,7 +128,8 @@ declare namespace H { setEngineType(type: H.Map.EngineType): H.Map; /** - * To persistently store the content of a map layer for a given area and range of zoom levels. It can be used to enable map rendering when no internet connection is established and also to reduce the download traffic for frequently visited map areas. + * To persistently store the content of a map layer for a given area and range of zoom levels. + * It can be used to enable map rendering when no internet connection is established and also to reduce the download traffic for frequently visited map areas. * @param opt_onprogress {function(H.util.Request)=} - A callback which is invoked every time when the progress state of the returned store request changes. * @param opt_bounds {H.geo.Rect=} - The area to store, default is the current view bounds * @param opt_min {number=} - The minimum zoom level to store, default is the current zoom level @@ -209,21 +215,21 @@ declare namespace H { * This method retrieves the list of all objects which have been added to the map. * @returns {Array} - the list of all use objects which are currently on the map. */ - getObjects(): Array; + getObjects(): H.map.Object[]; /** * This method adds an array of objects or an object group to the map. * @param mapObjects {Array} * @returns {H.Map} - the map instance */ - addObjects(mapObjects: Array): H.Map; + addObjects(mapObjects: H.map.Object[]): H.Map; /** * This method removes an array of object or an object group from the map. * @param mapObjects {(Array | H.map.Group)} * @returns {H.Map} - the map instance */ - removeObjects(mapObjects: (Array | H.map.Group)): H.Map; + removeObjects(mapObjects: (H.map.Object[] | H.map.Group)): H.Map; /** * Returns the top most z-ordered map object found under the specific screen coordinates. Coordinates are viewport pixel coordinates starting from top left corner as (0, 0) point. @@ -239,7 +245,7 @@ declare namespace H { * @param y {number} - map viewport y-axis pixel coordinate * @returns {Array} */ - getObjectsAt(x: number, y: number): Array; + getObjectsAt(x: number, y: number): H.map.Object[]; /** * This method will dispatch event on the event target object @@ -257,16 +263,17 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Map { + namespace Map { /** - * It defines the number of lower and higher zoom levels, where cached content of the base map is rendered while content of the current zoom level is still loading. Example: if range was set to {lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12. + * It defines the number of lower and higher zoom levels, where cached content of the base map is rendered while content of the current zoom level is still loading. + * Example: if range was set to {lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12. * @property lower {number} - The number of lower zoom levels to take into account, default is 0 * @property higher {number} - The number of higher zoom levels to take into account, default is 0 */ - export interface BackgroundRange { + interface BackgroundRange { lower: number; higher: number; } @@ -274,7 +281,7 @@ declare namespace H { /** * Types of engines */ - export enum EngineType { + enum EngineType { P2D, PANORAMA, } @@ -288,17 +295,19 @@ declare namespace H { * @property engineType: {H.Map.EngineType=} - The initial engine type to use, default is P2D * @property pixelRatio {number} - The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1 * @property imprint {H.map.Imprint.Options=} - The imprint options or null to suppress the imprint - * @property renderBaseBackground {H.Map.BackgroundRange=} - Object describes how many cached zoom levels should be used as a base map background while base map tiles are loading. Example: {lower: 3, higher: 2} - * @property autoColor {boolean=} - Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up to now only the copyright style will be adjusted. See H.map.layer.Layer.Options#dark + * @property renderBaseBackground {H.Map.BackgroundRange=} - Object describes how many cached zoom levels should be used as a base map background while base map tiles are loading. + * Example: {lower: 3, higher: 2} + * @property autoColor {boolean=} - Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up to now only the copyright style will be adjusted. + * See H.map.layer.Layer.Options#dark * @property margin {number=} - The size in pixel of the supplemental area to render for each side of the map * @property padding {H.map.ViewPort.Padding=} - The padding in pixels for each side of the map * @property fixedCenter {boolean=} - Indicates whether the center of the map should remain unchanged if the viewport's size or padding has been changed, default is true */ - export interface Options { + interface Options { center?: H.geo.IPoint; zoom?: number; bounds?: H.geo.Rect; - layers?: Array; + layers?: H.map.layer.Layer[]; engineType?: EngineType; pixelRatio?: number; imprint?: H.map.Imprint.Options; @@ -311,7 +320,7 @@ declare namespace H { } /***** clustering *****/ - export module clustering { + namespace clustering { /** * This class represents the input data structure for data points to be clustered. * @property lat {H.geo.Latitude} - The latitude coordinate of the data point's position @@ -319,7 +328,7 @@ declare namespace H { * @property wt {number} - The weight of the data point * @property data {*} - Data associated with this data point */ - export class DataPoint implements H.geo.IPoint { + class DataPoint implements H.geo.IPoint { /** * Constructor * @param lat {H.geo.Latitude} - The latitude coordinate of the data point's position @@ -340,7 +349,7 @@ declare namespace H { /** * This interface describes a cluster of data points, which fulfill the clustering specification (i.e. data points are within the epsilon and there are enough points to form a cluster). */ - export interface ICluster { + interface ICluster { /** * Returns the maximum zoom level where this cluster doesn't fall apart into sub clusters and/or noise poinst * @returns {number} @@ -354,7 +363,8 @@ declare namespace H { getBounds(): H.geo.Rect; /** - * Invokes the specified callback for each "entry" of the cluster. That "entry" can be either a cluster which implements H.clustering.ICluster interface or a noise point which implements H.clustering.INoisePoint interface. + * Invokes the specified callback for each "entry" of the cluster. + * That "entry" can be either a cluster which implements H.clustering.ICluster interface or a noise point which implements H.clustering.INoisePoint interface. * @param callback {function(H.clustering.IResult)} - The callback gets the currently traversed entry as an argument, which is cluster or noise point. */ forEachEntry(callback: (result: H.clustering.IResult) => void): void; @@ -393,7 +403,7 @@ declare namespace H { /** * This interface represents a data point which does not belong to a cluster. */ - export interface INoisePoint { + interface INoisePoint { /** * This method returns data which coresponds to this noise point. * @returns {*} @@ -428,8 +438,7 @@ declare namespace H { /** * This interface represents the result item of a clustering operation. */ - export interface IResult { - + interface IResult { /** * Returns the geographical position of this cluster result. * @returns {H.geo.Point} @@ -458,8 +467,7 @@ declare namespace H { /** * Interface which specifies the methods a theme must implement. */ - export interface ITheme { - + interface ITheme { /** * Function returns a cluster presentation as a map object. * @param cluster {H.clustering.ICluster} @@ -476,17 +484,18 @@ declare namespace H { } /** - * The clustering provider serves clusters and noise point representation for the map depending on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options. + * The clustering provider serves clusters and noise point representation for the map depending on the provided data set. + * Levels for clustering as well as custom cluster representation can be set via Options. * @property min {number} - Minimum zoom level at which provider can cluster data * @property max {number} - Maximum zoom level at which provider can cluster data */ - export class Provider extends H.util.EventTarget { + class Provider extends H.util.EventTarget { /** * Constructor * @param dataPoints {Array} * @param opt_options {H.clustering.Provider.Options=} */ - constructor(dataPoints: Array, opt_options?: H.clustering.Provider.Options); + constructor(dataPoints: H.clustering.DataPoint[], opt_options?: H.clustering.Provider.Options); /** * This method will dispatch event on the event target object @@ -504,13 +513,13 @@ declare namespace H { * @param callback {Function} * @param opt_scope {Object=} */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; /** * This method sets new data to the provider * @param dataPoints {Array} */ - setDataPoints(dataPoints: Array): void; + setDataPoints(dataPoints: H.clustering.DataPoint[]): void; /** * This method adds a data point to the provider. Beware that this method provokes reclustering of the whole data set. @@ -522,7 +531,7 @@ declare namespace H { * This method adds a list of data points to the provider. Beware that this method provokes reclustering of the whole data set. * @param dataPoints {Array} */ - addDataPoints(dataPoints: Array): void; + addDataPoints(dataPoints: H.clustering.DataPoint[]): void; /** * This method removes a data point from the provider. Beware that this method provokes reclustering of the whole data set. @@ -556,7 +565,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestDomMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestDomMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.DomMarker[]; /** * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. @@ -572,7 +581,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Marker[]; /** * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. @@ -588,7 +597,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatials(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatials(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Returns the spatial objects which intersect the given tile @@ -597,7 +606,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Returns the accumulate invalidations of this provider's objects that have occurred. @@ -616,15 +625,16 @@ declare namespace H { max: number; } - export module Provider { + namespace Provider { /** * Options which are used within cluster calculations. - * @property eps {number=} - epsilon parameter for cluster calculation. For the FASTGRID strategy it must not exceed 256 and must take values that are power of 2. For the GRID and DYNAMICGRID strategies it can take values from 10 to 127. Default is 32. + * @property eps {number=} - epsilon parameter for cluster calculation. For the FASTGRID strategy it must not exceed 256 and must take values that are power of 2. + * For the GRID and DYNAMICGRID strategies it can take values from 10 to 127. Default is 32. * @property minWeight {number=} - the minimum points weight sum to form a cluster, default is 2 * @property projection {H.geo.IProjection=} - projection to use for clustering, default is H.geo.mercator * @property strategy {H.clustering.Provider.Strategy=} - clustering stretegy, defaults to H.clustering.Provider.Strategy.FASTGRID */ - export interface ClusteringOptions { + interface ClusteringOptions { eps?: number; minWeight?: number; projection?: H.geo.IProjection; @@ -638,7 +648,7 @@ declare namespace H { * @property clusteringOptions {H.clustering.Provider.ClusteringOptions=} - options for clustering algorithm * @property theme {H.clustering.ITheme=} - cluster and noise point graphical representation */ - export interface Options { + interface Options { min?: number; max?: number; clusteringOptions?: H.clustering.Provider.ClusteringOptions; @@ -646,9 +656,12 @@ declare namespace H { } /** - * Enumeration represents possible clustering strategies. FASTGRID clustering is the efficient way to cluster large sets of data points. GRID clustering is slower but has greater precision due to the bigger range of epsilon values, this strategy suitable for clustering smaller data sets (up to 1000 data points) on desktop devices. DYNAMICGRID clustering uses the same algorithm of clustering as the GRID, but clusters on the viewport basis is meant to be used with data sets that are subject to the frequent update operations. + * Enumeration represents possible clustering strategies. FASTGRID clustering is the efficient way to cluster large sets of data points. + * GRID clustering is slower but has greater precision due to the bigger range of epsilon values, this strategy suitable for clustering smaller data sets (up to 1000 data points) + * on desktop devices. DYNAMICGRID clustering uses the same algorithm of clustering as the GRID, but clusters on the viewport basis is meant to be used with data sets that are subject + * to the frequent update operations. */ - export enum Strategy { + enum Strategy { FASTGRID, GRID, DYNAMICGRID, @@ -657,11 +670,11 @@ declare namespace H { } /***** data *****/ - export module data { + namespace data { /** * An abstract reader class defines interface for data readers and has general functionality related to fetching data and reader events. */ - export class AbstractReader extends H.util.EventTarget { + class AbstractReader extends H.util.EventTarget { /** * Constructor * @param opt_url {string=} @@ -669,7 +682,8 @@ declare namespace H { constructor(opt_url?: string); /** - * Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new instance of the class with every invocation. If data hasn't been parsed it will return H.map.layer.ObjectLayer that contains partial information, and reader will add new parsed objects to the layer's provider later on. + * Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new instance of the class with every invocation. + * If data hasn't been parsed it will return H.map.layer.ObjectLayer that contains partial information, and reader will add new parsed objects to the layer's provider later on. * @returns {H.map.layer.ObjectLayer} */ getLayer(): H.map.layer.ObjectLayer; @@ -678,7 +692,7 @@ declare namespace H { * Method returns collection of currently parsed, and converted to H.map.Object data objects. Method returns only currently parsed objects if parsing is ongoing. * @returns {Array} */ - getParsedObjects(): Array; + getParsedObjects(): H.map.Object[]; /** * Returns URL of the current file, which is either in process of fetching/parsing or file that has been already parsed. @@ -687,7 +701,8 @@ declare namespace H { getUrl(): string | void; /** - * Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects, etc.), and throws InvalidState exception if Reader's state is not READY or ERROR. + * Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects, etc.), and throws + * InvalidState exception if Reader's state is not READY or ERROR. * @param url {string} - The new URL * @returns {H.data.AbstractReader} */ @@ -700,16 +715,17 @@ declare namespace H { getState(): H.data.AbstractReader.State; /** - * Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader). Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers. + * Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader). + * Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers. */ parse(): void; } - export module AbstractReader { + namespace AbstractReader { /** * The event class for state events that are dispatched by AbstractReader */ - export class Event extends H.util.Event { + class Event extends H.util.Event { /** * Constructor * @param target {(H.data.AbstractReader | H.map.Object)} - The target that's passed to event listeners @@ -723,7 +739,7 @@ declare namespace H { /** * The state types of an Reader. Possible states are: */ - export enum State { + enum State { ERROR, LOADING, VISIT, @@ -733,16 +749,16 @@ declare namespace H { } /***** geo *****/ - export module geo { + namespace geo { /** * A Geographic coordinate that specifies the height of a point in meters. A value of undefined is treated as 0. */ - export type Altitude = number; + type Altitude = number; /** * Contexts for altitudes to specify the contextual origin of an altitude's value */ - export enum AltitudeContext { + enum AltitudeContext { /** Ground level */ undefined, /** Ground level */ @@ -766,14 +782,14 @@ declare namespace H { * @property alt {H.geo.Altitude=} - The altitude coordinate. * @property ctx {H.geo.AltitudeContext=} - The altitude context. */ - export interface IPoint { + interface IPoint { lat: H.geo.Latitude; lng: Longitude; alt?: H.geo.Altitude; ctx?: H.geo.AltitudeContext; } - export interface IProjection { + interface IProjection { latLngToPoint(lat: number, lng: number, opt_out?: H.math.Point): H.math.Point; xyToGeo(x: number, y: number, opt_out?: H.geo.Point): H.geo.Point; pointToGeo(point: H.math.IPoint, opt_out?: H.geo.Point): H.geo.Point; @@ -783,12 +799,12 @@ declare namespace H { /** * A geographic coordinate that specifies the north-south position of a point on the Earth's surface in the range from -90 to + 90 degrees, inclusive. */ - export type Latitude = number; + type Latitude = number; /** * A Geographic coordinate that specifies the east-west position of a point on the Earth's surface in the range from -180 to 180 degrees, inclusive. */ - export type Longitude = number; + type Longitude = number; /** * Class represents a geographical point, which is defined by the latitude, longitude and optional altitude. @@ -797,7 +813,7 @@ declare namespace H { * @property alt {H.geo.Altitude} - The altitude coordinate. * @property ctx {H.geo.AltitudeContext} - The altitude context. */ - export class Point implements IPoint { + class Point implements IPoint { /** * Constructor * @property lat {H.geo.Latitude} - The latitude coordinate. @@ -822,7 +838,8 @@ declare namespace H { distance(other: IPoint): number; /** - * This method calculates the geographic point of a destination point using the distance and bearing specified by the caller. The altitude is ignored, instead the WGS84 Mean Radius is taken. + * This method calculates the geographic point of a destination point using the distance and bearing specified by the caller. + * The altitude is ignored, instead the WGS84 Mean Radius is taken. * @param bearing {number} - The bearing to use in the calculation in degrees. * @param distance {number} - The distance to the destination in meters. * @param opt_overGreatCircle {boolean=} - If true the computation uses the 'Great Circle' otherwise 'Rhumb Line'. @@ -831,13 +848,14 @@ declare namespace H { walk(bearing: number, distance: number, opt_overGreatCircle?: boolean): Point; /** - * This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types. Additionally the value of the lat property is clamped into a range of -90 ... +90 and the value of the lng property is modulo into a range of -180 ... +180 plus validates the values of the alt and ctx properties + * This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types. Additionally the value of the lat property is clamped into a range of -90 ... +90 + * and the value of the lng property is modulo into a range of -180 ... +180 plus validates the values of the alt and ctx properties * @param point {H.geo.IPoint} - The point to validate * @param opt_caller {Function=} - The caller to use for InvalidArgumentError. If omitted no error is thrown * @param opt_argNr {number=} - The argument number to use for InvalidArgumentError. * @returns {boolean} - if the given point could validate */ - static validate(point: IPoint, opt_caller?: Function, opt_argNr?: number): boolean; + static validate(point: IPoint, opt_caller?: () => void, opt_argNr?: number): boolean; /** * This method creates a Point instance from a given IPoint object. @@ -855,7 +873,7 @@ declare namespace H { /** * This class represents a rectangular geographic area. The area is defined by four geographical coordinates two (left, right) longitudes and two (top, bottom) latitudes. */ - export class Rect { + class Rect { /** * Constructor * @param top {H.geo.Latitude} - the northern-most latitude @@ -1030,7 +1048,8 @@ declare namespace H { * @param opt_out {H.geo.Rect=} - an optional rect to store the results * @returns {H.geo.Rect} - either the opt_out rect or a new rect */ - static merge(topA: H.geo.Latitude, leftA: H.geo.Longitude, bottomA: H.geo.Latitude, rightA: H.geo.Longitude, topB: H.geo.Latitude, leftB: H.geo.Longitude, bottomB: H.geo.Latitude, rightB: H.geo.Longitude, opt_out?: H.geo.Rect): H.geo.Rect; + static merge(topA: H.geo.Latitude, leftA: H.geo.Longitude, bottomA: H.geo.Latitude, rightA: H.geo.Longitude, topB: H.geo.Latitude, leftB: H.geo.Longitude, bottomB: H.geo.Latitude, + rightB: H.geo.Longitude, opt_out?: H.geo.Rect): H.geo.Rect; /** * This method creates a rectangular area from a top-left and bottom-right point pair. @@ -1047,7 +1066,7 @@ declare namespace H { * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments * @returns {H.geo.Rect} - returns the minimum rectangular area covering the points or null if no point is covered */ - static coverPoints(pointArray: Array, opt_skipValidation?: boolean): H.geo.Rect; + static coverPoints(pointArray: H.geo.IPoint[], opt_skipValidation?: boolean): H.geo.Rect; /** * This method creates the minimum rectangular area covering all of the coordinates in the argument array. @@ -1055,7 +1074,7 @@ declare namespace H { * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments * @returns {(H.geo.Rect | undefined)} - returns the minimum rectangular area covering the coordinates */ - static coverLatLngAlts(latLngAltArray: Array, opt_skipValidation?: boolean): H.geo.Rect | void; + static coverLatLngAlts(latLngAltArray: number[], opt_skipValidation?: boolean): H.geo.Rect | void; /** * This method creates the minimum rectangular area covering all of the rectangular areas in the argument array. @@ -1063,7 +1082,7 @@ declare namespace H { * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments * @returns {(H.geo.Rect | undefined)} - returns the minimum rectangular area covering the rectangular areas */ - static coverRects(rectArray: Array, opt_skipValidation?: boolean): H.geo.Rect | void; + static coverRects(rectArray: H.geo.Rect[], opt_skipValidation?: boolean): H.geo.Rect | void; /** * This method clones the given bounding rect and resizes the clone if necessary until the location supplied by the caller is at its center. @@ -1077,13 +1096,13 @@ declare namespace H { /** * A strip is a flat list of latitude, longitude, altitude tuples in a fixed order. */ - export class Strip { + class Strip { /** * Constructor * @param opt_latLngAlts {Array=} - An optional array of latitude, longitude and altitude triples to initialize the strip with. * @param opt_ctx {H.geo.AltitudeContext=} - An optional altitude context for all altitudes contained in this strip. */ - constructor(opt_latLngAlts?: Array, opt_ctx?: H.geo.AltitudeContext); + constructor(opt_latLngAlts?: number[], opt_ctx?: H.geo.AltitudeContext); /** * This method pushes a lat, lng, alt to the end of this strip. @@ -1100,7 +1119,7 @@ declare namespace H { * @param opt_latLngAlts {Array=} - The lat, lng, alt values to add * @returns {Array} - an array of removed elements */ - spliceLatLngAlts(index: number, opt_nRemove?: number, opt_latLngAlts?: Array): Array; + spliceLatLngAlts(index: number, opt_nRemove?: number, opt_latLngAlts?: number[]): number[]; /** * This method inserts one set of lat, lng, alt values into the strip at the specified index. @@ -1145,7 +1164,8 @@ declare namespace H { extractPoint(pointIndex: number, opt_out?: H.geo.Point): H.geo.Point; /** - * This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements passing lat, lng and alt and the virtual point index as arguments. + * This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements passing lat, lng and alt and the virtual point + * index as arguments. * @param eachFn {function(H.geo.Latitude, H.geo.Longitude, H.geo.Altitude, number)} - the function to be called for each 3 elements * @param opt_start {number=} - an optional start index to iterate from * @param opt_end {number=} - an optional end index to iterate to @@ -1169,7 +1189,7 @@ declare namespace H { * This method returns the internal array keeping the lat, lng, alt values. Modifying this array directly can destroy the integrity of this strip. Use it only for read access. * @returns {Array} - returns the raw lat, lng, alt values of this strip */ - getLatLngAltArray(): Array; + getLatLngAltArray(): number[]; /** * This method returns the bounding box of this strip. @@ -1190,18 +1210,18 @@ declare namespace H { * @param latLngs {Array} - the array of lat, lng value. * @returns {H.geo.Strip} - the strip containing the lat, lng values */ - static fromLatLngArray(latLngs: Array): H.geo.Strip; + static fromLatLngArray(latLngs: number[]): H.geo.Strip; } } /***** lang *****/ /***** map *****/ - export module map { + namespace map { /** * This class represents marker, which offers a means of identifying a location on the map with an icon. */ - export class AbstractMarker extends H.map.Object { + class AbstractMarker extends H.map.Object { /** * Constructor * @param position {H.geo.IPoint} - The location of this marker @@ -1236,18 +1256,19 @@ declare namespace H { setIcon(icon: (H.map.Icon | H.map.DomIcon)): H.map.AbstractMarker; } - export module AbstractMarker { + namespace AbstractMarker { /** * Options used to initialize a AbstractMarker * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. + * This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. * @property icon {(H.map.Icon | H.map.DomIcon)=} - The icon to use for the visual representation, if omitted a default icon is used. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1261,7 +1282,7 @@ declare namespace H { /** * This class represents style attributes for arrows to be rendered along a polyline. A ArrowStyle instance is always treated as immutable to avoid inconstiencies and must not modified. */ - export class ArrowStyle { + class ArrowStyle { /** * Constructor * @param opt_options {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} @@ -1276,15 +1297,18 @@ declare namespace H { equals(other: (H.map.ArrowStyle | H.map.ArrowStyle.Options)): boolean; } - export module ArrowStyle { + namespace ArrowStyle { /** * An object type to specify the style of arrows to render along a polyline * @property fillColor {string=} - The CSS color value used to fill the arrow shapes. If omitted or the value evaluates to false it defaults to "rgba(255, 255, 255, 0.75)" - * @property width {number=} - The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow description is applied. If omitted or the value is <= 0 it defaults to 1.2 - * @property length {number=} - The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of which the arrow is drawn. If omitted or the value is <= 0 it defaults to 1.6 - * @property frequency {number=} - The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1 results in gapless arrows. If omitted or the value is false it defaults to 5 + * @property width {number=} - The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow description is applied. + * If omitted or the value is <= 0 it defaults to 1.2 + * @property length {number=} - The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of which the arrow is drawn. + * If omitted or the value is <= 0 it defaults to 1.6 + * @property frequency {number=} - The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1 results in gapless arrows. + * If omitted or the value is false it defaults to 5 */ - export interface Options { + interface Options { fillColor?: string; width?: number; length?: number; @@ -1295,17 +1319,18 @@ declare namespace H { /** * A Polygon with a circular shape. */ - export class Circle extends H.map.Polygon { + class Circle extends H.map.Polygon { /** * Constructor * @param center {H.geo.IPoint} - The geographical coordinates of the circle's center * @param radius {number} - The radius of the circle in meters - * @param opt_options {H.map.Circle.Options=} - An object that specifies circle options and their initial values (among these, precision has a significant impact on the shape of the circle - please see + * @param opt_options {H.map.Circle.Options=} - An object that specifies circle options and their initial values (among these, precision has a significant impact on the shape of the circle */ constructor(center: H.geo.IPoint, radius: number, opt_options?: H.map.Circle.Options); /** - * To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify this Point instance without calling setCenter immediately afterwards. + * To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify this Point instance without calling setCenter + * immediately afterwards. * @param center {H.geo.IPoint} */ setCenter(center: H.geo.IPoint): void; @@ -1341,18 +1366,22 @@ declare namespace H { getPrecision(): number; } - export module Circle { + namespace Circle { /** * @property style {H.map.SpatialStyle=} - the style to be used when tracing the polyline * @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true - * @property precision {number=} - The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range between [4 ... 360], where 60 is the default. Note that the lower the value the more angular and the less circle-like the shape appears and, conversely, the higher the value the smoother and more rounded the result. Thus, starting at the extreme low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears increasingly angular as the zoom level increases (as you zoom in), and finally 360 produces a smooth circle. + * @property precision {number=} - The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range between [4 ... 360], where 60 is + * the default. Note that the lower the value the more angular and the less circle-like the shape appears and, conversely, the higher the value the smoother and more rounded the result. + * Thus, starting at the extreme low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears increasingly angular as + * the zoom level increases (as you zoom in), and finally 360 produces a smooth circle. * @property zIndex {number=} - The z-index value of the circle, default is 0 * @property min {number=} - The minimum zoom level for which the circle is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the circle is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. + * This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData */ - export interface Options { + interface Options { style?: H.map.SpatialStyle | H.map.SpatialStyle.Options; visibility?: boolean; precision?: number; @@ -1365,20 +1394,21 @@ declare namespace H { } /** - * The class represents data model of the map. It holds list of layers that are rendered by map's RenderEngine. The class listens to 'update' events from layers and dispatches them to the RenderEngine. + * The class represents data model of the map. It holds list of layers that are rendered by map's RenderEngine. + * The class listens to 'update' events from layers and dispatches them to the RenderEngine. */ - export class DataModel extends H.util.OList { + class DataModel extends H.util.OList { /** * Constructor * @param opt_layers {Array=} - array of layers to be added to the data model */ - constructor(opt_layers?: Array); + constructor(opt_layers?: H.map.layer.Layer[]); } /** * A visual representation of the H.map.DomMarker. */ - export class DomIcon { + class DomIcon { /** * Constructor * @param element {!(Element | string)} - The element or markup to use for this icon @@ -1387,22 +1417,25 @@ declare namespace H { constructor(element: (Element | string), opt_options?: H.map.DomIcon.Options); } - export module DomIcon { + namespace DomIcon { /** * Options used to initialize a DomIcon - * @property onAttach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked before a clone of the icon's element is appended and displayed on the map. This callback can be used to setup the clone. - * @property onDetach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked after a clone of the icon's element is removed from the map. This callback can be used to clean up the clone. + * @property onAttach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked before a clone of the icon's element is appended and displayed on the map. + * This callback can be used to setup the clone. + * @property onDetach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked after a clone of the icon's element is removed from the map. + * This callback can be used to clean up the clone. */ - export interface Options { - onAttach?: (el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker) => void; - onDetach?: (el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker) => void; + interface Options { + onAttach?(el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker): void; + onDetach?(el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker): void; } } /** - * A marker with a visual representation in the form of a full styleable and scripteable DOM element. DomMarker are predestinated if small amounts of markers with dynamic styled and/or scripted icons should be displayed om the map (e.g. animated interactive SVG). + * A marker with a visual representation in the form of a full styleable and scripteable DOM element. DomMarker are predestinated if small amounts of markers with dynamic styled and/or + * scripted icons should be displayed om the map (e.g. animated interactive SVG). */ - export class DomMarker extends H.map.AbstractMarker { + class DomMarker extends H.map.AbstractMarker { /** * Constructor * @param position {H.geo.IPoint} @@ -1411,18 +1444,19 @@ declare namespace H { constructor(position: H.geo.IPoint, opt_options?: H.map.DomMarker.Options); } - export module DomMarker { + namespace DomMarker { /** * Options used to initialize a DomMarker * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to + * instantiate an object. * @property icon {H.map.DomIcon=} - The icon to use for the visual representation, if omitted a default icon is used. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1436,7 +1470,7 @@ declare namespace H { /** * This class represents a spatial shape in geographic space. It is defined by a path containing the vertices of the shape (lat, lng, alt values). */ - export class GeoShape extends H.map.Spatial { + class GeoShape extends H.map.Spatial { /** * Constructor * @param isClosed {boolean} - Indicates whether this geographical shape is closed (a polygon) @@ -1468,7 +1502,7 @@ declare namespace H { /** * This class represents a map object which can contain other map objects. It's visibility, zIndex and object-order influences the contained map objects */ - export class Group extends H.map.Object { + class Group extends H.map.Object { /** * Constructor * @param opt_options {H.map.Group.Options=} - an optional object containing initialization values @@ -1488,7 +1522,7 @@ declare namespace H { * @param opt_recursive {boolean=} - Indicates whether objects in sub-groups are also collected . * @returns {!Array} */ - getObjects(opt_recursive?: boolean): Array; + getObjects(opt_recursive?: boolean): H.map.Object[]; /** * Method returns the bounding rectangle for the group. The rectangle is the smallest rectangle that covers all objects. If group doesn't contains objects method returns null. @@ -1507,7 +1541,7 @@ declare namespace H { * Appends a list of objects to this group * @param objects {Array} */ - addObjects(objects: Array): void; + addObjects(objects: H.map.Object[]): void; /** * Removes an object from this group. @@ -1520,7 +1554,7 @@ declare namespace H { * Removes objects from this group. * @param objects {!Array} - The list of objects to remove */ - removeObjects(objects: Array): void; + removeObjects(objects: H.map.Object[]): void; /** * Method removes all objects from the group. @@ -1528,45 +1562,46 @@ declare namespace H { removeAll(): void; } - export module Group { + namespace Group { /** * Options used to initialize a group * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible, default is true * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. * @property objects {Array=} - A list of map objects to add initially to this group. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; zIndex?: number; provider?: H.map.provider.Provider; data?: any; - objects?: Array; + objects?: H.map.Object[]; } } /** * This class represents an area that objects, like a marker, occupies in the screen space, meaning that object can be probed and returned by H.Map@getObjectsAt method. */ - export class HitArea { + class HitArea { /** * Constructor * @param shapeType {H.map.HitArea.ShapeType} - The shape type of the HitArea * @param opt_values {Array=} - The type-dependent values to define the shape of the hit area. The format for the different types are: */ - constructor(shapeType: H.map.HitArea.ShapeType, opt_values?: Array); + constructor(shapeType: H.map.HitArea.ShapeType, opt_values?: number[]); } - export module HitArea { + namespace HitArea { /** * Enumeration represents possible shape types that HitArea can have. */ - export enum ShapeType { + enum ShapeType { NONE, RECT, CIRCLE, @@ -1577,8 +1612,7 @@ declare namespace H { /** * Control interface defines method which are used for direct view or camera manipulation */ - export interface IControl { - + interface IControl { /** * This method starts control action for camera. This action allows to control camera animation and movement according to provided values in the H.map.IControl#control function * @param opt_kinetics {H.util.kinetics.IKinetics=} - kinetics settings @@ -1588,7 +1622,8 @@ declare namespace H { startControl(opt_kinetics?: H.util.kinetics.IKinetics, opt_atX?: number, opt_atY?: number): void; /** - * This method triggers single control action on engine. This will trigger an animation which will start modification of the view's or camera's properties according to values begin set. Modification will occur at every frame. The speed values are measure by 'levels per frame' were 1 level cooresponds to a distance to next zoom level. + * This method triggers single control action on engine. This will trigger an animation which will start modification of the view's or camera's properties according to values begin set. + * Modification will occur at every frame. The speed values are measure by 'levels per frame' were 1 level cooresponds to a distance to next zoom level. * @param moveX {number} - moves the view/cam in right/left direction * @param moveY {number} - moves the view/cam in bottom/top direction * @param moveZ {number} - moves the view/cam in depth direction (changes zoom level) @@ -1601,9 +1636,11 @@ declare namespace H { control(moveX: number, moveY: number, moveZ: number, angleX: number, angleY: number, angleZ: number, zoom: number, opt_timestamp?: number): void; /** - * This method ends current control, which will stop ongoing animation triggered by the startControl method. This method can prevent kinetics as well as it can adjust the final view if the adjust function is being passed. + * This method ends current control, which will stop ongoing animation triggered by the startControl method. This method can prevent kinetics as well as it can adjust the final view if + * the adjust function is being passed. * @param opt_preventKinetics {boolean=} - if set to true will prevent kinetics animation - * @param opt_adjustView {function(H.map.ViewModel.CameraData)=} - user defined function which can adjust the final view this function takes last requestedData from the view model and should return a modified H.map.ViewModel.CameraData which will be set as the final view + * @param opt_adjustView {function(H.map.ViewModel.CameraData)=} - user defined function which can adjust the final view this function takes last requestedData from the view model and + * should return a modified H.map.ViewModel.CameraData which will be set as the final view */ endControl(opt_preventKinetics?: boolean, opt_adjustView?: (data: H.map.ViewModel.CameraData) => void): void; } @@ -1613,15 +1650,16 @@ declare namespace H { * @property label {string} - A short textual representation of the copyright note, e.g. "DigitalGlobe 2009" * @property alt {string} - A detailed textual representation of the copyright note, e.g. "copyright 2009 DigitalGlobe, Inc." */ - export interface ICopyright { + interface ICopyright { label: string; alt: string; } /** - * Interface describes interaction with the view port. Interaction will reflect view change depending on the interaction coordinates passed and the modifiers which specify the type of interaction. + * Interface describes interaction with the view port. Interaction will reflect view change depending on the interaction coordinates passed and the modifiers which specify the type of + * interaction. */ - export interface IInteraction { + interface IInteraction { /** * This method starts the interaction with the view port. Should be called every time when new interaction is started i.e mouse grab, or touch start. * @param modifiers {number} - a bitmask which specifies what operations should performed during every interaction @@ -1649,7 +1687,7 @@ declare namespace H { /** * A visual representation of the H.map.Marker. */ - export class Icon { + class Icon { /** * Constructor * @param bitmap {!(string | HTMLImageElement | HTMLCanvasElement)} - Either an image URL, a SVG markup, an image or a canvas. @@ -1688,13 +1726,14 @@ declare namespace H { getHitArea(): H.map.HitArea; /** - * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible. + * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. + * Otherwise memory leak is possible. * @param type {string} - name of event * @param handler {Function} - event handler function * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) * @param opt_scope {Object=} - scope for the handler function */ - addEventListener(type: string, handler: Function, opt_capture?: boolean, opt_scope?: Object): void; + addEventListener(type: string, handler: () => void, opt_capture?: boolean, opt_scope?: {}): void; /** * This method will removed previously added listener from the event target @@ -1703,7 +1742,7 @@ declare namespace H { * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) * @param opt_scope {Object=} - scope for the handler function */ - removeEventListener(type: string, handler: Function, opt_capture?: boolean, opt_scope?: Object): void; + removeEventListener(type: string, handler: () => void, opt_capture?: boolean, opt_scope?: {}): void; /** * This method will dispatch event on the event target object @@ -1721,14 +1760,14 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Icon { + namespace Icon { /** * The state types of an Icon */ - export enum State { + enum State { ERROR, LOADING, READY, @@ -1739,11 +1778,13 @@ declare namespace H { * @property size {H.math.ISize=} - The icon's size in pixel, default is the bitmap's natural size * @property anchor {H.math.IPoint=} - The anchorage point in pixel, default is bottom-center * @property hitArea {H.map.HitArea=} - The area to use for hit detection, default is the whole rectangular area - * @property asCanvas {H.map.HitArea=} - Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion improves the rendering performance but it could also cause a higher memory consumption. - * @property crossOrigin {boolean} - Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting canvas from tainting, default is false. The option is ignored by IE9-10. + * @property asCanvas {H.map.HitArea=} - Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion improves the rendering performance but it could + * also cause a higher memory consumption. + * @property crossOrigin {boolean} - Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting canvas from tainting, default is + * false. The option is ignored by IE9-10. */ - export interface Options { - size?: H.math.ISize; + interface Options { + size?: H.math.ISize | number; anchor?: H.math.IPoint; hitArea?: H.map.HitArea; asCanvas?: H.map.HitArea; @@ -1754,7 +1795,7 @@ declare namespace H { /** * This class encapsulates the brand, copyright and terms of use elements on the map. */ - export class Imprint { + class Imprint { /** * Constructor * @param map {H.Map} - The map where the imprint is attached to @@ -1785,7 +1826,7 @@ declare namespace H { * @param callback {Function} * @param opt_scope {Object=} */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; /** * This method is used to capture the element view @@ -1797,14 +1838,14 @@ declare namespace H { capture(canvas: HTMLCanvasElement, pixelRatio: number, callback?: (canvas: HTMLCanvasElement) => void, opt_errback?: (s: string) => void): void; } - export module Imprint { + namespace Imprint { /** * Options to style an imprint * @property invert {boolean=} - Indicates whether the logo is inverted. If omitted the current value remains, default is false. * @property font {string=} - The font of the text. If omitted the current value remains, default is "11px Arial,sans-serif". * @property href {string=} - The URL of the "Terms of use" link. If omitted the current value remains, default is "http://here.com/terms". */ - export interface Options { + interface Options { invert?: boolean; font?: string; href?: string; @@ -1814,7 +1855,7 @@ declare namespace H { /** * A marker with a visual representation in the form of a bitmap icon. Marker are predestinated if large amounts of markers with static icons should be displayed om the map. */ - export class Marker extends H.map.AbstractMarker { + class Marker extends H.map.AbstractMarker { /** * Constructor * @param position {H.geo.IPoint} - The location of this marker @@ -1823,18 +1864,19 @@ declare namespace H { constructor(position: H.geo.IPoint, opt_options?: H.map.Marker.Options); } - export module Marker { + namespace Marker { /** * Options used to initialize a Marker * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property icon {H.map.Icon=} - The icon to use for the visual representation, if omitted a default icon is used. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1848,7 +1890,7 @@ declare namespace H { /** * This class represents the abstract base class for map objects such as polylines, polygons, markers, groups etc. */ - export class Object extends H.util.EventTarget { + class Object extends H.util.EventTarget { /** * Constructor * @param opt_options {H.map.Object.Options=} - The values to initialize this object @@ -1963,20 +2005,21 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Object { + namespace Object { /** * Options used to initialize a map object * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1988,7 +2031,7 @@ declare namespace H { /** * The major types of map objects */ - export enum Type { + enum Type { /** spatial object */ ANY, /** spatial object */ @@ -2007,7 +2050,7 @@ declare namespace H { /** * This class represents an overlay, which offers a bitmap that covers a geographical reactangular area on the map. */ - export class Overlay extends H.map.Object { + class Overlay extends H.map.Object { /** * Constructor * @param bounds {H.geo.Rect} - The geographical reactangular area of this overlay @@ -2056,7 +2099,7 @@ declare namespace H { setOpacity(opacity: number): H.map.Overlay; } - export module Overlay { + namespace Overlay { /** * Options used to initialize an Overlay * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity @@ -2064,10 +2107,11 @@ declare namespace H { * @property opacity {number=} - The opacity of the object in range from 0 (transparent) to 1 (opaque), default is 1. * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; opacity?: number; @@ -2079,9 +2123,11 @@ declare namespace H { } /** - * This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo shape object (lat, lng, alt values) and a pen to use when rendering the polyline. Polygon represents a closed plane defined by the list of verticies, projected on the map display. List of vericies which define the polygon are is a list of geo coordinates encapsulated by the strip object H.geo.Strip + * This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo shape object (lat, lng, alt values) and a pen to use when rendering the polyline. + * Polygon represents a closed plane defined by the list of verticies, projected on the map display. List of vericies which define the polygon are is a list of geo coordinates encapsulated + * by the strip object H.geo.Strip */ - export class Polygon extends H.map.GeoShape { + class Polygon extends H.map.GeoShape { /** * Constructor * @param strip {H.geo.Strip} - the strip describing this polygon's vertices @@ -2090,7 +2136,8 @@ declare namespace H { constructor(strip: H.geo.Strip, opt_options?: H.map.Spatial.Options); /** - * To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional information is needed to know if the southern or northern part of the world should be covered by the poygon. + * To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines arround the world on longitude axis (for example a circle whose + * center is one of the poles). In this case a additional information is needed to know if the southern or northern part of the world should be covered by the poygon. * @param flag {boolean} - A value of true means it covers the north pole, false means south pole * @returns {H.map.Polygon} - the Polygon instance itself */ @@ -2106,7 +2153,7 @@ declare namespace H { /** * This class represents a polyline in geo-space. It is defined by a path containing the vertices of a polyline (lat, lng, alt values) and a pen to use when tracing the path on the map. */ - export class Polyline extends H.map.GeoShape { + class Polyline extends H.map.GeoShape { /** * Constructor * @param strip {H.geo.Strip} - the strip describing this polygon's vertices @@ -2119,10 +2166,10 @@ declare namespace H { * @param geoRect {H.geo.Rect} * @returns {Array>} */ - clip(geoRect: H.geo.Rect): Array>; + clip(geoRect: H.geo.Rect): number[][]; } - export module Polyline { + namespace Polyline { /** * Options which are used to initialize a polyline * @property style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - the style to be used when tracing the polyline @@ -2131,10 +2178,11 @@ declare namespace H { * @property zIndex {number=} - The z-index value of the map object, default is 0 * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData */ - export interface Options { + interface Options { style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options); arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options); visibility?: boolean; @@ -2149,7 +2197,7 @@ declare namespace H { /** * A Polygon with a rectangular shape. */ - export class Rect extends H.map.Polygon { + class Rect extends H.map.Polygon { /** * Constructor * @param bounds {H.geo.Rect} - The geographical bounding box for this rectangle @@ -2167,7 +2215,7 @@ declare namespace H { /** * This class represents a spatial map object which provides its projected geometry. */ - export class Spatial extends H.map.Object { + class Spatial extends H.map.Object { /** * Constructor * @param isClosed {boolean} - Indicates whether this spatial object represents a closed shape @@ -2182,14 +2230,16 @@ declare namespace H { getStyle(): H.map.SpatialStyle; /** - * To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent inconsistancies! . + * To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent + * inconsistancies! * @param opt_style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - The style to set. If it evaluates to a falsy the H.map.SpatialStyle.DEFAULT_STYLE is used. * @returns {H.map.Spatial} - the Spatial instance itself */ setStyle(opt_style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): H.map.Spatial; /** - * To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as immutable and must not be modified afterwards to prevent inconsistancies! + * To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as immutable and must not be modified afterwards to prevent + * inconsistancies! * @returns {(H.map.ArrowStyle | undefined)} */ getArrows(): H.map.ArrowStyle | void; @@ -2208,7 +2258,7 @@ declare namespace H { isClosed(): boolean; } - export module Spatial { + namespace Spatial { /** * Data to used as rendering hint for a label * @property x {number} - The X coordinate of the first line's starting point @@ -2219,7 +2269,7 @@ declare namespace H { * @property color {string} - The CSS color * @property text {string} - The text content, new line characters (\u000A) are interpreted as line breaks */ - export interface Label { + interface Label { x: number; y: number; angle: number; @@ -2237,10 +2287,11 @@ declare namespace H { * @property zIndex {number=} - The z-index value of the map object, default is 0 * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options); arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options); visibility?: boolean; @@ -2253,19 +2304,21 @@ declare namespace H { } /** - * The SpatialStyle class represents a style with which spatial objects like polylines and polygons are drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies and must not modified. + * The SpatialStyle class represents a style with which spatial objects like polylines and polygons are drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies + * and must not modified. * @property strokeColor {string} - The color of the stroke in CSS syntax, default is 'rgba(0, 85, 170, 0.6)'. * @property fillColor {string} - The filling color in CSS syntax, default is 'rgba(0, 85, 170, 0.4)'. * @property lineWidth {number} - The width of the line in pixels, default is 2. * @property lineCap {H.map.SpatialStyle.LineCap} - The style of the end caps for a line, default is 'round'. * @property lineJoin {H.map.SpatialStyle.LineJoin} - The type of corner created, when two lines meet, default is 'miter'. * @property miterLimit {number} - The miter length is the distance between the inner corner and the outer corner where two lines meet. The default is 10. - * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. The default is [ ]. + * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. The default is []. * @property lineDashOffset {number} - The phase offset of the line dash pattern The default is 0. * @property MAX_LINE_WIDTH {number} - This constant represents the maximum line width which can be used for rendering. - * @property DEFAULT_STYLE {H.map.SpatialStyle} - This static member defines the default style for spatial objects on the map. It's value is { strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)' lineWidth: 1, lineCap: 'round', lineJoin: 'miter', miterLimit: 10, lineDash: [ ], lineDashOffset: 0 } + * @property DEFAULT_STYLE {H.map.SpatialStyle} - This static member defines the default style for spatial objects on the map. It's value is + * { strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)', lineWidth: 1, lineCap: 'round', lineJoin: 'miter', miterLimit: 10, lineDash: [], lineDashOffset: 0 } */ - export class SpatialStyle { + class SpatialStyle { /** * Constructor * @param opt_options {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - The optional style attributes @@ -2292,22 +2345,22 @@ declare namespace H { lineCap: H.map.SpatialStyle.LineCap; lineJoin: H.map.SpatialStyle.LineJoin; miterLimit: number; - lineDash: Array; + lineDash: number[]; lineDashOffset: number; static MAX_LINE_WIDTH: number; static DEFAULT_STYLE: H.map.SpatialStyle; } - export module SpatialStyle { + namespace SpatialStyle { /** * The style of the end caps for a line, one of 'butt', 'round' or 'square'. */ - export type LineCap = 'butt' | 'round' | 'square'; + type LineCap = 'butt' | 'round' | 'square'; /** * The type of corner created, when two lines meet, one of 'round', 'bevel' or 'miter'. */ - export type LineJoin = 'round' | 'bevel' | 'miter'; + type LineJoin = 'round' | 'bevel' | 'miter'; /** * Options used to initialize a style. If a property is not set, the default value from H.map.SpatialStyle is taken. @@ -2317,25 +2370,27 @@ declare namespace H { * @property lineCap {H.map.SpatialStyle.LineCap=} - The style of the end caps for a line. * @property lineJoin {H.map.SpatialStyle.LineJoin=} - The type of corner created, when two lines meet. * @property miterLimit {number=} - The miter limit in pixel, default is 10. The maximum supported miter limit is 100 - * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. If the browser doesn't support this feature this style property is ignored. + * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. If the browser doesn't support this feature + * this style property is ignored. * @property lineDashOffset {number=} - The phase offset of the line dash pattern */ - export interface Options { + interface Options { strokeColor?: string; fillColor?: string; lineWidth?: number; lineCap?: H.map.SpatialStyle.LineCap; lineJoin?: H.map.SpatialStyle.LineJoin; miterLimit?: number; - lineDash?: Array; + lineDash?: number[]; lineDashOffset?: number; } } /** - * This class represents a view of the map. It consists of a virtual camera and a look-at point both of which have a position in geo-space and orientation angles. The view model allows to change the values of these objects in order to move or rotate the map or zoom in and out. + * This class represents a view of the map. It consists of a virtual camera and a look-at point both of which have a position in geo-space and orientation angles. The view model allows to + * change the values of these objects in order to move or rotate the map or zoom in and out. */ - export class ViewModel extends H.util.EventTarget implements H.map.IControl { + class ViewModel extends H.util.EventTarget implements H.map.IControl { /** * This method returns the camera data, which is currently rendered. * @returns {H.map.ViewModel.CameraData} - the current rendered camera data @@ -2411,10 +2466,10 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module ViewModel { + namespace ViewModel { /** * Defines camera's properties. * @property zoom {number=} - zoom level to be used by rendering engine @@ -2424,7 +2479,7 @@ declare namespace H { * @property roll {number=} - the rotation of the virtual camera along its local z-axis * @property fov {number=} - */ - export interface CameraData { + interface CameraData { zoom?: number; position: H.geo.IPoint; pitch?: number; @@ -2439,7 +2494,7 @@ declare namespace H { * @property zoom {number=} - The requested zoom level * @property animate {boolean=} - indicates if the requested transition should be animated */ - export interface RequestedData { + interface RequestedData { camera?: H.map.ViewModel.CameraData; zoom?: number; animate?: boolean; @@ -2452,7 +2507,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class UpdateEvent extends H.util.Event { + class UpdateEvent extends H.util.Event { /** * Constructor * @param requested {H.map.ViewModel.RequestedData} @@ -2477,7 +2532,8 @@ declare namespace H { } /** - * ViewPort object holds information about the HTML element where the map is rendered. It contains information regarding the element (view port) size and triggers events when the element size is changed. + * ViewPort object holds information about the HTML element where the map is rendered. It contains information regarding the element (view port) size and triggers events when the element size + * is changed. * @property element {Element} - This property holds the HTML element, which defines the viewport. * @property width {number} - This property holds this viewport's current width * @property height {number} - This property holds this viewport's current height @@ -2485,7 +2541,7 @@ declare namespace H { * @property padding {H.map.ViewPort.Padding} - This property holds this viewport's current padding * @property center {H.math.Point} - This property holds this viewport's current center point */ - export class ViewPort extends H.util.EventTarget implements H.map.IInteraction { + class ViewPort extends H.util.EventTarget implements H.map.IInteraction { /** * Constructor * @param element {Element} - html element were map will be rendered @@ -2552,7 +2608,7 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; element: Element; width: number; @@ -2562,14 +2618,14 @@ declare namespace H { center: H.math.Point; } - export module ViewPort { + namespace ViewPort { /** * Options which may be used to initialize new ViewPort instance * @property margin {number=} - The size in pixel of the supplemental area to render for each side of the map * @property padding {H.map.ViewPort.Padding=} - The padding in pixels for each side of the map * @property fixedCenter {boolean=} - Indicates whether the center of the map should remain unchanged if the viewport's size or or padding has been changed, default is true */ - export interface Options { + interface Options { margin?: number; padding?: H.map.ViewPort.Padding; fixedCenter?: boolean; @@ -2582,7 +2638,7 @@ declare namespace H { * @property bottom {number} - the padding on the bottom edge (in pixels) * @property left {number} - the padding on the left edge (in pixels) */ - export interface Padding { + interface Padding { top: number; right: number; bottom: number; @@ -2590,11 +2646,12 @@ declare namespace H { } } - export module layer { + namespace layer { /** - * BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request management. + * BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid + * calculation, tile request management. */ - export class BaseTileLayer extends H.map.layer.Layer { + class BaseTileLayer extends H.map.layer.Layer { /** * Constructor * @param provider {H.map.provider.TileProvider} - data source for the TileLayer @@ -2643,7 +2700,8 @@ declare namespace H { cancelTile(x: number, y: number, z: number): void; /** - * This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be available during subsequent calls. + * This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response + * as soon as they will be available during subsequent calls. * @param tileBounds {H.math.Rect} - bounds in tile grid * @param isCDB {boolean} * @param zoomLevel {number} - The zoom level for which the objects are requested @@ -2657,8 +2715,7 @@ declare namespace H { /** * This interface describes a layer which provides marker objects to the renderer. */ - export interface IMarkerLayer { - + interface IMarkerLayer { /** * This method requests marker objects for provided bounding rectangle. * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned @@ -2677,18 +2734,19 @@ declare namespace H { * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); + requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | + H.map.layer.IMarkerLayer.TiledResponse); } - export module IMarkerLayer { + namespace IMarkerLayer { /** * This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers function. * @property total {number} - The total number of markers, inclusive markers with not ready icons * @property markers {Array} - The marker objects for the bounding rectangle (only ready) */ - export interface Response { + interface Response { total: number; - markers: Array; + markers: H.map.AbstractMarker[]; } /** @@ -2697,17 +2755,18 @@ declare namespace H { * @property requested {number} - number of requested tiles * @property objects {Array} - the marker objects within requested tiled area */ - export interface TiledResponse { + interface TiledResponse { number: number; requested: number; - objects: Array; + objects: H.map.AbstractMarker[]; } } /** - * This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion (where z describes the level within the tree and x and y describe the absolute column and row indeces whithin the level). + * This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion (where z describes the level within the tree and x and y describe the absolute + * column and row indeces whithin the level). */ - export interface ITileLayer { + interface ITileLayer { /** * This method requests tiles for the current bounding rectangle at the given zoom level (z-value). * @param boundingRect {H.geo.Rect} - the bounding rectangle for which tiles are to be returned @@ -2737,13 +2796,13 @@ declare namespace H { cancelTile(x: number, y: number, z: number): void; } - export module ITileLayer { + namespace ITileLayer { /** * Options which are used to initialize a TileLayer object. * @property projection {H.geo.IProjection=} - an optional projection to be used for this layer, default is H.geo.mercator * @property opacity {number=} - tile layer opacity, default is 1 */ - export interface Options { + interface Options { projection?: H.geo.IProjection; opacity?: number; } @@ -2753,16 +2812,17 @@ declare namespace H { * @property total {number} - the total number of requested tiles * @property tiles {Array} - the tiles which this provider can currently return synchronously */ - export interface Response { + interface Response { total: number; - tiles: Array; + tiles: H.map.provider.Tile[]; } } /** - * The Layer class represents an object that is evaluated by the renderer in the order in which it is added to the layers collection. It provides the basic infrastructure for dispatching update events to the renderer in case new data is available. + * The Layer class represents an object that is evaluated by the renderer in the order in which it is added to the layers collection. It provides the basic infrastructure for dispatching + * update events to the renderer in case new data is available. */ - export class Layer extends H.util.EventTarget { + class Layer extends H.util.EventTarget { /** * Constructor * @param opt_options {H.map.layer.Layer.Options=} - optional configuration object @@ -2796,7 +2856,7 @@ declare namespace H { * @param level {number} - the zoom level for which to retrieve the copyright information * @returns {Array} - a list of copyright information objects for the provided area and zoom level */ - getCopyrights(bounds: H.geo.Rect, level: number): Array; + getCopyrights(bounds: H.geo.Rect, level: number): H.map.ICopyright[]; /** * This method will dispatch event on the event target object @@ -2814,10 +2874,10 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Layer { + namespace Layer { /** * Options which can be used when creating new layer object. * @property min {number=} - The minimum zoom level for which the layer can provide data, default is 0 @@ -2826,7 +2886,7 @@ declare namespace H { * @property projection {H.geo.IProjection=} - The projection to be used for this layer, default is H.geo.mercator * @property minWorldSize {number=} - The minimal world size at zoom level 0, default is 256 */ - export interface Options { + interface Options { min?: number; max?: number; dark?: boolean; @@ -2838,7 +2898,7 @@ declare namespace H { /** * ObjectTileLayer represents map objects which are requested on a tile basis */ - export class MarkerTileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.IMarkerLayer { + class MarkerTileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.IMarkerLayer { /** * Constructor * @param provider {H.map.provider.MarkerTileProvider} @@ -2864,13 +2924,15 @@ declare namespace H { * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); + requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | + H.map.layer.IMarkerLayer.TiledResponse); } /** - * This class represents a layer which renders map objects. Spatial objects like polygons and polylines a rendered to tiles before being passed to the enigne. Point objects like markers are provided as objects given an rectangular area. + * This class represents a layer which renders map objects. Spatial objects like polygons and polylines a rendered to tiles before being passed to the enigne. Point objects like markers + * are provided as objects given an rectangular area. */ - export class ObjectLayer extends H.map.layer.Layer implements H.map.layer.ITileLayer { + class ObjectLayer extends H.map.layer.Layer implements H.map.layer.ITileLayer { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - the ObjectProvider which provides the map objects to this object layer. @@ -2940,10 +3002,11 @@ declare namespace H { * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); + requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | + H.map.layer.IMarkerLayer.TiledResponse); } - export module ObjectLayer { + namespace ObjectLayer { /** * Configuration object which can be use to initialize the ObjectLayer. * @property tileSize {number=} - the size of the tiles rendered by this layer for polylines and polygons (must be power of 2, default is 256) @@ -2951,7 +3014,7 @@ declare namespace H { * @property dataCacheSize {number=} - the number of tiles to cache which have render data only, default is 512 * @property pixelRatio {number=} - The pixelRatio to use for over-sampling in cases of high-resolution displays */ - export interface Options { + interface Options { tileSize?: number; tileCacheSize?: number; dataCacheSize?: number; @@ -2963,9 +3026,9 @@ declare namespace H { * @property total {number} - The total number of overlays within the requested bounds, inclusive overlays which are not ready loaded yet * @property overlays {Array} - A list all overlays which are ready to render */ - export interface OverlaysResponse { + interface OverlaysResponse { total: number; - overlays: Array; + overlays: H.map.Overlay[]; } } @@ -2973,7 +3036,7 @@ declare namespace H { * Tile Layer, represents data shown on map on a tile basis. Can be used to show map tile images or other type of data which is partitioned into tiles. * @event update {H.util.Event} */ - export class TileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.ITileLayer { + class TileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.ITileLayer { /** * Constructor * @param provider {H.map.provider.TileProvider} - data source for the TileLayer @@ -2995,12 +3058,12 @@ declare namespace H { } } - export module provider { + namespace provider { /** * An ImageTileProvider uses network service to provide bitmap images as tiles. * @property tileSize {number} - Size of a tile image supported by the provider */ - export class ImageTileProvider extends H.map.provider.RemoteTileProvider { + class ImageTileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param options {H.map.provider.ImageTileProvider.Options} - configuration for tile provider @@ -3010,25 +3073,27 @@ declare namespace H { tileSize: number; } - export module ImageTileProvider { + namespace ImageTileProvider { /** * Options to initialize an ImageTileProvider instance - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. + * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross + * sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 * @property getCopyrights {(function(H.geo.Rect, number) : ?Array)=} - A function to replace the default implementation of H.map.provider.Provider#getCopyrights * @property tileSize {number=} - The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256 * @property getURL {function(number, number, number)} - The function to create an URL for the specified tile. If it returns a falsy the tile is not requested. - * @property crossOrigin {(string | boolean=)} - The CORS settings to use for the crossOrigin attribute for the image, if omitted or if the value evaluates to false no CORS settings are used. + * @property crossOrigin {(string | boolean=)} - The CORS settings to use for the crossOrigin attribute for the image, if omitted or if the value evaluates to false no CORS settings + * are used. */ - export interface Options { + interface Options { uri?: string; min?: number; max?: number; - getCopyrights?: ((rect: H.geo.Rect, n: number) => Array); + getCopyrights?(rect: H.geo.Rect, n: number): H.map.ICopyright[]; tileSize?: number; - getURL: (n1: number, n2: number, n3: number) => string; - crossOrigin?: (string | boolean); + getURL(n1: number, n2: number, n3: number): string; + crossOrigin?: string | boolean; } } @@ -3036,8 +3101,7 @@ declare namespace H { * This class represents invalidation states of a renderable object. A renderer can optimize its rendering strategies based on the information in this object. * @property MARK_INITIAL {H.map.provider.Invalidations.Mark} - This constant represents the initial invalidation mark an invalidations object has. */ - export class Invalidations { - + class Invalidations { /** * To update invalidation marks accordingly to the given the invalidation types. * @param mark {H.map.provider.Invalidations.Mark} - The invalidation mark to set @@ -3096,11 +3160,11 @@ declare namespace H { static MARK_INITIAL: H.map.provider.Invalidations.Mark; } - export module Invalidations { + namespace Invalidations { /** * This enumeration encapsulates bit flags for different invalidations of map objects. */ - export enum Flag { + enum Flag { NONE, VISUAL, SPATIAL, @@ -3112,7 +3176,7 @@ declare namespace H { /** * The invalidation mark represents a counter which is increased whenever an invalidation takes place. */ - export interface Mark { } + type Mark = any; } /** @@ -3125,7 +3189,7 @@ declare namespace H { * @property max {number} - Maximum zoom level at which provider can server data, set at construction time * @property uid {string} - Provider instance unique identifier, generated at construction time */ - export class MarkerTileProvider extends H.map.provider.RemoteTileProvider { + class MarkerTileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param options {H.map.provider.MarkerTileProvider.Options} - configuration for tile provider @@ -3146,18 +3210,19 @@ declare namespace H { providesDomMarkers(): boolean; } - export module MarkerTileProvider { + namespace MarkerTileProvider { /** * Options which are used to initialize the MarkerTileProvider object. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 - * @property requestData {function(number, number, number, function(Array), Function) : H.util.ICancelable} - function that fetches marker data and creates array of H.map.AbstractMarker that is passed success callback, if function fails to fetch data onError callback must be called + * @property requestData {function(number, number, number, function(Array), Function) : H.util.ICancelable} - function that fetches marker data and creates array + * of H.map.AbstractMarker that is passed success callback, if function fails to fetch data onError callback must be called * @property providesDomMarkers {boolean=} - indicates if markers provided are of type H.map.DomMarker or H.map.Marker, default is H.map.Marker */ - export interface Options { + interface Options { min?: number; max?: number; - requestData: (n1: number, n2: number, n3: number, markerCallback: (markers: Array) => void, f: Function) => H.util.ICancelable; + requestData(n1: number, n2: number, n3: number, markerCallback: (markers: H.map.AbstractMarker[]) => void, f: () => void): H.util.ICancelable; providesDomMarkers?: boolean; } } @@ -3165,7 +3230,7 @@ declare namespace H { /** * An abstract class to manage and provide map objects (Marker, Polyline, Polygon) */ - export class ObjectProvider extends H.map.provider.Provider { + class ObjectProvider extends H.map.provider.Provider { /** * Constructor * @param opt_options {H.map.provider.Provider.Options=} @@ -3200,7 +3265,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestOverlays(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestOverlays(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Overlay[]; /** * Checks whether this provider is currently providing spatial map objects. A concrete implementation of ObjectProvider must override it if it currently provides Spatials. @@ -3216,7 +3281,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatials(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatials(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Returns the spatial objects which intersect the given tile @@ -3225,7 +3290,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Checks whether this provider is currently providing Marker map objects. A concrete implementation of ObjectProvider must override it if it currently provides Markers. @@ -3241,7 +3306,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Marker[]; /** * Checks whether this provider is currently providing DomMarker map objects. A concrete implementation of ObjectProvider must override it if it currently provides Markers. @@ -3257,17 +3322,18 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestDomMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestDomMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.DomMarker[]; } /** - * A Provider defines an object which works as a database for the map. Providers can exists in different forms they can implement client side object storage or they can request data from the remote service. + * A Provider defines an object which works as a database for the map. Providers can exists in different forms they can implement client side object storage or they can request data from + * the remote service. * @property uri {string} - This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid * @property min {number} - Minimum zoom level at which provider can serve data, set at construction time * @property max {number} - Maximum zoom level at which provider can server data, set at construction time * @property uid {string} - Provider instance unique identifier, generated at construction time */ - export class Provider extends H.util.EventTarget { + class Provider extends H.util.EventTarget { /** * Constructor * @param opt_options {H.map.provider.Provider.Options=} @@ -3280,7 +3346,7 @@ declare namespace H { * @param level {number} - The zoom level for which to retrieve the copyright information * @returns {?Array} - a list of copyright information objects for the provided area and zoom level */ - getCopyrights(bounds: H.geo.Rect, level: number): Array; + getCopyrights(bounds: H.geo.Rect, level: number): H.map.ICopyright[]; /** * This method will dispatch event on the event target object @@ -3298,7 +3364,7 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; uri: string; min: number; @@ -3306,26 +3372,28 @@ declare namespace H { uid: string; } - export module Provider { + namespace Provider { /** * Options to initialize a Provider instance - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. + * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross + * sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 * @property getCopyrights {(function(H.geo.Rect, number) : ?Array)=} - A function to replace the default implementation of H.map.provider.Provider#getCopyrights */ - export interface Options { + interface Options { uri?: string; min?: number; max?: number; - getCopyrights?: (rect: H.geo.Rect, n: number) => Array; + getCopyrights?(rect: H.geo.Rect, n: number): H.map.ICopyright[]; } } /** - * RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement 'requestInternal' (to request remote tile) and 'getCache' (to provide configured cache object were tiled data is being cached) + * RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement 'requestInternal' + * (to request remote tile) and 'getCache' (to provide configured cache object were tiled data is being cached) */ - export class RemoteTileProvider extends H.map.provider.TileProvider { + class RemoteTileProvider extends H.map.provider.TileProvider { /** * Constructor * @param options {H.map.provider.TileProvider.Options} - The options to instantiate this TileProvider @@ -3354,7 +3422,7 @@ declare namespace H { z: number, onResponse?: ( - object: Array | HTMLImageElement | HTMLCanvasElement | ArrayBuffer, + object: H.map.Object[] | HTMLImageElement | HTMLCanvasElement | ArrayBuffer, response: any ) => void, @@ -3370,7 +3438,8 @@ declare namespace H { } /** - * Generic Tile object which represents a part of the world fiting into the Tile area represented by the Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles at particular zoom level (which means number of areas into world is being splitted) is defined as following: numberOfRows = numberOfColumns = 2^zoomlevel + * Generic Tile object which represents a part of the world fiting into the Tile area represented by the Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles + * at particular zoom level (which means number of areas into world is being splitted) is defined as following: numberOfRows = numberOfColumns = 2^zoomlevel * @property key {string} - Unique tile key generated by provider * @property data {*} - Tile data (an image for example) * @property valid {boolean} - This property holds a boolean flag indicating whether this tile is still valid (true) or whether it should be re-fetched (false) @@ -3378,7 +3447,7 @@ declare namespace H { * @property y {number} - Tile row * @property z {number} - Tile zoom level */ - export class Tile { + class Tile { /** * Constructor * @param x {number} - x tile coordinate (row) @@ -3405,7 +3474,7 @@ declare namespace H { * @property max {number} - Maximum zoom level at which provider can server data, set at construction time * @property uid {string} - Provider instance unique identifier, generated at construction time */ - export class TileProvider extends H.map.provider.Provider { + class TileProvider extends H.map.provider.Provider { /** * Constructor * @param options {H.map.provider.TileProvider.Options} - The options to instantiate this TileProvider @@ -3441,19 +3510,20 @@ declare namespace H { uid: string; } - export module TileProvider { + namespace TileProvider { /** - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. + * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. + * If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 * @property getCopyrights {(function(H.geo.Rect, number): Array)=} - A function to replace the default implememtation of H.map.provider.Provider#getCopyrights * @property tileSize {number=} - The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256 */ - export interface Options { + interface Options { uri?: string; min?: number; max?: number; - getCopyrights?(rect: H.geo.Rect, number: number): Array; + getCopyrights?(rect: H.geo.Rect, number: number): H.map.ICopyright[]; tileSize?: number; } } @@ -3461,14 +3531,14 @@ declare namespace H { } /***** mapevents *****/ - export module mapevents { + namespace mapevents { /** * Behavior class uses map events and adds behavior functionality to the map. This allows map panning and zooming via using mouse wheel * @property DRAGGING {number} - Map responds to user dragging via mouse or touch * @property WHEELZOOM {number} - Map zooms in or out in respond to mouse wheel events * @property DBLTAPZOOM {number} - Map zooms in or out in response to double click or double tap. For double tap if more that one touches are on the screen map will zoom out. */ - export class Behavior extends H.util.Disposable { + class Behavior extends H.util.Disposable { /** * Constructor * @param mapEvents {H.mapevents.MapEvents} - previously initialized map events instance @@ -3477,7 +3547,8 @@ declare namespace H { constructor(mapEvents: H.mapevents.MapEvents, options?: H.mapevents.Behavior.Options); /** - * This method destroys all map interaction handling. Should be used when the behavior functionality is disposed. Behavior object will also be disposed (this function will be called) when attached H.mapevents.MapEvents object is dispose. + * This method destroys all map interaction handling. Should be used when the behavior functionality is disposed. Behavior object will also be disposed (this function will be called) + * when attached H.mapevents.MapEvents object is dispose. */ dispose(): void; @@ -3505,13 +3576,13 @@ declare namespace H { static DBLTAPZOOM: number; } - export module Behavior { + namespace Behavior { /** * Options which are used to initialize the Behavior class. * @property kinetics {H.util.kinetics.IKinetics=} - The parameters for the kinetic movement. * @property enable {number=} - The bitmask of behaviors to enable like H.mapevents.Behavior.DRAGGING. All are enabled by default. */ - export interface Options { + interface Options { kinetics?: H.util.kinetics.IKinetics; enable?: H.math.BitMask; } @@ -3527,7 +3598,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class ContextMenuEvent extends H.util.Event { + class ContextMenuEvent extends H.util.Event { /** * Constructor * @param viewportX {number} - The x coordinate on the viewport @@ -3537,7 +3608,7 @@ declare namespace H { */ constructor(viewportX: number, viewportY: number, target: (H.Map | H.map.Object), originalEvent: Event); - viewportX: Array; + viewportX: H.util.ContextItem[]; viewportY: number; originalEvent: Event; } @@ -3554,7 +3625,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class Event extends H.util.Event { + class Event extends H.util.Event { /** * Constructor * @param type {string} - type of event @@ -3565,7 +3636,8 @@ declare namespace H { * @param target {(H.Map | H.map.Object)} - target map object which triggered event * @param originalEvent {Event} - original dom event */ - constructor(type: string, pointers: Array, changedPointers: Array, targetPointers: Array, currentPointer: H.mapevents.Pointer, target: (H.Map | H.map.Object), originalEvent: Event); + constructor(type: string, pointers: H.mapevents.Pointer[], changedPointers: H.mapevents.Pointer[], targetPointers: H.mapevents.Pointer[], currentPointer: H.mapevents.Pointer, + target: (H.Map | H.map.Object), originalEvent: Event); /** * Sets defaultPrevented to true. Which can be used to prevent some default behavior. @@ -3577,9 +3649,9 @@ declare namespace H { */ stopPropagation(): void; - pointers: Array; - changedPointers: Array; - targetPointers: Array; + pointers: H.mapevents.Pointer[]; + changedPointers: H.mapevents.Pointer[]; + targetPointers: H.mapevents.Pointer[]; currentPointer: H.mapevents.Pointer; originalEvent: Event; target: (H.map.Object | H.Map); @@ -3589,9 +3661,11 @@ declare namespace H { } /** - * MapEvents enable the events functionality on the map and on the map objects. By using this extension it is possible to listen to events on map objects like markers, polylines, polygons, circles and on the map object itself. Events are triggered depending on user interaction. Please check the Events Summary section for the list of events fired by this class and by the map objects. + * MapEvents enable the events functionality on the map and on the map objects. By using this extension it is possible to listen to events on map objects like markers, polylines, polygons, + * circles and on the map object itself. Events are triggered depending on user interaction. Please check the Events Summary section for the list of events fired by this class and by the map + * objects. */ - export class MapEvents extends H.util.Disposable { + class MapEvents extends H.util.Disposable { /** * Constructor * @param map {H.Map} - map instance which is used for firing events @@ -3599,7 +3673,8 @@ declare namespace H { constructor(map: H.Map); /** - * This method destroys the MapEvents by removing all handlers from the map object. After calling this function mapEvents and map objects will not trigger any events. This object will be disposed automatically if the corresponding map object is disposed. + * This method destroys the MapEvents by removing all handlers from the map object. After calling this function mapEvents and map objects will not trigger any events. This object will be + * disposed automatically if the corresponding map object is disposed. */ dispose(): void; @@ -3620,7 +3695,7 @@ declare namespace H { * @property dragTarget {(H.map.Object | H.Map)} - Object which is currently dragged by the pointer * @property button {H.mapevents.Pointer.Button} - Indicates which pointer device button has changed. */ - export class Pointer { + class Pointer { /** * Constructor * @param viewportX {number} - pointer position on x-axis @@ -3640,11 +3715,11 @@ declare namespace H { static button: H.mapevents.Pointer.Button; } - export module Pointer { + namespace Pointer { /** * Types of a button */ - export enum Button { + enum Button { /** No button */ NONE, /** Left mouse button or touch contact or pen contact */ @@ -3664,7 +3739,7 @@ declare namespace H { * - 4: Middle mouse button pressed */ // TODO not sure this is the right interpretation of the docs - export type Buttons = H.math.BitMask; + type Buttons = H.math.BitMask; } /** @@ -3678,7 +3753,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class WheelEvent extends H.util.Event { + class WheelEvent extends H.util.Event { /** * Constructor * @param deltaY {number} - The wheel move delta on y-axis @@ -3697,18 +3772,18 @@ declare namespace H { } /***** math *****/ - export module math { + namespace math { /** * A signed 32 bit integer (JS restriction) where bit operator can be applied to. The range is [-2,147,483,648 ... 2,147,483,647] or [-2^31 ... 2^31 − 1] */ - export type BitMask = number; + type BitMask = number; /** * An interface for a 2-dimensional point consisting a x and y coordinate. * @property x {number} - The point's coordinate on X-axis. * @property y {number} - The point's coordinate on Y-axis. */ - export interface IPoint { + interface IPoint { x: number; y: number; } @@ -3718,7 +3793,7 @@ declare namespace H { * @property w {number} - The size's width. * @property h {number} - The size's height. */ - export interface ISize { + interface ISize { w: number; h: number; } @@ -3728,7 +3803,7 @@ declare namespace H { * @property x {number} - The point's coordinate on X-axis. * @property y {number} - The point's coordinate on Y-axis. */ - export class Point implements IPoint { + class Point implements IPoint { /** * Constructor * @param x {number} - The point's coordinate on X-axis. @@ -3826,7 +3901,7 @@ declare namespace H { /** * Class defines a rectangle in 2-dimensional geometric space. It is used to represent the area in projected space. */ - export class Rect { + class Rect { /** * Constructor * @param left {number} - The rectangle's left edge x value @@ -3885,7 +3960,7 @@ declare namespace H { * @property w {number} - The size's width value * @property h {number} - The size's height value */ - export class Size { + class Size { /** * Constructor * @param width {number} - Width. @@ -3898,27 +3973,27 @@ declare namespace H { } /***** net *****/ - export module net { - export module Request { - export enum State { + namespace net { + namespace Request { + enum State { DONE = 2, OPENED = 1, UNSENT = 0, } // TODO no idea how this interface is set up, investigate - export interface Priority { } + type Priority = any; } } /***** places *****/ /***** service *****/ - export module service { + namespace service { /** * Abstract rest service class */ - export class AbstractRestService implements H.service.IConfigurable { + class AbstractRestService implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.AbstractRestService.Options=} @@ -3931,22 +4006,22 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in + * the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module AbstractRestService { - export interface Options { - - } + namespace AbstractRestService { + type Options = any; } /** - * This class encapsulates Enterprise Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getEnterpriseRoutingService. + * This class encapsulates Enterprise Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. + * H.service.Platform#getEnterpriseRoutingService. */ - export class EnterpriseRoutingService extends H.service.AbstractRestService { + class EnterpriseRoutingService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.EnterpriseRoutingService.Options=} @@ -3954,7 +4029,8 @@ declare namespace H { constructor(opt_options?: H.service.EnterpriseRoutingService.Options); /** - * This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. + * This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occurred. * @param calculateRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3962,7 +4038,8 @@ declare namespace H { calculateRoute(calculateRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; /** - * This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. + * This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occurred. * @param getRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3970,7 +4047,8 @@ declare namespace H { getRoute(getRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; /** - * This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occured. * @param getLinkInfoParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3978,7 +4056,8 @@ declare namespace H { getLinkInfo(getLinkInfoParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; /** - * This method sends a "calculateisoline" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. + * This method sends a "calculateisoline" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occurred. * @param calculateIsolineParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3986,13 +4065,14 @@ declare namespace H { calculateIsoline(calculateIsolineParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; } - export module EnterpriseRoutingService { + namespace EnterpriseRoutingService { /** * @property subDomain {string=} - The sub-domain of the routing service relative to the platform's base URL (default is 'route') * @property path {string=} - The path of the map tile service, default is "routing/7.2" - * @property baseUrl {H.service.Url=} - The base URL of the service, defaults to the the platform's base URL if instance was created using H.service.Platform#getEnterpriseRoutingService method. + * @property baseUrl {H.service.Url=} - The base URL of the service, defaults to the the platform's base URL if instance was created using H.service.Platform#getEnterpriseRoutingService + * method. */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4002,7 +4082,7 @@ declare namespace H { /** * This class encapsulates the Geocoding REST API in a service stub with calls to its various resources implemented. */ - export class GeocodingService extends H.service.AbstractRestService { + class GeocodingService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.GeocodingService.Options=} @@ -4010,7 +4090,8 @@ declare namespace H { constructor(opt_options?: H.service.GeocodingService.Options); /** - * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object - or the onError callback if a communication error occured. * @param geoodingParams {H.service.ServiceParameters} - the service parameters to be sent with the geocoding request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4019,7 +4100,8 @@ declare namespace H { geocode(geoodingParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** - * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object - or the onError callback if a communication error occured. * @param reverseGeocodingParams {H.service.ServiceParameters} - the service parameters to be sent with the reverse geocoding request * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4028,7 +4110,8 @@ declare namespace H { reverseGeocode(reverseGeocodingParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** - * This method sends a landmark search request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a landmark search request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object - or the onError callback if a communication error occured. * @param searchParams {H.service.ServiceParameters} - the service parameters to be sent with the reverse geocoding request * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4037,12 +4120,12 @@ declare namespace H { search(searchParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; } - export module GeocodingService { + namespace GeocodingService { /** * @property subDomain {string=} - the sub-domain of the geo-coding service relative to the platform's base URL, default is 'geocoder' * @property path {string=} - the path of the Geocoding service, default is '6.2' */ - export interface Options { + interface Options { subDomain?: string; path?: string; } @@ -4051,14 +4134,15 @@ declare namespace H { /** * An interface represents an object, that can be configured credentials, settings etc. by H.service.Platform */ - export interface IConfigurable { + interface IConfigurable { /** * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in + * the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; @@ -4068,15 +4152,15 @@ declare namespace H { * @property id {number} - the ID associated internally with this request * @property cancel {function()} - this function cancels the request and invokes the errback function */ - export interface JsonpRequestHandle { + interface JsonpRequestHandle { id: number; - cancel: () => void; + cancel(): void; } /** * This class encapsulates a map tile end point of the HERE Map Tile API. */ - export class MapTileService extends H.util.EventTarget implements H.service.IConfigurable { + class MapTileService extends H.util.EventTarget implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.MapTileService.Options=} @@ -4111,7 +4195,8 @@ declare namespace H { * @param opt_options {H.service.TileProviderOptions=} - additional set of options for the provider * @returns {H.map.provider.ImageTileProvider} - the image tile provider */ - createTileProvider(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_options?: H.service.TileProviderOptions): H.map.provider.ImageTileProvider; + createTileProvider(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_options?: H.service.TileProviderOptions): + H.map.provider.ImageTileProvider; /** * This method creates a tile layer. This layer can be used as a layer on a map's data model. @@ -4125,7 +4210,8 @@ declare namespace H { * @param opt_options {H.service.TileProviderOptions=} - additional set of options for the provider * @returns {H.map.layer.TileLayer} - the tile layer */ - createTileLayer(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_opacity?: number, opt_dark?: boolean, opt_options?: H.service.TileProviderOptions): H.map.layer.TileLayer; + createTileLayer(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_opacity?: number, opt_dark?: boolean, + opt_options?: H.service.TileProviderOptions): H.map.layer.TileLayer; /** * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. @@ -4133,13 +4219,14 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in + * the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module MapTileService { + namespace MapTileService { /** * @property maps {Object} - * @property schemes {Object} - @@ -4148,7 +4235,7 @@ declare namespace H { * @property resolutions {Object} - * @property languages {Object} - */ - export interface Info { + interface Info { maps: { [key: string]: any }; schemes: { [key: string]: any }; tiletypes: { [key: string]: any }; @@ -4163,7 +4250,7 @@ declare namespace H { * @property subDomain {string=} - the sub-domain of the map tile service relative to the platform's base URL, default is 'maps' * @property path {string=} - the path of the map tile service, default is 'maptile/2.1' */ - export interface Options { + interface Options { type?: string; version?: string; subDomain?: string; @@ -4172,7 +4259,8 @@ declare namespace H { } /** - * A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or 'terrain'). A map type contains at least a map property which defines the basic map layer for a given map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic etc. + * A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or 'terrain'). A map type contains at least a map property which defines the basic + * map layer for a given map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic etc. * @property map {H.map.layer.TileLayer} - the basic map tiles with all features and labels * @property mapnight {H.map.layer.TileLayer} - the basic map tiles with all features and labels (night mode) * @property xbase {H.map.layer.TileLayer=} - map tiles without features and labels @@ -4186,7 +4274,7 @@ declare namespace H { * @property panoramanight {H.map.layer.TileLayer=} - map tiles highlighting areas with HERE StreetLevel coverage (night mode) * @property labels {H.map.layer.TileLayer=} - transparent map tiles with labels only */ - export interface MapType { + interface MapType { map: H.map.layer.TileLayer; mapnight: H.map.layer.TileLayer; xbase?: H.map.layer.TileLayer; @@ -4204,7 +4292,7 @@ declare namespace H { /** * Places service implements a low level places RestApi access. Please refer to Restful API documentation for providing parameters and handling response objects. */ - export class PlacesService extends H.service.AbstractRestService { + class PlacesService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.PlacesService.Options=} @@ -4214,12 +4302,13 @@ declare namespace H { /** * This is generic method to query places RestAPI. * @param entryPoint {string} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH - * @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places restful api documentation documentation for available parameters for chose entry point + * @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places + * restful api documentation documentation for available parameters for chose entry point * @param onResult {Function} - callback which is called when result is returned * @param onError {Function} - callback which is called when error occured (i.e request timeout) * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - request(entryPoint: string, entryPointParams: Object, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + request(entryPoint: string, entryPointParams: {}, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'search' entry point. Please refer to documentation for parameter specification and response handling. @@ -4228,7 +4317,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - search(searchParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + search(searchParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter specification and response handling. @@ -4237,7 +4326,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - suggest(suggestParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + suggest(suggestParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'explore' entry point. Please refer to documentation for parameter specification and response handling. @@ -4246,7 +4335,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - explore(exploreParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + explore(exploreParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'around' entry point. Please refer to documentation for parameter specification and response handling. @@ -4255,7 +4344,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - around(aroundParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + around(aroundParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'here' entry point. Please refer to documentation for parameter specification and response handling. @@ -4264,7 +4353,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - here(hereParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + here(hereParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'categories' entry point. Please refer to documentation for parameter specification and response handling. @@ -4273,7 +4362,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - categories(categoriesParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + categories(categoriesParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * This method should be used to follow hyperlinks available in results returned by dicovery queries. @@ -4283,14 +4372,14 @@ declare namespace H { * @param opt_additionalParameters {Object=} - additional parameters to send with request * @returns {H.service.JsonpRequestHandle} - jsonp resquest handle */ - follow(hyperlink: string, onResult: Function, onError: Function, opt_additionalParameters?: Object): H.service.JsonpRequestHandle; + follow(hyperlink: string, onResult: () => void, onError: () => void, opt_additionalParameters?: {}): H.service.JsonpRequestHandle; } - export module PlacesService { + namespace PlacesService { /** * List of available entry points */ - export enum EntryPoint { + enum EntryPoint { SEARCH, SUGGEST, EXPLORE, @@ -4304,7 +4393,7 @@ declare namespace H { * @property path {string=} - the path of the places service, default is 'places/v1' * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4312,9 +4401,10 @@ declare namespace H { } /** - * The Platform class represents central class from which all other service stubs are created. It also contains the shared settings to be passed to the individual service stubs, for example the root URL of the platform, application credentials, etc. + * The Platform class represents central class from which all other service stubs are created. It also contains the shared settings to be passed to the individual service stubs, for example + * the root URL of the platform, application credentials, etc. */ - export class Platform { + class Platform { /** * Constructor * @param options {H.service.Platform.Options} @@ -4381,15 +4471,18 @@ declare namespace H { /** * This method creates a pre-configured set of HERE tile layers for convenient use with the map. - * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. If the parameter is an object, then it represents options and all remaining below parameters should be omitted. + * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. + * If theparameter is an object, then it represents options and all remaining below parameters should be omitted. * @param opt_ppi {number=} - optional 'ppi' parameter to use when querying tiles, default is not specified * @param opt_lang {string=} - optional primary language parameter, default is not specified * @param opt_secondaryLang {string=} - optional secondary language parameter, default is not specified * @param opt_style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified - * @param opt_pois {(string | boolean)=} - indicates if pois are displayed on the map. Pass true to indicate that all pois should be visible. Alternatively you can specify mask for the POI Categories as described at the Map Tile API documentation POI Categories chapter. + * @param opt_pois {(string | boolean)=} - indicates if pois are displayed on the map. Pass true to indicate that all pois should be visible. Alternatively you can specify mask for the + * POI Categories as described at the Map Tile API documentation POI Categories chapter. * @returns {Object} - a set of tile layers ready to use */ - createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, opt_pois?: (string | boolean)): H.service.Platform.MapTypes; + createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, + opt_pois?: (string | boolean)): H.service.Platform.MapTypes; /** * This method returns an instance of H.service.RoutingService to query the Routing API. @@ -4419,7 +4512,7 @@ declare namespace H { getEnterpriseRoutingService(opt_options?: H.service.EnterpriseRoutingService.Options): H.service.EnterpriseRoutingService; } - export module Platform { + namespace Platform { /** * Options used to create default layers * @property tileSize {number=} - tile size to be queried from the HERE Map Tile API, default is 256 @@ -4428,9 +4521,10 @@ declare namespace H { * @property lg2 {string=} - optional secondary language parameter, default is not specified * @property style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified * @property pois {boolean=} - indicates if pois are displayed on the map - * @property crossOrigin {(string | boolean=)} - indicates if CORS headers should be used for default layers, if false is specified, CORS headers are not set, defaults to 'anonymous'. Be aware that storing of content is not possible if crossOrigin is not set to true (see H.Map#storeContent). + * @property crossOrigin {(string | boolean=)} - indicates if CORS headers should be used for default layers, if false is specified, CORS headers are not set, defaults to 'anonymous'. + * Be aware that storing of content is not possible if crossOrigin is not set to true (see H.Map#storeContent). */ - export interface DefaultLayersOptions { + interface DefaultLayersOptions { tileSize?: number; ppi?: number; lg?: string; @@ -4447,7 +4541,7 @@ declare namespace H { * @property useCIT {boolean=} - Indicates whether the Customer Integration Testing should be used, default is false * @property useHTTPS {boolean=} - Indicates whether secure communication should be used, default is false */ - export interface Options { + interface Options { app_id: string; app_code: string; baseUrl?: H.service.Url; @@ -4458,18 +4552,19 @@ declare namespace H { /** * pre-configured set of HERE tile layers for convenient use with the map. */ - export interface MapTypes { + interface MapTypes { normal?: H.service.MapType; satellite?: H.service.MapType; terrain?: H.service.MapType; - [key: string]: H.service.MapType; + [key: string]: H.service.MapType | undefined; } } /** - * This class encapsulates the Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getRoutingService. + * This class encapsulates the Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. + * H.service.Platform#getRoutingService. */ - export class RoutingService extends H.service.AbstractRestService { + class RoutingService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.RoutingService.Options=} @@ -4477,7 +4572,8 @@ declare namespace H { constructor(opt_options?: H.service.RoutingService.Options); /** - * This method sends a "calculateroute" request to Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a "calculateroute" request to Routing REST API and calls the onResult callback function once the service response was received - providing a + * H.service.ServiceResult object - or the onError callback if a communication error occured. * @param calculateRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4485,13 +4581,13 @@ declare namespace H { calculateRoute(calculateRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; } - export module RoutingService { + namespace RoutingService { /** * @property subDomain {string=} - the sub-domain of the routing service relative to the platform's base URL, default is 'route' * @property path {string=} - the path of the map tile service, default is 'routing/7.2' * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4501,14 +4597,14 @@ declare namespace H { /** * This type encapsulates URL parameters to be sent to a HERE platform service. */ - export interface ServiceParameters { + interface ServiceParameters { [key: string]: string; } /** * This type encapsulates a response object provider by a HERE platform service. */ - export interface ServiceResult { + interface ServiceResult { [key: string]: string; } @@ -4516,14 +4612,15 @@ declare namespace H { * Options which are used to initialize the tile provider. * @property crossOrigin {boolean=} - The string to be set for the crossOrigin attribute for loaded images */ - export interface TileProviderOptions { + interface TileProviderOptions { crossOrigin?: boolean; } /** - * TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API documentation where it is possible to retrieve traffic incident information on a tile basis + * TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API documentation where it is possible to retrieve traffic incident information on a + * tile basis */ - export class TrafficIncidentsService extends H.service.AbstractRestService { + class TrafficIncidentsService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.TrafficIncidentsService.Options=} @@ -4549,16 +4646,17 @@ declare namespace H { * @param opt_serviceParams {H.service.ServiceParameters=} - optional service parameters to be added to the request * @returns {H.service.JsonpRequestHandle} */ - requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters): H.service.JsonpRequestHandle; + requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters): + H.service.JsonpRequestHandle; } - export module TrafficIncidentsService { + namespace TrafficIncidentsService { /** * @property subDomain {string=} - the sub-domain of the traffic incidents service relative to the platform's base URL, default is 'traffic' * @property path {string=} - the path of the traffic incidents service, default is 'traffic/6.1' * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4566,9 +4664,10 @@ declare namespace H { } /** - * This class represents a URL giving access to the individual parts that make up a URL,such as the scheme, host/domain, path, etc. Use the static parse method to populate a new URL object from a URL string. Be aware that URLs with user and password like "ftp://user:password@foo.bar/" are not supported! + * This class represents a URL giving access to the individual parts that make up a URL,such as the scheme, host/domain, path, etc. Use the static parse method to populate a new URL object + * from a URL string. Be aware that URLs with user and password like "ftp://user:password@foo.bar/" are not supported! */ - export class Url { + class Url { /** * Constructor * @param scheme {string} - the URL scheme (e.g. "http" or "https" or "mailto") @@ -4578,7 +4677,7 @@ declare namespace H { * @param opt_port {number=} - The port of the host on which the host listens. If a string is passed it must be convertible to an integer. * @param opt_anchor {string=} - an optional anchor part of the URL (usually preceded by '#'); */ - constructor(scheme: string, host: string, opt_path?: string, opt_params?: Object, opt_port?: number, opt_anchor?: string); + constructor(scheme: string, host: string, opt_path?: string, opt_params?: {}, opt_port?: number, opt_anchor?: string); /** * This function parses a URL string and returns a H.service.Url object. The URL string must contain at least a scheme and a host. @@ -4589,7 +4688,8 @@ declare namespace H { static parse(url: string, opt_baseURL?: string): H.service.Url; /** - * Clones this URL object. Optionally, mutations can be passed to this function to modify properties of the cloned object. Note that URL parameters are not replaced but merged with the parameters of this instance. + * Clones this URL object. Optionally, mutations can be passed to this function to modify properties of the cloned object. Note that URL parameters are not replaced but merged with the + * parameters of this instance. * @returns {H.service.Url} - the clone of the URL object */ clone(): H.service.Url; @@ -4634,11 +4734,12 @@ declare namespace H { getPath(): string | void; /** - * This function sets the specified parameters for this URL object. Keys in this object, which are associated with undefined values will be treated as query string parameters with no value. + * This function sets the specified parameters for this URL object. Keys in this object, which are associated with undefined values will be treated as query string parameters + * with no value. * @param params {(Object | undefined)} - a hash of query string parameters specifying the parameters to be set.or a boolean to clear the parameters. * @returns {H.service.Url} - this URL object */ - setQuery(params?: Object | boolean): H.service.Url; + setQuery(params?: {} | boolean): H.service.Url; /** * This function returns a boolean value indicating whether there are any query string parameter associated with this URL. @@ -4650,7 +4751,7 @@ declare namespace H { * This function returns the query object of this Url object. * @returns {Object} - the query object */ - getQuery(): Object; + getQuery(): {}; /** * This function sets the anchor of this URL object. @@ -4666,11 +4767,12 @@ declare namespace H { getAnchor(): string | void; /** - * This function merges the provided parameters into this URL's existing parameters. Key-value pairs which are defined in the argument and this URL's parameters will be overwritten. Key-value pairs which are defined in the argument and are not defined in this URL's parameters will be added. Prototype properties and function properties will not be merged. + * This function merges the provided parameters into this URL's existing parameters. Key-value pairs which are defined in the argument and this URL's parameters will be overwritten. + * Key-value pairs which are defined in the argument and are not defined in this URL's parameters will be added. Prototype properties and function properties will not be merged. * @param other {Object} - the parmeters to be merged into this URL's query string parameters * @returns {H.service.Url} - this URL object */ - mergeQuery(other: Object): H.service.Url; + mergeQuery(other: {}): H.service.Url; /** * This function adds a sub-domain to the host of this URL object. @@ -4693,11 +4795,11 @@ declare namespace H { toString(): string; } - export module metaInfo { + namespace metaInfo { /** * This class encapsulates a Metainfo Tile end point of the HERE Map Tile API. */ - export class Service extends H.util.EventTarget implements H.service.IConfigurable { + class Service extends H.util.EventTarget implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.metaInfo.Service.Options=} - additional service parameters @@ -4726,7 +4828,8 @@ declare namespace H { * @param opt_scheme {string=} - the scheme for which the meta info tiles a requested (default is 'normal.day') * @returns {H.map.provider.TileProvider} - the tile provider */ - createTileProvider(tileSize: number, pixelRatio: number, opt_categoryFilter?: Array, opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, opt_scheme?: string): H.map.provider.TileProvider; + createTileProvider(tileSize: number, pixelRatio: number, opt_categoryFilter?: string[], opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, + opt_scheme?: string): H.map.provider.TileProvider; /** * This method creates a tile layer. This layer can be used as a layer on a map's data model. @@ -4738,7 +4841,8 @@ declare namespace H { * @param opt_scheme {string=} - the scheme for which the meta info tiles a requested (default is 'normal.day') * @returns {H.map.layer.TileLayer} - the tile layer */ - createTileLayer(tileSize: number, pixelRatio: number, opt_categoryFilter?: Array, opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, opt_scheme?: string): H.map.layer.TileLayer; + createTileLayer(tileSize: number, pixelRatio: number, opt_categoryFilter?: string[], opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, + opt_scheme?: string): H.map.layer.TileLayer; /** * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. @@ -4746,13 +4850,14 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified + * in the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module Service { + namespace Service { /** * @property maps {Object} - * @property schemes {Object} - @@ -4761,7 +4866,7 @@ declare namespace H { * @property resolutions {Object} - * @property languages {Object} - */ - export interface Info { + interface Info { maps: { [key: string]: any }; schemes: { [key: string]: any }; tiletypes: { [key: string]: any }; @@ -4771,11 +4876,12 @@ declare namespace H { } /** - * @property type {string=} - the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API documentation for available types) + * @property type {string=} - the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API documentation for + * available types) * @property version {string=} - the map version hash to use for retrieving tiles, default is newest and will be automatically updated * @property subDomain {string=} - the sub-domain of the map tile service relative to the platform's base URL, default is 'maps' */ - export interface Options { + interface Options { type?: string; version?: string; subDomain?: string; @@ -4785,7 +4891,7 @@ declare namespace H { /** * This class utilizes Metainfo Tiles functionality provided by the Map Tile API to load meta information about map objects (buildings, labels, public transport etc.). */ - export class TileProvider extends H.map.provider.RemoteTileProvider { + class TileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param service {(H.service.metaInfo.Service | H.service.MapTileService)} - the tile service which holds information from about the source of the tiles @@ -4795,7 +4901,7 @@ declare namespace H { constructor(service: (H.service.metaInfo.Service | H.service.MapTileService), opt_params?: H.service.ServiceParameters, opt_options?: H.service.metaInfo.TileProvider.Options); } - export module TileProvider { + namespace TileProvider { /** * Configuration object which can be used to initialize the TileProvider. * @property tileType {string=} - The tile type for which to request meta info @@ -4805,22 +4911,22 @@ declare namespace H { * @property pixelRatio {number=} - The pixel ratio to use for over-sampling in cases of high-resolution displays * @property categoryFilter {Array=} - A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names. */ - export interface Options { + interface Options { tileType?: string; scheme?: string; tileCacheSize?: number; tileSize?: number; pixelRatio?: number; - categoryFilter?: Array; + categoryFilter?: string[]; } } } - export module venues { + namespace venues { /** * The class represents the building in the venue hiearachy (see H.service.venues.Venue) and holds floors that belong to the building. */ - export class Building extends H.map.Group { + class Building extends H.map.Group { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue building @@ -4857,9 +4963,10 @@ declare namespace H { } /** - * The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class holds information about floor geometry and spaces (see H.service.venues.Space) that belong to this floor. + * The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class holds information about floor geometry and spaces (see H.service.venues.Space) + * that belong to this floor. */ - export class Floor extends H.map.Group { + class Floor extends H.map.Group { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue floor @@ -4893,7 +5000,8 @@ declare namespace H { getBuilding(): H.service.venues.Building; /** - * Method returns raw data associated with the floor. For more details on data format see http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-floor.html + * Method returns raw data associated with the floor. For more details on data format see + * http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-floor.html * @returns {*} - the raw floor data object */ getData(): any; @@ -4909,7 +5017,7 @@ declare namespace H { /** * This class encapsulates methods to call Venue Maps API endpoints. */ - export class Service extends H.util.EventTarget implements H.service.IConfigurable { + class Service extends H.util.EventTarget implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.venues.Service.Options=} - additional service parameters @@ -4917,7 +5025,8 @@ declare namespace H { constructor(opt_options?: H.service.venues.Service.Options); /** - * This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object, or the onError callback if a communication error occured. + * This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object, or the onError callback if a communication error occured. * @param serviceParams {H.service.ServiceParameters} - the service parameters to be sent with the discovery request * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Venue Maps API provides a response to the request * @param onError {function(string)} - this function will be called if a communication error occurs during request and error type is passed as an argument @@ -4925,7 +5034,8 @@ declare namespace H { discover(serviceParams: H.service.ServiceParameters, onResult: (res: H.service.ServiceResult) => void, onError: (s: string) => void): void; /** - * This method creates a tile layer which can be added to the map in order to see the venues. It uses Interaction Tile endpoint of the Venue Maps API, more at http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html. + * This method creates a tile layer which can be added to the map in order to see the venues. It uses Interaction Tile endpoint of the Venue Maps API, more at + * http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html. * @param opt_options {H.service.venues.TileProvider.Options=} - Tile provider options * @returns {H.map.layer.TileLayer} - the tile layer */ @@ -4943,18 +5053,19 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified + * in the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module Service { + namespace Service { /** * @property subDomain {string=} - the sub-domain of the Venue Maps service relative to the platform's base URL, default is 'venue.maps' * @property path {string=} - the path to append after host name when making requests to the Venue Maps API, default is empty */ - export interface Options { + interface Options { subDomain?: string; path?: string; } @@ -4962,7 +5073,7 @@ declare namespace H { /** * The state types of the H.service.venues.Service. Possible states are: */ - export enum State { + enum State { ERROR, INIT, READY, @@ -4972,7 +5083,7 @@ declare namespace H { /** * Represents a spatial object for this space. Each space object contains data associated with that space and can be retrieved by using H.service.venues.Space#getData method. */ - export class Space { + class Space { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The provider of this object. @@ -4989,7 +5100,8 @@ declare namespace H { isFloorSpace(): boolean; /** - * This method sets custom style to use for rendering the labels. Should be called before the first render of the space, otherwise has no any effect. Note that due to the design consistency currently it is not allowed to change the font family and the size of the labels. + * This method sets custom style to use for rendering the labels. Should be called before the first render of the space, otherwise has no any effect. Note that due to the design + * consistency currently it is not allowed to change the font family and the size of the labels. * @param labelStyle {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - Custom label style */ initLabelStyle(labelStyle: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): void; @@ -5001,16 +5113,17 @@ declare namespace H { getFloor(): H.service.venues.Floor; /** - * Method returns raw data associated with the space. For more details on data format see http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-space.html + * Method returns raw data associated with the space. For more details on data format see + * http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-space.html * @returns {Object} - raw space data object */ - getData(): Object; + getData(): {}; } /** * This class represents a Venue Maps tile provider which requests venues tiles from a platform venue tile service. */ - export class TileProvider extends H.map.provider.RemoteTileProvider { + class TileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param service {H.service.venues.Service} @@ -5031,24 +5144,27 @@ declare namespace H { getCurrentLevel(): number; } - export module TileProvider { + namespace TileProvider { /** * Configuration object which can be used to initialize the TileProvider. * @property tileCacheSize {number=} - The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32 * @property pixelRatio {number=} - The pixel ratio to use for over-sampling in cases of high-resolution displays - * @property onSpaceCreated {function(H.service.venues.Space)=} - A callback function that is called on every created space (see H.service.venues.Space) object. The function can be used for space object styling. + * @property onSpaceCreated {function(H.service.venues.Space)=} - A callback function that is called on every created space (see H.service.venues.Space) object. The function can be + * used for space object styling. */ - export interface Options { + interface Options { tileCacheSize?: number; pixelRatio?: number; - onSpaceCreated?: (space: H.service.venues.Space) => void; + onSpaceCreated?(space: H.service.venues.Space): void; } } /** - * The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from H.map.Group and holds building objects (see H.service.venues.Building). Building objects hold floor objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces (see H.service.venues.Space) that are spatial map objects and reside inside floor containers. + * The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from H.map.Group and holds building objects (see H.service.venues.Building). + * Building objects hold floor objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces (see H.service.venues.Space) that are spatial map objects + * and reside inside floor containers. */ - export class Venue extends H.map.Group { + class Venue extends H.map.Group { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue @@ -5073,11 +5189,11 @@ declare namespace H { } /***** ui *****/ - export module ui { + namespace ui { /** * This class represents the base class for UI controls on the map. */ - export class Control extends H.ui.base.Container { + class Control extends H.ui.base.Container { /** * This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes. * @param unitSystem {H.ui.UnitSystem} - the unit system the UI currently uses @@ -5119,7 +5235,7 @@ declare namespace H { /** * This class represents a distance measurement control which helps calculating distances between geographical locations indicated by the user clicks. */ - export class DistanceMeasurement extends H.ui.Control { + class DistanceMeasurement extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.DistanceMeasurement.Options=} - optional parameters to be passed to this control @@ -5127,7 +5243,7 @@ declare namespace H { constructor(opt_options?: H.ui.DistanceMeasurement.Options); } - export module DistanceMeasurement { + namespace DistanceMeasurement { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM * @property startIcon {H.map.Icon=} - the icon to use for the first measurement point @@ -5135,9 +5251,10 @@ declare namespace H { * @property endIcon {H.map.Icon=} - the icon to use for the last measurement point * @property splitIcon {H.map.Icon=} - the icon to use for indicating position under pointer over the line where new point will be created once user clicks * @property lineStyle {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - the style to use for connecting lines of the measurement points - * @property distanceFormatter {function(number)=} - Optional function used for formatting a distance. By default distance measurement tool will do the formatting according to the specified measurement unit (see H.ui.UI.Options#unitSystem) + * @property distanceFormatter {function(number)=} - Optional function used for formatting a distance. By default distance measurement tool will do the formatting according to the + * specified measurement unit (see H.ui.UI.Options#unitSystem) */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; startIcon?: H.map.Icon; stopoverIcon?: H.map.Icon; @@ -5151,7 +5268,7 @@ declare namespace H { /** * This class represents an information bubble bound to a geo-position on the map. */ - export class InfoBubble extends base.Element { + class InfoBubble extends base.Element { /** * Constructor * @param position {H.geo.IPoint} - the geo-position to which this info bubble corresponds @@ -5196,24 +5313,25 @@ declare namespace H { getContentElement(): HTMLElement; /** - * This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of this info bubble or a HTML node which is appended to the content element. + * This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of this info bubble or a HTML node which is appended + * to the content element. * @param content {(string | Node)} - the content for this bubble */ setContent(content: string | Node): void; } - export module InfoBubble { + namespace InfoBubble { /** * This enumeration holds the state an info bubble can have. */ - export enum State { + enum State { /** This value represents the state where an info bubble is open and visible (value: 'open'). */ OPEN, /** This value represents the state where an info bubble is closed and invisible (value: 'closed') */ CLOSED, } - export interface Options { + interface Options { /** * a callback to be invoked when the info bubble's state changes * @param event {H.util.Event} @@ -5230,7 +5348,7 @@ declare namespace H { /** * This enumeration holds the possible layout alignments for the UI elements. */ - export enum LayoutAlignment { + enum LayoutAlignment { TOP_LEFT, TOP_CENTER, TOP_RIGHT, @@ -5248,7 +5366,7 @@ declare namespace H { /** * This class represents a menu control allowing to control which map type the map shows, etc. */ - export class MapSettingsControl extends H.ui.Control { + class MapSettingsControl extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.MapSettingsControl.Options=} - optional parameters to be passed to this control @@ -5262,13 +5380,13 @@ declare namespace H { setIncidentsLayer(incidentsLayer: H.map.layer.Layer): void; } - export module MapSettingsControl { + namespace MapSettingsControl { /** * The map type entry is an object containing a display name and a map type object to which it refers. * @property name {string} - label which describes the map type * @property mapType {H.service.MapType} - reference to map type */ - export interface MapTypeEntry { + interface MapTypeEntry { name: string; mapType: H.service.MapType; } @@ -5278,9 +5396,9 @@ declare namespace H { * @property entries {Array=} - the map type entries to be shown in this map settings control * @property incidents {H.map.layer.Layer} - the traffic incidents layer to be activated by the map settings control */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; - entries?: Array; + entries?: H.ui.MapSettingsControl.MapTypeEntry[]; incidents: H.map.layer.Layer; } } @@ -5288,7 +5406,7 @@ declare namespace H { /** * This class represents the UI controls for panorama */ - export class Pano extends H.ui.Control { + class Pano extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.Pano.Options=} - optional parameters to be passed to the map. @@ -5296,12 +5414,12 @@ declare namespace H { constructor(opt_options?: H.ui.Pano.Options); } - export module Pano { + namespace Pano { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM * @property mapTypes {H.service.MapTypes} - The map types to use */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; mapTypes: H.service.MapType; } @@ -5310,7 +5428,7 @@ declare namespace H { /** * This class represents a UI element showing the current zoom scale. */ - export class ScaleBar { + class ScaleBar { /** * Constructor * @param opt_options {H.ui.ScaleBar.Options=} - optional parameters to be passed to this scale bar. @@ -5318,11 +5436,11 @@ declare namespace H { constructor(opt_options?: H.ui.ScaleBar.Options); } - export module ScaleBar { + namespace ScaleBar { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; } } @@ -5330,7 +5448,7 @@ declare namespace H { /** * This class encapsulates map UI functionality. */ - export class UI implements H.util.ICapturable { + class UI implements H.util.ICapturable { /** * Constructor * @param map {H.Map} @@ -5383,7 +5501,7 @@ declare namespace H { * This method returns a list of info bubble objects which are currently attached to this UI. * @returns {Array} - the list of info bubbles */ - getBubbles(): Array; + getBubbles(): InfoBubble[]; /** * This method appends a control to the UI. @@ -5451,7 +5569,7 @@ declare namespace H { */ } - export module UI { + namespace UI { /** * Optional parameters to be passed to the UI constructor. * @property unitSystem {H.ui.UnitSystem=} - An optional unit system to be used by the UI, default is H.ui.UnitSystem.METRIC @@ -5461,9 +5579,11 @@ declare namespace H { * @property scalebar {(H.ui.ScaleBar.Options | boolean)=} - * @property panorama {(H.ui.Pano.Options | boolean)=} - * @property distancemeasurement {(H.ui.DistanceMeasurement.Options | boolean)=} - - * @property locale {(H.ui.i18n.Localization | string)=} - defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with custom translation map, or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If not defined ui will use 'en-US' by default + * @property locale {(H.ui.i18n.Localization | string)=} - defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with custom translation map, + * or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If not defined ui will use 'en-US' + * by default */ - export interface Options { + interface Options { unitSystem?: H.ui.UnitSystem; zoom?: (H.ui.ZoomControl.Options | boolean); zoomrectangle?: (H.ui.ZoomRectangle.Options | boolean); @@ -5478,7 +5598,7 @@ declare namespace H { /** * This enumeration holds the possible unit systems for the UI to display distances. */ - export enum UnitSystem { + enum UnitSystem { /** This value represents the imperial unit system using miles and feet (value: 'imperial'). */ IMPERIAL, /** This value represents the metric unit system using meters and kilometers, etc (value: 'metric'). */ @@ -5488,7 +5608,7 @@ declare namespace H { /** * This class represents the UI controls for zooming in an out of the map. */ - export class ZoomControl extends H.ui.Control { + class ZoomControl extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.ZoomControl.Options=} - optional parameters to be passed to the map. @@ -5502,14 +5622,14 @@ declare namespace H { getZoomSpeed(): number; } - export module ZoomControl { + namespace ZoomControl { /** * @property zoomSpeed {number=} - the speed if zooming in and out in levels per millisecond, defaults to 0.05 * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, defaults to H.ui.LayoutAlignment.RIGHT_MIDDLE * @property slider {boolean=} - flag whether to show the slider (true) or not, defaults to false * @property sliderSnaps {boolean=} - flag whether slider should snap to the integer values or not, defaults to false. This option has effect only if slider is enabled. */ - export interface Options { + interface Options { zoomSpeed?: number; alignment?: H.ui.LayoutAlignment; slider?: boolean; @@ -5520,7 +5640,7 @@ declare namespace H { /** * This class represents a zoom rectangle control element that allows zooming to the selected area on the screen. */ - export class ZoomRectangle extends H.ui.Control { + class ZoomRectangle extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.ZoomRectangle.Options=} - optional parameters to be passed to this control @@ -5528,12 +5648,13 @@ declare namespace H { constructor(opt_options?: H.ui.ZoomRectangle.Options); } - export module ZoomRectangle { + namespace ZoomRectangle { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT - * @property adjustZoom {function(number, H.Map) : number=} - optional function that defines how zoom level should be changed, by default zoom level is picked to fit the bounding rectangle into the view port. + * @property adjustZoom {function(number, H.Map) : number=} - optional function that defines how zoom level should be changed, by default zoom level is picked to fit the + * bounding rectangle into the view port. */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; adjustZoom?(n: number, m: H.Map): number; } @@ -5544,15 +5665,15 @@ declare namespace H { /** * This namespace contains basic UI elements from which the UI controls are built. */ - export module base { - export class Container extends H.util.EventTarget { + namespace base { + class Container extends H.util.EventTarget { /** * Constructor * @param opt_elementType {string=} - the type of HTML element this UI element renders as, default is 'div' * @param opt_className {string=} - an optional class name to be used on this element * @param opt_children {Array=} - optional child elements to be added to this container */ - constructor(opt_elementType?: string, opt_className?: string, opt_children?: Array); + constructor(opt_elementType?: string, opt_className?: string, opt_children?: Element[]); /** * Adds a child element to be rendered within the container element. @@ -5565,7 +5686,7 @@ declare namespace H { * Returns the child collection of this container. * @returns {Array} - Returns the child collection of this container. */ - getChildren(): Array; + getChildren(): Element[]; /** * Removes a child element from this container's child collection. @@ -5641,7 +5762,7 @@ declare namespace H { removeClass(className: string): Element; } - export class Element extends H.util.EventTarget { + class Element extends H.util.EventTarget { /** * Constructor * @param opt_elementType {string=} - the type of HTML element this UI element renders as, default is 'div' @@ -5721,16 +5842,16 @@ declare namespace H { /** * Namespace contains functionality related to internationalization. */ - export module i18n { + namespace i18n { /** * Default available locales. UI provides default translations for this set of locale codes. */ - export const defaultLocales: Array; + const defaultLocales: string[]; /** * This class is used for internationalization of UI components. */ - export class Localization { + class Localization { constructor(locale: string, opt_translationMap?: any); /** @@ -5743,7 +5864,7 @@ declare namespace H { * This method returns translation keys for current locale. Keys from this set can be used to get translations via translate method. * @returns {Array} */ - getKeys(): Array; + getKeys(): string[]; /** * This method returns a boolean value indicating whether this localization object has a translation for the specified translation key. @@ -5763,11 +5884,13 @@ declare namespace H { } /***** util *****/ - export module util { + namespace util { /** - * The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until the cache's content exceeds a maximum size. Once the size of all content elements exceeds the maximum size the cache will drop the least recently retrieved elements until the size of the cache is within the bounds of its maximum size. Data elements are always associated with an identifier that allow to retrieve them at a later stage and their content size. + * The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until the cache's content exceeds a maximum size. Once the size of all content elements + * exceeds the maximum size the cache will drop the least recently retrieved elements until the size of the cache is within the bounds of its maximum size. Data elements are always + * associated with an identifier that allow to retrieve them at a later stage and their content size. */ - export class Cache implements H.util.ICache { + class Cache implements H.util.ICache { /** * Constructor * @param maxSize {number} - the maximum size of the cache @@ -5819,7 +5942,8 @@ declare namespace H { drop(id: any): void; /** - * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on those entries for which the predicated returns true. + * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed + * on those entries for which the predicated returns true. * @param callback {function(string, ?, number)} - the callback to be invoked for each entry * @param opt_ctx {Object=} - an optional context object to be used as this within the callback * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional match predicate to customize on which entries the callback will be called @@ -5827,8 +5951,10 @@ declare namespace H { forEach(callback: (s: string, i: any, n: number) => void, opt_ctx?: any, opt_matcher?: (s: string, i: any, n: number) => boolean): void; /** - * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate return true. - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively + * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate + * return true. + * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or + * leave the entry in the cache respectively */ removeAll(opt_matcher?: (s: string, i: any, n: number) => boolean): void; @@ -5846,7 +5972,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class ChangeEvent extends H.util.Event { + class ChangeEvent extends H.util.Event { /** * Constructor * @param type {string} - The type of the event @@ -5875,7 +6001,7 @@ declare namespace H { * This class represents a contextual information/action. * @property SEPARATOR {H.util.ContextItem} - Separator for the context items */ - export class ContextItem extends H.util.EventTarget { + class ContextItem extends H.util.EventTarget { /** * Constructor * @param opt_options {H.util.ContextItem.Options=} - The values to initialize this context item @@ -5924,29 +6050,29 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; static SEPARATOR: H.util.ContextItem; } - export module ContextItem { + namespace ContextItem { /** * This type defines options which can be used to initialize the context item. * @property label {string=} - the label of the context item * @property disabled {boolean=} - flag indicatting whether context item is disabled or no, by default false * @property callback {function(H.util.Event)=} - Optional callback function to call once context item is selected */ - export interface Options { + interface Options { label?: string; disabled?: boolean; - callback?: (event: H.util.Event) => void; + callback?(event: H.util.Event): void; } } /** * Object which can be safely disposed. */ - export class Disposable { + class Disposable { /** * Constructor */ @@ -5957,7 +6083,7 @@ declare namespace H { * @param callback {Function} * @param opt_scope {Object=} */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } /** @@ -5967,7 +6093,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class Event { + class Event { /** * Constructor * @param type {string} - Event Type. @@ -5994,14 +6120,15 @@ declare namespace H { /** * EventTarget enabled listening and dispatching events on all instances and derived classes. */ - export class EventTarget { + class EventTarget { /** * Constructor */ constructor(); /** - * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible. + * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. + * Otherwise memory leak is possible. * @param type {string} - name of event * @param handler {Function} - event handler function * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) @@ -6038,9 +6165,10 @@ declare namespace H { } /** - * An interface definition for the generic cache. Any data elements can be stored in the cache. They are always associated with an identifier to retrieve them at a later stage and their content size. + * An interface definition for the generic cache. Any data elements can be stored in the cache. They are always associated with an identifier to retrieve them at a later stage and their + * content size. */ - export interface ICache { + interface ICache { /** * This method adds an element to the cache. * @param id {*} - The identifier of this data element, the value is converted to a string. @@ -6065,16 +6193,19 @@ declare namespace H { drop(id: any): void; /** - * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on those entries for which the predicated returns true. + * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on + * those entries for which the predicated returns true. * @param callback {function(string, ?, number)} - the callback to be invoked for each entry * @param opt_ctx {Object=} - an optional context object to be used as this within the callback * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional match predicate to customize on which entries the callback will be called */ - forEach(callback: (s: string, t: any, n: number) => void, opt_ctx?: Object, opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; + forEach(callback: (s: string, t: any, n: number) => void, opt_ctx?: {}, opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; /** - * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate return true. - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively + * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate + * return true. + * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or + * leave the entry in the cache respectively */ removeAll(opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; @@ -6088,14 +6219,14 @@ declare namespace H { /** * An interface to cancelable requests and actions. */ - export interface ICancelable { + interface ICancelable { /** * This method is used to cancel current action */ cancel(): void; } - export interface ICapturable { + interface ICapturable { /** * This method is used to capture the element view * @param canvas {HTMLCanvasElement} - HTML Canvas element to draw the view of the capturable element @@ -6123,12 +6254,12 @@ declare namespace H { * @event set {H.util.OList.Event} - Fired when an entry was set in the list. * @event move {H.util.OList.Event} - Fired when an entry was moved within the list. */ - export class OList extends H.util.EventTarget { - + class OList extends H.util.EventTarget { /** * This method inserts an entry to the list. Optionally it can place new entry at provided index. * @param entry {?} - The entry to insert - * @param opt_idx {number=} - The index where the new entry should be inserted; if omitted or greater then the current size of the list, the entry is added at the end of the list; a negative index is treated as being relative from the end of the list + * @param opt_idx {number=} - The index where the new entry should be inserted; if omitted or greater then the current size of the list, the entry is added at the end of the list; + * a negative index is treated as being relative from the end of the list */ add(entry: any, opt_idx?: number): void; @@ -6178,7 +6309,7 @@ declare namespace H { * This method returns all list's entries as an array. * @returns {Array<*>} - The list as an array */ - asArray(): Array; + asArray(): any[]; /** * This method removes all entries from the list. @@ -6201,10 +6332,10 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module OList { + namespace OList { /** * The event class for events that are dispatched by OList * @property target {*} - Object which triggered the event @@ -6212,7 +6343,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class Event extends H.util.Event { + class Event extends H.util.Event { /** * Constructor * @param list {H.util.OList} - The OList instance which is emitting the event @@ -6244,7 +6375,7 @@ declare namespace H { /** * A generic class to represent a handle for any kind of asynchronous processed requests */ - export class Request { + class Request { /** * Constructor * @param opt_onprogress {function(H.util.Request)=} - A callback to invoke every time when the request's progress state changes @@ -6277,11 +6408,11 @@ declare namespace H { getFailed(): number; } - export module Request { + namespace Request { /** * The supported states of an request */ - export enum State { + enum State { PENDING, PROCESSING, COMPLETE, @@ -6290,11 +6421,11 @@ declare namespace H { } } - export module animation { + namespace animation { /** * This mamespace contains easing functions used for Animation class. */ - export class ease { + class ease { /** * This function defines linear ease. * @param val {number} - A value in range [0..1] to translate @@ -6332,13 +6463,13 @@ declare namespace H { } } - export module kinetics { + namespace kinetics { /** * This interface defines kinetic move parameters used by map for kinetic drag. * @property power {number} - Power multiplier. Multiplier is used to increase the speed of the kinetic move. By default map uses 1. * @property duration {number} - Defines duration of the kinetic move. */ - export interface IKinetics { + interface IKinetics { /** * Easing function modifies animation progress. In example it can modify the animation in a way it starts rapidly and then slows down at the end. * @param p {number} - current progress diff --git a/types/heremaps/tslint.json b/types/heremaps/tslint.json new file mode 100644 index 0000000000..4ac54521fe --- /dev/null +++ b/types/heremaps/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": [false] + } +} \ No newline at end of file diff --git a/types/highcharts-ng/index.d.ts b/types/highcharts-ng/index.d.ts index 639d21d88e..7c5386a890 100644 --- a/types/highcharts-ng/index.d.ts +++ b/types/highcharts-ng/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/pablojim/highcharts-ng // Definitions by: Scott Hatcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { ChartObject, IndividualSeriesOptions, Options } from "highcharts"; diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index b71610f6b7..2bdc1b648d 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.highcharts.com/ // Definitions by: Damiano Gambarotto , Dan Lewi Harkestad , Albert Ozimek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare namespace Highcharts { interface Position { diff --git a/types/highland/highland-tests.ts b/types/highland/highland-tests.ts index e4af44c0a0..9df2443a31 100644 --- a/types/highland/highland-tests.ts +++ b/types/highland/highland-tests.ts @@ -145,103 +145,32 @@ fooStream = _(fooThen); fooArrStream = _(fooArrThen); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -obj = _.nil; - +// STREAM OBJECTS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -f = _.curry(fn, foo); -f = _.curry(fn, foo, bar); - -f = _.ncurry(num, fn, foo); -f = _.ncurry(num, fn, foo, bar); - -f = _.partial(f, foo); -f = _.partial(f, foo, bar); - -f = _.flip(fn, foo); -f = _.flip(fn, foo, bar); - -f = _.compose(f); -f = _.compose(f, f); - -f = _.seq(f); -f = _.seq(f, f); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool = _.isStream(x); -bool = _.isStream(fooStream); - -bool = _.isStreamError(x); -bool = _.isStreamError(fooStream); - -bool = _.isStreamRedirect(x); -bool = _.isStreamRedirect(fooStream); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -anyStream = _.values(obj); -fooStream = _.values(fooArr); - -strStream = _.keys(obj); - -anyArrStream = _.pairs(obj); -anyArrStream = _.pairs(fooArr); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -obj = _.extend(obj, obj); - -objCurObj = _.extend(obj); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -x = _.get(str, obj); - -objCurObj = _.get(str); - -obj = _.set(str, foo, obj); - -objCurAny = _.set(str, foo); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -_.log(str); -_.log(str, num, foo); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -f = _.wrapCallback(func); -f = _.wrapCallback(func, num); -f = _.wrapCallback(func, strArr); -f = _.wrapCallback(func, fn); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -num = _.add(num, num); - -numCurNum = _.add(num); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// instance methods - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooStream.pause(); -fooStream.resume(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooStream.end(); - -fooStream = fooStream.pipe(fooStream); -barStream = fooStream.pipe(barStream); - fooStream.destroy(); +fooStream.end(); + +fooStream.pause(); + +fooStream.resume(); + +bool = fooStream.write(foo); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// TRANSFORMS +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooStream = fooStream.append(foo); + +fooArrStream = fooStream.batch(2); + +fooArrStream = fooStream.batchWithTimeOrCount(10, 2); + +fooArrStream = fooStream.collect(); + +fooStream = fooStream.compact(); barStream = fooStream.consume((err: Error, x: Foo, push: (err: Error, value?: Bar) => void, next: () => void) => { push(err); @@ -255,27 +184,11 @@ barStream = fooStream.consume((err, x, push, next) => { next(); }); -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +fooStream = fooStream.debounce(num); -fooStream.pull((err: Error, x: Foo) => { +fooStream = fooStream.doto((x: Foo) => {}); -}); - -fooStream.pull((err, x) => { - -}); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool = fooStream.write(foo); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooStream = fooStream.fork(); - -fooStream = fooStream.observe(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +fooStream = fooStream.drop(2); fooStream = fooStream.errors((err: Error, push: (e: Error, x?: Foo) => void) => { push(err); @@ -289,26 +202,76 @@ fooStream = fooStream.errors((err, push) => { push(null, foo); }); +fooStream = fooStream.filter((x: Foo) => { + return bool; +}); + +fooStream = fooStream.find((x: Foo) => { + return bool; +}); + +fooStream = fooStream.findWhere(obj); + +strFooArrMapStream = fooStream.group((x: Foo) => { + return str; +}); +strFooArrMapStream = fooStream.group(str); + +fooStream = fooStream.head(); + +barStream = fooStream.invoke(str, anyArr); + +fooStream = fooStream.last(); + +fooStream = fooStream.latest(); + +barStream = fooStream.map((x: Foo) => { + return bar; +}); + +barStream = fooStream.pluck(str); + +barStream = fooStream.reduce(bar, (memo: Bar, x: Foo) => { + return memo; +}); + +barStream = fooStream.reduce1(bar, (memo: Bar, x: Foo) => { + return memo; +}); + +fooStream = fooStream.reject((x: Foo) => { + return bool; +}); + +barStream = fooStream.scan(bar, (memo: Bar, x: Foo) => { + return memo; +}); + +//missing scan1 + fooStream = fooStream.stopOnError((e: Error) => { }); -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +fooStream = fooStream.take(num); -fooStream.each((x: Foo) => { +fooStream.tap((x: Foo) => {}); -}); +fooStream = fooStream.throttle(num); -fooStream.apply(func); +fooStream = fooStream.where(obj); -fooStream.toArray((arr: Foo[]) => { - -}); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// HIGHER-ORDER STREAMS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barStream = fooStream.map((x: Foo) => { - return bar; +fooStream = fooStream.concat(fooStream); + +fooStream = fooStream.concat(fooArr); + +fooStream = fooStream.flatFilter((x: Foo) => { + return boolStream; }); barStream = fooStream.flatMap((x: Foo) => { @@ -319,95 +282,127 @@ barStream = fooStream.flatMap((x: Foo) => { return bar; }); -barStream = fooStream.pluck(str); +barStream = fooStream.flatten(); -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +fooStream = fooStream.fork(); -fooStream = fooStream.filter((x: Foo) => { - return bool; -}); +fooStream = fooStream.merge(fooStreamStream); -fooStream = fooStream.flatFilter((x: Foo) => { - return boolStream; -}); +fooStream = fooStream.observe(); -fooStream = fooStream.reject((x: Foo) => { - return bool; -}); +fooStream = fooStream.otherwise(fooStream); -fooStream = fooStream.find((x: Foo) => { - return bool; -}); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -strFooArrMapStream = fooStream.group((x: Foo) => { - return str; -}); -strFooArrMapStream = fooStream.group(str); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooStream = fooStream.compact(); - -fooStream = fooStream.where(obj); - -fooStream = fooStream.zip(fooStream); -fooStream = fooStream.zip([foo, foo]); - -fooStream = fooStream.head(); -fooStream = fooStream.take(num); - -fooStream = fooStream.last(); +fooStream = fooStream.parallel(num); barStream = fooStream.sequence(); barStream = fooStream.series(); -barStream = fooStream.flatten(); - -fooStream = fooStream.parallel(num); - -fooStream = fooStream.otherwise(fooStream); - -fooStream = fooStream.append(foo); +fooStream = fooStream.zip(fooStream); +fooStream = fooStream.zip([foo, foo]); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// CONSUMPTION // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barStream = fooStream.reduce(bar, (memo: Bar, x: Foo) => { - return memo; +fooStream.apply(func); + +fooStream.done(() => {}); + +fooStream.each((x: Foo) => { + }); -barStream = fooStream.reduce1(bar, (memo: Bar, x: Foo) => { - return memo; +fooStream = fooStream.pipe(fooStream); +barStream = fooStream.pipe(barStream); + +fooStream.pull((err: Error, x: Foo) => { + }); -fooArrStream = fooStream.collect(); +fooStream.pull((err, x) => { -barStream = fooStream.scan(bar, (memo: Bar, x: Foo) => { - return memo; }); -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +fooStream.toArray((arr: Foo[]) => { -fooStream = fooStream.concat(fooStream); +}); -fooStream = fooStream.concat(fooArr); +fooStream.toCallback((err: Error, x: Foo) => {}); +fooStream.toCallback((err: Error) => {}); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooStream = fooStream.merge(fooStreamStream); - +// UTILS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barStream = fooStream.invoke(str, anyArr); +bool = _.isStream(x); +bool = _.isStream(fooStream); -fooStream = fooStream.throttle(num); +bool = _.isStreamError(x); +bool = _.isStreamError(fooStream); + +bool = _.isStreamRedirect(x); +bool = _.isStreamRedirect(fooStream); + +_.log(str); +_.log(str, num, foo); + +obj = _.nil; + +f = _.wrapCallback(func); +f = _.wrapCallback(func, num); +f = _.wrapCallback(func, strArr); +f = _.wrapCallback(func, fn); -fooStream = fooStream.debounce(num); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// OBJECTS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooStream = fooStream.latest(); +obj = _.extend(obj, obj); +objCurObj = _.extend(obj); + +x = _.get(str, obj); +objCurObj = _.get(str); + +strStream = _.keys(obj); + +anyArrStream = _.pairs(obj); +anyArrStream = _.pairs(fooArr); + +obj = _.set(str, foo, obj); +objCurAny = _.set(str, foo); + +anyStream = _.values(obj); +fooStream = _.values(fooArr); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// FUNCTIONS +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +f = _.compose(f); +f = _.compose(f, f); + +f = _.curry(fn, foo); +f = _.curry(fn, foo, bar); + +f = _.flip(fn, foo); +f = _.flip(fn, foo, bar); + +f = _.ncurry(num, fn, foo); +f = _.ncurry(num, fn, foo, bar); + +f = _.partial(f, foo); +f = _.partial(f, foo, bar); + +f = _.seq(f); +f = _.seq(f, f); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// OPERATORS +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +num = _.add(num, num); + +numCurNum = _.add(num); + +//missing not \ No newline at end of file diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index 82806d6349..6a3532baca 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -2,6 +2,7 @@ // Project: http://highlandjs.org/ // Definitions by: Bart van der Schoor // Hugo Wood +// William Yu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -81,6 +82,37 @@ interface HighlandStatic { (xs: Highland.Thenable>): Highland.Stream; (xs: Highland.Thenable): Highland.Stream; + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // UTILS + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** + * Returns true if `x` is a Highland Stream. + * + * @id isStream + * @section Streams + * @name _.isStream(x) + * @param x - the object to test + * @api public + */ + isStream(x: any): boolean; + + isStreamError(x: any): boolean; + + isStreamRedirect(x: any): boolean; + + /** + * Logs values to the console, a simple wrapper around `console.log` that + * it suitable for passing to other functions by reference without having to + * call `bind`. + * + * @id log + * @section Utils + * @name _.log(args..) + * @api public + */ + log(x: any, ...args: any[]): void; + /** * The end of stream marker. This is sent along the data channel of a Stream * to tell consumers that the Stream has ended. See the following map code for @@ -93,7 +125,139 @@ interface HighlandStatic { */ nil: Highland.Nil; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /** + * Wraps a node-style async function which accepts a callback, transforming + * it to a function which accepts the same arguments minus the callback and + * returns a Highland Stream instead. The wrapped function keeps its context, + * so you can safely use it as a method without binding (see the second + * example below). + * + * wrapCallback also accepts an optional mappingHint, which specifies how + * callback arguments are pushed to the stream. This can be used to handle + * non-standard callback protocols that pass back more than one value. + * + * mappingHint can be a function, number, or array. See the documentation on + * EventEmitter Stream Objects for details on the mapping hint. If + * mappingHint is a function, it will be called with all but the first + * argument that is passed to the callback. The first is still assumed to be + * the error argument. + * + * @id wrapCallback + * @section Utils + * @name _.wrapCallback(f) + * @param {Function} f - the node-style function to wrap + * @param {Array | Function | Number} [mappingHint] - how to pass the arguments to the callback + * @api public + */ + wrapCallback(f: Function, mappingHint?: Highland.MappingHint): (...args: any[]) => Highland.Stream; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // OBJECTS + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** + * Extends one object with the properties of another. **Note:** The + * arguments are in the reverse order of other libraries such as + * underscore. This is so it follows the convention of other functions in + * this library and so you can more meaningfully partially apply it. + * + * @id extend + * @section Objects + * @name _.extend(a, b) + * @param {Object} a - the properties to extend b with + * @param {Object} b - the original object to extend + * @api public + */ + extend(extensions: Object, target: Object): Object; + + extend(target: Object): (extensions: Object) => Object; + + /** + * Returns a property from an object. + * + * @id get + * @section Objects + * @name _.get(prop, obj) + * @param {String} prop - the property to return + * @param {Object} obj - the object to read properties from + * @api public + */ + get(prop: string, obj: Object): string; + + get(prop: string): (obj: Object) => Object; + + /** + * Returns keys from an Object as a Stream. + * + * @id keys + * @section Objects + * @name _.keys(obj) + * @param {Object} obj - the object to return keys from + * @api public + */ + keys(obj: Object): Highland.Stream; + + /** + * Returns key/value pairs for an Object as a Stream. Reads properties + * lazily, so if you don't read from all keys on an object, not + * all properties will be read from (may have an effect where getters + * are used). + * + * @id pairs + * @section Objects + * @name _.pairs(obj) + * @param {Object} obj - the object to return key/value pairs from + * @api public + */ + pairs(obj: Object): Highland.Stream; + + pairs(obj: any[]): Highland.Stream; + + /** + * Updates a property on an object, returning the updated object. + * + * @id set + * @section Objects + * @name _.set(prop, value, obj) + * @param {String} prop - the property to return + * @param value - the value to set the property to + * @param {Object} obj - the object to set properties on + * @api public + */ + set(prop: string, val: any, obj: Object): Object; + + set(prop: string, val: any): (obj: Object) => Object; + + /** + * Returns values from an Object as a Stream. Reads properties + * lazily, so if you don't read from all keys on an object, not + * all properties will be read from (may have an effect where getters + * are used). + * + * @id values + * @section Objects + * @name _.values(obj) + * @param {Object} obj - the object to return values from + * @api public + */ + values(obj: Object): Highland.Stream; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // FUNCTIONS + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** + * Creates a composite function, which is the application of function1 to + * the results of function2. You can pass an arbitrary number of arguments + * and have them composed. This means you can't partially apply the compose + * function itself. + * + * @id compose + * @name compose(fn1, fn2, ...) + * @section Functions + * @api public + */ + compose(...functions: Function[]): Function; /** * Transforms a function with specific arity (all arguments must be @@ -112,6 +276,20 @@ interface HighlandStatic { */ curry(fn: Function, ...args: any[]): Function; + /** + * Evaluates the function `fn` with the argument positions swapped. Only + * works with functions that accept two arguments. + * + * @id flip + * @name flip(fn, [x, y]) + * @section Functions + * @param {Function} f - function to flip argument application for + * @param x - parameter to apply to the right hand side of f + * @param y - parameter to apply to the left hand side of f + * @api public + */ + flip(fn: Function, ...args: any[]): Function; + /** * Same as `curry` but with a specific number of arguments. This can be * useful when functions do not explicitly define all its parameters. @@ -143,33 +321,6 @@ interface HighlandStatic { */ partial(f: Function, ...args: any[]): Function; - /** - * Evaluates the function `fn` with the argument positions swapped. Only - * works with functions that accept two arguments. - * - * @id flip - * @name flip(fn, [x, y]) - * @section Functions - * @param {Function} f - function to flip argument application for - * @param x - parameter to apply to the right hand side of f - * @param y - parameter to apply to the left hand side of f - * @api public - */ - flip(fn: Function, ...args: any[]): Function; - - /** - * Creates a composite function, which is the application of function1 to - * the results of function2. You can pass an arbitrary number of arguments - * and have them composed. This means you can't partially apply the compose - * function itself. - * - * @id compose - * @name compose(fn1, fn2, ...) - * @section Functions - * @api public - */ - compose(...functions: Function[]): Function; - /** * The reversed version of compose. Where arguments are in the order of * application. @@ -181,160 +332,10 @@ interface HighlandStatic { */ seq(...functions: Function[]): Function; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Returns true if `x` is a Highland Stream. - * - * @id isStream - * @section Streams - * @name _.isStream(x) - * @param x - the object to test - * @api public - */ - isStream(x: any): boolean; - - isStreamError(x: any): boolean; - - isStreamRedirect(x: any): boolean; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Returns values from an Object as a Stream. Reads properties - * lazily, so if you don't read from all keys on an object, not - * all properties will be read from (may have an effect where getters - * are used). - * - * @id values - * @section Objects - * @name _.values(obj) - * @param {Object} obj - the object to return values from - * @api public - */ - values(obj: Object): Highland.Stream; - - /** - * Returns keys from an Object as a Stream. - * - * @id keys - * @section Objects - * @name _.keys(obj) - * @param {Object} obj - the object to return keys from - * @api public - */ - keys(obj: Object): Highland.Stream; - - /** - * Returns key/value pairs for an Object as a Stream. Reads properties - * lazily, so if you don't read from all keys on an object, not - * all properties will be read from (may have an effect where getters - * are used). - * - * @id pairs - * @section Objects - * @name _.pairs(obj) - * @param {Object} obj - the object to return key/value pairs from - * @api public - */ - pairs(obj: Object): Highland.Stream; - - pairs(obj: any[]): Highland.Stream; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Extends one object with the properties of another. **Note:** The - * arguments are in the reverse order of other libraries such as - * underscore. This is so it follows the convention of other functions in - * this library and so you can more meaningfully partially apply it. - * - * @id extend - * @section Objects - * @name _.extend(a, b) - * @param {Object} a - the properties to extend b with - * @param {Object} b - the original object to extend - * @api public - */ - extend(extensions: Object, target: Object): Object; - - extend(target: Object): (extensions: Object) => Object; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Returns a property from an object. - * - * @id get - * @section Objects - * @name _.get(prop, obj) - * @param {String} prop - the property to return - * @param {Object} obj - the object to read properties from - * @api public - */ - get(prop: string, obj: Object): string; - - get(prop: string): (obj: Object) => Object; - - /** - * Updates a property on an object, returning the updated object. - * - * @id set - * @section Objects - * @name _.set(prop, value, obj) - * @param {String} prop - the property to return - * @param value - the value to set the property to - * @param {Object} obj - the object to set properties on - * @api public - */ - set(prop: string, val: any, obj: Object): Object; - - set(prop: string, val: any): (obj: Object) => Object; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Logs values to the console, a simple wrapper around `console.log` that - * it suitable for passing to other functions by reference without having to - * call `bind`. - * - * @id log - * @section Utils - * @name _.log(args..) - * @api public - */ - log(x: any, ...args: any[]): void; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Wraps a node-style async function which accepts a callback, transforming - * it to a function which accepts the same arguments minus the callback and - * returns a Highland Stream instead. The wrapped function keeps its context, - * so you can safely use it as a method without binding (see the second - * example below). - * - * wrapCallback also accepts an optional mappingHint, which specifies how - * callback arguments are pushed to the stream. This can be used to handle - * non-standard callback protocols that pass back more than one value. - * - * mappingHint can be a function, number, or array. See the documentation on - * EventEmitter Stream Objects for details on the mapping hint. If - * mappingHint is a function, it will be called with all but the first - * argument that is passed to the callback. The first is still assumed to be - * the error argument. - * - * @id wrapCallback - * @section Utils - * @name _.wrapCallback(f) - * @param {Function} f - the node-style function to wrap - * @param {Array | Function | Number} [mappingHint] - how to pass the arguments to the callback - * @api public - */ - wrapCallback(f: Function, mappingHint?: Highland.MappingHint): (...args: any[]) => Highland.Stream; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // OPERATORS + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /** * Add two values. Can be partially applied. * @@ -346,6 +347,19 @@ interface HighlandStatic { add(a: number, b: number): number; add(a: number): (b: number) => number; + /** + * Perform logical negation on a value. If `x` is truthy then returns false, + * otherwise returns true. + * + * @id not + * @section Operators + * @name _.not(x) + * @param x - the value to negate + * @api public + * + * _.not(true) // => false + * _.not(false) // => true + */ not(a: any): boolean; } @@ -391,6 +405,37 @@ declare namespace Highland { */ interface Stream extends NodeJS.EventEmitter { + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // STREAM OBJECTS + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** + * Destroys a stream by unlinking it from any consumers and sources. This will + * stop all consumers from receiving events from this stream and removes this + * stream as a consumer of any source stream. + * + * This function calls end() on the stream and unlinks it from any piped-to streams. + * + * @id pipe + * @section Streams + * @name Stream.destroy() + * @api public + */ + destroy(): void; + + /** + * Ends a Stream. This is the same as sending a [nil](#nil) value as data. + * You shouldn't need to call this directly, rather it will be called by + * any [Node Readable Streams](http://nodejs.org/api/stream.html#stream_class_stream_readable) + * you pipe in. + * + * @id end + * @section Streams + * @name Stream.end() + * @api public + */ + end(): void; + /** * Pauses the stream. All Highland Streams start in the paused state. * @@ -412,90 +457,6 @@ declare namespace Highland { */ resume(): void; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Ends a Stream. This is the same as sending a [nil](#nil) value as data. - * You shouldn't need to call this directly, rather it will be called by - * any [Node Readable Streams](http://nodejs.org/api/stream.html#stream_class_stream_readable) - * you pipe in. - * - * @id end - * @section Streams - * @name Stream.end() - * @api public - */ - end(): void; - - /** - * Pipes a Highland Stream to a [Node Writable Stream](http://nodejs.org/api/stream.html#stream_class_stream_writable) - * (Highland Streams are also Node Writable Streams). This will pull all the - * data from the source Highland Stream and write it to the destination, - * automatically managing flow so that the destination is not overwhelmed - * by a fast source. - * - * This function returns the destination so you can chain together pipe calls. - * - * @id pipe - * @section Streams - * @name Stream.pipe(dest) - * @param {Writable Stream} dest - the destination to write all data to - * @api public - */ - pipe(dest: Stream): Stream; - pipe(dest: NodeJS.ReadWriteStream): Stream; - pipe(dest: NodeJS.WritableStream): void; - - /** - * Destroys a stream by unlinking it from any consumers and sources. This will - * stop all consumers from receiving events from this stream and removes this - * stream as a consumer of any source stream. - * - * This function calls end() on the stream and unlinks it from any piped-to streams. - * - * @id pipe - * @section Streams - * @name Stream.destroy() - * @api public - */ - destroy(): void; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Consumes values from a Stream (once resumed) and returns a new Stream for - * you to optionally push values onto using the provided push / next functions. - * - * This function forms the basis of many higher-level Stream operations. - * It will not cause a paused stream to immediately resume, but behaves more - * like a 'through' stream, handling values as they are read. - * - * @id consume - * @section Streams - * @name Stream.consume(f) - * @param {Function} f - the function to handle errors and values - * @api public - */ - consume(f: (err: Error, x: R, push: (err: Error, value?: U) => void, next: () => void) => void): Stream; - - /** - * Consumes a single item from the Stream. Unlike consume, this function will - * not provide a new stream for you to push values onto, and it will unsubscribe - * as soon as it has a single error, value or nil from the source. - * - * You probably won't need to use this directly, but it is used internally by - * some functions in the Highland library. - * - * @id pull - * @section Streams - * @name Stream.pull(f) - * @param {Function} f - the function to handle data - * @api public - */ - pull(f: (err: Error, x: R) => void): void; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** * Writes a value to the Stream. If the Stream is paused it will go into the * Stream's incoming buffer, otherwise it will be immediately processed and @@ -514,36 +475,145 @@ declare namespace Highland { write(x: R): boolean; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Forks a stream, allowing you to add additional consumers with shared - * back-pressure. A stream forked to multiple consumers will only pull values - * from it's source as fast as the slowest consumer can handle them. - * - * @id fork - * @section Streams - * @name Stream.fork() - * @api public - */ - fork(): Stream; - - /** - * Observes a stream, allowing you to handle values as they are emitted, without - * adding back-pressure or causing data to be pulled from the source. This can - * be useful when you are performing two related queries on a stream where one - * would block the other. Just be aware that a slow observer could fill up it's - * buffer and cause memory issues. Where possible, you should use [fork](#fork). - * - * @id observe - * @section Streams - * @name Stream.observe() - * @api public - */ - observe(): Stream; - + // TRANSFORMS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** + * Adds a value to the end of a Stream. + * + * @id append + * @section Streams + * @name Stream.append(y) + * @param y - the value to append to the Stream + * @api public + */ + append(y: R): Stream; /** + * Takes one Stream and batches incoming data into arrays of given length + * + * @id batch + * @section Transforms + * @name Stream.batch(n) + * @param {Number} n - length of the array to batch + * @api public + * + * _([1, 2, 3, 4, 5]).batch(2) // => [1, 2], [3, 4], [5] + */ + batch(n: number): Stream; + + /** + * Takes one Stream and batches incoming data within a maximum time frame + * into arrays of a maximum length. + * + * @id batchWithTimeOrCount + * @section Transforms + * @name Stream.batchWithTimeOrCount(ms, n) + * @param {Number} ms - the maximum milliseconds to buffer a batch + * @param {Number} n - the maximum length of the array to batch + * @api public + * + * _(function (push) { + * push(1); + * push(2); + * push(3); + * setTimeout(push, 20, 4); + * }).batchWithTimeOrCount(10, 2) + * + * // => [1, 2], [3], [4] + */ + batchWithTimeOrCount(ms: number, n: number): Stream; + + /** + * Groups all values into an Array and passes down the stream as a single + * data event. This is a bit like doing [toArray](#toArray), but instead + * of accepting a callback and causing a *thunk*, it passes the value on. + * + * @id collect + * @section Streams + * @name Stream.collect() + * @api public + */ + collect(): Stream; + + /** + * Filters a Stream to drop all non-truthy values. + * + * @id compact + * @section Streams + * @name Stream.compact() + * @api public + */ + compact(): Stream; + + /** + * Consumes values from a Stream (once resumed) and returns a new Stream for + * you to optionally push values onto using the provided push / next functions. + * + * This function forms the basis of many higher-level Stream operations. + * It will not cause a paused stream to immediately resume, but behaves more + * like a 'through' stream, handling values as they are read. + * + * @id consume + * @section Streams + * @name Stream.consume(f) + * @param {Function} f - the function to handle errors and values + * @api public + */ + consume(f: (err: Error, x: R, push: (err: Error, value?: U) => void, next: () => void) => void): Stream; + + /** + * Holds off pushing data events downstream until there has been no more + * data for `ms` milliseconds. Sends the last value that occurred before + * the delay, discarding all other values. + * + * @id debounce + * @section Streams + * @name Stream.debounce(ms) + * @param {Number} ms - the milliseconds to wait before sending data + * @api public + */ + debounce(ms: number): Stream; + + /** + * Creates a new Stream which applies a function to each value from the source + * and re-emits the source value. Useful when you want to mutate the value or + * perform side effects + * + * @id doto + * @section Transforms + * @name Stream.doto(f) + * @param {Function} f - the function to apply + * @api public + * + * var appended = _([[1], [2], [3], [4]]).doto(function (x) { + * x.push(1); + * }); + * + * _([1, 2, 3]).doto(console.log) + * // 1 + * // 2 + * // 3 + * // => 1, 2, 3 + */ + doto(f: (x: R) => void): Stream; + + /** + * Acts as the inverse of [`take(n)`](#take) - instead of returning the first `n` values, it ignores the + * first `n` values and then emits the rest. `n` must be of type `Number`, if not the whole stream will + * be returned. All errors (even ones emitted before the nth value) will be emitted. + * + * @id drop + * @section Transforms + * @name Stream.drop(n) + * @param {Number} n - integer representing number of values to read from source + * @api public + * + * _([1, 2, 3, 4]).drop(2) // => 3, 4 + */ + drop(n: number): Stream; + + /** * Extracts errors from a Stream and applies them to an error handler * function. Returns a new Stream with the errors removed (unless the error * handler chooses to rethrow them using `push`). Errors can also be @@ -558,62 +628,116 @@ declare namespace Highland { errors(f: (err: Error, push: (err: Error, x?: R) => void) => void): Stream; /** - * Like the [errors](#errors) method, but emits a Stream end marker after - * an Error is encountered. + * Creates a new Stream including only the values which pass a truth test. * - * @id stopOnError + * @id filter * @section Streams - * @name Stream.stopOnError(f) - * @param {Function} f - the function to handle an error + * @name Stream.filter(f) + * @param f - the truth test function * @api public */ - stopOnError(f: (err: Error) => void): Stream; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + filter(f: (x: R) => boolean): Stream; /** - * Iterates over every value from the Stream, calling the iterator function - * on each of them. This function causes a **thunk**. + * A convenient form of filter, which returns the first object from a + * Stream that passes the provided truth test * - * If an error from the Stream reaches the `each` call, it will emit an - * error event (which will cause it to throw if unhandled). - * - * @id each + * @id find * @section Streams - * @name Stream.each(f) - * @param {Function} f - the iterator function + * @name Stream.find(f) + * @param {Function} f - the truth test function which returns a Stream * @api public */ - each(f: (x: R) => void): void; + find(f: (x: R) => boolean): Stream; + + /** + * A convenient form of [where](#where), which returns the first object from a + * Stream that matches a set of property values. findWhere is to [where](#where) as [find](#find) is to [filter](#filter). + * + * @id findWhere + * @section Transforms + * @name Stream.findWhere(props) + * @param {Object} props - the properties to match against + * @api public + * + * var docs = [ + * {type: 'blogpost', title: 'foo'}, + * {type: 'blogpost', title: 'bar'}, + * {type: 'comment', title: 'foo'} + * ]; + * + * _(docs).findWhere({type: 'blogpost'}) + * // => {type: 'blogpost', title: 'foo'} + * + * // example with partial application + * var firstBlogpost = _.findWhere({type: 'blogpost'}); + * + * firstBlogpost(docs) + * // => {type: 'blogpost', title: 'foo'} + */ + findWhere(props: Object): Stream; /** - * Applies results from a Stream as arguments to a function + * A convenient form of reduce, which groups items based on a function or property name * - * @id apply + * @id group * @section Streams - * @name Stream.apply(f) - * @param {Function} f - the function to apply arguments to + * @name Stream.group(f) + * @param {Function|String} f - the function or property name on which to group, + * toString() is called on the result of a function. * @api public */ - // TODO what to do here? - apply(f: Function): void; + // TODO verify this + group(f: (x: R) => string): Stream<{[prop:string]:R[]}>; + group(prop: string): Stream<{[prop:string]:R[]}>; /** - * Collects all values from a Stream into an Array and calls a function with - * once with the result. This function causes a **thunk**. + * Creates a new Stream with only the first value from the source. * - * If an error from the Stream reaches the `toArray` call, it will emit an - * error event (which will cause it to throw if unhandled). - * - * @id toArray + * @id head * @section Streams - * @name Stream.toArray(f) - * @param {Function} f - the callback to provide the completed Array to + * @name Stream.head() + * @api public + * + * _([1, 2, 3, 4]).head() // => 1 + */ + head(): Stream; + + /** + * Calls a named method on each object from the Stream - returning + * a new stream with the result of those calls. + * + * @id invoke + * @section Streams + * @name Stream.invoke(method, args) + * @param {String} method - the method name to call + * @param {Array} args - the arguments to call the method with * @api public */ - toArray(f: (arr: R[]) => void): void; + invoke(method: string, args: any[]): Stream; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /** + * Drops all values from the Stream apart from the last one (if any). + * + * @id last + * @section Streams + * @name Stream.last() + * @api public + */ + last(): Stream; + + /** + * Creates a new Stream, which when read from, only returns the last + * seen value from the source. The source stream does not experience + * back-pressure. Useful if you're using a Stream to model a changing + * property which you need to query periodically. + * + * @id latest + * @section Streams + * @name Stream.latest() + * @api public + */ + latest(): Stream; /** * Creates a new Stream of transformed values by applying a function to each @@ -629,22 +753,6 @@ declare namespace Highland { */ map(f: (x: R) => U): Stream; - /** - * Creates a new Stream of values by applying each item in a Stream to an - * iterator function which may return a Stream. Each item on these result - * Streams are then emitted on a single output Stream. - * - * The same as calling `stream.map(f).flatten()`. - * - * @id flatMap - * @section Streams - * @name Stream.flatMap(f) - * @param {Function} f - the iterator function - * @api public - */ - flatMap(f: (x: R) => Stream): Stream; - flatMap(f: (x: R) => U): Stream; - /** * Retrieves values associated with a given property from all elements in * the collection. @@ -657,219 +765,6 @@ declare namespace Highland { */ pluck(prop: string): Stream; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Creates a new Stream including only the values which pass a truth test. - * - * @id filter - * @section Streams - * @name Stream.filter(f) - * @param f - the truth test function - * @api public - */ - filter(f: (x: R) => boolean): Stream; - - /** - * Filters using a predicate which returns a Stream. If you need to check - * against an asynchronous data source when filtering a Stream, this can - * be convenient. The Stream returned from the filter function should have - * a Boolean as it's first value (all other values on the Stream will be - * disregarded). - * - * @id flatFilter - * @section Streams - * @name Stream.flatFilter(f) - * @param {Function} f - the truth test function which returns a Stream - * @api public - */ - flatFilter(f: (x: R) => Stream): Stream; - - /** - * The inverse of [filter](#filter). - * - * @id reject - * @section Streams - * @name Stream.reject(f) - * @param {Function} f - the truth test function - * @api public - * - * var odds = _([1, 2, 3, 4]).reject(function (x) { - * return x % 2 === 0; - * }); - */ - reject(f: (x: R) => boolean): Stream; - - /** - * A convenient form of filter, which returns the first object from a - * Stream that passes the provided truth test - * - * @id find - * @section Streams - * @name Stream.find(f) - * @param {Function} f - the truth test function which returns a Stream - * @api public - */ - find(f: (x: R) => boolean): Stream; - - /** - * A convenient form of reduce, which groups items based on a function or property name - * - * @id group - * @section Streams - * @name Stream.group(f) - * @param {Function|String} f - the function or property name on which to group, - * toString() is called on the result of a function. - * @api public - */ - // TODO verify this - group(f: (x: R) => string): Stream<{[prop:string]:R[]}>; - group(prop: string): Stream<{[prop:string]:R[]}>; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Filters a Stream to drop all non-truthy values. - * - * @id compact - * @section Streams - * @name Stream.compact() - * @api public - */ - compact(): Stream; - - /** - * A convenient form of filter, which returns all objects from a Stream - * match a set of property values. - * - * @id where - * @section Streams - * @name Stream.where(props) - * @param {Object} props - the properties to match against - * @api public - */ - where(props: Object): Stream; - - /** - * Takes two Streams and returns a Stream of corresponding pairs. - * - * @id zip - * @section Streams - * @name Stream.zip(ys) - * @param {Array | Stream} ys - the other stream to combine values with - * @api public - */ - zip(ys: R[]): Stream; - zip(ys: Stream): Stream; - - /** - * Creates a new Stream with the first `n` values from the source. - * - * @id take - * @section Streams - * @name Stream.take(n) - * @param {Number} n - integer representing number of values to read from source - * @api public - */ - take(n: number): Stream; - - /** - * Creates a new Stream with only the first value from the source. - * - * @id head - * @section Streams - * @name Stream.head() - * @api public - * - * _([1, 2, 3, 4]).head() // => 1 - */ - head(): Stream; - - /** - * Drops all values from the Stream apart from the last one (if any). - * - * @id last - * @section Streams - * @name Stream.last() - * @api public - */ - last(): Stream; - - /** - * Reads values from a Stream of Streams, emitting them on a Single output - * Stream. This can be thought of as a flatten, just one level deep. Often - * used for resolving asynchronous actions such as a HTTP request or reading - * a file. - * - * @id sequence - * @section Streams - * @name Stream.sequence() - * @api public - */ - //TODO figure out typing - sequence(): Stream; - - /** - * An alias for the [sequence](#sequence) method. - * - * @id series - * @section Streams - * @name Stream.series() - * @api public - */ - // TODO figure out typing - series(): Stream; - - /** - * Recursively reads values from a Stream which may contain nested Streams - * or Arrays. As values or errors are encountered, they are emitted on a - * single output Stream. - * - * @id flatten - * @section Streams - * @name Stream.flatten() - * @api public - */ - flatten(): Stream; - flatten(): Stream; - - /** - * Takes a Stream of Streams and reads from them in parallel, buffering - * the results until they can be returned to the consumer in their original - * order. - * - * @id parallel - * @section Streams - * @name Stream.parallel(n) - * @param {Number} n - the maximum number of concurrent reads/buffers - * @api public - */ - parallel(n: number): Stream; - - /** - * Switches source to an alternate Stream if the current Stream is empty. - * - * @id otherwise - * @section Streams - * @name Stream.otherwise(ys) - * @param {Stream} ys - alternate stream to use if this stream is empty - * @api public - */ - otherwise(ys: Stream): Stream; - - /** - * Adds a value to the end of a Stream. - * - * @id append - * @section Streams - * @name Stream.append(y) - * @param y - the value to append to the Stream - * @api public - */ - append(y: R): Stream; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** * Boils down a Stream to a single value. The memo is the initial state * of the reduction, and each successive step of it should be returned by @@ -899,16 +794,19 @@ declare namespace Highland { reduce1(memo: U, f: (memo: U, x: R) => U): Stream; /** - * Groups all values into an Array and passes down the stream as a single - * data event. This is a bit like doing [toArray](#toArray), but instead - * of accepting a callback and causing a *thunk*, it passes the value on. + * The inverse of [filter](#filter). * - * @id collect + * @id reject * @section Streams - * @name Stream.collect() + * @name Stream.reject(f) + * @param {Function} f - the truth test function * @api public + * + * var odds = _([1, 2, 3, 4]).reject(function (x) { + * return x % 2 === 0; + * }); */ - collect(): Stream; + reject(f: (x: R) => boolean): Stream; /** * Like [reduce](#reduce), but emits each intermediate value of the @@ -937,6 +835,68 @@ declare namespace Highland { */ scan1(memo: U, x: (memo: U, x: R) => U): Stream; + /** + * Like the [errors](#errors) method, but emits a Stream end marker after + * an Error is encountered. + * + * @id stopOnError + * @section Streams + * @name Stream.stopOnError(f) + * @param {Function} f - the function to handle an error + * @api public + */ + stopOnError(f: (err: Error) => void): Stream; + + /** + * Creates a new Stream with the first `n` values from the source. + * + * @id take + * @section Streams + * @name Stream.take(n) + * @param {Number} n - integer representing number of values to read from source + * @api public + */ + take(n: number): Stream; + + /** + * An alias for the [doto](#doto) method. + * + * @id tap + * @section Transforms + * @name Stream.tap(f) + * @param {Function} f - the function to apply + * @api public + * + * _([1, 2, 3]).tap(console.log) + */ + tap(f: (x: R) => void): Stream; + + /** + * Ensures that only one data event is push downstream (or into the buffer) + * every `ms` milliseconds, any other values are dropped. + * + * @id throttle + * @section Streams + * @name Stream.throttle(ms) + * @param {Number} ms - the minimum milliseconds between each value + * @api public + */ + throttle(ms: number): Stream; + + /** + * A convenient form of filter, which returns all objects from a Stream + * match a set of property values. + * + * @id where + * @section Streams + * @name Stream.where(props) + * @param {Object} props - the properties to match against + * @api public + */ + where(props: Object): Stream; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // HIGHER-ORDER STREAMS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** @@ -955,6 +915,62 @@ declare namespace Highland { concat(ys: Stream): Stream; concat(ys: R[]): Stream; + /** + * Filters using a predicate which returns a Stream. If you need to check + * against an asynchronous data source when filtering a Stream, this can + * be convenient. The Stream returned from the filter function should have + * a Boolean as it's first value (all other values on the Stream will be + * disregarded). + * + * @id flatFilter + * @section Streams + * @name Stream.flatFilter(f) + * @param {Function} f - the truth test function which returns a Stream + * @api public + */ + flatFilter(f: (x: R) => Stream): Stream; + + /** + * Creates a new Stream of values by applying each item in a Stream to an + * iterator function which may return a Stream. Each item on these result + * Streams are then emitted on a single output Stream. + * + * The same as calling `stream.map(f).flatten()`. + * + * @id flatMap + * @section Streams + * @name Stream.flatMap(f) + * @param {Function} f - the iterator function + * @api public + */ + flatMap(f: (x: R) => Stream): Stream; + flatMap(f: (x: R) => U): Stream; + + /** + * Recursively reads values from a Stream which may contain nested Streams + * or Arrays. As values or errors are encountered, they are emitted on a + * single output Stream. + * + * @id flatten + * @section Streams + * @name Stream.flatten() + * @api public + */ + flatten(): Stream; + flatten(): Stream; + + /** + * Forks a stream, allowing you to add additional consumers with shared + * back-pressure. A stream forked to multiple consumers will only pull values + * from it's source as fast as the slowest consumer can handle them. + * + * @id fork + * @section Streams + * @name Stream.fork() + * @api public + */ + fork(): Stream; + /** * Takes a Stream of Streams and merges their values and errors into a * single new Stream. The merged stream ends when all source streams have @@ -978,60 +994,217 @@ declare namespace Highland { */ merge (ys: Stream>): Stream; + /** + * Observes a stream, allowing you to handle values as they are emitted, without + * adding back-pressure or causing data to be pulled from the source. This can + * be useful when you are performing two related queries on a stream where one + * would block the other. Just be aware that a slow observer could fill up it's + * buffer and cause memory issues. Where possible, you should use [fork](#fork). + * + * @id observe + * @section Streams + * @name Stream.observe() + * @api public + */ + observe(): Stream; + + /** + * Switches source to an alternate Stream if the current Stream is empty. + * + * @id otherwise + * @section Streams + * @name Stream.otherwise(ys) + * @param {Stream} ys - alternate stream to use if this stream is empty + * @api public + */ + otherwise(ys: Stream): Stream; + + /** + * Takes a Stream of Streams and reads from them in parallel, buffering + * the results until they can be returned to the consumer in their original + * order. + * + * @id parallel + * @section Streams + * @name Stream.parallel(n) + * @param {Number} n - the maximum number of concurrent reads/buffers + * @api public + */ + parallel(n: number): Stream; + + /** + * Reads values from a Stream of Streams, emitting them on a Single output + * Stream. This can be thought of as a flatten, just one level deep. Often + * used for resolving asynchronous actions such as a HTTP request or reading + * a file. + * + * @id sequence + * @section Streams + * @name Stream.sequence() + * @api public + */ + //TODO figure out typing + sequence(): Stream; + + /** + * An alias for the [sequence](#sequence) method. + * + * @id series + * @section Streams + * @name Stream.series() + * @api public + */ + // TODO figure out typing + series(): Stream; + + /** + * Takes two Streams and returns a Stream of corresponding pairs. + * + * @id zip + * @section Streams + * @name Stream.zip(ys) + * @param {Array | Stream} ys - the other stream to combine values with + * @api public + */ + zip(ys: R[]): Stream; + zip(ys: Stream): Stream; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // CONSUMPTION // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Calls a named method on each object from the Stream - returning - * a new stream with the result of those calls. + * Applies results from a Stream as arguments to a function * - * @id invoke + * @id apply * @section Streams - * @name Stream.invoke(method, args) - * @param {String} method - the method name to call - * @param {Array} args - the arguments to call the method with + * @name Stream.apply(f) + * @param {Function} f - the function to apply arguments to * @api public */ - invoke(method: string, args: any[]): Stream; + // TODO what to do here? + apply(f: Function): void; /** - * Ensures that only one data event is push downstream (or into the buffer) - * every `ms` milliseconds, any other values are dropped. + * Calls a function once the Stream has ended. This method consumes the stream. + * If the Stream has already ended, the function is called immediately. * - * @id throttle - * @section Streams - * @name Stream.throttle(ms) - * @param {Number} ms - the minimum milliseconds between each value + * If an error from the Stream reaches this call, it will emit an `error` event + * (i.e., it will call `emit('error')` on the stream being consumed). This + * event will cause an error to be thrown if unhandled. + * + * As a special case, it is possible to chain `done` after a call to + * [each](#each) even though both methods consume the stream. + * + * @id done + * @section Consumption + * @name Stream.done(f) + * @param {Function} f - the callback * @api public + * + * var total = 0; + * _([1, 2, 3, 4]).each(function (x) { + * total += x; + * }).done(function () { + * // total will be 10 + * }); */ - throttle(ms: number): Stream; + done(f: () => void): void; /** - * Holds off pushing data events downstream until there has been no more - * data for `ms` milliseconds. Sends the last value that occurred before - * the delay, discarding all other values. + * Iterates over every value from the Stream, calling the iterator function + * on each of them. This function causes a **thunk**. * - * @id debounce + * If an error from the Stream reaches the `each` call, it will emit an + * error event (which will cause it to throw if unhandled). + * + * @id each * @section Streams - * @name Stream.debounce(ms) - * @param {Number} ms - the milliseconds to wait before sending data + * @name Stream.each(f) + * @param {Function} f - the iterator function * @api public */ - debounce(ms: number): Stream; - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + each(f: (x: R) => void): void; /** - * Creates a new Stream, which when read from, only returns the last - * seen value from the source. The source stream does not experience - * back-pressure. Useful if you're using a Stream to model a changing - * property which you need to query periodically. + * Pipes a Highland Stream to a [Node Writable Stream](http://nodejs.org/api/stream.html#stream_class_stream_writable) + * (Highland Streams are also Node Writable Streams). This will pull all the + * data from the source Highland Stream and write it to the destination, + * automatically managing flow so that the destination is not overwhelmed + * by a fast source. * - * @id latest + * This function returns the destination so you can chain together pipe calls. + * + * @id pipe * @section Streams - * @name Stream.latest() + * @name Stream.pipe(dest) + * @param {Writable Stream} dest - the destination to write all data to * @api public */ - latest(): Stream; + pipe(dest: Stream): Stream; + pipe(dest: NodeJS.ReadWriteStream): Stream; + pipe(dest: NodeJS.WritableStream): void; + + /** + * Consumes a single item from the Stream. Unlike consume, this function will + * not provide a new stream for you to push values onto, and it will unsubscribe + * as soon as it has a single error, value or nil from the source. + * + * You probably won't need to use this directly, but it is used internally by + * some functions in the Highland library. + * + * @id pull + * @section Streams + * @name Stream.pull(f) + * @param {Function} f - the function to handle data + * @api public + */ + pull(f: (err: Error, x: R) => void): void; + + /** + * Collects all values from a Stream into an Array and calls a function with + * once with the result. This function causes a **thunk**. + * + * If an error from the Stream reaches the `toArray` call, it will emit an + * error event (which will cause it to throw if unhandled). + * + * @id toArray + * @section Streams + * @name Stream.toArray(f) + * @param {Function} f - the callback to provide the completed Array to + * @api public + */ + toArray(f: (arr: R[]) => void): void; + + /** + * Returns the result of a stream to a nodejs-style callback function. + * + * If the stream contains a single value, it will call `cb` + * with the single item emitted by the stream (if present). + * If the stream is empty, `cb` will be called without any arguments. + * If an error is encountered in the stream, this function will stop + * consumption and call `cb` with the error. + * If the stream contains more than one item, it will stop consumption + * and call `cb` with an error. + * + * @id toCallback + * @section Consumption + * @name Stream.toCallback(cb) + * @param {Function} cb - the callback to provide the error/result to + * @api public + * + * _([1, 2, 3, 4]).collect().toCallback(function (err, result) { + * // parameter result will be [1,2,3,4] + * // parameter err will be null + * }); + */ + toCallback(cb: (err?: Error, x?: R) => void): void; + } + + interface PipeableStream extends Stream {} + + interface PipeOptions { + end: boolean } type MappingHint = number | string[] | Function; diff --git a/types/homeworks/index.d.ts b/types/homeworks/index.d.ts index 87affa65e5..4449483d35 100644 --- a/types/homeworks/index.d.ts +++ b/types/homeworks/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/IGAWorksDev/homeworks/ // Definitions by: Kenneth Ceyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/homeworks/tsconfig.json b/types/homeworks/tsconfig.json index 65f6fc4f01..d29bd1acfe 100644 --- a/types/homeworks/tsconfig.json +++ b/types/homeworks/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -19,4 +20,4 @@ "index.d.ts", "homeworks-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/html2canvas/index.d.ts b/types/html2canvas/index.d.ts index 0efe8bc34f..33effeff87 100644 --- a/types/html2canvas/index.d.ts +++ b/types/html2canvas/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/niklasvh/html2canvas // Definitions by: Richard Hepburn , Pei-Tang Huang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/hubot/hubot-tests.ts b/types/hubot/hubot-tests.ts new file mode 100644 index 0000000000..9c5e832bc2 --- /dev/null +++ b/types/hubot/hubot-tests.ts @@ -0,0 +1,14 @@ +import * as Hubot from "hubot"; + +const brain = new Hubot.Brain(); +brain; // $ExpectType Brain +brain.userForName('someone'); // $ExpectType any + +const robot = new Hubot.Robot( + 'src/adapters', + 'slack', + false, + 'hubot', +); +robot; // $ExpectType Robot +robot.hear(/hello/, () => null); // $ExpectType void diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts new file mode 100644 index 0000000000..e0a809f69a --- /dev/null +++ b/types/hubot/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for hubot 2.19 +// Project: https://github.com/github/hubot +// Definitions by: Dirk Gadsden +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Hubot { + class Brain { + userForId(id: any): any; + userForName(name: string): any; + } + + class User { + id: any; + name: string; + } + + class Message { + user: User; + text: string; + id: string; + } + + class Response { + match: RegExpMatchArray; + message: Message; + + constructor(robot: Robot, message: Message, match: RegExpMatchArray); + send(...strings: string[]): void; + reply(...strings: string[]): void; + random(items: T[]): T; + } + + type ListenerCallback = (response: Response) => void; + + class Robot { + brain: Brain; + + constructor(adapterPath: string, adapter: string, httpd: boolean, name: string, alias?: string); + hear(regex: RegExp, callback: ListenerCallback): void; + hear(regex: RegExp, options: any, callback: ListenerCallback): void; + respond(regex: RegExp, callback: ListenerCallback): void; + respond(regex: RegExp, options: any, callback: ListenerCallback): void; + } +} + +// Compatibility with CommonJS syntax exported by Hubot's CoffeeScript. +// tslint:disable-next-line export-just-namespace +export = Hubot; +export as namespace Hubot; diff --git a/types/hubot/tsconfig.json b/types/hubot/tsconfig.json new file mode 100644 index 0000000000..0e3faa4c35 --- /dev/null +++ b/types/hubot/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "hubot-tests.ts" + ] +} diff --git a/types/hubot/tslint.json b/types/hubot/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/hubot/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/i18n/i18n-tests.ts b/types/i18n/i18n-tests.ts index 76e733d778..ac3813c934 100644 --- a/types/i18n/i18n-tests.ts +++ b/types/i18n/i18n-tests.ts @@ -5,8 +5,6 @@ * Created by using code samples from https://github.com/mashpie/i18n-node. */ -/// - import express = require("express"); import i18n = require("i18n"); diff --git a/types/ibm-mobilefirst/index.d.ts b/types/ibm-mobilefirst/index.d.ts index 957d9075e0..4da0cbf3b1 100644 --- a/types/ibm-mobilefirst/index.d.ts +++ b/types/ibm-mobilefirst/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.ibm.com/software/products/en/mobilefirstfoundation // Definitions by: Guillermo Ignacio Enriquez Gutierrez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/icheck/index.d.ts b/types/icheck/index.d.ts index fb03ef9704..ea97f646a9 100644 --- a/types/icheck/index.d.ts +++ b/types/icheck/index.d.ts @@ -2,6 +2,7 @@ // Project: http://damirfoy.com/iCheck/ // Definitions by: Dániel Tar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface ICheckOptions { /** diff --git a/types/imagemapster/imagemapster-tests.ts b/types/imagemapster/imagemapster-tests.ts index 9712cb4e1a..8ee3942fd4 100644 --- a/types/imagemapster/imagemapster-tests.ts +++ b/types/imagemapster/imagemapster-tests.ts @@ -1,3 +1,5 @@ +import $ = require('jquery'); + const areaOptions: ImageMapster.AreaRenderingOptions = { key: "foo", includeKeys: "foo", diff --git a/types/imagemapster/index.d.ts b/types/imagemapster/index.d.ts index 0c28c2ad2b..0ab0991f7e 100644 --- a/types/imagemapster/index.d.ts +++ b/types/imagemapster/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: delphinus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - declare namespace ImageMapster { type Select = "select"; diff --git a/types/imagemapster/tsconfig.json b/types/imagemapster/tsconfig.json index dc96de2d3e..ca23742027 100644 --- a/types/imagemapster/tsconfig.json +++ b/types/imagemapster/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "imagemapster-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/imagesloaded/index.d.ts b/types/imagesloaded/index.d.ts index 9a48a18e19..5dd4ea0abc 100644 --- a/types/imagesloaded/index.d.ts +++ b/types/imagesloaded/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/desandro/imagesloaded // Definitions by: Chris Charabaruk , Cameron Little // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/inert/inert-tests.ts b/types/inert/inert-tests.ts index 82cd1f1295..9062e13f6b 100644 --- a/types/inert/inert-tests.ts +++ b/types/inert/inert-tests.ts @@ -1,7 +1,5 @@ // Copied from: https://github.com/hapijs/inert#examples -/// - import Path = require('path'); import Hapi = require('hapi'); import Inert = require('inert'); diff --git a/types/ini/ini-tests.ts b/types/ini/ini-tests.ts index 806d816a1a..a0c98264ca 100644 --- a/types/ini/ini-tests.ts +++ b/types/ini/ini-tests.ts @@ -1,9 +1,6 @@ -/// - -import fs = require("fs"); import ini = require("ini"); -var ini_content = fs.readFileSync("path_to_file.ini", "utf-8"); +var ini_content = ""; var ini_object: any = ini.decode(ini_content); var ini_rev_string: string = ini.encode(ini_object); \ No newline at end of file diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index dd2f4ad3c7..2a0b9f60f4 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Inquirer.js // Project: https://github.com/SBoudrias/Inquirer.js // Definitions by: Qubo +// Parvez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -110,6 +111,10 @@ declare namespace inquirer { * Change the number of lines that will be rendered when using list, rawList, expand or checkbox. */ pageSize?: number; + /** + * Add a mask when password will entered + */ + mask?: string; } /** diff --git a/types/inquirer/inquirer-tests.ts b/types/inquirer/inquirer-tests.ts index a8610aca8a..d3591b13d2 100644 --- a/types/inquirer/inquirer-tests.ts +++ b/types/inquirer/inquirer-tests.ts @@ -1,5 +1,3 @@ -/// - import inquirer = require('inquirer'); diff --git a/types/intl-tel-input/index.d.ts b/types/intl-tel-input/index.d.ts index 59e010fc83..28a147a1c5 100644 --- a/types/intl-tel-input/index.d.ts +++ b/types/intl-tel-input/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jackocnr/intl-tel-input // Definitions by: Fidan Hakaj , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/ion.rangeslider/index.d.ts b/types/ion.rangeslider/index.d.ts index 49dd14f815..21d99c5c6d 100644 --- a/types/ion.rangeslider/index.d.ts +++ b/types/ion.rangeslider/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/IonDen/ion.rangeSlider/ // Definitions by: Sixin Li // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // API documentation: http://ionden.com/a/plugins/ion.rangeSlider/en.html diff --git a/types/ion.rangeslider/v1/index.d.ts b/types/ion.rangeslider/v1/index.d.ts index 55c74e3f4e..d819f46964 100644 --- a/types/ion.rangeslider/v1/index.d.ts +++ b/types/ion.rangeslider/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/IonDen/ion.rangeSlider/ // Definitions by: Douglas Eichelberger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // API documentation: http://ionden.com/a/plugins/ion.rangeSlider/en.html diff --git a/types/ionic/index.d.ts b/types/ionic/index.d.ts index 4dfb7f60b6..51d284a711 100644 --- a/types/ionic/index.d.ts +++ b/types/ionic/index.d.ts @@ -2,6 +2,7 @@ // Project: http://ionicframework.com // Definitions by: Spencer Williams // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/isotope-layout/index.d.ts b/types/isotope-layout/index.d.ts index 007740df8e..84f14bed06 100644 --- a/types/isotope-layout/index.d.ts +++ b/types/isotope-layout/index.d.ts @@ -2,6 +2,7 @@ // Project: http://isotope.metafizzy.co/ // Definitions by: Anže Videnič // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jasmine-fixture/index.d.ts b/types/jasmine-fixture/index.d.ts index f018dde1cf..3c02fad4ac 100644 --- a/types/jasmine-fixture/index.d.ts +++ b/types/jasmine-fixture/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/searls/jasmine-fixture // Definitions by: Craig Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 /// diff --git a/types/jasmine-given/index.d.ts b/types/jasmine-given/index.d.ts new file mode 100644 index 0000000000..70a23d7e07 --- /dev/null +++ b/types/jasmine-given/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for jasmine-given 2.6 +// Project: https://github.com/searls/jasmine-given +// Definitions by: Shai Reznik +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function Given(func: () => void): void; +declare function When(func: () => void): void; +declare function Then(func: () => void): void; +declare function And(func: () => void): void; +declare function Invariant(func: () => void): void; diff --git a/types/jasmine-given/jasmine-given-tests.ts b/types/jasmine-given/jasmine-given-tests.ts new file mode 100644 index 0000000000..8a994ecbbe --- /dev/null +++ b/types/jasmine-given/jasmine-given-tests.ts @@ -0,0 +1,9 @@ +Given(() => { }); + +When(() => { }); + +Then(() => { }); + +And(() => { }); + +Invariant(() => {}); diff --git a/types/jasmine-given/tsconfig.json b/types/jasmine-given/tsconfig.json new file mode 100644 index 0000000000..cb1571590b --- /dev/null +++ b/types/jasmine-given/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jasmine-given-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jasmine-given/tslint.json b/types/jasmine-given/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/jasmine-given/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/jasmine-jquery/index.d.ts b/types/jasmine-jquery/index.d.ts index 14eb26b380..4cb2de8c26 100644 --- a/types/jasmine-jquery/index.d.ts +++ b/types/jasmine-jquery/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/velesin/jasmine-jquery // Definitions by: Gregor Stamac // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 /// /// diff --git a/types/jcanvas/index.d.ts b/types/jcanvas/index.d.ts index a5c1b7204f..4fdc3f72af 100644 --- a/types/jcanvas/index.d.ts +++ b/types/jcanvas/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/caleb531/jcanvas // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jcanvas/jcanvas-tests.ts b/types/jcanvas/jcanvas-tests.ts index 3cd5e32cab..667d9f9619 100644 --- a/types/jcanvas/jcanvas-tests.ts +++ b/types/jcanvas/jcanvas-tests.ts @@ -1,5 +1,4 @@ -import $ = require("jquery"); import jcanvas = require("jcanvas"); jcanvas($, window); diff --git a/types/jdataview/index.d.ts b/types/jdataview/index.d.ts index b91a6813ec..f80784eb60 100644 --- a/types/jdataview/index.d.ts +++ b/types/jdataview/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jDataView/jDataView // Definitions by: Ingvar Stepanyan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare class jDataView implements DataView { constructor(byteCount: number, offset?: number, length?: number, littleEndian?: boolean) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 9297ebfced..eeb64b38fb 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 19.2.0 +// Type definitions for Jest 20.0.4 // Project: http://facebook.github.io/jest/ // Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov , Alex Jover Morales // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -197,7 +197,7 @@ declare namespace jest { * * @param {any} actual The value to apply matchers against. */ - (actual: any): Matchers; + (actual: any): Matchers; anything(): any; /** Matches anything that was created with the given constructor. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. */ any(classType: any): any; @@ -205,6 +205,8 @@ declare namespace jest { arrayContaining(arr: any[]): any; /** Verifies that a certain number of assertions are called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ assertions(num: number): void; + /** Verifies that at least one assertion is called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ + hasAssertions(): void; /** You can use `expect.extend` to add your own matchers to Jest. */ extend(obj: ExpectExtendMap): void; /** Adds a module to format application-specific data structures for serialization. */ @@ -215,67 +217,71 @@ declare namespace jest { stringMatching(str: string | RegExp): any; } - interface Matchers { + interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ - not: Matchers; - lastCalledWith(...args: any[]): void; + not: Matchers; + /** Use resolves to unwrap the value of a fulfilled promise so any other matcher can be chained. If the promise is rejected the assertion fails. */ + resolves: Matchers>; + /** Unwraps the reason of a rejected promise so any other matcher can be chained. If the promise is fulfilled the assertion fails. */ + rejects: Matchers>; + lastCalledWith(...args: any[]): R; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ - toBe(expected: any): void; + toBe(expected: any): R; /** Ensures that a mock function is called. */ - toBeCalled(): void; + toBeCalled(): R; /** Ensure that a mock function is called with specific arguments. */ - toBeCalledWith(...args: any[]): void; + toBeCalledWith(...args: any[]): R; /** Using exact equality with floating point numbers is a bad idea. Rounding means that intuitive things fail. */ - toBeCloseTo(expected: number, delta?: number): void; + toBeCloseTo(expected: number, delta?: number): R; /** Ensure that a variable is not undefined. */ - toBeDefined(): void; + toBeDefined(): R; /** When you don't care what a value is, you just want to ensure a value is false in a boolean context. */ - toBeFalsy(): void; + toBeFalsy(): R; /** For comparing floating point numbers. */ - toBeGreaterThan(expected: number): void; + toBeGreaterThan(expected: number): R; /** For comparing floating point numbers. */ - toBeGreaterThanOrEqual(expected: number): void; + toBeGreaterThanOrEqual(expected: number): R; /** Ensure that an object is an instance of a class. This matcher uses `instanceof` underneath. */ - toBeInstanceOf(expected: any): void + toBeInstanceOf(expected: any): R /** For comparing floating point numbers. */ - toBeLessThan(expected: number): void; + toBeLessThan(expected: number): R; /** For comparing floating point numbers. */ - toBeLessThanOrEqual(expected: number): void; + toBeLessThanOrEqual(expected: number): R; /** This is the same as `.toBe(null)` but the error messages are a bit nicer. So use `.toBeNull()` when you want to check that something is null. */ - toBeNull(): void; + toBeNull(): R; /** Use when you don't care what a value is, you just want to ensure a value is true in a boolean context. In JavaScript, there are six falsy values: `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. */ - toBeTruthy(): void; + toBeTruthy(): R; /** Used to check that a variable is undefined. */ - toBeUndefined(): void; + toBeUndefined(): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this uses `===`, a strict equality check. */ - toContain(expected: any): void; + toContain(expected: any): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toContainEqual(expected: any): void; + toContainEqual(expected: any): R; /** Used when you want to check that two objects have the same value. This matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toEqual(expected: any): void; + toEqual(expected: any): R; /** Ensures that a mock function is called. */ - toHaveBeenCalled(): boolean; + toHaveBeenCalled(): R; /** Ensures that a mock function is called an exact number of times. */ - toHaveBeenCalledTimes(expected: number): boolean; + toHaveBeenCalledTimes(expected: number): R; /** Ensure that a mock function is called with specific arguments. */ - toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledWith(...params: any[]): R; /** If you have a mock function, you can use `.toHaveBeenLastCalledWith` to test what arguments it was last called with. */ - toHaveBeenLastCalledWith(...params: any[]): boolean; + toHaveBeenLastCalledWith(...params: any[]): R; /** Used to check that an object has a `.length` property and it is set to a certain numeric value. */ - toHaveLength(expected: number): void; - toHaveProperty(propertyPath: string, value?: any): void; + toHaveLength(expected: number): R; + toHaveProperty(propertyPath: string, value?: any): R; /** Check that a string matches a regular expression. */ - toMatch(expected: string | RegExp): void; + toMatch(expected: string | RegExp): R; /** Used to check that a JavaScript object matches a subset of the properties of an objec */ - toMatchObject(expected: {}): void; + toMatchObject(expected: {}): R; /** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */ - toMatchSnapshot(snapshotName?: string): void; + toMatchSnapshot(snapshotName?: string): R; /** Used to test that a function throws when it is called. */ - toThrow(error?: string | Constructable | RegExp): void; + toThrow(error?: string | Constructable | RegExp): R; /** If you want to test that a specific error is thrown inside a function. */ - toThrowError(error?: string | Constructable | RegExp): void; + toThrowError(error?: string | Constructable | RegExp): R; /** Used to test that a function throws a error matching the most recent snapshot when it is called. */ - toThrowErrorMatchingSnapshot(): void; + toThrowErrorMatchingSnapshot(): R; } interface Constructable { diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index d8f6d54dfd..ea44766937 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -1,4 +1,11 @@ -/// +// TODO: Avoid requiring things that don't exist. +declare var require: { + (s: string): any; + requireActual(s: string): any; + requireMock(s: string): any; +}; +// TODO: use real jquery types? +declare var $: any; // Tests based on the Jest website jest.unmock('../sum'); @@ -12,7 +19,6 @@ describe('sum', function() { describe('fetchCurrentUser', function() { it('calls the callback when $.ajax requests are finished', function() { - var $ = require('jquery'); var fetchCurrentUser = require('../fetchCurrentUser'); // Create a mock function for our callback @@ -525,3 +531,41 @@ describe('Mocks', function () { anotherIns.testMethod.mockImplementation(() => 1); }); }); + +// https://facebook.github.io/jest/docs/en/expect.html#resolves +describe('resolves', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.resolve('test')).resolves.toEqual('test'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; + }); + + it('unwraps a .toHaveBeenCalledX', function(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', function(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', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.reject(new Error('error'))).rejects.toMatch('error'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; + }); +}); diff --git a/types/jest/v16/jest-tests.ts b/types/jest/v16/jest-tests.ts index c69eae61a2..7a58d6e9b1 100644 --- a/types/jest/v16/jest-tests.ts +++ b/types/jest/v16/jest-tests.ts @@ -1,4 +1,11 @@ -/// +// TODO: Avoid requiring things that don't exist. +declare var require: { + (s: string): any; + requireActual(s: string): any; + requireMock(s: string): any; +}; +// TODO: use real jquery types? +declare var $: any; // Tests based on the Jest website jest.unmock('../sum'); diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 67844d31b9..a0684724b7 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -1,6 +1,3 @@ - -/// - import Joi = require('joi'); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -13,7 +10,6 @@ var bool: boolean = false; var exp: RegExp = null; var obj: Object = null; var date: Date = null; -var bin: NodeBuffer = null; var err: Error = null; var func: Function = null; @@ -23,7 +19,6 @@ var strArr: string[] = []; var boolArr: boolean[] = []; var expArr: RegExp[] = []; var objArr: Object[] = []; -var bufArr: NodeBuffer[] = []; var errArr: Error[] = []; var funcArr: Function[] = []; diff --git a/types/joi/v6/joi-tests.ts b/types/joi/v6/joi-tests.ts index 03ca5ffac0..33923b500a 100644 --- a/types/joi/v6/joi-tests.ts +++ b/types/joi/v6/joi-tests.ts @@ -1,5 +1,3 @@ -/// - import Joi = require('joi'); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -12,7 +10,6 @@ var bool: boolean = false; var exp: RegExp = null; var obj: Object = null; var date: Date = null; -var bin: NodeBuffer = null; var err: Error = null; var func: Function = null; @@ -22,7 +19,6 @@ var strArr: string[] = []; var boolArr: boolean[] = []; var expArr: RegExp[] = []; var objArr: Object[] = []; -var bufArr: NodeBuffer[] = []; var errArr: Error[] = []; var funcArr: Function[] = []; diff --git a/types/jointjs/index.d.ts b/types/jointjs/index.d.ts index 5ce0f187f0..c15cdc79c6 100644 --- a/types/jointjs/index.d.ts +++ b/types/jointjs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.jointjs.com/ // Definitions by: Aidan Reel , David Durman , Ewout Van Gossum , Federico Caselli , Chris Moran // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // typings: https://github.com/CaselIT/typings-jointjs /// diff --git a/types/jqgrid/index.d.ts b/types/jqgrid/index.d.ts index 00310f43ad..5b85910077 100644 --- a/types/jqgrid/index.d.ts +++ b/types/jqgrid/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tonytomov/jqGrid // Definitions by: Lokesh Peta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -414,4 +415,4 @@ interface JQuery { * @returns {} */ setGridParam(obj: any): void; -} \ No newline at end of file +} diff --git a/types/jqrangeslider/index.d.ts b/types/jqrangeslider/index.d.ts index 36bb5a16d2..5ee9a45ed7 100644 --- a/types/jqrangeslider/index.d.ts +++ b/types/jqrangeslider/index.d.ts @@ -2,6 +2,7 @@ // Project: http://ghusse.github.com/jQRangeSlider // Definitions by: Dániel Tar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/jqrangeslider/tsconfig.json b/types/jqrangeslider/tsconfig.json index 2484e06a5c..4a41364b36 100644 --- a/types/jqrangeslider/tsconfig.json +++ b/types/jqrangeslider/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "jqrangeslider-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery-ajax-chain/index.d.ts b/types/jquery-ajax-chain/index.d.ts index 6f15c1190f..3c24da237c 100644 --- a/types/jquery-ajax-chain/index.d.ts +++ b/types/jquery-ajax-chain/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/humana-fragilitas/jQuery-Ajax-Chain/ // Definitions by: Andrea Blasio // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-alertable/index.d.ts b/types/jquery-alertable/index.d.ts index 4f874547e2..3b302ce286 100644 --- a/types/jquery-alertable/index.d.ts +++ b/types/jquery-alertable/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/claviska/jquery-alertable // Definitions by: Steven Robertson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-backstretch/index.d.ts b/types/jquery-backstretch/index.d.ts index f868cc5c94..7f2826502f 100644 --- a/types/jquery-backstretch/index.d.ts +++ b/types/jquery-backstretch/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/srobbin/jquery-backstretch // Definitions by: Dmytro Kulyk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -89,4 +90,4 @@ interface JQueryStatic { interface JQuery { backstretch(images:string[], config?:JQueryBackStretch.BackStretchOptions):JQueryBackStretch.BackStretch; backstretch(method:string):JQuery; -} \ No newline at end of file +} diff --git a/types/jquery-cropbox/index.d.ts b/types/jquery-cropbox/index.d.ts index 42d2ed9689..0de20878d5 100644 --- a/types/jquery-cropbox/index.d.ts +++ b/types/jquery-cropbox/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/acornejo/jquery-cropbox // Definitions by: Per Kastman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-easy-loading/index.d.ts b/types/jquery-easy-loading/index.d.ts index c6d878df1a..72ab6cd65d 100644 --- a/types/jquery-easy-loading/index.d.ts +++ b/types/jquery-easy-loading/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: delphinus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - declare namespace JQueryEasyLoading { interface Static { diff --git a/types/jquery-easy-loading/tsconfig.json b/types/jquery-easy-loading/tsconfig.json index 392a80ff8c..efe892fc96 100644 --- a/types/jquery-easy-loading/tsconfig.json +++ b/types/jquery-easy-loading/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "jquery-easy-loading-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery-fullscreen/index.d.ts b/types/jquery-fullscreen/index.d.ts index 477caf3b45..8190ad935c 100644 --- a/types/jquery-fullscreen/index.d.ts +++ b/types/jquery-fullscreen/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kayahr/jquery-fullscreen-plugin // Definitions by: Bruno Grieder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-handsontable/index.d.ts b/types/jquery-handsontable/index.d.ts index fbf8bcda33..29a4d8a327 100644 --- a/types/jquery-handsontable/index.d.ts +++ b/types/jquery-handsontable/index.d.ts @@ -2,6 +2,7 @@ // Project: http://handsontable.com // Definitions by: Ted John // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-jsonrpcclient/index.d.ts b/types/jquery-jsonrpcclient/index.d.ts index 911e9d08ec..31a2979b74 100644 --- a/types/jquery-jsonrpcclient/index.d.ts +++ b/types/jquery-jsonrpcclient/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Textalk/jquery.jsonrpcclient.js // Definitions by: Maksim Karelov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -100,4 +101,4 @@ interface JsonRpcClientFactory { interface JQueryStatic { JsonRpcClient: JsonRpcClientFactory; -} \ No newline at end of file +} diff --git a/types/jquery-knob/index.d.ts b/types/jquery-knob/index.d.ts index 925e632c68..ef1e720ba5 100644 --- a/types/jquery-knob/index.d.ts +++ b/types/jquery-knob/index.d.ts @@ -2,6 +2,7 @@ // Project: http://anthonyterrien.com/knob/ // Definitions by: Iain Buchanan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-mask-plugin/index.d.ts b/types/jquery-mask-plugin/index.d.ts index 270828856f..a142d0a97e 100644 --- a/types/jquery-mask-plugin/index.d.ts +++ b/types/jquery-mask-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://igorescobar.github.io/jQuery-Mask-Plugin/ // Definitions by: Anže Videnič , Igor Escobar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-match-height/index.d.ts b/types/jquery-match-height/index.d.ts index e63fb30d4d..664a5de4b4 100644 --- a/types/jquery-match-height/index.d.ts +++ b/types/jquery-match-height/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/liabru/jquery-match-height // Definitions by: Andrea Briganti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-mockjax/index.d.ts b/types/jquery-mockjax/index.d.ts index f951fb9e11..f5dc5c8db1 100644 --- a/types/jquery-mockjax/index.d.ts +++ b/types/jquery-mockjax/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Laszlo Jakab , Vladimir Đokić // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - interface MockJaxSettingsHeaders { [key: string]: string; } diff --git a/types/jquery-mockjax/jquery-mockjax-tests.ts b/types/jquery-mockjax/jquery-mockjax-tests.ts index 3090a1c3cc..a0df96dad6 100644 --- a/types/jquery-mockjax/jquery-mockjax-tests.ts +++ b/types/jquery-mockjax/jquery-mockjax-tests.ts @@ -1,5 +1,7 @@ /// +import $ = require('jquery'); + class Tests { private _noErrorCallbackExpected: (jqXHR: JQueryXHR, textStatus: string, errorThrown: string) => any; private _defaultMockjaxSettings: MockJaxSettings; diff --git a/types/jquery-mockjax/tsconfig.json b/types/jquery-mockjax/tsconfig.json index 95708b17ef..5fcedf714e 100644 --- a/types/jquery-mockjax/tsconfig.json +++ b/types/jquery-mockjax/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "jquery-mockjax-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery-mousewheel/index.d.ts b/types/jquery-mousewheel/index.d.ts index dbc91e126c..fdeaa39585 100644 --- a/types/jquery-mousewheel/index.d.ts +++ b/types/jquery-mousewheel/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jquery/jquery-mousewheel // Definitions by: Brian Surowiec // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-sortable/index.d.ts b/types/jquery-sortable/index.d.ts index 2205bf50e1..e144510fa8 100644 --- a/types/jquery-sortable/index.d.ts +++ b/types/jquery-sortable/index.d.ts @@ -2,6 +2,7 @@ // Project: http://johnny.github.io/jquery-sortable/ // Definitions by: Nathan Pitman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-steps/index.d.ts b/types/jquery-steps/index.d.ts index 7670245480..72b2e036f3 100644 --- a/types/jquery-steps/index.d.ts +++ b/types/jquery-steps/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.jquery-steps.com/ // Definitions by: Joseph Blank , Nicholas Wong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-timeentry/index.d.ts b/types/jquery-timeentry/index.d.ts index 1ba12a40d6..ebc0fb3ab8 100644 --- a/types/jquery-timeentry/index.d.ts +++ b/types/jquery-timeentry/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kbwood/timeentry // Definitions by: Mark Nadig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-toastmessage-plugin/index.d.ts b/types/jquery-toastmessage-plugin/index.d.ts index 9e5eb8e8b9..89b905cb3a 100644 --- a/types/jquery-toastmessage-plugin/index.d.ts +++ b/types/jquery-toastmessage-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/akquinet/jquery-toastmessage-plugin // Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-truncate-html/index.d.ts b/types/jquery-truncate-html/index.d.ts index cb9b749e48..9e110b0233 100644 --- a/types/jquery-truncate-html/index.d.ts +++ b/types/jquery-truncate-html/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kbwood/timeentry // Definitions by: Abraão Alves // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-urlparam/index.d.ts b/types/jquery-urlparam/index.d.ts index 496bb2f26c..d8b437f201 100644 --- a/types/jquery-urlparam/index.d.ts +++ b/types/jquery-urlparam/index.d.ts @@ -2,6 +2,7 @@ // Project: https://gist.github.com/stpettersens/e1f4478f299b6f4905c1 // Definitions by: Sam Saint-Pettersen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery-validation-unobtrusive/index.d.ts b/types/jquery-validation-unobtrusive/index.d.ts index f1997a1002..128ef10544 100644 --- a/types/jquery-validation-unobtrusive/index.d.ts +++ b/types/jquery-validation-unobtrusive/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/aspnet/jquery-validation-unobtrusive // Definitions by: Matt Brooks // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.address/index.d.ts b/types/jquery.address/index.d.ts index 3c0003b8ca..efa8353c29 100644 --- a/types/jquery.address/index.d.ts +++ b/types/jquery.address/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/asual/jquery-address // Definitions by: Martin Duparc , Tim Klingeleers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ +// TypeScript Version: 2.3 /// diff --git a/types/jquery.are-you-sure/index.d.ts b/types/jquery.are-you-sure/index.d.ts index 5a7e547e50..0eef8c01e9 100644 --- a/types/jquery.are-you-sure/index.d.ts +++ b/types/jquery.are-you-sure/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/codedance/jquery.AreYouSure // Definitions by: Jon Egerton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -31,4 +32,4 @@ interface AreYouSure { interface JQuery { areYouSure: AreYouSure; -} \ No newline at end of file +} diff --git a/types/jquery.autosize/index.d.ts b/types/jquery.autosize/index.d.ts index f43e6bf7d3..5d9ded0a77 100644 --- a/types/jquery.autosize/index.d.ts +++ b/types/jquery.autosize/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.jacklmoore.com/autosize/ // Definitions by: Aaron T. King // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// declare namespace autosize { diff --git a/types/jquery.base64/index.d.ts b/types/jquery.base64/index.d.ts index e071dc940a..5eaf083d9b 100644 --- a/types/jquery.base64/index.d.ts +++ b/types/jquery.base64/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/yatt/jquery.base64/ // Definitions by: Shinya Mochizuki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.bbq/index.d.ts b/types/jquery.bbq/index.d.ts index 44deadb690..1860d63343 100644 --- a/types/jquery.bbq/index.d.ts +++ b/types/jquery.bbq/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Adam R. Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - declare namespace JQueryBbq { interface JQuery { diff --git a/types/jquery.bbq/jquery.bbq-tests.ts b/types/jquery.bbq/jquery.bbq-tests.ts index 16216ea557..9762ee44d9 100644 --- a/types/jquery.bbq/jquery.bbq-tests.ts +++ b/types/jquery.bbq/jquery.bbq-tests.ts @@ -1,5 +1,7 @@ /// +import $ = require('jquery'); + // ************** Tests to jquery JQueryParam interface var myObject = { a: { @@ -1277,4 +1279,4 @@ test( 'jQuery.bbq.pushState(), jQuery.bbq.getState(), jQuery.bbq.removeState(), }); -}); // END CLOSURE \ No newline at end of file +}); // END CLOSURE diff --git a/types/jquery.bbq/tsconfig.json b/types/jquery.bbq/tsconfig.json index 776f038eab..b6df3537a9 100644 --- a/types/jquery.bbq/tsconfig.json +++ b/types/jquery.bbq/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "jquery.bbq-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery.blockui/index.d.ts b/types/jquery.blockui/index.d.ts index 6763de1a0f..bdaad4e21d 100644 --- a/types/jquery.blockui/index.d.ts +++ b/types/jquery.blockui/index.d.ts @@ -2,6 +2,7 @@ // Project: http://malsup.com/jquery/block/ // Definitions by: Jeffrey Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -126,4 +127,4 @@ interface JQuery { * unblock the element(s) */ unblock(option?: JQBlockUIOptions): JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.bootstrap.wizard/index.d.ts b/types/jquery.bootstrap.wizard/index.d.ts index b04835e14e..465d7cd095 100644 --- a/types/jquery.bootstrap.wizard/index.d.ts +++ b/types/jquery.bootstrap.wizard/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/VinceG/twitter-bootstrap-wizard // Definitions by: Blake Niemyjski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -45,4 +46,4 @@ interface JQuery { interface JQueryStatic { bootstrapWizard: Wizard; -} \ No newline at end of file +} diff --git a/types/jquery.cleditor/index.d.ts b/types/jquery.cleditor/index.d.ts index 14ce2703ad..324aaa2dff 100644 --- a/types/jquery.cleditor/index.d.ts +++ b/types/jquery.cleditor/index.d.ts @@ -2,6 +2,7 @@ // Project: http://premiumsoftware.net/CLEditor // Definitions by: Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.clientsidelogging/index.d.ts b/types/jquery.clientsidelogging/index.d.ts index 9266ff2f94..f0548b89b2 100644 --- a/types/jquery.clientsidelogging/index.d.ts +++ b/types/jquery.clientsidelogging/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Diullei Gomes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - interface ClientSideLoggingClientInfoObject { location?: boolean; // The url to the page on which the error occurred. screen_size?: boolean; // The size of the user's screen (different to the window size because the window might not be maximized) diff --git a/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts b/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts index b0724ecc0f..f23b9acb25 100644 --- a/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts +++ b/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts @@ -1,3 +1,5 @@ +import $ = require('jquery'); + $.clientSideLogging({ log_level: 3, client_info: { @@ -12,4 +14,4 @@ $.info({msg:$(this).parents('li').find('input:text').val()}); $.error({msg:$(this).parents('li').find('input:text').val()}); $.log($(this).parents('li').find('input:text').val()); -$.post('/log?type=error&msg=YOUR_ERROR_MESSAGE'); \ No newline at end of file +$.post('/log?type=error&msg=YOUR_ERROR_MESSAGE'); diff --git a/types/jquery.clientsidelogging/tsconfig.json b/types/jquery.clientsidelogging/tsconfig.json index de9b88ffd8..db54f5cd84 100644 --- a/types/jquery.clientsidelogging/tsconfig.json +++ b/types/jquery.clientsidelogging/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "jquery.clientsidelogging-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery.color/index.d.ts b/types/jquery.color/index.d.ts index 4b24a7c434..713ed67915 100644 --- a/types/jquery.color/index.d.ts +++ b/types/jquery.color/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jquery/jquery-color // Definitions by: Derek Cicerone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.colorbox/index.d.ts b/types/jquery.colorbox/index.d.ts index 3e9b0ea161..2a830611ab 100644 --- a/types/jquery.colorbox/index.d.ts +++ b/types/jquery.colorbox/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.jacklmoore.com/colorbox/ // Definitions by: Gidon Junge // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ +// TypeScript Version: 2.3 /// diff --git a/types/jquery.colorpicker/index.d.ts b/types/jquery.colorpicker/index.d.ts index 566b7d4103..2d44ddb967 100644 --- a/types/jquery.colorpicker/index.d.ts +++ b/types/jquery.colorpicker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/vanderlee/colorpicker // Definitions by: Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.contextmenu/index.d.ts b/types/jquery.contextmenu/index.d.ts index 64db123173..56188d2ac0 100644 --- a/types/jquery.contextmenu/index.d.ts +++ b/types/jquery.contextmenu/index.d.ts @@ -2,6 +2,7 @@ // Project: http://medialize.github.com/jQuery-contextMenu/ // Definitions by: Natan Vivo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.cookie/index.d.ts b/types/jquery.cookie/index.d.ts index 8c3ef6190d..c15341aa97 100644 --- a/types/jquery.cookie/index.d.ts +++ b/types/jquery.cookie/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/carhartl/jquery-cookie // Definitions by: Roy Goode , Ben Lorantfy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.customselect/index.d.ts b/types/jquery.customselect/index.d.ts index faaf6df5af..c64589afd3 100644 --- a/types/jquery.customselect/index.d.ts +++ b/types/jquery.customselect/index.d.ts @@ -2,6 +2,7 @@ // Project: http://adam.co/lab/jquery/customselect// // Definitions by: adamcoulombe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -13,4 +14,4 @@ interface JQueryCustomSelectOption { interface JQuery { customSelect(val:JQueryCustomSelectOption): JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.cycle/index.d.ts b/types/jquery.cycle/index.d.ts index 3c91561f93..5bee065fdb 100644 --- a/types/jquery.cycle/index.d.ts +++ b/types/jquery.cycle/index.d.ts @@ -2,6 +2,7 @@ // Project: http://jquery.malsup.com/cycle/ // Definitions by: François Guillot // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.cycle2/index.d.ts b/types/jquery.cycle2/index.d.ts index 39bb2f0d90..faef998fae 100644 --- a/types/jquery.cycle2/index.d.ts +++ b/types/jquery.cycle2/index.d.ts @@ -3,6 +3,7 @@ // https://github.com/malsup/cycle2 // Definitions by: Donny Nadolny // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.dropotron/index.d.ts b/types/jquery.dropotron/index.d.ts index e930034292..26dbc29050 100644 --- a/types/jquery.dropotron/index.d.ts +++ b/types/jquery.dropotron/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/n33/jquery.dropotron // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ +// TypeScript Version: 2.3 /** * @summary Interface for "dropotron" configurations. @@ -157,4 +158,4 @@ interface Dropotron { */ interface JQuery { dropotron: Dropotron; -} \ No newline at end of file +} diff --git a/types/jquery.dynatree/index.d.ts b/types/jquery.dynatree/index.d.ts index 273f88a2c5..267115cc8d 100644 --- a/types/jquery.dynatree/index.d.ts +++ b/types/jquery.dynatree/index.d.ts @@ -2,6 +2,7 @@ // Project: http://code.google.com/p/dynatree/ // Definitions by: François de Campredon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.elang/index.d.ts b/types/jquery.elang/index.d.ts index 9a5459af65..21a73e237f 100644 --- a/types/jquery.elang/index.d.ts +++ b/types/jquery.elang/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sumegizoltan/ELang/ // Definitions by: Zoltan Sumegi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -311,4 +312,4 @@ interface IFnJQuery { command: string, pluginName: string, pluginDataAttribute: string): JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index c5e84d69f7..e2c79b0341 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.fileupload/index.d.ts b/types/jquery.fileupload/index.d.ts index e113d2733c..6ca998d41a 100644 --- a/types/jquery.fileupload/index.d.ts +++ b/types/jquery.fileupload/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/blueimp/jQuery-File-Upload // Definitions by: Rob Alarcon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.finger/index.d.ts b/types/jquery.finger/index.d.ts index d8a033834b..0cf61e07d2 100644 --- a/types/jquery.finger/index.d.ts +++ b/types/jquery.finger/index.d.ts @@ -2,6 +2,7 @@ // Project: http://ngryman.sh/jquery.finger/ // Definitions by: Max Ackley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.flagstrap/index.d.ts b/types/jquery.flagstrap/index.d.ts index 98acf3cc39..4f6557fdaa 100644 --- a/types/jquery.flagstrap/index.d.ts +++ b/types/jquery.flagstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/blazeworx/flagstrap // Definitions by: Felipe de Sena Garcia // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -81,4 +82,4 @@ interface JQuery { flagStrap(): void; flagStrap(options: jQueryFlagStrap.FlagStrapOptions): void; -} \ No newline at end of file +} diff --git a/types/jquery.form/index.d.ts b/types/jquery.form/index.d.ts index 404b618618..c96b1fd71b 100644 --- a/types/jquery.form/index.d.ts +++ b/types/jquery.form/index.d.ts @@ -2,6 +2,7 @@ // Project: http://malsup.com/jquery/form/ // Definitions by: François Guillot // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -47,4 +48,4 @@ interface JQuery { formToArray: (semantic?: boolean, elements?: Element[]) => any[]; enable: (enable?: boolean) => JQuery; selected: (select?: boolean) => JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.fullscreen/index.d.ts b/types/jquery.fullscreen/index.d.ts index 8831a68cbd..dd8fd9a2e8 100644 --- a/types/jquery.fullscreen/index.d.ts +++ b/types/jquery.fullscreen/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/private-face/jquery.fullscreen // Definitions by: Piraveen Kamalathas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.gridster/index.d.ts b/types/jquery.gridster/index.d.ts index 305788190b..c91fd6f9e4 100644 --- a/types/jquery.gridster/index.d.ts +++ b/types/jquery.gridster/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jbaldwin/gridster // Definitions by: Josh Baldwin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /* gridster-0.1.0.d.ts may be freely distributed under the MIT license. diff --git a/types/jquery.growl/index.d.ts b/types/jquery.growl/index.d.ts index 7b52ee311b..caa9e0d7cd 100644 --- a/types/jquery.growl/index.d.ts +++ b/types/jquery.growl/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ksylvest/jquery-growl#readme // Definitions by: Amir.h Yeganemehr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.highlight-bartaz/index.d.ts b/types/jquery.highlight-bartaz/index.d.ts index 26fbb1e40a..f76a2bcb98 100644 --- a/types/jquery.highlight-bartaz/index.d.ts +++ b/types/jquery.highlight-bartaz/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bartaz/sandbox.js/blob/master/jquery.highlight.js // Definitions by: Stefan Profanter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.jnotify/index.d.ts b/types/jquery.jnotify/index.d.ts index d85fceb054..8e1fc1433a 100644 --- a/types/jquery.jnotify/index.d.ts +++ b/types/jquery.jnotify/index.d.ts @@ -2,6 +2,7 @@ // Project: http://jnotify.codeplex.com // Definitions by: James Curran // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // Project by: Fabio Franzini /// diff --git a/types/jquery.joyride/index.d.ts b/types/jquery.joyride/index.d.ts index ee918d83c0..05e5b5e2d9 100644 --- a/types/jquery.joyride/index.d.ts +++ b/types/jquery.joyride/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Vincent Bortone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - /** * HTML segments for tip layout */ @@ -270,4 +268,4 @@ interface JQuery { * @return {Joyride} Joyride instance. */ joyride: Joyride; -} \ No newline at end of file +} diff --git a/types/jquery.joyride/jquery.joyride-tests.ts b/types/jquery.joyride/jquery.joyride-tests.ts index c7324dd6c9..08d7687611 100644 --- a/types/jquery.joyride/jquery.joyride-tests.ts +++ b/types/jquery.joyride/jquery.joyride-tests.ts @@ -1,3 +1,5 @@ +import $ = require('jquery'); + var options: JoyrideOptions; options.autoStart = true; options.postStepCallback = (index, tip)=> { @@ -10,4 +12,4 @@ options.expose = true; $(window).load(()=> { $('#joyRideTipContent').joyride(options); -}); \ No newline at end of file +}); diff --git a/types/jquery.joyride/tsconfig.json b/types/jquery.joyride/tsconfig.json index ceb432e871..2c4734d4ae 100644 --- a/types/jquery.joyride/tsconfig.json +++ b/types/jquery.joyride/tsconfig.json @@ -12,6 +12,11 @@ "typeRoots": [ "../" ], + "paths": { + "jquery": [ + "jquery/v2" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -20,4 +25,4 @@ "index.d.ts", "jquery.joyride-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jquery.jsignature/index.d.ts b/types/jquery.jsignature/index.d.ts index a047f83dea..a3650d487b 100644 --- a/types/jquery.jsignature/index.d.ts +++ b/types/jquery.jsignature/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/willowsystems/jSignature // Definitions by: Patrick Magee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // Project by: Willow Systems Corp /// diff --git a/types/jquery.leanmodal/index.d.ts b/types/jquery.leanmodal/index.d.ts index e0c2f7f707..91f9ea83d6 100644 --- a/types/jquery.leanmodal/index.d.ts +++ b/types/jquery.leanmodal/index.d.ts @@ -2,6 +2,7 @@ // Project: http://leanmodal.finelysliced.com.au/ // Definitions by: FinelySliced // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -19,4 +20,4 @@ interface JQueryStatic { interface JQuery { leanModal(): JQuery; leanModal(val : JQueryLeanModalOption): JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.livestampjs/index.d.ts b/types/jquery.livestampjs/index.d.ts index 12d401367d..2d65c13674 100644 --- a/types/jquery.livestampjs/index.d.ts +++ b/types/jquery.livestampjs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://mattbradley.github.com/livestampjs/ // Definitions by: Vincent Bortone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // A simple, unobtrusive jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements using Moment.js. diff --git a/types/jquery.menuaim/index.d.ts b/types/jquery.menuaim/index.d.ts index 5bcbebf189..393a637d6f 100644 --- a/types/jquery.menuaim/index.d.ts +++ b/types/jquery.menuaim/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kamens/jQuery-menu-aim // Definitions by: Robert Fonseca-Ensor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.mmenu/index.d.ts b/types/jquery.mmenu/index.d.ts index 9c27bdb530..07eb443a11 100644 --- a/types/jquery.mmenu/index.d.ts +++ b/types/jquery.mmenu/index.d.ts @@ -2,6 +2,7 @@ // Project: http://mmenu.frebsite.nl/ // Definitions by: John Gouigouix // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.notifybar/index.d.ts b/types/jquery.notifybar/index.d.ts index f1e500d420..6aa12b52f6 100644 --- a/types/jquery.notifybar/index.d.ts +++ b/types/jquery.notifybar/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar/ // Definitions by: Shunsuke Ohtani // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.noty/index.d.ts b/types/jquery.noty/index.d.ts index f4bfe4bcb9..0570e02358 100644 --- a/types/jquery.noty/index.d.ts +++ b/types/jquery.noty/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Aaron King , Tim Helfensdörfer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Project by: Nedim Carter +// TypeScript Version: 2.3 /// diff --git a/types/jquery.payment/index.d.ts b/types/jquery.payment/index.d.ts index 88ecd255a5..26cbbc3fef 100644 --- a/types/jquery.payment/index.d.ts +++ b/types/jquery.payment/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/stripe/jquery.payment // Definitions by: Eric J. Smith , John Rutherford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.payment/jquery.payment-tests.ts b/types/jquery.payment/jquery.payment-tests.ts index 9eaad853cb..5b0c3be9c8 100644 --- a/types/jquery.payment/jquery.payment-tests.ts +++ b/types/jquery.payment/jquery.payment-tests.ts @@ -35,8 +35,8 @@ $.payment.cardExpiryVal('03 / 2025') === {month: 3, year: 2025}; //=> {month: 3, $.payment.cardExpiryVal('05 / 04') === {month: 3, year: 2025}; //=> {month: 5, year: 2004} $('input.cc-exp').payment('cardExpiryVal') //=> {month: 4, year: 2020} -var valid = $.payment.validateCardNumber($('input.cc-num').val()); +var valid = $.payment.validateCardNumber($('input.cc-num').val() as string); if (!valid) { alert('Your card is not valid!'); -} \ No newline at end of file +} diff --git a/types/jquery.pjax.falsandtru/index.d.ts b/types/jquery.pjax.falsandtru/index.d.ts index 02c3b1fdda..e7a5cea8e0 100644 --- a/types/jquery.pjax.falsandtru/index.d.ts +++ b/types/jquery.pjax.falsandtru/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/falsandtru/jquery.pjax.js/ // Definitions by: 新ゝ月 NewNotMoon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -186,4 +187,4 @@ interface JQueryStatic { interface JQuery { pjax(setting?: PjaxSetting): any; -} \ No newline at end of file +} diff --git a/types/jquery.pjax/index.d.ts b/types/jquery.pjax/index.d.ts index 2657a90f44..ebb713236e 100644 --- a/types/jquery.pjax/index.d.ts +++ b/types/jquery.pjax/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/defunkt/jquery-pjax // Definitions by: Junle Li // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.placeholder/index.d.ts b/types/jquery.placeholder/index.d.ts index 92fe7e5f02..6f8283ff38 100644 --- a/types/jquery.placeholder/index.d.ts +++ b/types/jquery.placeholder/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mathiasbynens/jquery-placeholder // Definitions by: Peter Gill , Neil Culver // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.pnotify/index.d.ts b/types/jquery.pnotify/index.d.ts index 3355f889ce..70946c30ef 100644 --- a/types/jquery.pnotify/index.d.ts +++ b/types/jquery.pnotify/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sciactive/pnotify // Definitions by: David Sichau , Robin Maenhaut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.pnotify/jquery.pnotify-tests.ts b/types/jquery.pnotify/jquery.pnotify-tests.ts index f1b8ffb73e..fa4f008ef9 100644 --- a/types/jquery.pnotify/jquery.pnotify-tests.ts +++ b/types/jquery.pnotify/jquery.pnotify-tests.ts @@ -21,9 +21,9 @@ function test_pnotify() { text: 'I don\'t have a shadow. (It\'s cause I\'m a vampire or something. Or is that reflections...)', shadow: false }); - new PNotify('Check me out! I\'m a notice.'); + // new PNotify('Check me out! I\'m a notice.'); - new PNotify(Math.round(Math.random() * 9999)); + // new PNotify(Math.round(Math.random() * 9999)); new PNotify({ title: 'PIcon Notice', @@ -216,7 +216,7 @@ function test_pnotify() { icon: "fa fa-bars", delay: 20000, history: false, - stack: false + stack: {} }); var type = "error"; diff --git a/types/jquery.postmessage/index.d.ts b/types/jquery.postmessage/index.d.ts index f370ad3822..9e5c3a1d7c 100644 --- a/types/jquery.postmessage/index.d.ts +++ b/types/jquery.postmessage/index.d.ts @@ -2,6 +2,7 @@ // Project: http://benalman.com/projects/jquery-postmessage-plugin/ // Definitions by: Junle Li // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // Official docs: http://benalman.com/code/projects/jquery-postmessage/docs/files/jquery-ba-postmessage-js.html interface JQueryStatic { diff --git a/types/jquery.prettyphoto/index.d.ts b/types/jquery.prettyphoto/index.d.ts index 9c5f5f6a52..d37d7c40d2 100644 --- a/types/jquery.prettyphoto/index.d.ts +++ b/types/jquery.prettyphoto/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/scaron/prettyphoto // Definitions by: pgaske // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.qrcode/index.d.ts b/types/jquery.qrcode/index.d.ts index 94504d4dda..0ce6a0b96b 100644 --- a/types/jquery.qrcode/index.d.ts +++ b/types/jquery.qrcode/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/lrsjng/jquery-qrcode // Definitions by: Dan Manastireanu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.rateit/index.d.ts b/types/jquery.rateit/index.d.ts index be62f3b3da..f94640c5ff 100644 --- a/types/jquery.rateit/index.d.ts +++ b/types/jquery.rateit/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gjunge/rateit.js // Definitions by: Gidon Junge // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// type RateItMode = "bg" | "font"; diff --git a/types/jquery.rowgrid/index.d.ts b/types/jquery.rowgrid/index.d.ts index 5456b9c323..121a2be5bd 100644 --- a/types/jquery.rowgrid/index.d.ts +++ b/types/jquery.rowgrid/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/brunjo/rowGrid.js // Definitions by: Vinayak Garg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -14,4 +15,4 @@ interface JQueryRowGridJSOptions { interface JQuery { rowGrid(options?: JQueryRowGridJSOptions): JQuery; rowGrid(appended: string): JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.scrollto/index.d.ts b/types/jquery.scrollto/index.d.ts index 3a4f13d1a8..9a6777b7a9 100644 --- a/types/jquery.scrollto/index.d.ts +++ b/types/jquery.scrollto/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/flesler/jquery.scrollTo // Definitions by: Neil Stalker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.simplemodal/index.d.ts b/types/jquery.simplemodal/index.d.ts index 7fff90f18a..4588fd5b21 100644 --- a/types/jquery.simplemodal/index.d.ts +++ b/types/jquery.simplemodal/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.ericmmartin.com/projects/simplemodal/ // Definitions by: Friedrich von Never // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.simplepagination/index.d.ts b/types/jquery.simplepagination/index.d.ts index c09ea685e3..85f3ca88a2 100644 --- a/types/jquery.simplepagination/index.d.ts +++ b/types/jquery.simplepagination/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/flaviusmatis/simplePagination.js // Definitions by: Natan Vivo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.simulate/index.d.ts b/types/jquery.simulate/index.d.ts index 65a80a263e..73d3690e7d 100644 --- a/types/jquery.simulate/index.d.ts +++ b/types/jquery.simulate/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jquery/jquery-simulate // Definitions by: Derek Cicerone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.slimscroll/index.d.ts b/types/jquery.slimscroll/index.d.ts index 4309e19c21..43eb86a028 100644 --- a/types/jquery.slimscroll/index.d.ts +++ b/types/jquery.slimscroll/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rochal/jQuery-slimScroll // Definitions by: Chintan Shah // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// interface IJQuerySlimScrollOptions { diff --git a/types/jquery.soap/index.d.ts b/types/jquery.soap/index.d.ts index 384b5bc480..36674a677b 100644 --- a/types/jquery.soap/index.d.ts +++ b/types/jquery.soap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/doedje/jquery.soap // Definitions by: Roland Greim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ +// TypeScript Version: 2.3 /// diff --git a/types/jquery.sortelements/index.d.ts b/types/jquery.sortelements/index.d.ts index 5fbf62ab8e..112c2f8169 100644 --- a/types/jquery.sortelements/index.d.ts +++ b/types/jquery.sortelements/index.d.ts @@ -2,6 +2,7 @@ // Project: http://james.padolsey.com/javascript/sorting-elements-with-jquery/ // Definitions by: Tim Bureck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.superlink/index.d.ts b/types/jquery.superlink/index.d.ts index 23bd71077d..90eed21d69 100644 --- a/types/jquery.superlink/index.d.ts +++ b/types/jquery.superlink/index.d.ts @@ -2,9 +2,10 @@ // Project: http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js // Definitions by: Blake Niemyjski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// interface JQuery { superLink(link?: string): JQuery; -} \ No newline at end of file +} diff --git a/types/jquery.tagsmanager/index.d.ts b/types/jquery.tagsmanager/index.d.ts index aa9ff8e74f..77af837b63 100644 --- a/types/jquery.tagsmanager/index.d.ts +++ b/types/jquery.tagsmanager/index.d.ts @@ -2,6 +2,7 @@ // Project: http://welldonethings.com/tags/manager // Definitions by: Vincent Bortone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.tile/index.d.ts b/types/jquery.tile/index.d.ts index d8437b0b01..0519c64673 100644 --- a/types/jquery.tile/index.d.ts +++ b/types/jquery.tile/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/urin/jquery.tile.js // Definitions by: Shunsuke Ohtani // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.timeago/index.d.ts b/types/jquery.timeago/index.d.ts index 820af3e128..9e1087ec31 100644 --- a/types/jquery.timeago/index.d.ts +++ b/types/jquery.timeago/index.d.ts @@ -2,6 +2,7 @@ // Project: http://timeago.yarp.com/ // Definitions by: François Guillot // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -59,4 +60,4 @@ interface JQueryStatic { interface JQuery { timeago: Timeago; -} \ No newline at end of file +} diff --git a/types/jquery.timepicker/index.d.ts b/types/jquery.timepicker/index.d.ts index d6a8d45a3b..cb6dcd5a5a 100644 --- a/types/jquery.timepicker/index.d.ts +++ b/types/jquery.timepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: http://fgelinas.com/code/timepicker/ // Definitions by: Anwar Javed // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/jquery.timer/index.d.ts b/types/jquery.timer/index.d.ts index f43e887787..752e04289e 100644 --- a/types/jquery.timer/index.d.ts +++ b/types/jquery.timer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jchavannes/jquery-timer // Definitions by: Joshua Strobl // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.tinycarousel/index.d.ts b/types/jquery.tinycarousel/index.d.ts index 0e91ba75ad..213fdd0728 100644 --- a/types/jquery.tinycarousel/index.d.ts +++ b/types/jquery.tinycarousel/index.d.ts @@ -2,6 +2,7 @@ // Project: http://baijs.nl/tinycarousel/ // Definitions by: Christiaan Rakowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.tinyscrollbar/index.d.ts b/types/jquery.tinyscrollbar/index.d.ts index c56da8df7d..5cd3240dfb 100644 --- a/types/jquery.tinyscrollbar/index.d.ts +++ b/types/jquery.tinyscrollbar/index.d.ts @@ -2,6 +2,7 @@ // Project: http://baijs.nl/tinyscrollbar/ // Definitions by: Christiaan Rakowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.tipsy/index.d.ts b/types/jquery.tipsy/index.d.ts index 678c2a77f0..3414eeae49 100644 --- a/types/jquery.tipsy/index.d.ts +++ b/types/jquery.tipsy/index.d.ts @@ -2,6 +2,7 @@ // Project: http://onehackoranother.com/projects/jquery/tipsy/ // Definitions by: Brian Dukes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.tipsy/jquery.tipsy-tests.ts b/types/jquery.tipsy/jquery.tipsy-tests.ts index 09ba7f2d68..8a0591e137 100644 --- a/types/jquery.tipsy/jquery.tipsy-tests.ts +++ b/types/jquery.tipsy/jquery.tipsy-tests.ts @@ -22,8 +22,8 @@ $(function() { $('#focus-example [title]').tipsy({trigger: 'focus', gravity: 'w'}); }); -function onclickExample1() { $("#manual-example a[rel=tipsy]").tipsy("show"); return false; } -function onclickExample2() { $("#manual-example a[rel=tipsy]").tipsy("hide"); return false; } +function onclickExample1() { $("#manual-example a[rel=tipsy]").tipsy({ title: "show" }); return false; } +function onclickExample2() { $("#manual-example a[rel=tipsy]").tipsy({ title: "hide" }); return false; } $('#manual-example a[rel=tipsy]').tipsy({trigger: 'manual'}); -$('a.live-tipsy').tipsy({live: true}); \ No newline at end of file +$('a.live-tipsy').tipsy({live: true}); diff --git a/types/jquery.tools/index.d.ts b/types/jquery.tools/index.d.ts index d84db10e7b..0c19d7a8fb 100644 --- a/types/jquery.tools/index.d.ts +++ b/types/jquery.tools/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jquerytools/jquerytools // Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.tools/jquery.tools-tests.ts b/types/jquery.tools/jquery.tools-tests.ts index f2f27666f6..d7c9b36523 100644 --- a/types/jquery.tools/jquery.tools-tests.ts +++ b/types/jquery.tools/jquery.tools-tests.ts @@ -13,7 +13,7 @@ const triggers = $(".modalInput").overlay({ closeOnClick: false }); -const buttons = $("#yesno button").click(function(this: JQuery, e: JQueryEventObject) { +const buttons = $("#yesno button").click(function(e) { // get user input const yes = buttons.index(this) === 0; @@ -32,14 +32,14 @@ $(".my_overlay_trigger").overlay({ // ... the rest of the configuration properties }); -$("#prompt form").submit(function(this: JQuery, e: JQueryEventObject) { +$("#prompt form").submit(function(e) { // close the overlay triggers.eq(1).overlay().close(); // or more straightforward: triggers.data('overlay').close(); // get user input - const input = $("input", this).val(); + const input = $("input", this).val() as string; // do something with the answer triggers.eq(1).html(input); @@ -57,13 +57,13 @@ $.tools.overlay.addEffect("myEffect", - 'this' variable is a reference to the overlay API - here we use jQuery's fadeIn() method to perform the effect */ - this.getOverlay().css(position).fadeIn(this.getConf().speed, done); + this.getOverlay().css(position).fadeIn(this.getConf().speed!, done); }, // close function function(done) { // fade out the overlay - this.getOverlay().fadeOut(this.getConf().closeSpeed, done); + this.getOverlay().fadeOut(this.getConf().closeSpeed!, done); } ); @@ -100,7 +100,7 @@ $(() => { const wrap = this.getOverlay().find(".contentWrap"); // load the page specified in the trigger - wrap.load(this.getTrigger().attr("href")); + wrap.load(this.getTrigger().attr("href")!); } }); }); @@ -115,7 +115,7 @@ $(() => { ]; // setup triggers - $("button[rel]").each(function(this: JQuery, i: number) { + $("button[rel]").each(function(i) { $(this).overlay({ // common configuration for each overlay oneInstance: false, @@ -161,7 +161,7 @@ $.tools.overlay.addEffect("drop", { top: '-=55', opacity: 0, width: '-=20' }, 300, 'drop', - function(this: JQuery) { + function() { $(this).hide(); done.call(null); }); diff --git a/types/jquery.tooltipster/index.d.ts b/types/jquery.tooltipster/index.d.ts index 5ef4debed4..8d2e580d35 100644 --- a/types/jquery.tooltipster/index.d.ts +++ b/types/jquery.tooltipster/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/iamceege/tooltipster // Definitions by: Patrick Magee , Dmitry Pesterev , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.total-storage/index.d.ts b/types/jquery.total-storage/index.d.ts index 5de79c34a6..1966d84e62 100644 --- a/types/jquery.total-storage/index.d.ts +++ b/types/jquery.total-storage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Upstatement/jquery-total-storage // Definitions by: Jeremy Brooks // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -61,4 +62,4 @@ interface JQueryTotalStorageOptions { interface JQueryStatic { totalStorage: JQueryTotalStorage; -} \ No newline at end of file +} diff --git a/types/jquery.transit/index.d.ts b/types/jquery.transit/index.d.ts index f267bbb24f..4bf4f5aabf 100644 --- a/types/jquery.transit/index.d.ts +++ b/types/jquery.transit/index.d.ts @@ -2,6 +2,7 @@ // Project: http://ricostacruz.com/jquery.transit/ // Definitions by: MrBigDog2U // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.ui.datetimepicker/index.d.ts b/types/jquery.ui.datetimepicker/index.d.ts index 96ed13e2bc..332bba5358 100644 --- a/types/jquery.ui.datetimepicker/index.d.ts +++ b/types/jquery.ui.datetimepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: http://trentrichardson.com/examples/timepicker/ // Definitions by: dougajmcdonald // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/jquery.ui.layout/index.d.ts b/types/jquery.ui.layout/index.d.ts index cab45fe24d..148265ac6a 100644 --- a/types/jquery.ui.layout/index.d.ts +++ b/types/jquery.ui.layout/index.d.ts @@ -2,6 +2,7 @@ // Project: http://layout.jquery-dev.net/ // Definitions by: Steve Fenton , Douglas Armstrong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/jquery.uniform/index.d.ts b/types/jquery.uniform/index.d.ts index b8b44f9b88..685538aa08 100644 --- a/types/jquery.uniform/index.d.ts +++ b/types/jquery.uniform/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/pixelmatrix/uniform // Definitions by: flyfishMT // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.validation/index.d.ts b/types/jquery.validation/index.d.ts index 5e0e2cfa01..95be732332 100644 --- a/types/jquery.validation/index.d.ts +++ b/types/jquery.validation/index.d.ts @@ -2,6 +2,7 @@ // Project: http://jqueryvalidation.org/ // Definitions by: François de Campredon , John Reilly , Anže Videnič // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.watermark/index.d.ts b/types/jquery.watermark/index.d.ts index bb6c5e1f0c..b735bcb2e0 100644 --- a/types/jquery.watermark/index.d.ts +++ b/types/jquery.watermark/index.d.ts @@ -2,6 +2,7 @@ // Project: http://jquery-watermark.googlecode.com // Definitions by: Anwar Javed // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery.window/index.d.ts b/types/jquery.window/index.d.ts index 2dc8f75309..d1e60ff5be 100644 --- a/types/jquery.window/index.d.ts +++ b/types/jquery.window/index.d.ts @@ -2,6 +2,7 @@ // Project: http://fstoke.me/jquery/window/ // Definitions by: Ryan Graham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index a8b2895d6b..3a7ecb5786 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for jQuery 2.0 -// Project: http://jquery.com/ -// Definitions by: Boris Yankov +// Type definitions for jquery 3.2 +// Project: https://jquery.com +// Definitions by: Leonard Thieu +// Boris Yankov // Christian Hoffmeister // Steve Fenton // Diullei Gomes @@ -20,494 +21,4477 @@ // John Reilly // Dick van den Brink // Thomas Schulz -// Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -/* ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - - -/** - * Interface for the AJAX setting that will configure the AJAX request - * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings} - */ -interface JQueryAjaxSettings { - /** - * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. - */ - accepts?: any; - /** - * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success(). - */ - async?: boolean; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. - */ - beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; - /** - * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. - */ - cache?: boolean; - /** - * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - complete? (jqXHR: JQueryXHR, textStatus: string): any; - /** - * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) - */ - contents?: { [key: string]: any; }; - //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" - // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/742 - /** - * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. - */ - contentType?: any; - /** - * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). - */ - context?: any; - /** - * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5) - */ - converters?: { [key: string]: any; }; - /** - * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5) - */ - crossDomain?: boolean; - /** - * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be key-value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). - */ - data?: any; - /** - * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. - */ - dataFilter? (data: any, ty: any): any; - /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). - */ - dataType?: string; - /** - * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. - */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; - /** - * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. - */ - global?: boolean; - /** - * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5) - */ - headers?: { [key: string]: any; }; - /** - * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. - */ - ifModified?: boolean; - /** - * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1) - */ - isLocal?: boolean; - /** - * Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } - */ - jsonp?: any; - /** - * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. - */ - jsonpCallback?: any; - /** - * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0) - */ - method?: string; - /** - * A MIME type to override the XHR MIME type. (version added: 1.5.1) - */ - mimeType?: string; - /** - * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - password?: string; - /** - * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. - */ - processData?: boolean; - /** - * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. - */ - scriptCharset?: string; - /** - * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5) - */ - statusCode?: { [key: string]: any; }; - /** - * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; - /** - * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. - */ - timeout?: number; - /** - * Set this to true if you wish to use the traditional style of parameter serialization. - */ - traditional?: boolean; - /** - * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. - */ - type?: string; - /** - * A string containing the URL to which the request is sent. - */ - url?: string; - /** - * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - username?: string; - /** - * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory. - */ - xhr?: any; - /** - * An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1) - */ - xhrFields?: { [key: string]: any; }; +declare module 'jquery' { + export = factory; } -/** - * Interface for the jqXHR object - * @see {@link https://api.jquery.com/jQuery.ajax/#jqXHR} - */ -interface JQueryXHR extends XMLHttpRequest, JQueryPromise { - /** - * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). - */ - overrideMimeType(mimeType: string): any; - /** - * Cancel the request. - * - * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" - */ - abort(statusText?: string): void; - /** - * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. - */ - then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R|JQueryPromise, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; - /** - * Property containing the parsed response if the response content type is json - */ - responseJSON?: any; - /** - * A function to be called if the request fails. - */ - error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void; +declare module 'jquery/dist/jquery.slim' { + export = factory; } -/** - * Interface for the JQuery callback - * @see {@link https://api.jquery.com/category/callbacks-object/} - */ -interface JQueryCallback { +declare function factory(window: Window, noGlobal?: boolean): JQueryStatic; + +declare const jQuery: JQueryStatic; +declare const $: JQueryStatic; + +// Used by JQuery.Event +type _Event = Event; + +interface JQuery { /** - * Add a callback or a collection of callbacks to a callback list. + * A string containing the jQuery version number. * - * @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/jquery/} + * @since 1.0 */ - add(callbacks: Function): JQueryCallback; + jquery: string; /** - * Add a callback or a collection of callbacks to a callback list. + * The number of elements in the jQuery object. * - * @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/length/} + * @since 1.0 */ - add(callbacks: Function[]): JQueryCallback; - + length: number; /** - * Disable a callback list from doing anything more. - * @see {@link https://api.jquery.com/callbacks.disable/} - */ - disable(): JQueryCallback; - - /** - * Determine if the callbacks list has been disabled. - * @see {@link https://api.jquery.com/callbacks.disabled/} - */ - disabled(): boolean; - - /** - * Remove all of the callbacks from a list. - * @see {@link https://api.jquery.com/callbacks.empty/} - */ - empty(): JQueryCallback; - - /** - * Call all of the callbacks with the given arguments + * Create a new jQuery object with elements added to the set of matched elements. * - * @param arguments The argument or list of arguments to pass back to the callback list. - * @see {@link https://api.jquery.com/callbacks.fire/} + * @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/} + * @since 1.4 */ - fire(...arguments: any[]): JQueryCallback; - + add(selector: JQuery.Selector, context: Element): JQuery; /** - * Determine if the callbacks have already been called at least once. - * @see {@link https://api.jquery.com/callbacks.fired/} - */ - fired(): boolean; - - /** - * Call all callbacks in a list with the given context and arguments. + * Create a new jQuery object with elements added to the set of matched elements. * - * @param context A reference to the context in which the callbacks in the list should be fired. - * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. - * @see {@link https://api.jquery.com/callbacks.fireWith/} + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * 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/} + * @since 1.0 + * @since 1.3.2 */ - fireWith(context?: any, args?: any[]): JQueryCallback; - + add(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery.htmlString | JQuery): JQuery; /** - * Determine whether a supplied callback is in a list + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. * - * @param callback The callback to search for. - * @see {@link https://api.jquery.com/callbacks.has/} + * @param selector A string containing a selector expression to match the current set of elements against. + * @see {@link https://api.jquery.com/addBack/} + * @since 1.8 */ - has(callback: Function): boolean; - + addBack(selector?: JQuery.Selector): this; /** - * Lock a callback list in its current state. - * @see {@link https://api.jquery.com/callbacks.lock/} - */ - lock(): JQueryCallback; - - /** - * Determine if the callbacks list has been locked. - * @see {@link https://api.jquery.com/callbacks.locked/} - */ - locked(): boolean; - - /** - * Remove a callback or a collection of callbacks from a callback list. + * Adds the specified class(es) to each element in the set of matched elements. * - * @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/} + * @param className One or more space-separated classes to be added to the class attribute of each matched element. + * 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/} + * @since 1.0 + * @since 1.4 */ - remove(callbacks: Function): JQueryCallback; + addClass(className: string | ((this: TElement, index: number, currentClassName: string) => string)): this; /** - * Remove a callback or a collection of callbacks from a callback list. + * Insert content, specified by the parameter, after each element in the set of matched elements. * - * @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/} + * @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/} + * @since 1.0 */ - remove(callbacks: Function[]): JQueryCallback; + after(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * 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/} + * @since 1.4 + * @since 1.10 + */ + after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * 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/} + * @since 1.0 + */ + ajaxComplete(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; + /** + * 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/} + * @since 1.0 + */ + ajaxError(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this; + /** + * 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/} + * @since 1.0 + */ + ajaxSend(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; + /** + * 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/} + * @since 1.0 + */ + ajaxStart(handler: (this: Document) => void | false): this; + /** + * 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/} + * @since 1.0 + */ + ajaxStop(handler: (this: Document) => void | false): this; + /** + * 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/} + * @since 1.0 + */ + ajaxSuccess(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @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/} + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + duration: JQuery.Duration, + easing: string, + complete?: (this: TElement) => void): this; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @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/} + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + duration_easing: JQuery.Duration | string, + complete?: (this: TElement) => void): this; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/animate/} + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * @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/} + * @since 1.0 + */ + append(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at + * 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/} + * @since 1.4 + */ + append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements to the end of the target. + * + * @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/} + * @since 1.0 + */ + appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @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/} + * @since 1.0 + * @since 1.1 + */ + attr(attributeName: string, + value: string | number | null | ((this: TElement, index: number, attr: string) => string | number | void | undefined)): this; + /** + * 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/} + * @since 1.0 + */ + attr(attributes: JQuery.PlainObject): this; + /** + * 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/} + * @since 1.0 + */ + attr(attributeName: string): string | undefined; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * @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/} + * @since 1.0 + */ + before(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * 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/} + * @since 1.4 + * @since 1.10 + */ + before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Attach a handler to an event for the elements. + * + * @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/} + * @since 1.0 + * @deprecated 3.0 + */ + bind(eventType: string, eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. + * + * @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 preventBubble Setting the third argument to false will attach a function that prevents the default action from + * occurring and stops the event from bubbling. The default is true. + * @see {@link https://api.jquery.com/bind/} + * @since 1.4.3 + * @deprecated 3.0 + */ + bind(eventType: string, eventData: any, preventBubble: boolean): this; + /** + * Attach a handler to an event for the elements. + * + * @param eventType 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/bind/} + * @since 1.0 + * @deprecated 3.0 + */ + bind(eventType: string, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param preventBubble_eventData Setting the third argument to false will attach a function that prevents the default action from + * occurring and stops the event from bubbling. The default is true. + * An object containing data that will be passed to the event handler. + * @see {@link https://api.jquery.com/bind/} + * @since 1.0 + * @deprecated 3.0 + */ + bind(eventType: string, preventBubble_eventData?: boolean | any): this; + /** + * 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/} + * @since 1.4 + * @deprecated 3.0 + */ + bind(events: JQuery.PlainObject | false>): this; + /** + * Bind an event handler to the "blur" 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/blur/} + * @since 1.4.3 + */ + blur(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + blur(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "change" 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/change/} + * @since 1.4.3 + */ + change(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + change(handler?: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + children(selector?: JQuery.Selector): this; + /** + * 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/} + * @since 1.4 + */ + clearQueue(queueName?: string): this; + /** + * Bind an event handler to the "click" 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/click/} + * @since 1.4.3 + */ + click(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + click(handler?: JQuery.EventHandler | false): this; + /** + * Create a deep copy of the set of matched elements. + * + * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The + * default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back + * 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/} + * @since 1.0 + * @since 1.5 + */ + clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this; + /** + * For each element in the set, get the first element that matches the selector by testing the element + * itself and traversing up through its ancestors in the DOM tree. + * + * @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/} + * @since 1.4 + */ + closest(selector: JQuery.Selector, context: Element): this; + /** + * For each element in the set, get the first element that matches the selector by testing the element + * itself and traversing up through its ancestors in the DOM tree. + * + * @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/} + * @since 1.3 + * @since 1.6 + */ + closest(selector: JQuery.Selector | JQuery | Element): this; + /** + * Get the children of each element in the set of matched elements, including text and comment nodes. + * + * @see {@link https://api.jquery.com/contents/} + * @since 1.2 + */ + contents(): this; + /** + * Bind an event handler to the "contextmenu" 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/contextmenu/} + * @since 1.4.3 + */ + contextmenu(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + contextmenu(handler?: JQuery.EventHandler | false): this; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @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/} + * @since 1.0 + * @since 1.4 + */ + css(propertyName: string, + value: string | number | ((this: TElement, index: number, value: string) => string | number | void | undefined)): this; + /** + * 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/} + * @since 1.0 + */ + css(properties: JQuery.PlainObject string | number | void | undefined)>): this; + /** + * Get the computed style properties for the first element in the set of matched elements. + * + * @param propertyName A CSS property. + * An array of one or more CSS properties. + * @see {@link https://api.jquery.com/css/} + * @since 1.0 + */ + css(propertyName: string): string; + /** + * 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/} + * @since 1.9 + */ + css(propertyNames: string[]): JQuery.PlainObject; + /** + * 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. + * + * @param key Name of the data stored. + * @param undefined + * @see {@link https://api.jquery.com/data/} + * @since 1.2.3 + */ + // tslint:disable-next-line:unified-signatures + data(key: string, undefined: undefined): any; + /** + * Store arbitrary data associated with the matched elements. + * + * @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/} + * @since 1.2.3 + */ + data(key: string, value: any): this; + /** + * 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/} + * @since 1.4.3 + */ + data(obj: JQuery.PlainObject): this; + /** + * 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. + * + * @param key Name of the data stored. + * @see {@link https://api.jquery.com/data/} + * @since 1.2.3 + */ + data(key: string): any; + /** + * 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/} + * @since 1.4 + */ + data(): JQuery.PlainObject; + /** + * Bind an event handler to the "dblclick" 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/dblclick/} + * @since 1.4.3 + */ + dblclick(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + dblclick(handler?: JQuery.EventHandler | false): this; + /** + * Set a timer to delay execution of subsequent items in the queue. + * + * @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/} + * @since 1.4 + */ + delay(duration: JQuery.Duration, queueName?: string): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the + * future, based on a specific set of root elements. + * + * @param selector A selector to filter the elements that trigger the event. + * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or + * "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/} + * @since 1.4.2 + * @deprecated 3.0 + */ + delegate(selector: string, eventType: string, eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the + * future, based on a specific set of root elements. + * + * @param selector A selector to filter the elements that trigger the event. + * @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/} + * @since 1.4.2 + * @deprecated 3.0 + */ + delegate(selector: string, eventType: string, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the + * future, based on a specific set of root elements. + * + * @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/} + * @since 1.4.3 + * @deprecated 3.0 + */ + delegate(selector: string, events: JQuery.PlainObject | false>): this; + /** + * 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/} + * @since 1.2 + */ + dequeue(queueName?: string): this; + /** + * 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/} + * @since 1.4 + */ + detach(selector?: JQuery.Selector): this; + /** + * 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/} + * @since 1.0 + */ + each(fn: (this: TElement, index: number, element: Element) => void | false): this; + /** + * Remove all child nodes of the set of matched elements from the DOM. + * + * @see {@link https://api.jquery.com/empty/} + * @since 1.0 + */ + empty(): this; + /** + * 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/} + * @since 1.0 + */ + end(): this; + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param index An integer indicating the 0-based position of the element. + * @see {@link https://api.jquery.com/eq/} + * @since 1.1.2 + */ + eq(index: number): this; + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param indexFromEnd An integer indicating the position of the element, counting backwards from the last element in the set. + * @see {@link https://api.jquery.com/eq/} + * @since 1.4 + */ + eq(indexFromEnd: number): this; + /** + * 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/} + * @since 1.0 + */ + extend(obj: object): JQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @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/} + * @since 1.4.3 + */ + fadeIn(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements by fading them to opaque. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + fadeIn(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.4.3 + */ + fadeIn(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Hide the matched elements by fading them to transparent. + * + * @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/} + * @since 1.4.3 + */ + fadeOut(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements by fading them to transparent. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + fadeOut(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.4.3 + */ + fadeOut(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Adjust the opacity of the matched elements. + * + * @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 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/} + * @since 1.4.3 + */ + fadeTo(duration: JQuery.Duration, opacity: number, easing: string, complete?: (this: TElement) => void): this; + /** + * Adjust the opacity of the matched elements. + * + * @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/} + * @since 1.0 + */ + fadeTo(duration: JQuery.Duration, opacity: number, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * + * @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/} + * @since 1.4.4 + */ + fadeToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + fadeToggle(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.4.3 + */ + fadeToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param selector A string containing a selector expression to match the current set of elements against. + * 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/} + * @since 1.0 + * @since 1.4 + */ + filter(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, + * jQuery object, or element. + * + * @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/} + * @since 1.0 + * @since 1.6 + */ + find(selector: JQuery.Selector | Element | JQuery): JQuery; + /** + * Stop the currently-running animation, remove all queued animations, and complete all animations for + * the matched elements. + * + * @param queue The name of the queue in which to stop animations. + * @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/} + * @since 1.4 + */ + first(): this; + /** + * Bind an event handler to the "focus" 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/focus/} + * @since 1.4.3 + */ + focus(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + focus(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focusin" event. + * + * @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/} + * @since 1.4.3 + */ + focusin(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.4 + */ + focusin(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focusout" JavaScript event. + * + * @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/} + * @since 1.4.3 + */ + focusout(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.4 + */ + focusout(handler?: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + get(index: number): TElement; + /** + * Retrieve the elements matched by the jQuery object. + * + * @see {@link https://api.jquery.com/get/} + * @since 1.0 + */ + get(): TElement[]; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @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/} + * @since 1.4 + */ + has(selector: string | Element): this; + /** + * 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/} + * @since 1.2 + */ + hasClass(className: string): boolean; + /** + * Set the CSS height of every matched element. + * + * @param value An integer representing the number of pixels, or an integer with an optional unit of measure + * 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/} + * @since 1.0 + * @since 1.4.1 + */ + height(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed height for the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/height/} + * @since 1.0 + */ + height(): number; + /** + * Hide the matched elements. + * + * @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/} + * @since 1.4.3 + */ + hide(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; + /** + * Hide the matched elements. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + hide(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; + /** + * Hide the matched elements. + * + * @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/} + * @since 1.0 + */ + hide(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and + * leaves the elements. + * + * @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/} + * @since 1.0 + * @since 1.4 + */ + hover(handlerInOut: (this: TElement, eventObject: JQuery.Event) => void | false, + handlerOut?: (this: TElement, eventObject: JQuery.Event) => void | false): this; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param htmlString A string of HTML to set as the content of each matched element. + * 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/} + * @since 1.0 + * @since 1.4 + */ + html(htmlString: JQuery.htmlString | ((this: TElement, index: number, oldhtml: JQuery.htmlString) => JQuery.htmlString)): this; + /** + * Get the HTML contents of the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/html/} + * @since 1.0 + */ + html(): string; + /** + * Search for a given element from among the matched elements. + * + * @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/} + * @since 1.0 + * @since 1.4 + */ + index(element?: Element | JQuery | JQuery.Selector): number; + /** + * Set the CSS inner height of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string). + * 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/} + * @since 1.8.0 + */ + innerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * 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/} + * @since 1.2.6 + */ + innerHeight(): number; + /** + * Set the CSS inner width of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string). + * 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/} + * @since 1.8.0 + */ + innerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; + /** + * 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/} + * @since 1.2.6 + */ + innerWidth(): number; + /** + * Insert every element in the set of matched elements after the target. + * + * @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/} + * @since 1.0 + */ + insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements before the target. + * + * @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/} + * @since 1.0 + */ + insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return + * true if at least one of these elements matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + * A function used as a test for every element in the set. It accepts two arguments, index, which is + * the 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. + * One or more elements to match the current set of elements against. + * @see {@link https://api.jquery.com/is/} + * @since 1.0 + * @since 1.6 + */ + is(selector: JQuery.Selector | ((this: TElement, index: number, element: TElement) => boolean) | JQuery | Element | Element[]): boolean; + /** + * Bind an event handler to the "keydown" 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/keydown/} + * @since 1.4.3 + */ + keydown(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + keydown(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keypress" 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/keypress/} + * @since 1.4.3 + */ + keypress(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + keypress(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keyup" 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/keyup/} + * @since 1.4.3 + */ + keyup(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + keyup(handler?: JQuery.EventHandler | false): this; + /** + * Reduce the set of matched elements to the final one in the set. + * + * @see {@link https://api.jquery.com/last/} + * @since 1.4 + */ + last(): this; + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @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/} + * @since 1.0 + */ + load(url: string, + data: string | JQuery.PlainObject, + complete: (this: TElement, responseText: string, textStatus: string, jqXHR: JQuery.jqXHR) => void): this; + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @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/} + * @since 1.0 + */ + load(url: string, + complete_data?: ((this: TElement, responseText: string, textStatus: string, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this; + /** + * Pass each element in the current matched set through a function, producing a new jQuery object + * 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/} + * @since 1.2 + */ + map(callback: (this: TElement, index: number, domElement: TElement) => any | any[] | 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/} + * @since 1.4.3 + */ + mousedown(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mousedown(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to be fired when the mouse enters an element, or trigger that handler 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/mouseenter/} + * @since 1.4.3 + */ + mouseenter(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mouseenter(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler 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/mouseleave/} + * @since 1.4.3 + */ + mouseleave(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mouseleave(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mousemove" 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/mousemove/} + * @since 1.4.3 + */ + mousemove(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mousemove(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseout" 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/mouseout/} + * @since 1.4.3 + */ + mouseout(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mouseout(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseover" 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/mouseover/} + * @since 1.4.3 + */ + mouseover(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mouseover(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseup" 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/mouseup/} + * @since 1.4.3 + */ + mouseup(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + mouseup(handler?: JQuery.EventHandler | false): this; + /** + * Get the immediately following sibling of each element in the set of matched elements. If a selector + * 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/} + * @since 1.0 + */ + next(selector?: JQuery.Selector): this; + /** + * 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/} + * @since 1.2 + */ + nextAll(selector?: string): this; + /** + * Get all following siblings of each element up to but not including the element matched by the + * selector, DOM node, or jQuery object passed. + * + * @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/} + * @since 1.4 + * @since 1.6 + */ + nextUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Remove elements from the set of matched elements. + * + * @param selector A string containing a selector expression, a DOM element, or an array of elements to match against the set. + * A function used as a test for each element in the set. It accepts two arguments, index, which is the + * 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/} + * @since 1.0 + * @since 1.4 + */ + not(selector: JQuery.Selector | JQuery.TypeOrArray | ((this: TElement, index: number, element: TElement) => boolean) | JQuery): this; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as + * "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/} + * @since 1.7 + */ + off(events: string, selector: string, handler: JQuery.EventHandler | false): this; + /** + * Remove an event handler. + * + * @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/} + * @since 1.7 + */ + off(events: JQuery.PlainObject | false>, selector: string): this; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as + * "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/} + * @since 1.7 + */ + off(events: string, selector_handler?: string | JQuery.EventHandler | false): this; + /** + * Remove an event handler. + * + * @param events A jQuery.Event object. + * 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). + * @see {@link https://api.jquery.com/off/} + * @since 1.7 + */ + off(events?: JQuery.Event | JQuery.PlainObject | false>): this; + /** + * Set the current coordinates of every element in the set of matched elements, relative to the document. + * + * @param coordinates An object containing the properties top and left, which are numbers indicating the new top and left + * coordinates for the elements. + * 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/} + * @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/} + * @since 1.2 + */ + offset(): JQuery.Coordinates; + /** + * Get the closest ancestor element that is positioned. + * + * @see {@link https://api.jquery.com/offsetParent/} + * @since 1.2.6 + */ + offsetParent(): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @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 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. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, selector: string | null, data: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @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 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/} + * @since 1.7 + */ + on(events: JQuery.PlainObject | false>, selector: string | null, data: TData): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector_data 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. + * 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. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, selector_data: string | null | TData, handler: JQuery.EventHandler | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @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/} + * @since 1.7 + */ + on(events: string, handler: JQuery.EventHandler | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @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 selector_data 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. + * Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: JQuery.PlainObject | false>, selector_data?: string | null | TData): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @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 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. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: string, selector: string | null, data: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector_data 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. + * 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. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: string, selector_data: string | null | TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @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 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/} + * @since 1.7 + */ + one(events: JQuery.PlainObject | false>, selector: string | null, data: TData): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @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/} + * @since 1.7 + */ + one(events: string, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @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 selector_data 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. + * Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: JQuery.PlainObject | false>, selector_data?: string | null | TData): this; + /** + * Set the CSS outer height of each element in the set of matched elements. + * + * @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/} + * @since 1.8.0 + */ + outerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed outer height (including padding, border, and optionally margin) for the + * 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/} + * @since 1.2.6 + */ + outerHeight(includeMargin?: boolean): number; + /** + * Set the CSS outer width of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * 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/} + * @since 1.8.0 + */ + outerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; + /** + * Get the current computed outer width (including padding, border, and optionally margin) for the + * 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/} + * @since 1.2.6 + */ + outerWidth(includeMargin?: boolean): number; + /** + * 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/} + * @since 1.0 + */ + parent(selector?: JQuery.Selector): this; + /** + * 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/} + * @since 1.0 + */ + parents(selector?: JQuery.Selector): this; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including + * the element matched by the selector, DOM node, or jQuery object. + * + * @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/} + * @since 1.4 + * @since 1.6 + */ + parentsUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * 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/} + * @since 1.2 + */ + position(): JQuery.Coordinates; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * @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/} + * @since 1.0 + */ + prepend(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at + * 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/} + * @since 1.4 + */ + prepend(fn: (this: TElement, elementOfArray: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements to the beginning of the target. + * + * @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/} + * @since 1.0 + */ + prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Get the immediately preceding sibling of each element in the set of matched elements. If a selector + * 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/} + * @since 1.0 + */ + prev(selector?: JQuery.Selector): this; + /** + * 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/} + * @since 1.2 + */ + prevAll(selector?: JQuery.Selector): this; + /** + * Get all preceding siblings of each element up to but not including the element matched by the + * selector, DOM node, or jQuery object. + * + * @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/} + * @since 1.4 + * @since 1.6 + */ + prevUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, + * queued or not, have finished. + * + * @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/} + * @since 1.6 + */ + promise(type: string, target: T): T & JQuery.Promise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, + * queued or not, have finished. + * + * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/promise/} + * @since 1.6 + */ + promise(target: T): T & JQuery.Promise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, + * queued or not, have finished. + * + * @param type The type of queue that needs to be observed. + * @see {@link https://api.jquery.com/promise/} + * @since 1.6 + */ + promise(type?: string): JQuery.Promise; + /** + * Set one or more properties for the set of matched elements. + * + * @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/} + * @since 1.6 + */ + prop(propertyName: string, value: (this: TElement, index: number, oldPropertyValue: any) => any): this; + /** + * Set one or more properties for the set of matched elements. + * + * @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/} + * @since 1.6 + */ + // tslint:disable-next-line:unified-signatures + prop(propertyName: string, value: any): this; + /** + * 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/} + * @since 1.6 + */ + prop(properties: JQuery.PlainObject): this; + /** + * 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/} + * @since 1.6 + */ + prop(propertyName: string): any | undefined; + /** + * 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. + * @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/} + * @since 1.3 + */ + pushStack(elements: ArrayLike, name: string, args: any[]): JQuery; + /** + * 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/} + * @since 1.0 + */ + pushStack(elements: ArrayLike): JQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @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/} + * @since 1.2 + */ + queue(queueName: string, newQueue: JQuery.TypeOrArray>): this; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @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/} + * @since 1.2 + */ + queue(newQueue: JQuery.TypeOrArray>): this; + /** + * 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/} + * @since 1.2 + */ + queue(queueName?: string): JQuery.Queue; + /** + * 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/} + * @since 1.0 + */ + ready(handler: ($: JQueryStatic) => void): this; + /** + * 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/} + * @since 1.0 + */ + remove(selector?: string): this; + /** + * 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/} + * @since 1.0 + */ + removeAttr(attributeName: string): this; + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param className One or more space-separated 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/} + * @since 1.0 + * @since 1.4 + */ + removeClass(className?: string | ((this: TElement, index: number, className: string) => string)): this; + /** + * Remove a previously-stored piece of data. + * + * @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/} + * @since 1.2.3 + * @since 1.7 + */ + removeData(name?: JQuery.TypeOrArray): this; + /** + * 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/} + * @since 1.6 + */ + removeProp(propertyName: string): this; + /** + * 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/} + * @since 1.2 + */ + replaceAll(target: JQuery.Selector | JQuery | JQuery.TypeOrArray): this; + /** + * Replace each element in the set of matched elements with the provided new content and return the set + * of elements that was removed. + * + * @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/} + * @since 1.2 + * @since 1.4 + */ + replaceWith(newContent: JQuery.htmlString | JQuery.TypeOrArray | JQuery | ((this: TElement) => any)): JQuery; + /** + * Bind an event handler to the "resize" 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/resize/} + * @since 1.4.3 + */ + resize(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + resize(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "scroll" 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/scroll/} + * @since 1.4.3 + */ + scroll(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + scroll(handler?: JQuery.EventHandler | false): this; + /** + * 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/} + * @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/} + * @since 1.2.6 + */ + scrollLeft(): number; + /** + * 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/} + * @since 1.2.6 + */ + scrollTop(value: number): this; + /** + * 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/} + * @since 1.2.6 + */ + scrollTop(): number; + /** + * Bind an event handler to the "select" 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/select/} + * @since 1.4.3 + */ + select(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + select(handler?: JQuery.EventHandler | false): this; + /** + * Encode a set of form elements as a string for submission. + * + * @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/} + * @since 1.2 + */ + serializeArray(): JQuery.NameValuePair[]; + /** + * Display the matched elements. + * + * @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/} + * @since 1.4.3 + */ + show(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; + /** + * Display the matched elements. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + show(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; + /** + * Display the matched elements. + * + * @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/} + * @since 1.0 + */ + show(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * 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/} + * @since 1.0 + */ + siblings(selector?: JQuery.Selector): this; + /** + * Reduce the set of matched elements to a subset specified by a range of indices. + * + * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, + * 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/} + * @since 1.1.4 + */ + slice(start: number, end?: number): this; + /** + * Display the matched elements with a sliding motion. + * + * @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/} + * @since 1.4.3 + */ + slideDown(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements with a sliding motion. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + slideDown(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements with a sliding motion. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.4.3 + */ + slideDown(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Display or hide the matched elements with a sliding motion. + * + * @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/} + * @since 1.4.3 + */ + slideToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements with a sliding motion. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + slideToggle(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.4.3 + */ + slideToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Hide the matched elements with a sliding motion. + * + * @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/} + * @since 1.4.3 + */ + slideUp(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements with a sliding motion. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + */ + slideUp(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.4.3 + */ + slideUp(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Stop the currently-running animation on the matched elements. + * + * @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/} + * @since 1.7 + */ + stop(queue: string, clearQueue?: boolean, jumpToEnd?: boolean): this; + /** + * Stop the currently-running animation on the matched elements. + * + * @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/} + * @since 1.2 + */ + stop(clearQueue?: boolean, jumpToEnd?: boolean): this; + /** + * Bind an event handler to the "submit" 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/submit/} + * @since 1.4.3 + */ + submit(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * 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/} + * @since 1.0 + */ + submit(handler?: JQuery.EventHandler | false): this; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will + * 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/} + * @since 1.0 + * @since 1.4 + */ + text(text: string | number | boolean | ((this: TElement, index: number, text: string) => string | number | boolean)): this; + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + * + * @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/} + * @since 1.4 + */ + toArray(): TElement[]; + /** + * Display or hide the matched elements. + * + * @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/} + * @since 1.4.3 + */ + toggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements. + * + * @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/} + * @since 1.0 + */ + toggle(duration: JQuery.Duration, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements. + * + * @param options 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/} + * @since 1.0 + * @since 1.3 + */ + toggle(options?: JQuery.EffectsOptions | boolean): this; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on + * either the class's presence or the value of the state argument. + * + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. + * 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/} + * @since 1.0 + * @since 1.3 + * @since 1.4 + */ + toggleClass(className: string | ((this: TElement, index: number, className: string, state: boolean) => string), + state?: boolean): this; + /** + * + * + * @param state A boolean value to determine whether the class should be added or removed. + * @see {@link https://api.jquery.com/toggleClass/} + * @since 1.4 + * @deprecated 3.0 + */ + toggleClass(state?: boolean): this; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @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/} + * @since 1.0 + * @since 1.3 + */ + trigger(eventType: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject): this; + /** + * Execute all handlers attached to an element for an event. + * + * @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/} + * @since 1.2 + * @since 1.3 + */ + triggerHandler(eventType: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject): undefined | any; + /** + * Remove a previously-attached event handler from the elements. + * + * @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/} + * @since 1.0 + * @since 1.4.3 + * @deprecated 3.0 + */ + unbind(event: string, handler: JQuery.EventHandler | false | false): this; + /** + * Remove a previously-attached event handler from the elements. + * + * @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/} + * @since 1.0 + * @deprecated 3.0 + */ + unbind(event?: string | JQuery.Event): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a + * specific set of root elements. + * + * @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/} + * @since 1.4.2 + * @deprecated 3.0 + */ + undelegate(selector: JQuery.Selector, eventType: string, handler: JQuery.EventHandler | false): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a + * specific set of root elements. + * + * @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/} + * @since 1.4.2 + * @since 1.4.3 + * @deprecated 3.0 + */ + undelegate(selector: JQuery.Selector, eventTypes: string | JQuery.PlainObject | false>): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a + * 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/} + * @since 1.4.2 + * @since 1.6 + * @deprecated 3.0 + */ + undelegate(namespace?: string): this; + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + * + * @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/} + * @since 1.4 + * @since 3.0 + */ + unwrap(selector?: string): this; + /** + * Set the value of each element in the set of matched elements. + * + * @param value A string of text, a number, or an array of strings corresponding to the value of each matched + * 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/} + * @since 1.0 + * @since 1.4 + */ + val(value: string | number | string[] | ((this: TElement, index: number, value: string) => string)): this; + /** + * Get the current value of the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/val/} + * @since 1.0 + */ + val(): string | number | string[] | undefined; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure + * 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/} + * @since 1.0 + * @since 1.4.1 + */ + width(value: string | number | ((this: TElement, index: number, value: number) => string | number)): this; + /** + * Get the current computed width for the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/width/} + * @since 1.0 + */ + width(): number; + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the + * matched elements. When you pass a jQuery collection containing more than one element, or a selector + * matching more than one element, the first element will be used. + * 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/} + * @since 1.0 + * @since 1.4 + */ + wrap(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery)): this; + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + * A callback function returning the HTML content or jQuery object to wrap around all the matched + * 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/} + * @since 1.2 + * @since 1.4 + */ + wrapAll(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement) => string | JQuery)): this; + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap + * around the content of the matched elements. + * 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/} + * @since 1.2 + * @since 1.4 + */ + wrapInner(wrappingElement: JQuery.htmlString | JQuery.Selector | JQuery | Element | ((this: TElement, index: number) => string)): this; } -/** - * Allows jQuery Promises to interop with non-jQuery promises - */ -interface JQueryGenericPromise { - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @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. - * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter} - */ - then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; +interface JQuery extends ArrayLike, Iterable { } +interface JQueryStatic { + Event: JQuery.Event; /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize + * CSS property naming, or create custom properties. * - * @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. - * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter} + * @see {@link https://api.jquery.com/jQuery.cssHooks/} + * @since 1.4.3 */ - then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; + cssHooks: JQuery.PlainObject>; + /** + * 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/} + * @since 1.4.3 + */ + cssNumber: JQuery.PlainObject; + readonly fn: JQuery; + fx: { + /** + * The rate (in milliseconds) at which animations fire. + * + * @see {@link https://api.jquery.com/jQuery.fx.interval/} + * @since 1.4.3 + * @deprecated 3.0 + */ + interval: number; + /** + * Globally disable all animations. + * + * @see {@link https://api.jquery.com/jQuery.fx.off/} + * @since 1.3 + */ + off: boolean; + step: JQuery.PlainObject>; + }; + /** + * A Promise-like object (or "thenable") that resolves when the document is ready. + * + * @see {@link https://api.jquery.com/jQuery.ready/} + * @since 1.8 + */ + ready: JQuery.Thenable; + /** + * A collection of properties that represent the presence of different browser features or bugs. + * Intended for jQuery's internal use; specific properties may be removed when they are no longer + * needed internally to improve page startup performance. For your own project's feature-detection + * 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/} + * @since 1.3 + * @deprecated 1.9 + */ + support: JQuery.PlainObject; + valHooks: JQuery.PlainObject>; + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. + * 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/} + * @since 1.0 + * @since 1.4 + */ + (html: JQuery.htmlString, ownerDocument_attributes: Document | JQuery.PlainObject): JQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @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/} + * @since 1.0 + */ + (selector: JQuery.Selector, context: Element | Document | JQuery): JQuery; + /** + * 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. + * The function to execute when the DOM is ready. + * @see {@link https://api.jquery.com/jQuery/} + * @since 1.0 + * @since 1.4 + */ + (selector_object_callback?: JQuery.Selector | JQuery.TypeOrArray | JQuery.PlainObject | JQuery | (($: JQueryStatic) => void)): 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/} + * @since 1.7 + */ + Callbacks(flags?: string): JQuery.Callbacks; + /** + * A factory function that returns a chainable utility object with methods to register multiple + * callbacks into callback queues, invoke callback queues, and relay the success or failure state of + * 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/} + * @since 1.5 + */ + Deferred(beforeStart?: (this: JQuery.Deferred, + deferred: JQuery.Deferred) => void): JQuery.Deferred; + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @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/} + * @since 1.5 + */ + ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @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/} + * @since 1.0 + */ + ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they + * are processed by $.ajax(). + * + * @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/} + * @since 1.5 + */ + ajaxPrefilter(dataTypes: string, + handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they + * are processed by $.ajax(). + * + * @param handler A handler to set default values for future Ajax requests. + * @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; + /** + * 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/} + * @since 1.1 + */ + ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings; + /** + * Creates an object that handles the actual transmission of Ajax data. + * + * @param dataType A string identifying the data type to use + * @param handler A handler to return the new transport object to use with the data type provided in the first argument. + * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} + * @since 1.5 + */ + ajaxTransport(dataType: string, + handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => JQuery.Transport | void): void; + /** + * Check to see if a DOM element is a descendant of another DOM element. + * + * @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/} + * @since 1.4 + */ + contains(container: Element, contained: Element): boolean; + css(elem: Element, unknown: any): any; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or + * the full data store for the element. + * + * @param element The DOM element to query for the data. + * @param key Name of the data stored. + * @param undefined + * @see {@link https://api.jquery.com/jQuery.data/} + * @since 1.2.3 + */ + // tslint:disable-next-line:unified-signatures + data(element: Element, key: string, undefined: undefined): any; + /** + * Store arbitrary data associated with the specified element. Returns the value that was set. + * + * @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/} + * @since 1.2.3 + */ + data(element: Element, key: string, value: T): T; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or + * the full data store for the element. + * + * @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/} + * @since 1.2.3 + * @since 1.4 + */ + data(element: Element, key?: string): any; + /** + * Execute the next function on the queue for the matched element. + * + * @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/} + * @since 1.3 + */ + dequeue(element: Element, queueName?: string): void; + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. + * Arrays and array-like objects with a length property (such as a function's arguments object) are + * iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @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/} + * @since 1.0 + */ + each(array: ArrayLike, callback: (indexInArray: number, value: T) => false | any): ArrayLike; + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. + * Arrays and array-like objects with a length property (such as a function's arguments object) are + * iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @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/} + * @since 1.0 + */ + each(obj: T, callback: (propertyName: K, valueOfProperty: T[K]) => false | any): T; + /** + * Takes a string and throws an exception containing it. + * + * @param message The message to send out. + * @see {@link https://api.jquery.com/jQuery.error/} + * @since 1.4.1 + */ + error(message: string): never; + /** + * 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/} + * @since 3.0 + */ + escapeSelector(selector: JQuery.Selector): JQuery.Selector; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @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; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @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; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V): T & U & V; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.1.4 + */ + extend(deep: true, target: T, ...objects: U[]): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @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; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W): T & U & V & W; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V): T & U & V; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.0 + */ + extend(target: T, object1: U): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * + * @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/} + * @since 1.0 + */ + extend(target: T, ...objects: U[]): T & U; + /** + * Load data from the server using a HTTP GET request. + * + * @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. 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/} + * @since 1.0 + */ + get(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback | null, + dataType?: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @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. 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/} + * @since 1.0 + */ + get(url: string, + success: JQuery.jqXHR.DoneCallback | null, + dataType: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @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. 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/} + * @since 1.0 + */ + get(url: string, + success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url_settings A string containing the URL to which the request is sent. + * 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/} + * @since 1.0 + * @since 1.12 + * @since 2.2 + */ + get(url_settings?: string | JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @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/} + * @since 1.0 + */ + getJSON(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @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/} + * @since 1.0 + */ + getJSON(url: string, + success_data?: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * + * @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/} + * @since 1.0 + */ + getScript(url: string, + success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Execute some JavaScript code globally. + * + * @param code The JavaScript code to execute. + * @see {@link https://api.jquery.com/jQuery.globalEval/} + * @since 1.0.4 + */ + globalEval(code: string): void; + /** + * Finds the elements of an array which satisfy a filter function. The original array is not affected. + * + * @param array The array-like object to search through. + * @param fn The function to process each item against. The first argument to the function is the item, and the + * second argument is the index. The function should return a Boolean value. this will be the global window object. + * @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/} + * @since 1.0 + */ + grep(array: ArrayLike, + fn: (elementOfArray: T, indexInArray: number) => boolean, + invert?: boolean): T[]; + /** + * 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/} + * @since 1.5 + */ + hasData(element: Element): boolean; + /** + * 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/} + * @since 1.6 + */ + holdReady(hold: boolean): void; + /** + * 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/} + * @since 1.12/2.2 + */ + htmlPrefilter(html: string): string; + /** + * Search for a specified value within an array and return its index (or -1 if not found). + * + * @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/} + * @since 1.2 + */ + inArray(value: T, array: T[], fromIndex?: number): number; + /** + * 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/} + * @since 1.3 + */ + isArray(obj: any): obj is any[]; + /** + * 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/} + * @since 1.4 + */ + isEmptyObject(obj: any): boolean; + /** + * 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/} + * @since 1.2 + */ + isFunction(obj: any): obj is Function; + /** + * Determines whether its argument represents a JavaScript number. + * + * @param value The value to be tested. + * @see {@link https://api.jquery.com/jQuery.isNumeric/} + * @since 1.7 + */ + isNumeric(value: any): value is number; + /** + * 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/} + * @since 1.4 + */ + isPlainObject(obj: any): obj is JQuery.PlainObject; + /** + * 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/} + * @since 1.4.3 + */ + isWindow(obj: any): obj is Window; + /** + * 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/} + * @since 1.1.4 + */ + isXMLDoc(node: Node): boolean; + /** + * 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/} + * @since 1.2 + */ + makeArray(obj: ArrayLike): T[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param array The Array to translate. + * @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/} + * @since 1.0 + */ + map(array: T[], callback: (elementOfArray: T, indexInArray: number) => R): R[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param obj The Object to translate. + * @param callback The function to process each item against. The first argument to the function is the value; the + * 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/} + * @since 1.6 + */ + map(obj: T, callback: (propertyOfObject: T[K], key: K) => R): R[]; + /** + * 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/} + * @since 1.0 + */ + merge(first: ArrayLike, second: ArrayLike): Array; + /** + * 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/} + * @since 1.0 + */ + noConflict(removeAll?: boolean): JQueryStatic; + /** + * An empty function. + * + * @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/} + * @since 1.4.3 + */ + now(): number; + /** + * Create a serialized representation of an array, a plain object, or a jQuery object suitable for use + * in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input + * elements with name/value properties. + * + * @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/} + * @since 1.2 + * @since 1.4 + */ + param(obj: any[] | JQuery.PlainObject | JQuery, traditional?: boolean): string; + /** + * Parses a string into an array of DOM nodes. + * + * @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/} + * @since 1.8 + */ + parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): Node[]; + /** + * Parses a string into an array of DOM nodes. + * + * @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/} + * @since 1.8 + */ + parseHTML(data: string, context_keepScripts?: Document | null | undefined | boolean): Node[]; + /** + * 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/} + * @since 1.4.1 + * @deprecated 3.0 + */ + parseJSON(json: string): any; + /** + * 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/} + * @since 1.5 + */ + parseXML(data: string): XMLDocument; + /** + * Load data from the server using a HTTP POST request. + * + * @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. 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/} + * @since 1.0 + */ + post(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback | null, + dataType?: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @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. 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/} + * @since 1.0 + */ + post(url: string, + success: JQuery.jqXHR.DoneCallback | null, + dataType: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @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. 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/} + * @since 1.0 + */ + post(url: string, + success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url_settings A string containing the URL to which the request is sent. + * 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/} + * @since 1.0 + * @since 1.12 + * @since 2.2 + */ + post(url_settings?: string | JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @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/} + * @since 1.4 + * @since 1.6 + */ + proxy(fn: Function, context: object, ...additionalArguments: any[]): Function; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @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/} + * @since 1.4 + * @since 1.6 + */ + proxy(context: T, name: keyof T, ...additionalArguments: any[]): Function; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element where the array of queued functions is attached. + * @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/} + * @since 1.3 + */ + queue(element: Element, queueName: string, newQueue: JQuery.TypeOrArray>): JQuery; + /** + * Show the queue of functions to be executed on the matched element. + * + * @param element A DOM element to inspect for an attached queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/jQuery.queue/} + * @since 1.3 + */ + queue(element: Element, queueName?: string): JQuery.Queue; + /** + * 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/} + * @since 3.1 + */ + readyException(error: Error): any; + /** + * Remove a previously-stored piece of data. + * + * @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/} + * @since 1.2.3 + */ + removeData(element: Element, name?: string): JQuery; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @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/} + * @since 1.1 + */ + speed(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @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/} + * @since 1.1 + */ + speed(easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @param duration A string or number determining how long the animation will run. + * @param easing_complete_settings 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/} + * @since 1.0 + * @since 1.1 + */ + speed(duration: JQuery.Duration, + easing_complete_settings: string | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @param duration_easing_complete_settings A string or number determining how long the animation will run. + * 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/} + * @since 1.0 + * @since 1.1 + */ + speed(duration_easing_complete_settings?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions; + /** + * 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/} + * @since 1.0 + */ + trim(str: string): string; + /** + * 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/} + * @since 1.4.3 + */ + type(obj: any): 'array' | 'boolean' | 'date' | 'error' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'string' | 'symbol' | 'undefined'; + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on + * arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + * @see {@link https://api.jquery.com/jQuery.unique/} + * @since 1.1.3 + * @deprecated 3.0 + */ + unique(array: T[]): T[]; + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on + * arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + * @see {@link https://api.jquery.com/jQuery.uniqueSort/} + * @since 1.12-2.2 + */ + uniqueSort(array: T[]): T[]; + when(jqxhr1: JQuery.jqXHR, jqxhr2: JQuery.jqXHR, jqxhr3: JQuery.jqXHR): JQuery.Promise<[T | U | V, string, JQuery.jqXHR]>; + when(jqxhr1: JQuery.jqXHR, jqxhr2: JQuery.jqXHR): JQuery.Promise<[T | U, string, JQuery.jqXHR]>; + when(jqxhr1: JQuery.jqXHR): JQuery.Promise>; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually + * Deferred objects that represent asynchronous events. + * + * @param deferreds Zero or more Thenable objects. + * @see {@link https://api.jquery.com/jQuery.when/} + * @since 1.5 + */ + when(...deferreds: any[]): JQuery.Promise; } +declare namespace JQuery { + type TypeOrArray = T | T[]; + + /** + * A string is designated htmlString in jQuery documentation when it is used to represent one or more + * DOM elements, typically to be created and inserted in the document. When passed as an argument of + * the jQuery() function, the string is identified as HTML if it starts with ) and is parsed + * as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it + * contained anywhere within the string. + */ + type htmlString = string; + /** + * A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most + * cases, the DOM document present in all browsers, but can also be an XML document received via Ajax. + */ + type Selector = string; + + /** + * The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain + * object is, in other words, an Object object. It is designated "plain" in jQuery documentation to + * distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and + * host objects such as document, all of which have a typeof value of "object." + */ + interface PlainObject { + [key: string]: T; + } + + // region Ajax + + /** + * @see {@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings} + */ + interface AjaxSettings { + /** + * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept + * request header. This header tells the server what kind of response it will accept in return. + */ + accepts?: PlainObject; + /** + * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need + * synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests + * do not support synchronous operation. Note that synchronous requests may temporarily lock the + * browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: + * false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback + * options instead of the corresponding methods of the jqXHR object such as jqXHR.done(). + */ + async?: boolean; + /** + * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, + * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and + * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend + * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless + * of the type of request. + */ + beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettings): false | void; + /** + * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache + * to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" + * to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a + * POST is made to a URL that has already been requested by a GET. + */ + cache?: boolean; + /** + * A function to be called when the request finishes (after success and error callbacks are executed). + * The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a + * string categorizing the status of the request ("success", "notmodified", "nocontent", "error", + * "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of + * functions. Each function will be called in turn. This is an Ajax Event. + */ + complete?: TypeOrArray>; + /** + * An object of string/regular-expression pairs that determine how jQuery will parse the response, + * given its content type. + */ + contents?: PlainObject; + /** + * When sending data to the server, use this content type. Default is + * "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly + * pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). + * As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C + * XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset + * will not force the browser to change the encoding. Note: For cross-domain requests, setting the + * content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or + * text/plain will trigger the browser to send a preflight OPTIONS request to the server. + */ + contentType?: string | false; + /** + * This object will be the context of all Ajax-related callbacks. By default, the context is an object + * that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). + */ + context?: TContext; + /** + * An object containing dataType-to-dataType converters. Each converter's value is a function that + * returns the transformed value of the response. + */ + converters?: PlainObject<((value: any) => any) | true>; + /** + * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of + * crossDomain to true. This allows, for example, server-side redirection to another domain. + */ + crossDomain?: boolean; + /** + * Data to be sent to the server. It is converted to a query string, if not already a string. It's + * appended to the url for GET-requests. See processData option to prevent this automatic processing. + * Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same + * key based on the value of the traditional setting (described below). + */ + data?: PlainObject | string | any[]; + /** + * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering + * function to sanitize the response. You should return the sanitized data. The function accepts two + * arguments: The raw data returned from the server and the 'dataType' parameter. + */ + dataFilter?(data: string, type: string): any; + /** + * The type of data that you're expecting back from the server. If none is specified, jQuery will try + * to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON + * will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be + * returned as a string). The available types (and the result passed as the first argument to your + * success callback) are: + * + * "xml": Returns a XML document that can be processed via jQuery. + * + * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM. + * + * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by + * appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to + * true. Note: This will turn POSTs into GETs for remote-domain requests. + * + * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests + * are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON + * data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of + * jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} + * instead. (See json.org for more information on proper JSON formatting.) + * + * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to + * specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to + * the URL unless the cache option is set to true. + * + * "text": A plain text string. + * + * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it + * received in the Content-Type header to what you require. For example, if you want a text response to + * be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it + * received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string + * such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from + * jsonp to text, and then from text to xml. + */ + dataType?: 'xml' | 'html' | 'script' | 'json' | 'jsonp' | 'text' | string; + /** + * A function to be called if the request fails. The function receives three arguments: The jqXHR (in + * jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an + * optional exception object, if one occurred. Possible values for the second argument (besides null) + * are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives + * the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery + * 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: + * This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. + */ + error?: TypeOrArray>; + /** + * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to + * prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to + * control various Ajax Events. + */ + global?: boolean; + /** + * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest + * transport. The header X-Requested-With: XMLHttpRequest is always added, but its default + * XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from + * within the beforeSend function. + */ + headers?: PlainObject; + /** + * Allow the request to be successful only if the response has changed since the last request. This is + * done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery + * 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. + */ + ifModified?: boolean; + /** + * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery + * does not recognize it as such by default. The following protocols are currently recognized as local: + * file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so + * once in the $.ajaxSetup() method. + */ + isLocal?: boolean; + /** + * Override the callback function name in a JSONP request. This value will be used instead of + * 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would + * result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false + * prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for + * transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, + * { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax + * requests, consider setting the jsonp property to false for security reasons. + */ + jsonp?: string | boolean; + /** + * Specify the callback function name for a JSONP request. This value will be used instead of the + * random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name + * as it'll make it easier to manage the requests and provide callbacks and error handling. You may + * want to specify the callback when you want to enable better browser caching of GET requests. As of + * jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback + * is set to the return value of that function. + */ + jsonpCallback?: string | ((this: TContext) => string); + /** + * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). + */ + method?: string; + /** + * A mime type to override the XHR mime type. + */ + mimeType?: string; + /** + * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + password?: string; + /** + * By default, data passed in to the data option as an object (technically, anything other than a + * string) will be processed and transformed into a query string, fitting to the default content-type + * "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, + * set this option to false. + */ + processData?: boolean; + /** + * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or + * "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. + * Used when the character set on the local page is not the same as the one on the remote script. + */ + scriptCharset?: string; + /** + * An object of numeric HTTP codes and functions to be called when the response has the corresponding + * code. + * + * If the request is successful, the status code functions take the same parameters as the success + * callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. + */ + statusCode?: PlainObject | Ajax.ErrorCallback>; + /** + * A function to be called if the request succeeds. The function gets passed three arguments: The data + * returned from the server, formatted according to the dataType parameter or the dataFilter callback + * function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, + * XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each + * function will be called in turn. This is an Ajax Event. + */ + success?: TypeOrArray>; + /** + * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This + * will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the + * $.ajax call is made; if several other requests are in progress and the browser has no connections + * available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and + * below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any + * object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be + * cancelled by a timeout; the script will run even if it arrives after the timeout period. + */ + timeout?: number; + /** + * Set this to true if you wish to use the traditional style of param serialization. + */ + traditional?: boolean; + /** + * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. + */ + type?: string; + /** + * A string containing the URL to which the request is sent. + */ + url?: string; + /** + * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + username?: string; + /** + * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), + * the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or + * enhancements to the factory. + */ + xhr?(): XMLHttpRequest; + /** + * An object of fieldName-fieldValue pairs to set on the native XHR object. + * + * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS + * requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ + * should you require the use of it. + */ + xhrFields?: PlainObject; + } + + namespace Ajax { + type SuccessTextStatus = 'success' | 'notmodified' | 'nocontent'; + type ErrorTextStatus = 'timeout' | 'error' | 'abort' | 'parsererror'; + type TextStatus = SuccessTextStatus | ErrorTextStatus; + + interface SuccessCallback { + (this: TContext, data: any, textStatus: SuccessTextStatus, jqXHR: JQuery.jqXHR): void; + } + + interface ErrorCallback { + (this: TContext, jqXHR: jqXHR, textStatus: ErrorTextStatus | null, errorThrown: string): void; + } + + interface CompleteCallback { + (this: TContext, jqXHR: jqXHR, textStatus: TextStatus): void; + } + } + + interface Transport { + send(headers: PlainObject, completeCallback: Transport.SuccessCallback): void; + abort(): void; + } + + namespace Transport { + interface SuccessCallback { + (status: number, statusText: Ajax.TextStatus, responses?: PlainObject, headers?: string): void; + } + } + + /** + * @see {@link http://api.jquery.com/jquery.ajax/#jqXHR} + */ + interface jqXHR extends Pick { + responseJSON: any; + statusCode(map: PlainObject | Ajax.ErrorCallback>): void; + + /** + * 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/} + * @since 1.6 + */ + always(alwaysCallback: TypeOrArray>, + ...alwaysCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (jqXHR: this, textStatus: Ajax.ErrorTextStatus, errorThrown: string) => never): Deferred; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (jqXHR: this, textStatus: Ajax.ErrorTextStatus, errorThrown: string) => UResolve | Thenable): Deferred; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @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/} + * @since 1.5 + */ + done(doneCallback: TypeOrArray>, + ...doneCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @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/} + * @since 1.5 + */ + fail(failCallback: TypeOrArray, + ...failCallbacks: Array>): this; + /** + * Utility method to filter and/or chain Deferreds. + * + * @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/} + * @since 1.6 + * @since 1.7 + * @deprecated 1.8 + */ + pipe(doneFilter: ((data: TResolve, textStatus: Ajax.SuccessTextStatus, jqXHR: this) => UResolve | Thenable) | null, + failFilter?: ((jqXHR: this, textStatus: Ajax.ErrorTextStatus, errorThrown: string) => UReject | Thenable) | null): Deferred; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @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/} + * @since 1.7 + */ + progress(progressCallback: TypeOrArray, + ...progressCallbacks: Array>): this; + /** + * 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/} + * @since 1.5 + */ + promise(target: TTarget): JQuery.Promise & TTarget; + /** + * Return a Deferred's Promise object. + * + * @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/} + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @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/} + * @since 1.8 + */ + then(doneFilter: ((data: TResolve, textStatus: Ajax.SuccessTextStatus, jqXHR: this) => UResolve | Thenable) | null, + failFilter?: ((jqXHR: this, textStatus: Ajax.ErrorTextStatus, errorThrown: string) => UReject | Thenable) | null): Deferred; + } + + namespace jqXHR { + interface DoneCallback { + (data: TResolve, textStatus: Ajax.SuccessTextStatus, jqXHR: jqXHR): void; + } + + interface FailCallback { + (jqXHR: this, textStatus: Ajax.ErrorTextStatus | null, errorThrown: string): void; + } + + interface AlwaysCallback { + (data_jqXHR: TResolve | jqXHR, textStatus: Ajax.TextStatus, jqXHR_errorThrown: jqXHR | string): void; + } + + interface ProgressCallback { + (...values: any[]): void; + } + } + + // endregion + + // region Callbacks + + interface Callbacks { + /** + * Add a callback or a collection of callbacks to a 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/} + * @since 1.7 + */ + add(callbacks: TypeOrArray): this; + /** + * Disable a callback list from doing anything more. + * + * @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/} + * @since 1.7 + */ + disabled(): boolean; + /** + * Remove all of the callbacks from a list. + * + * @see {@link https://api.jquery.com/callbacks.empty/} + * @since 1.7 + */ + empty(): this; + /** + * 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/} + * @since 1.7 + */ + fire(...args: any[]): this; + /** + * Call all callbacks in a list with the given context and arguments. + * + * @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/} + * @since 1.7 + */ + fireWith(context?: object, args?: TypeOrArray): this; + /** + * Determine if the callbacks have already been called at least once. + * + * @see {@link https://api.jquery.com/callbacks.fired/} + * @since 1.7 + */ + fired(): boolean; + /** + * Determine whether or not the list has any callbacks attached. If a callback is provided as an + * argument, determine whether it is in a list. + * + * @param callback The callback to search for. + * @see {@link https://api.jquery.com/callbacks.has/} + * @since 1.7 + */ + has(callback?: Function): boolean; + /** + * Lock a callback list in its current state. + * + * @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/} + * @since 1.7 + */ + locked(): boolean; + /** + * 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/} + * @since 1.7 + */ + remove(callbacks: TypeOrArray): this; + } + + // endregion + + // region CSS + + interface CSSHook { + get(this: this, elem: TElement, computed: any, extra: any): any; + set(this: this, elem: TElement, value: any): void; + } + + // endregion + + // region Deferred + + /** + * Any object that has a then method. + */ + interface Thenable extends PromiseLike { } + + interface Deferred { + /** + * 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/} + * @since 1.6 + */ + always(alwaysCallback: TypeOrArray>, + ...alwaysCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (...reasons: TReject[]) => UResolve | Thenable): Deferred; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @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/} + * @since 1.5 + */ + done(doneCallback: TypeOrArray>, + ...doneCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @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/} + * @since 1.5 + */ + fail(failCallback: TypeOrArray>, + ...failCallbacks: Array>>): this; + /** + * Call the progressCallbacks on a Deferred object with the given args. + * + * @param args Optional arguments that are passed to the progressCallbacks. + * @see {@link https://api.jquery.com/deferred.notify/} + * @since 1.7 + */ + notify(...args: TNotify[]): this; + /** + * Call the progressCallbacks on a Deferred object with the given context and args. + * + * @param context Context passed to the progressCallbacks as the this object. + * @param args An optional array of arguments that are passed to the progressCallbacks. + * @see {@link https://api.jquery.com/deferred.notifyWith/} + * @since 1.7 + */ + notifyWith(context: object, ...args: TNotify[]): this; + /** + * Utility method to filter and/or chain Deferreds. + * + * @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/} + * @since 1.6 + * @since 1.7 + * @deprecated 1.8 + */ + pipe(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Deferred; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @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/} + * @since 1.7 + */ + progress(progressCallback: TypeOrArray>, + ...progressCallbacks: Array>>): this; + /** + * 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/} + * @since 1.5 + */ + promise(target: TTarget): JQuery.Promise & TTarget; + /** + * Return a Deferred's Promise object. + * + * @see {@link https://api.jquery.com/deferred.promise/} + * @since 1.5 + */ + promise(): JQuery.Promise; + /** + * 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/} + * @since 1.5 + */ + reject(...args: TReject[]): this; + /** + * Reject a Deferred object and call any failCallbacks with the given context and args. + * + * @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/} + * @since 1.5 + */ + rejectWith(context: object, ...args: TReject[]): this; + /** + * 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/} + * @since 1.5 + */ + resolve(...args: TResolve[]): this; + /** + * Resolve a Deferred object and call any doneCallbacks with the given context and args. + * + * @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/} + * @since 1.5 + */ + resolveWith(context: object, ...args: TResolve[]): this; + /** + * Determine the current state of a Deferred object. + * + * @see {@link https://api.jquery.com/deferred.state/} + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @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/} + * @since 1.8 + */ + then(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Deferred; + } + + namespace Deferred { + interface DoneCallback { + (...values: TResolve[]): void; + } + + interface FailCallback { + (...reasons: TReject[]): void; + } + + interface AlwaysCallback { + (...values_reasons: Array): void; + } + + interface ProgressCallback { + (...values: TNotify[]): void; + } + } + + /** + * 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} + */ + interface Promise extends Pick, + 'always' | 'done' | 'fail' | 'progress' | 'promise' | 'state'> { + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (...reasons: TReject[]) => UReject | Thenable): Promise; + /** + * Utility method to filter and/or chain Deferreds. + * + * @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/} + * @since 1.6 + * @since 1.7 + * @deprecated 1.8 + */ + pipe(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Promise; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @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/} + * @since 1.8 + */ + then(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Promise; + } + + // endregion + + // region Effects + + type Duration = number | 'fast' | 'slow'; + type Queue = { 0: string; } & Array>; + + interface QueueFunction { + (this: TElement, next: () => void): void; + } + + /** + * @see {@link https://api.jquery.com/animate/#animate-properties-options} + */ + interface EffectsOptions { + /** + * A function to be called when the animation on an element completes or stops without completing (its + * Promise object is either resolved or rejected). + */ + always?(this: TElement, animation: JQuery.Promise, jumpedToEnd: boolean): void; + /** + * A function that is called once the animation on an element is complete. + */ + complete?(this: TElement): void; + /** + * A function to be called when the animation on an element completes (its Promise object is resolved). + */ + done?(this: TElement, animation: JQuery.Promise, jumpedToEnd: boolean): void; + /** + * A string or number determining how long the animation will run. + */ + duration?: Duration; + /** + * A string indicating which easing function to use for the transition. + */ + easing?: string; + /** + * A function to be called when the animation on an element fails to complete (its Promise object is rejected). + */ + fail?(this: TElement, animation: JQuery.Promise, jumpedToEnd: boolean): void; + /** + * A function to be called after each step of the animation, only once per animated element regardless + * of the number of animated properties. + */ + progress?(this: TElement, animation: JQuery.Promise, progress: number, remainingMs: number): void; + /** + * A Boolean indicating whether to place the animation in the effects queue. If false, the animation + * will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case + * the animation is added to the queue represented by that string. When a custom queue name is used the + * animation does not automatically start; you must call .dequeue("queuename") to start it. + */ + queue?: boolean | string; + /** + * An object containing one or more of the CSS properties defined by the properties argument and their + * corresponding easing functions. + */ + specialEasing?: PlainObject; + /** + * A function to call when the animation on an element begins. + */ + start?(this: TElement, animation: JQuery.Promise): void; + /** + * A function to be called for each animated property of each animated element. This function provides + * an opportunity to modify the Tween object to change the value of the property before it is set. + */ + step?(this: TElement, now: number, tween: Tween): void; + } + + interface SpeedSettings { + /** + * A string or number determining how long the animation will run. + */ + duration?: Duration; + /** + * A string indicating which easing function to use for the transition. + */ + easing?: string; + /** + * A function to call once the animation is complete. + */ + complete?(this: TElement): void; + } + + // Undocumented + // https://github.com/jquery/api.jquery.com/issues/391 + // https://github.com/jquery/api.jquery.com/issues/61 + class Tween { + easing: string; + elem: TElement; + end: number; + now: number; + options: EffectsOptions; + pos: number; + prop: string; + start: number; + unit: string; + } + + interface AnimationHook { + (fx: JQuery.Tween): void; + } + + // endregion + + // region Events + + class Event { + /** + * The current DOM element within the event bubbling phase. + * + * @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/} + * @since 1.1 + */ + data: TData; + /** + * The element where the currently-called jQuery event handler was attached. + * + * @see {@link https://api.jquery.com/event.delegateTarget/} + * @since 1.7 + */ + delegateTarget: TTarget; + /** + * Indicates whether the META key was pressed when the event fired. + * + * @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/} + * @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/} + * @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/} + * @since 1.0.4 + */ + pageY: number; + /** + * The other DOM element involved in the event, if any. + * + * @see {@link https://api.jquery.com/event.relatedTarget/} + * @since 1.1.4 + */ + relatedTarget: TTarget | null; + /** + * 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/} + * @since 1.3 + */ + result: any; + /** + * The DOM element that initiated the event. + * + * @see {@link https://api.jquery.com/event.target/} + * @since 1.0 + */ + target: TTarget; + /** + * The difference in milliseconds between the time the browser created the event and January 1, 1970. + * + * @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/} + * @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/} + * @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/} + * @since 1.3 + */ + isDefaultPrevented(): boolean; + + /** + * Returns whether event.stopImmediatePropagation() was ever called on this event object. + * + * @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/} + * @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/} + * @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/} + * @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/} + * @since 1.0 + */ + stopPropagation(): void; + } + + interface Event extends Partial> { + originalTarget?: TTarget; + originalEvent: _Event; + new(event: string, properties?: T): JQuery.Event & T; + new(properties: T): JQuery.Event & T; + (event: string, properties?: T): JQuery.Event & T; + (properties: T): JQuery.Event & T; + } + + // Extra parameters can be passed from trigger() + interface EventHandler { + (this: TContext, eventObject: JQuery.Event, ...args: any[]): void | false | any; + } + + // Provided for convenience for use with jQuery.Event.which + const enum Mouse { + None = 0, + Left = 1, + Middle = 2, + Right = 3 + } + + // Provided for convenience for use with jQuery.Event.which + const enum Key { + Backspace = 8, + Tab = 9, + Enter = 13, + Shift = 16, + Control = 17, + Alt = 18, + CapsLock = 20, + Escape = 27, + Space = 32, + PageUp = 33, + PageDown = 34, + End = 35, + Home = 36, + ArrowLeft = 37, + ArrowUp = 38, + ArrowRight = 39, + ArrowDown = 40, + + Semicolon = 186, + Colon = 186, + EqualsSign = 187, + Plus = 187, + Comma = 188, + LessThanSign = 188, + Minus = 189, + Underscore = 189, + Period = 190, + GreaterThanSign = 190, + ForwardSlash = 191, + QuestionMark = 191, + Backtick = 192, + Tilde = 192, + OpeningSquareBracket = 219, + OpeningCurlyBrace = 219, + Backslash = 220, + Pipe = 220, + ClosingSquareBracket = 221, + ClosingCurlyBrace = 221, + SingleQuote = 222, + DoubleQuote = 222, + + Pause = 19, + PrintScreen = 44, + Insert = 45, + Delete = 46, + Num0 = 48, + Num1 = 49, + Num2 = 50, + Num3 = 51, + Num4 = 52, + Num5 = 53, + Num6 = 54, + Num7 = 55, + Num8 = 56, + Num9 = 57, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + MetaLeft = 91, + MetaRight = 92, + ContextMenu = 93, + Numpad0 = 96, + Numpad1 = 97, + Numpad2 = 98, + Numpad3 = 99, + Numpad4 = 100, + Numpad5 = 101, + Numpad6 = 102, + Numpad7 = 103, + Numpad8 = 104, + Numpad9 = 105, + NumpadMultiply = 106, + NumpadAdd = 107, + NumpadSubtract = 109, + NumpadDecimal = 110, + NumpadDivide = 111, + F1 = 112, + F2 = 113, + F3 = 114, + F4 = 115, + F5 = 116, + F6 = 117, + F7 = 118, + F8 = 119, + F9 = 120, + F10 = 121, + F11 = 122, + F12 = 123, + NumLock = 144, + ScrollLock = 145 + } + + // endregion + + interface NameValuePair { + name: string; + value: string; + } + + interface Coordinates { + left: number; + top: number; + } + + interface ValHook { + get?(elem: TElement): any; + set?(elem: TElement, value: any): any; + } +} + +// region Legacy types + +interface JQueryCallback extends JQuery.Callbacks { } +interface JQueryDeferred extends JQuery.Deferred { } +interface JQueryEventObject extends JQuery.Event { } +interface JQueryEventConstructor extends JQuery.Event { } +interface JQueryDeferred extends JQuery.Deferred { } +interface JQueryAjaxSettings extends JQuery.AjaxSettings { } +interface JQueryAnimationOptions extends JQuery.EffectsOptions { } +interface JQueryCoordinates extends JQuery.Coordinates { } +interface JQueryGenericPromise extends JQuery.Thenable { } +interface JQueryXHR extends JQuery.jqXHR { } +interface JQueryPromise extends JQuery.Promise { } +interface JQuerySerializeArrayElement extends JQuery.NameValuePair { } + /** - * Interface for the JQuery promise/deferred callbacks + * @deprecated 1.9 + */ +interface JQuerySupport extends JQuery.PlainObject { } + +// Legacy types that are not represented in the current type definitions are marked deprecated. + +/** + * @deprecated */ interface JQueryPromiseCallback { (value?: T, ...args: any[]): void; } - -interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; -} - /** - * Interface for the JQuery promise, part of callbacks - * @see {@link https://api.jquery.com/category/deferred-object/} + * @deprecated */ -interface JQueryPromise extends JQueryGenericPromise { +interface JQueryParam { /** - * Determine the current state of a Deferred object. - * @see {@link https://api.jquery.com/deferred.state/} - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. * - * @param alwaysCallback1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbackN 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/} + * @param obj An array or object to serialize. + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallback1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see {@link https://api.jquery.com/deferred.done/} - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallback1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.fail/} - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallback1 A function, or array of functions, to be called when the Deferred generates progress notifications. - * @param progressCallbackN Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. - * @see {@link https://api.jquery.com/deferred.progress/} - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - - /** - * 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/} - */ - promise(target?: any): JQueryPromise; + (obj: any, traditional?: boolean): string; } - /** - * Interface for the JQuery deferred, part of callbacks - * @see {@link https://api.jquery.com/category/deferred-object/} - */ -interface JQueryDeferred extends JQueryGenericPromise { - /** - * Determine the current state of a Deferred object. - * @see {@link https://api.jquery.com/deferred.state/} - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallback1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbackN 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/} - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallback1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see {@link https://api.jquery.com/deferred.done/} - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallback1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.fail/} - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallback1 A function, or array of functions, to be called when the Deferred generates progress notifications. - * @param progressCallbackN Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. - * @see {@link https://api.jquery.com/deferred.progress/} - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given args. - * - * @param args Optional arguments that are passed to the progressCallbacks. - * @see {@link https://api.jquery.com/deferred.notify/} - */ - notify(value?: any, ...args: any[]): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given context and args. - * - * @param context Context passed to the progressCallbacks as the this object. - * @param args Optional arguments that are passed to the progressCallbacks. - * @see {@link https://api.jquery.com/deferred.notifyWith/} - */ - notifyWith(context: any, args?: any[]): JQueryDeferred; - - /** - * 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/} - */ - reject(value?: any, ...args: any[]): JQueryDeferred; - /** - * Reject a Deferred object and call any failCallbacks with the given context and args. - * - * @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/} - */ - rejectWith(context: any, args?: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given args. - * - * @param value First argument passed to doneCallbacks. - * @param args Optional subsequent arguments that are passed to the doneCallbacks. - * @see {@link https://api.jquery.com/deferred.resolve/} - */ - resolve(value?: T, ...args: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * - * @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/} - */ - resolveWith(context: any, args?: T[]): JQueryDeferred; - - /** - * 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/} - */ - promise(target?: any): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; -} - -/** - * Interface of the JQuery extension of the W3C event object - * @see {@link https://api.jquery.com/category/events/event-object/} + * @deprecated */ interface BaseJQueryEventObject extends Event { /** @@ -601,14 +4585,18 @@ interface BaseJQueryEventObject extends Event { */ metaKey: boolean; } - +/** + * @deprecated + */ interface JQueryInputEventObject extends BaseJQueryEventObject { altKey: boolean; ctrlKey: boolean; metaKey: boolean; shiftKey: boolean; } - +/** + * @deprecated + */ interface JQueryMouseEventObject extends JQueryInputEventObject { button: number; clientX: number; @@ -620,3198 +4608,35 @@ interface JQueryMouseEventObject extends JQueryInputEventObject { screenX: number; screenY: number; } - +/** + * @deprecated + */ interface JQueryKeyEventObject extends JQueryInputEventObject { char: any; charCode: number; key: any; keyCode: number; } - -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ -} - /** - * A collection of properties that represent the presence of different browser features or bugs. - * - * Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally - * to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the - * use of an external library such as {@link http://modernizr.com/|Modernizr} instead of dependency on properties - * in jQuery.support. - * - * @deprecated since version 1.9 + * @deprecated */ -interface JQuerySupport { - ajax?: boolean; - boxModel?: boolean; - changeBubbles?: boolean; - checkClone?: boolean; - checkOn?: boolean; - cors?: boolean; - cssFloat?: boolean; - hrefNormalized?: boolean; - htmlSerialize?: boolean; - leadingWhitespace?: boolean; - noCloneChecked?: boolean; - noCloneEvent?: boolean; - opacity?: boolean; - optDisabled?: boolean; - optSelected?: boolean; - scriptEval? (): boolean; - style?: boolean; - submitBubbles?: boolean; - tbody?: boolean; +interface JQueryPromiseOperator { + (callback1: JQuery.TypeOrArray>, + ...callbacksN: Array>>): JQueryPromise; } - -interface JQueryParam { - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - */ - (obj: any): string; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - */ - (obj: any, traditional: boolean): string; -} - /** - * The interface used to construct jQuery events (with $.Event). It is - * defined separately instead of inline in JQueryStatic to allow - * overriding the construction function with specific strings - * returning specific event objects. + * @deprecated */ -interface JQueryEventConstructor { - (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; -} - -/** - * The interface used to specify coordinates. - */ -interface JQueryCoordinates { - left: number; - top: number; -} - -/** - * Elements in the array returned by serializeArray() - */ -interface JQuerySerializeArrayElement { - name: string; - value: string; -} - -/** - * @see {@link https://api.jquery.com/animate/} - */ -interface JQueryAnimationOptions { - /** - * A string or number determining how long the animation will run. - */ - duration?: any; - /** - * A string indicating which easing function to use for the transition. - */ - easing?: string; - /** - * A function to call once the animation is complete. - */ - complete?: Function; - /** - * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. - */ - step?: (now: number, tween: any) => any; - /** - * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) - */ - progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; - /** - * A function to call when the animation begins. (version added: 1.8) - */ - start?: (animation: JQueryPromise) => any; - /** - * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) - */ - done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) - */ - fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) - */ - always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. - */ - queue?: any; - /** - * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) - */ - specialEasing?: Object; -} - interface JQueryEasingFunction { - ( percent: number ): number; + (percent: number): number; } - +/** + * @deprecated + */ interface JQueryEasingFunctions { - [ name: string ]: JQueryEasingFunction; + [name: string]: JQueryEasingFunction; linear: JQueryEasingFunction; swing: JQueryEasingFunction; } -/** - * Static members of jQuery (those on $ and jQuery themselves) - * - * @see {@link https://api.jquery.com/Types/#jQuery} - */ -interface JQueryStatic { - - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @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/#jQuery-ajax-settings} - */ - ajax(settings: JQueryAjaxSettings): JQueryXHR; - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @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 {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-url-settings} - */ - ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; - - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @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/} - */ - ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param handler A handler to set default values for future Ajax requests. - * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} - */ - ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - - /** - * Creates an object that handles the actual transmission of Ajax data. - * - * @param dataType A string identifying the data type to use. - * @param handler A handler to return the new transport object to use with the data type provided in the first argument. - * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} - */ - ajaxTransport(dataType: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - - ajaxSettings: JQueryAjaxSettings; - - /** - * 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/} - */ - ajaxSetup(options: JQueryAjaxSettings): void; - - /** - * Load data from the server using a HTTP GET request. - * - * @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. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-url-data-success-dataType} - */ - get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @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. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-url-data-success-dataType} - */ - get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param settings The JQueryAjaxSettings to be used for the request - * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-settings} - */ - get(settings : JQueryAjaxSettings): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @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.getJSON/} - */ - getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @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/} - */ - getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load a JavaScript file from the server using a GET HTTP request, then execute it. - * - * @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/} - */ - getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @see {@link https://api.jquery.com/jQuery.param/} - */ - param: JQueryParam; - - /** - * Load data from the server using a HTTP POST request. - * - * @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. 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/#jQuery-post-url-data-success-dataType} - */ - post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @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. 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/#jQuery-post-url-data-success-dataType} - */ - post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param settings The JQueryAjaxSettings to be used for the request - * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-settings} - */ - post(settings : JQueryAjaxSettings): JQueryXHR; - /** - * 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/} - */ - Callbacks(flags?: string): JQueryCallback; - - /** - * 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/} - */ - holdReady(hold: boolean): void; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @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/#jQuery-selector-context} - */ - (selector: string, context?: Element|JQuery): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param element A DOM element to wrap in a jQuery object. - * @see {@link https://api.jquery.com/jQuery/#jQuery-element} - */ - (element: Element): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. - * @see {@link https://api.jquery.com/jQuery/#jQuery-elementArray} - */ - (elementArray: Element[]): JQuery; - - /** - * Binds a function to be executed when the DOM has finished loading. - * - * @param callback A function to execute after the DOM is ready. - * @see {@link https://api.jquery.com/jQuery/#jQuery-callback} - */ - (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object A plain object to wrap in a jQuery object. - * @see {@link https://api.jquery.com/jQuery/#jQuery-object} - */ - (object: {}): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object An existing jQuery object to clone. - * @see {@link https://api.jquery.com/jQuery/#jQuery-object} - */ - (object: JQuery): JQuery; - - /** - * Specify a function to execute when the DOM is fully loaded. - * @see {@link https://api.jquery.com/jQuery/#jQuery} - */ - (): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. - * @param ownerDocument A document in which the new elements will be created. - * @see {@link https://api.jquery.com/jQuery/#jQuery-html-ownerDocument} - */ - (html: string, ownerDocument?: Document): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string defining a single, standalone, HTML element (e.g.
or
). - * @param attributes An object of attributes, events, and methods to call on the newly-created element. - * @see {@link https://api.jquery.com/jQuery/#jQuery-html-attributes} - */ - (html: string, attributes: Object): JQuery; - - /** - * 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/} - */ - noConflict(removeAll?: boolean): JQueryStatic; - - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - * @see {@link https://api.jquery.com/jQuery.when/} - */ - when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; - - /** - * 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/} - */ - cssHooks: { [key: string]: any; }; - - /** - * 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/} - */ - cssNumber: any; - - /** - * Store arbitrary data associated with the specified element. Returns the value that was set. - * - * @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. - * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element-key-value} - */ - data(element: Element, key: string, value: T): T; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element-key} - */ - data(element: Element, key: string): any; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element} - */ - data(element: Element): any; - - /** - * Execute the next function on the queue for the matched element. - * - * @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/} - */ - dequeue(element: Element, queueName?: string): void; - - /** - * 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/} - */ - hasData(element: Element): boolean; - - /** - * Show the queue of functions to be executed on the matched element. - * - * @param element A DOM element to inspect for an attached queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName} - */ - queue(element: Element, queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element where the array of queued functions is attached. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-newQueue} - */ - queue(element: Element, queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element on which to add a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue. - * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-callback} - */ - queue(element: Element, queueName: string, callback: Function): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @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/} - */ - removeData(element: Element, name?: string): JQuery; - - /** - * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of 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/} - */ - Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; - - /** - * Effects - */ - - easing: JQueryEasingFunctions; - - fx: { - tick: () => void; - /** - * The rate (in milliseconds) at which animations fire. - * @see {@link https://api.jquery.com/jQuery.fx.interval/} - */ - interval: number; - stop: () => void; - speeds: { slow: number; fast: number; }; - /** - * Globally disable all animations. - * @see {@link https://api.jquery.com/jQuery.fx.off/} - */ - off: boolean; - step: any; - }; - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param func 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/#jQuery-proxy-function-context-additionalArguments} - */ - proxy(func: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param context The object to which the context (this) 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/#jQuery-proxy-context-name-additionalArguments} - */ - proxy(context: Object, name: string, ...additionalArguments: any[]): any; - - Event: JQueryEventConstructor; - - /** - * Takes a string and throws an exception containing it. - * - * @param message The message to send out. - * @see {@link https://api.jquery.com/jQuery.error/} - */ - error(message: any): JQuery; - - expr: any; - readonly fn: JQuery; - - isReady: boolean; - - // Properties - support: JQuerySupport; - - /** - * Check to see if a DOM element is a descendant of another DOM element. - * - * @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/} - */ - contains(container: Element, contained: Element): boolean; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. Will break the loop by returning false. - * @returns the first argument, the object that is iterated. - * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-array-callback} - */ - each( - collection: T[], - callback: (indexInArray: number, valueOfElement: T) => boolean | void - ): T[]; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. Will break the loop by returning false. - * @returns the first argument, the object that is iterated. - * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-object-callback} - */ - each( - collection: T, - // TODO: `(keyInObject: keyof T, valueOfElement: T[keyof T])`, when TypeScript 2.1 allowed in repository - callback: (keyInObject: string, valueOfElement: any) => boolean | void - ): T; - - /** - * Merge the contents of two or more objects together into the first object. - * - * @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. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - * @see {@link https://api.jquery.com/jQuery.extend/#jQuery-extend-target-object1-objectN} - */ - extend(target: any, object1?: any, ...objectN: any[]): any; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). - * @param target The object to extend. It will receive the new properties. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - * @see {@link https://api.jquery.com/jQuery.extend/#jQuery-extend-deep-target-object1-objectN} - */ - extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; - - /** - * Execute some JavaScript code globally. - * - * @param code The JavaScript code to execute. - * @see {@link https://api.jquery.com/jQuery.globalEval/} - */ - globalEval(code: string): any; - - /** - * Finds the elements of an array which satisfy a filter function. The original array is not affected. - * - * @param array The array to search through. - * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. - * @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/} - */ - grep(array: T[], func: (elementOfArray?: T, indexInArray?: number) => boolean, invert?: boolean): T[]; - - /** - * Search for a specified value within an array and return its index (or -1 if not found). - * - * @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/} - */ - inArray(value: T, array: T[], fromIndex?: number): number; - - /** - * 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/} - */ - isArray(obj: any): obj is Array; - /** - * 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/} - */ - isEmptyObject(obj: any): boolean; - /** - * 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/} - */ - isFunction(obj: any): obj is Function; - /** - * Determines whether its argument is a number. - * - * @param value The value to be tested. - * @see {@link https://api.jquery.com/jQuery.isNumeric/} - */ - isNumeric(value: any): boolean; - /** - * 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/} - */ - isPlainObject(obj: any): boolean; - /** - * 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/} - */ - isWindow(obj: any): obj is Window; - /** - * 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/} - */ - isXMLDoc(node: Node): boolean; - - /** - * 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/} - */ - makeArray(obj: any): any[]; - - /** - * Translate all items in an array or object to new array of items. - * - * @param array The Array to translate. - * @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. Within the function, this refers to the global (window) object. - * @see {@link https://api.jquery.com/jQuery.map/#jQuery-map-array-callback} - */ - map(array: T[], callback: (elementOfArray?: T, indexInArray?: number) => U): U[]; - /** - * Translate all items in an array or object to new array of items. - * - * @param arrayOrObject The Array or Object to translate. - * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or 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/#jQuery-map-object-callback} - */ - map(arrayOrObject: any, callback: (value?: any, indexOrKey?: any) => any): any; - - /** - * Merge the contents of two arrays together into the first array. - * - * @param first The first array to merge, the elements of second added. - * @param second The second array to merge into the first, unaltered. - * @see {@link https://api.jquery.com/jQuery.merge/} - */ - merge(first: T[], second: T[]): T[]; - - /** - * An empty function. - * @see {@link https://api.jquery.com/jQuery.noop/} - */ - noop(): any; - - /** - * Return a number representing the current time. - * @see {@link https://api.jquery.com/jQuery.now/} - */ - now(): number; - - /** - * Takes a well-formed JSON string and returns the resulting JavaScript object. - * - * @param json The JSON string to parse. - * @see {@link https://api.jquery.com/jQuery.parseJSON/} - */ - parseJSON(json: string): any; - - /** - * 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/} - */ - parseXML(data: string): XMLDocument; - - /** - * Remove the whitespace from the beginning and end of a string. - * - * @param str Remove the whitespace from the beginning and end of a string. - * @see {@link https://api.jquery.com/jQuery.trim/} - */ - trim(str: string): string; - - /** - * 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/} - */ - type(obj: any): "array" | "boolean" | "date" | "error" | "function" | "null" | "number" | "object" | "regexp" | "string" | "symbol" | "undefined"; - - /** - * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - * - * @param array The Array of DOM elements. - * @see {@link https://api.jquery.com/jQuery.unique/} - */ - unique(array: T[]): T[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM 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/} - */ - parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM 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/} - */ - parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; -} - -/** - * The jQuery instance members - * - * @see {@link https://api.jquery.com/Types/#jQuery} - */ -interface JQuery { - /** - * 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/} - */ - ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery; - /** - * 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/} - */ - ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery; - /** - * 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/} - */ - ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - /** - * 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/} - */ - ajaxStart(handler: () => any): JQuery; - /** - * 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/} - */ - ajaxStop(handler: () => any): JQuery; - /** - * 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/} - */ - ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @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/} - */ - load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; - - /** - * Encode a set of form elements as a string for submission. - * @see {@link https://api.jquery.com/serialize/} - */ - serialize(): string; - /** - * Encode a set of form elements as an array of names and values. - * @see {@link https://api.jquery.com/serializeArray/} - */ - serializeArray(): JQuerySerializeArrayElement[]; - - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param className One or more space-separated classes to be added to the class attribute of each matched element. - * @see {@link https://api.jquery.com/addClass/#addClass-className} - */ - addClass(className: string): JQuery; - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param func 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/#addClass-function} - */ - addClass(func: (index: number, className: string) => string): JQuery; - - /** - * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. - * @see {@link https://api.jquery.com/addBack/} - */ - addBack(selector?: string): JQuery; - - /** - * 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/#attr-attributeName} - */ - attr(attributeName: string): string; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. If this is `null`, the attribute will be deleted. - * @see {@link https://api.jquery.com/attr/#attr-attributeName-value} - */ - attr(attributeName: string, value: string|number|null): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param func 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/#attr-attributeName-function} - */ - attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; - /** - * 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/#attr-attributes} - */ - attr(attributes: Object): JQuery; - - /** - * 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/} - */ - hasClass(className: string): boolean; - - /** - * Get the HTML contents of the first element in the set of matched elements. - * @see {@link https://api.jquery.com/html/#html} - */ - html(): string; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param htmlString A string of HTML to set as the content of each matched element. - * @see {@link https://api.jquery.com/html/#html-htmlString} - */ - html(htmlString: string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func 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/#html-function} - */ - html(func: (index: number, oldhtml: string) => string): JQuery; - - /** - * 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/#prop-propertyName} - */ - prop(propertyName: string): any; - /** - * Set one or more properties for the set of matched elements. - * - * @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/#prop-propertyName-value} - */ - prop(propertyName: string, value: string|number|boolean): JQuery; - /** - * 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/#prop-properties} - */ - prop(properties: Object): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param func 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/#prop-propertyName-function} - */ - prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery; - - /** - * 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/} - */ - removeAttr(attributeName: string): JQuery; - - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - * @see {@link https://api.jquery.com/removeClass/#removeClass-className} - */ - removeClass(className?: string): JQuery; - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param func 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/#removeClass-function} - */ - removeClass(func: (index: number, className: string) => string): JQuery; - - /** - * 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/} - */ - removeProp(propertyName: string): JQuery; - - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-className} - */ - toggleClass(className: string, swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param swtch A boolean value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-state} - */ - toggleClass(swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param func 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 switch as arguments. - * @param swtch A boolean value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-function-state} - */ - toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery; - - /** - * Get the current value of the first element in the set of matched elements. - * @see {@link https://api.jquery.com/val/#val} - */ - val(): any; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. - * @see {@link https://api.jquery.com/val/#val-value} - */ - val(value: string|string[]|number): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func 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/#val-function} - */ - val(func: (index: number, value: string) => string): JQuery; - - /** - * Get the value of style properties for the first element in the set of matched elements. - * - * @param propertyName A CSS property. - * @see {@link https://api.jquery.com/css/#css-propertyName} - */ - css(propertyName: string): string; - /** - * Get the value of style properties for the first element in the set of matched elements. - * Results in an object of property-value pairs. - * - * @param propertyNames An array of one or more CSS properties. - * @see {@link https://api.jquery.com/css/#css-propertyNames} - */ - css(propertyNames: string[]): any; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - * @see {@link https://api.jquery.com/css/#css-propertyName-value} - */ - css(propertyName: string, value: string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value 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/#css-propertyName-function} - */ - css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; - /** - * 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/#css-properties} - */ - css(properties: Object): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements. - * @see {@link https://api.jquery.com/height/#height} - */ - height(): number; - /** - * Set the CSS height of every matched element. - * - * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/height/#height-value} - */ - height(value: number|string): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func 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/#height-function} - */ - height(func: (index: number, height: number) => number|string): JQuery; - - /** - * 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/#innerHeight} - */ - innerHeight(): number; - - /** - * Sets the inner height on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/innerHeight/#innerHeight-value} - */ - innerHeight(value: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding but not border. - * @see {@link https://api.jquery.com/innerWidth/#innerWidth} - */ - innerWidth(): number; - - /** - * Sets the inner width on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/innerWidth/#innerWidth-value} - */ - innerWidth(value: number|string): JQuery; - - /** - * 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/#offset} - */ - offset(): JQueryCoordinates; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * @see {@link https://api.jquery.com/offset/#offset-coordinates} - */ - offset(coordinates: JQueryCoordinates): JQuery; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param func 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/#offset-function} - */ - offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see {@link https://api.jquery.com/outerHeight/#outerHeight-includeMargin} - */ - outerHeight(includeMargin?: boolean): number; - - /** - * Sets the outer height on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/outerHeight/#outerHeight-value} - */ - outerHeight(value: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding and border. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see {@link https://api.jquery.com/outerWidth/#outerWidth-includeMargin} - */ - outerWidth(includeMargin?: boolean): number; - - /** - * Sets the outer width on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/outerWidth/#outerWidth-value} - */ - outerWidth(value: number|string): JQuery; - - /** - * 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/} - */ - position(): JQueryCoordinates; - - /** - * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. - * @see {@link https://api.jquery.com/scrollLeft/#scrollLeft} - */ - scrollLeft(): number; - /** - * 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/#scrollLeft-value} - */ - scrollLeft(value: number): JQuery; - - /** - * 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/#scrollTop} - */ - scrollTop(): number; - /** - * Set the current vertical 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/scrollTop/#scrollTop-value} - */ - scrollTop(value: number): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements. - * @see {@link https://api.jquery.com/width/#width} - */ - width(): number; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/width/#width-value} - */ - width(value: number|string): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func 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/#width-function} - */ - width(func: (index: number, width: number) => number|string): JQuery; - - /** - * 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/} - */ - clearQueue(queueName?: string): JQuery; - - /** - * Store arbitrary data associated with the matched elements. - * - * @param key A string naming the piece of data to set. - * @param value The new data value; it can be any JavaScript type including Array or Object. - * @see {@link https://api.jquery.com/data/#data-key-value} - */ - data(key: string, value: any): JQuery; - /** - * 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. - * - * @param key Name of the data stored. - * @see {@link https://api.jquery.com/data/#data-key} - */ - data(key: string): any; - /** - * 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/#data-obj} - */ - data(obj: { [key: string]: any; }): JQuery; - /** - * 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/#data} - */ - data(): any; - - /** - * 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/} - */ - dequeue(queueName?: string): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/#removeData-name} - */ - removeData(name: string): JQuery; - /** - * Remove a previously-stored piece of data. - * - * @param list An array of strings naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/#removeData-list} - */ - removeData(list: string[]): JQuery; - /** - * Remove all previously-stored piece of data. - * @see {@link https://api.jquery.com/removeData/} - */ - removeData(): JQuery; - - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. - * - * @param type The type of queue that needs to be observed. (default: fx) - * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/promise/} - */ - promise(type?: string, target?: Object): JQueryPromise; - - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete} - */ - animate(properties: Object, duration?: string|number, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @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. (default: swing) - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete} - */ - animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @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/#animate-properties-options} - */ - animate(properties: Object, options: JQueryAnimationOptions): JQuery; - - /** - * Set a timer to delay execution of subsequent items in the queue. - * - * @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/} - */ - delay(duration: number, queueName?: string): JQuery; - - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-complete} - */ - fadeIn(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @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. - * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-easing-complete} - */ - fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeIn/#fadeIn-options} - */ - fadeIn(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-complete} - */ - fadeOut(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @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. - * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-easing-complete} - */ - fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeOut/#fadeOut-options} - */ - fadeOut(options: JQueryAnimationOptions): JQuery; - - /** - * Adjust the opacity of the matched elements. - * - * @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. - * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-complete} - */ - fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; - /** - * Adjust the opacity of the matched elements. - * - * @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 easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-easing-complete} - */ - fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; - - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete} - */ - fadeToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @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. - * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete} - */ - fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-options} - */ - fadeToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @see {@link https://api.jquery.com/finish/} - */ - finish(queue?: string): JQuery; - - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/hide/#hide} - */ - hide(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @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. - * @see {@link https://api.jquery.com/hide/#hide-duration-easing-complete} - */ - hide(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/hide/#hide-options} - */ - hide(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/show/#show} - */ - show(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @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. - * @see {@link https://api.jquery.com/show/#show-duration-easing-complete} - */ - show(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/show/#show-options} - */ - show(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-complete} - */ - slideDown(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @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. - * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-easing-complete} - */ - slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideDown/#slideDown-options} - */ - slideDown(options: JQueryAnimationOptions): JQuery; - - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-complete} - */ - slideToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @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. - * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-easing-complete} - */ - slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideToggle/#slideToggle-options} - */ - slideToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-complete} - */ - slideUp(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @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. - * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-easing-complete} - */ - slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideUp/#slideUp-options} - */ - slideUp(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation on the matched elements. - * - * @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/#stop-clearQueue-jumpToEnd} - */ - stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - /** - * Stop the currently-running animation on the matched elements. - * - * @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/#stop-queue-clearQueue-jumpToEnd} - */ - stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/toggle/#toggle-duration-complete} - */ - toggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @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. - * @see {@link https://api.jquery.com/toggle/#toggle-duration-easing-complete} - */ - toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/toggle/#toggle-options} - */ - toggle(options: JQueryAnimationOptions): JQuery; - /** - * Display or hide the matched elements. - * - * @param showOrHide A Boolean indicating whether to show or hide the elements. - * @see {@link https://api.jquery.com/toggle/#toggle-display} - */ - toggle(showOrHide: boolean): JQuery; - - /** - * Attach a handler to an event for the elements. - * - * @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/#bind-eventType-eventData-handler} - */ - bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType 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/bind/#bind-eventType-eventData-handler} - */ - bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @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 preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} - */ - bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} - */ - bind(eventType: string, preventBubble: boolean): JQuery; - /** - * 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/#bind-events} - */ - bind(events: any): JQuery; - - /** - * Trigger the "blur" event on an element - * @see {@link https://api.jquery.com/blur/#blur} - */ - blur(): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/blur/#blur-handler} - */ - blur(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @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/#blur-eventData-handler} - */ - blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "change" event on an element. - * @see {@link https://api.jquery.com/change/#change} - */ - change(): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/change/#change-handler} - */ - change(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @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/#change-eventData-handler} - */ - change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "click" event on an element. - * @see {@link https://api.jquery.com/click/#click} - */ - click(): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/click/#click-handler} - */ - click(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @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/#click-eventData-handler} - */ - click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "contextmenu" event on an element. - * @see {@link https://api.jquery.com/contextmenu/#contextmenu} - */ - contextmenu(): JQuery; - /** - * Bind an event handler to the "contextmenu" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/contextmenu/#contextmenu-handler} - */ - contextmenu(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "contextmenu" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/contextmenu/#contextmenu-eventData-handler} - */ - contextmenu(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "dblclick" event on an element. - * @see {@link https://api.jquery.com/dblclick/#dblclick} - */ - dblclick(): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/dblclick/#dblclick-handler} - */ - dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @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/#dblclick-eventData-handler} - */ - dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-handler} - */ - delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-eventData-handler} - */ - delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focus" event on an element. - * @see {@link https://api.jquery.com/focus/#focus} - */ - focus(): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focus/#focus-handler} - */ - focus(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @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/#focus-eventData-handler} - */ - focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focusin" event on an element. - * @see {@link https://api.jquery.com/focusin/#focusin} - */ - focusin(): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusin/#focusin-handler} - */ - focusin(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @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/#focusin-eventData-handler} - */ - focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focusout" event on an element. - * @see {@link https://api.jquery.com/focusout/#focusout} - */ - focusout(): JQuery; - /** - * 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/#focusout-handler} - */ - focusout(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @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/#focusout-eventData-handler} - */ - focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. - * - * @param handlerIn A function to execute when the mouse pointer enters the element. - * @param handlerOut A function to execute when the mouse pointer leaves the element. - * @see {@link https://api.jquery.com/hover/#hover-handlerIn-handlerOut} - */ - hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. - * - * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. - * @see {@link https://api.jquery.com/hover/#hover-handlerInOut} - */ - hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "keydown" event on an element. - * @see {@link https://api.jquery.com/keydown/#keydown} - */ - keydown(): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keydown/#keydown-handler} - */ - keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @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/#keydown-eventData-handler} - */ - keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keypress" event on an element. - * @see {@link https://api.jquery.com/keypress/#keypress} - */ - keypress(): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keypress/#keypress-handler} - */ - keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @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/#keypress-eventData-handler} - */ - keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keyup" event on an element. - * @see {@link https://api.jquery.com/keyup/#keyup} - */ - keyup(): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keyup/#keyup-handler} - */ - keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @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/#keyup-eventData-handler} - */ - keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/load/} - */ - load(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/load/} - */ - load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "mousedown" event on an element. - * @see {@link https://api.jquery.com/mousedown/#mousedown} - */ - mousedown(): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousedown/#mousedown-handler} - */ - mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousedown/#mousedown-eventData-handler} - */ - mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseenter" event on an element. - * @see {@link https://api.jquery.com/mouseenter/#mouseenter} - */ - mouseenter(): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseenter/#mouseenter-handler} - */ - mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseenter/#mouseenter-eventData-handler} - */ - mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseleave" event on an element. - * @see {@link https://api.jquery.com/mouseleave/#mouseleave} - */ - mouseleave(): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseleave/#mouseleave-handler} - */ - mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseleave/#mouseleave-eventData-handler} - */ - mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mousemove" event on an element. - * @see {@link https://api.jquery.com/mousemove/#mousemove} - */ - mousemove(): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousemove/#mousemove-handler} - */ - mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousemove/#mousemove-eventData-handler} - */ - mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseout" event on an element. - * @see {@link https://api.jquery.com/mouseout/#mouseout} - */ - mouseout(): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseout/#mouseout-handler} - */ - mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseout/#mouseout-eventData-handler} - */ - mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseover" event on an element. - * @see {@link https://api.jquery.com/mouseover/#mouseover} - */ - mouseover(): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseover/#mouseover-handler} - */ - mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseover/#mouseover-eventData-handler} - */ - mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseup" event on an element. - * @see {@link https://api.jquery.com/mouseup/#mouseup} - */ - mouseup(): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseup/#mouseup-handler} - */ - mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseup/#mouseup-eventData-handler} - */ - mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Remove an event handler. - * @see {@link https://api.jquery.com/off/#off} - */ - off(): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "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 handler function previously attached for the event(s), or the special value false. - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on(). - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @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/#off-events-selector} - */ - off(events: { [key: string]: any; }, selector?: string): JQuery; - - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @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. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @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. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @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. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @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 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. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @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 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/#on-events-selector-data} - */ - on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @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/#on-events-selector-data} - */ - on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/one/#one-events-data-handler} - */ - one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param data An object containing data that will be passed to the event handler. - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/one/#one-events-data-handler} - */ - one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @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. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} - */ - one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @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 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. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} - */ - one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @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 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/#one-events-selector-data} - */ - one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @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/#one-events-selector-data} - */ - one(events: { [key: string]: any; }, data?: any): JQuery; - - - /** - * 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/} - */ - ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Trigger the "resize" event on an element. - * @see {@link https://api.jquery.com/resize/#resize} - */ - resize(): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/resize/#resize-handler} - */ - resize(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @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/#resize-eventData-handler} - */ - resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "scroll" event on an element. - * @see {@link https://api.jquery.com/scroll/#scroll} - */ - scroll(): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/scroll/#scroll-handler} - */ - scroll(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @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/#scroll-eventData-handler} - */ - scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "select" event on an element. - * @see {@link https://api.jquery.com/select/#select} - */ - select(): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/select/#select-handler} - */ - select(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @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/#select-eventData-handler} - */ - select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "submit" event on an element. - * @see {@link https://api.jquery.com/submit/#submit} - */ - submit(): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/submit/#submit-handler} - */ - submit(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @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/#submit-eventData-handler} - */ - submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters Additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/trigger/#trigger-eventType-extraParameters} - */ - trigger(eventType: string, extraParameters?: any[]|Object): JQuery; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param event A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/trigger/#trigger-event-extraParameters} - */ - trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; - - /** - * Execute all handlers attached to an element for an event. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters An array of additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-eventType-extraParameters} - */ - triggerHandler(eventType: string, ...extraParameters: any[]): Object; - - /** - * Execute all handlers attached to an element for an event. - * - * @param event A jQuery.Event object. - * @param extraParameters An array of additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-event-extraParameters} - */ - triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; - - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param handler The function that is to be no longer executed. - * @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler} - */ - unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). - * @see {@link https://api.jquery.com/unbind/#unbind-eventType-false} - */ - unbind(eventType: string, fls: boolean): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param evt A JavaScript event object as passed to an event handler. - * @see {@link https://api.jquery.com/unbind/#unbind-event} - */ - unbind(evt: any): JQuery; - - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * @see {@link https://api.jquery.com/undelegate/#undelegate} - */ - undelegate(): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @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 at the time the event is triggered. - * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-eventType} - */ - undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param events An object of one or more event types and previously bound functions to unbind from them. - * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-events} - */ - undelegate(selector: string, events: Object): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param namespace A string containing a namespace to unbind all events from. - * @see {@link https://api.jquery.com/undelegate/#undelegate-namespace} - */ - undelegate(namespace: string): JQuery; - - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/unload/#unload-handler} - */ - unload(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/unload/#unload-eventData-handler} - */ - unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) - * @see {@link https://api.jquery.com/context/} - */ - context: Element; - - jquery: string; - - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/error/#error-handler} - */ - error(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/error/#error-eventData-handler} - */ - error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * 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/#pushStack-elements} - */ - pushStack(elements: any[]): JQuery; - /** - * 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. - * @param name The name of a jQuery method that generated the array of elements. - * @param arguments The arguments that were passed in to the jQuery method (for serialization). - * @see {@link https://api.jquery.com/pushStack/#pushStack-elements-name-arguments} - */ - pushStack(elements: any[], name: string, arguments: any[]): JQuery; - - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - * @see {@link https://api.jquery.com/after/#after-content-content} - */ - after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of 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/after/#after-function} - */ - after(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, 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/#append-content-content} - */ - append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at 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/#append-function} - */ - append(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @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/} - */ - appendTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - * @see {@link https://api.jquery.com/before/#before-content-content} - */ - before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of 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/before/#before-function} - */ - before(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Create a deep copy of the set of matched elements. - * - * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. - * @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/} - */ - clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery; - - /** - * 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/} - */ - detach(selector?: string): JQuery; - - /** - * Remove all child nodes of the set of matched elements from the DOM. - * @see {@link https://api.jquery.com/empty/} - */ - empty(): JQuery; - - /** - * Insert every element in the set of matched elements after the target. - * - * @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/} - */ - insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert every element in the set of matched elements before the target. - * - * @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/} - */ - insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, 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/#prepend-content-content} - */ - prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at 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/#prepend-function} - */ - prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @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/} - */ - prependTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * 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/} - */ - remove(selector?: string): JQuery; - - /** - * 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/} - */ - replaceAll(target: JQuery|any[]|Element|string): JQuery; - - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - * @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent} - */ - replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * @param func A function that returns content with which to replace the set of matched elements. - * @see {@link https://api.jquery.com/replaceWith/#replaceWith-function} - */ - replaceWith(func: () => Element|JQuery): JQuery; - - /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - * @see {@link https://api.jquery.com/text/#text} - */ - text(): string; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. - * @see {@link https://api.jquery.com/text/#text-text} - */ - text(text: string|number|boolean): JQuery; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param func 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/#text-function} - */ - text(func: (index: number, text: string) => string): JQuery; - - /** - * Retrieve all the elements contained in the jQuery set, as an array. - * @name toArray - * @see {@link https://api.jquery.com/toArray/} - */ - toArray(): HTMLElement[]; - - /** - * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - * @see {@link https://api.jquery.com/unwrap/} - */ - unwrap(): JQuery; - - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - * @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement} - */ - wrap(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param func 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/#wrap-function} - */ - wrap(func: (index: number) => string|JQuery): JQuery; - - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - * @see {@link https://api.jquery.com/wrapAll/#wrapAll-wrappingElement} - */ - wrapAll(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param func A callback function returning the HTML content or jQuery object to wrap around all the matched elements. Within the function, this refers to the first element in the set. - * @see {@link https://api.jquery.com/wrapAll/#wrapAll-function} - */ - wrapAll(func: (index: number) => string): JQuery; - - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - * @see {@link https://api.jquery.com/wrapInner/#wrapInner-wrappingElement} - */ - wrapInner(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param func 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/#wrapInner-function} - */ - wrapInner(func: (index: number) => string): JQuery; - - /** - * Iterate over a jQuery object, executing a function for each matched element. - * - * @param func A function to execute for each matched element. Can stop the loop by returning false. - * @see {@link https://api.jquery.com/each/} - */ - each(func: (index: number, elem: Element) => boolean | void): JQuery; - - /** - * 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/#get-index} - */ - get(index: number): HTMLElement; - /** - * Retrieve the elements matched by the jQuery object. - * @alias toArray - * @see {@link https://api.jquery.com/get/#get} - */ - get(): HTMLElement[]; - - /** - * Search for a given element from among the matched elements. - * @see {@link https://api.jquery.com/index/#index} - */ - index(): number; - /** - * Search for a given element from among the matched elements. - * - * @param selector A selector representing a jQuery collection in which to look for an element. - * @see {@link https://api.jquery.com/index/#index-selector} - */ - index(selector: string|JQuery|Element): number; - - /** - * The number of elements in the jQuery object. - * @see {@link https://api.jquery.com/length/} - */ - length: number; - /** - * A selector representing selector passed to jQuery(), if any, when creating the original set. - * version deprecated: 1.7, removed: 1.9 - * @see {@link https://api.jquery.com/selector/} - */ - selector: string; - [index: number]: HTMLElement; - - /** - * Add elements to the set of matched elements. - * - * @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/#add-selector} - */ - add(selector: string, context?: Element): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param elements One or more elements to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/#add-elements} - */ - add(...elements: Element[]): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param html An HTML fragment to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/#add-html} - */ - add(html: string): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param obj An existing jQuery object to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/#add-selection} - */ - add(obj: JQuery): JQuery; - - /** - * 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/} - */ - children(selector?: string): JQuery; - - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/closest/#closest-selector} - */ - closest(selector: string): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @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. If no context is passed in then the context of the jQuery set will be used instead. - * @see {@link https://api.jquery.com/closest/#closest-selector-context} - */ - closest(selector: string, context?: Element): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param obj A jQuery object to match elements against. - * @see {@link https://api.jquery.com/closest/#closest-selection} - */ - closest(obj: JQuery): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param element An element to match elements against. - * @see {@link https://api.jquery.com/closest/#closest-element} - */ - closest(element: Element): JQuery; - - /** - * Get an array of all the elements and selectors matched against the current element up through the DOM tree. - * - * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - * @see {@link https://api.jquery.com/closest/#closest-selectors-context} - */ - closest(selectors: any, context?: Element): any[]; - - /** - * Get the children of each element in the set of matched elements, including text and comment nodes. - * @see {@link https://api.jquery.com/contents/} - */ - contents(): JQuery; - - /** - * 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/} - */ - end(): JQuery; - - /** - * Reduce the set of matched elements to the one at the specified index. - * - * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * @see {@link https://api.jquery.com/eq/} - */ - eq(index: number): JQuery; - - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param selector A string containing a selector expression to match the current set of elements against. - * @see {@link https://api.jquery.com/filter/#filter-selector} - */ - filter(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param func 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/#filter-function} - */ - filter(func: (index: number, element: Element) => boolean): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param element An element to match the current set of elements against. - * @see {@link https://api.jquery.com/filter/#filter-elements} - */ - filter(element: Element): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param obj An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/filter/#filter-selection} - */ - filter(obj: JQuery): JQuery; - - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/find/#find-selector} - */ - find(selector: string): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param element An element to match elements against. - * @see {@link https://api.jquery.com/find/#find-element} - */ - find(element: Element): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param obj A jQuery object to match elements against. - * @see {@link https://api.jquery.com/find/#find-element} - */ - find(obj: JQuery): JQuery; - - /** - * Reduce the set of matched elements to the first in the set. - * @see {@link https://api.jquery.com/first/} - */ - first(): JQuery; - - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/has/#has-selector} - */ - has(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param contained A DOM element to match elements against. - * @see {@link https://api.jquery.com/has/#has-contained} - */ - has(contained: Element): JQuery; - - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/is/#is-selector} - */ - is(selector: string): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. - * @see {@link https://api.jquery.com/is/#is-function} - */ - is(func: (index: number, element: Element) => boolean): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param obj An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/is/#is-selection} - */ - is(obj: JQuery): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param elements One or more elements to match the current set of elements against. - * @see {@link https://api.jquery.com/is/#is-elements} - */ - is(elements: any): boolean; - - /** - * Reduce the set of matched elements to the final one in the set. - * @see {@link https://api.jquery.com/last/} - */ - last(): JQuery; - - /** - * Pass each element in the current matched set through a function, producing a new jQuery object 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/} - */ - map(callback: (index: number, domElement: Element) => any): JQuery; - - /** - * Get the immediately following sibling of each element in the set of matched elements. If a selector 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/} - */ - next(selector?: string): JQuery; - - /** - * 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/} - */ - nextAll(selector?: string): JQuery; - - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param selector A string containing a selector expression to indicate 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/#nextUntil-selector-filter} - */ - nextUntil(selector?: string, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param element 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/#nextUntil-element-filter} - */ - nextUntil(element?: Element, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param obj 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/#nextUntil-element-filter} - */ - nextUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Remove elements from the set of matched elements. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/not/#not-selector} - */ - not(selector: string): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - * @see {@link https://api.jquery.com/not/#not-function} - */ - not(func: (index: number, element: Element) => boolean): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param elements One or more DOM elements to remove from the matched set. - * @see {@link https://api.jquery.com/not/#not-selection} - */ - not(elements: Element|Element[]): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param obj An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/not/#not-selection} - */ - not(obj: JQuery): JQuery; - - /** - * Get the closest ancestor element that is positioned. - * @see {@link https://api.jquery.com/offsetParent/} - */ - offsetParent(): JQuery; - - /** - * 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/} - */ - parent(selector?: string): JQuery; - - /** - * 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/} - */ - parents(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate 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/#parentsUntil-selector-filter} - */ - parentsUntil(selector?: string, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element 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/#parentsUntil-element-filter} - */ - parentsUntil(element?: Element, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj 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/#parentsUntil-element-filter} - */ - parentsUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the immediately preceding sibling 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/prev/} - */ - prev(selector?: string): JQuery; - - /** - * 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/} - */ - prevAll(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate 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/#prevUntil-selector-filter} - */ - prevUntil(selector?: string, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element 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/#prevUntil-element-filter} - */ - prevUntil(element?: Element, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj 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/#prevUntil-element-filter} - */ - prevUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * 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/} - */ - siblings(selector?: string): JQuery; - - /** - * Reduce the set of matched elements to a subset specified by a range of indices. - * - * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, 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/} - */ - slice(start: number, end?: number): JQuery; - - /** - * 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/#queue-queueName} - */ - queue(queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param newQueue An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue} - */ - queue(newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} - */ - queue(callback: Function): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue} - */ - queue(queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} - */ - queue(queueName: string, callback: Function): JQuery; - - /** - * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. - * - * @param object An object to merge onto the jQuery prototype. - * @see {@link https://api.jquery.com/jQuery.fn.extend/#jQuery-fn-extend-object} - */ - extend(object: { [method: string]: (...args: any[]) => any; }): JQuery; -} -declare module "jquery" { - export = $; -} -declare var jQuery: JQueryStatic; -declare var $: JQueryStatic; +// endregion diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index d2d58aa2a2..79358fd199 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -1,3552 +1,182 @@ - - -function test_add() { - $("p").add("div").addClass("widget"); - var pdiv = $("p").add("div"); - - $('li').add('p').css('background-color', 'red'); - $('li').add(document.getElementsByTagName('p')[0]) - .css('background-coailor', 'red'); - $('li').add('

new paragraph

') - .css('background-color', 'red'); - $("div").css("border", "2px solid red") - .add("p") - .css("background", "yellow"); - $("p").add("span").css("background", "yellow"); - $("p").clone().add("Again").appendTo(document.body); - $("p").add(document.getElementById("a")).css("background", "yellow"); - var collection = $("p"); - - collection = collection.add(document.getElementById("a")); - collection.css("background", "yellow"); -} - -function test_addClass() { - $("p").addClass("myClass yourClass"); - $("p").removeClass("myClass noClass").addClass("yourClass"); - $("ul li:last").addClass(function (index) { - return "item-" + index; - }); - $("p:last").addClass("selected"); - $("p:last").addClass("selected highlight"); - $("div").addClass(function (index, currentClass) { - var addedClass: string; - if (currentClass === "red") { - addedClass = "green"; - $("p").text("There is one green div"); +function JQuery() { + function iterable() { + for (const a of $('div')) { + a.textContent = 'myDiv'; } - return addedClass; - }); -} + } -function test_after() { - $('.inner').after('

Test

'); - $('
').after('

').after(document.createDocumentFragment()); - $('
').after('

').addClass('foo') - .filter('p').attr('id', 'bar').html('hello') - .end() - .appendTo('body'); - $('p').after(function () { - return '
' + this.className + '
'; - }); - var $newdiv1 = $('
'), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - $('p').first().after($newdiv1, [newdiv2, existingdiv1]); - $("p").after(document.createTextNode("Hello")); - $("p").after($("b")); -} + function arrayLike() { + $('div')[0] === new HTMLElement(); + } -function test_ajax() { - $.ajax({ - url: "test.html", - context: document.body - }).done(function () { - $(this).addClass("done"); - }); - $.ajax({ - statusCode: { - 404: function () { - alert("page not found"); - } + function on() { + function false_handler_shorthand() { + $().on('events', false); } - }); - $.ajax({ - url: "http://fiddle.jshell.net/favicon.png", - beforeSend: function (xhr) { - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - } - }).done(function (data) { - if (console && console.log) { - console.log("Sample of data:", data.slice(0, 100)); - } - }); - $.ajax({ - url: 'ajax/test.html', - success: function (data) { - $('.result').html(data); - alert('Load was performed.'); - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Load failed. responseJSON=' + jqXHR.responseJSON); - } - }); - var _super = jQuery.ajaxSettings.xhr; - jQuery.ajaxSettings.xhr = function () { - var xhr = _super(), - getAllResponseHeaders = xhr.getAllResponseHeaders; - xhr.getAllResponseHeaders = function () { - if (getAllResponseHeaders()) { - return getAllResponseHeaders(); - } - - var allHeaders = ""; - var headersFieldNames = ["Cache-Control", "Content-Language", "Content-Type", - "Expires", "Last-Modified", "Pragma"]; - $(headersFieldNames).each(function (i, header_name) { - if (xhr.getResponseHeader(header_name)) { - allHeaders += header_name + ": " + xhr.getResponseHeader(header_name) + "\n"; - } + function typed_event_data() { + $('#myElement').on('custom', 45, (event, data) => { + event.data === 23; }); - return allHeaders; - }; - - return xhr; - }; - $.ajax({ - type: "POST", - url: "some.php", - data: { name: "John", location: "Boston" } - }).done(function (msg) { - alert("Data Saved: " + msg); - }); - $.ajax({ - method: "POST", - url: "some.php", - data: { name: "John", location: "Boston" } - }); - $.ajax({ - url: "test.html", - cache: false - }).done(function (html) { - $("#results").append(html); - }); - var xmlDocument = []; - var xmlRequest = $.ajax({ - url: "page.php", - processData: false, - data: xmlDocument - }); - var handleResponse; - xmlRequest.done(handleResponse); - - var menuId = $("ul.nav").first().attr("id"); - var request = $.ajax({ - url: "script.php", - type: "POST", - data: { id: menuId }, - dataType: "html" - }); - request.done(function (msg) { - $("#log").html(msg); - }); - request.fail(function (jqXHR, textStatus) { - alert("Request failed: " + textStatus); - }); - - $.ajax({ - type: "GET", - url: "test.js", - dataType: "script" - }); - - // Test the jqXHR object returned by $.ajax() as of 1.5 - // More details: http://api.jquery.com/jQuery.ajax/#jqXHR - - // done method - $.ajax({ - url: "test.js" - }).done((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // then method can change promise type through promise chaining - var chainedValuePromise : JQueryPromise; - chainedValuePromise = $.ajax({ - url: "test.js" - }).then(() => $.when(1)); - - // fail method - $.ajax({ - url: "test.js" - }).fail((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // always method with successful request - $.ajax({ - url: "test.js" - }).always((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // always method with failed request - $.ajax({ - url: "test.js" - }).always((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // then method (as of 1.8) - $.ajax({ - url: "test.js" - }).then((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }, (jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // generic then method - var p: JQueryPromise = $.ajax({ url: "test.js" }) - .then(() => "Hello") - .then((x) => x.length); - - // jqXHR object - var jqXHR = $.ajax({ - url: "test.js" - }); - jqXHR.abort('aborting because I can'); - - //Test the promise exposed by the jqXHR object - - // done method - $.ajax({ - url: "test.js" - }).promise().done((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // fail method - $.ajax({ - url: "test.js" - }).promise().fail((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // always method with successful request - $.ajax({ - url: "test.js" - }).promise().always((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // always method with failed request - $.ajax({ - url: "test.js" - }).promise().always((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // then method (as of 1.8) - $.ajax({ - url: "test.js" - }).promise().then((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }, (jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // generic then method - var p: JQueryPromise = $.ajax({ url: "test.js" }).promise() - .then(() => "Hello") - .then((x) => x.length); -} - -function test_ajaxComplete() { - $('.log').ajaxComplete(function () { - $(this).text('Triggered ajaxComplete handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $('.log').ajaxComplete(function (e, xhr, settings) { - if (settings.url == 'ajax/test.html') { - $(this).text('Triggered ajaxComplete handler. The result is ' + xhr.responseText); } - }); - $("#msg").ajaxComplete(function (event, request, settings) { - $(this).append("
  • Request Complete.
  • "); - }); + } } -function test_ajaxError() { - $("div.log").ajaxError(function () { - $(this).text("Triggered ajaxError handler."); - }); - $("button.trigger").click(function () { - $("div.result").load("ajax/missing.html"); - }); - $("div.log").ajaxError(function (e, jqxhr, settings, exception) { - if (settings.url == "ajax/missing.html") { - $(this).text("Triggered ajaxError handler."); +function JQueryStatic() { + function type_annotation() { + const jq: JQueryStatic = $; + } + + function constructor() { + function selector_object_callback() { + const jq = $ as JQueryStatic; + // $ExpectType JQuery + jq('div'); } - }); - $("#msg").ajaxError(function (event, request, settings) { - $(this).append("
  • Error requesting page " + settings.url + "
  • "); - }); -} + } -function test_ajaxPrefilter() { - var currentRequests = {}; - $.ajaxPrefilter(function (options, originalOptions, jqXHR) { - if (options.abortOnRetry) { - if (currentRequests[options.url]) { - currentRequests[options.url].abort(); + function Callbacks() { + const cb = $.Callbacks(); + + cb.add(console.log); + } + + function Event() { + function constructor() { + const e = $.Event('click'); + e.stopPropagation(); + } + } + + function each() { + function arrayLike() { + $.each({ length: 3 }, (index, val) => { + index === 3; + }); + } + } + + function isArray() { + function type_guard(obj: object) { + if ($.isArray(obj)) { + console.log(obj[0]); } - currentRequests[options.url] = jqXHR; } - }); - $.ajaxPrefilter(function (options) { - if (options.crossDomain) { - options.url = "http://mydomain.net/proxy/" + encodeURIComponent(options.url); - options.crossDomain = false; - } - }); - $.ajaxPrefilter("json script", function (options, originalOptions, jqXHR) { + } - }); - var isActuallyScript; - $.ajaxPrefilter(function (options) { - if (isActuallyScript(options.url)) { - return "script"; - } - }); -} - -function test_ajaxSend() { - $('.log').ajaxSend(function () { - $(this).text('Triggered ajaxSend handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $('.log').ajaxSend(function (e, jqxhr, settings) { - if (settings.url == 'ajax/test.html') { - $(this).text('Triggered ajaxSend handler.'); - } - }); - $("#msg").ajaxSend(function (evt, request, settings) { - $(this).append("
  • Starting request at " + settings.url + "
  • "); - }); -} - -function test_ajaxSetup() { - $.ajaxSetup({ - url: 'ping.php' - }); - $.ajax({ - data: { 'name': 'Dan' } - }); - $.ajaxSetup({ - url: "/xmlhttp/", - global: false, - type: "POST" - }); -} - -function test_ajaxStart() { - $('.log').ajaxStart(function () { - $(this).text('Triggered ajaxStart handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $("#loading").ajaxStart(function () { - $(this).show(); - }); -} - -function test_ajaxStop() { - $('.log').ajaxStop(function () { - $(this).text('Triggered ajaxStop handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $("#loading").ajaxStop(function () { - $(this).hide(); - }); -} - -function test_ajaxSuccess() { - $('.log').ajaxSuccess(function () { - $(this).text('Triggered ajaxSuccess handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $('.log').ajaxSuccess(function (e, xhr, settings) { - if (settings.url == 'ajax/test.html') { - $(this).text('Triggered ajaxSuccess handler. The ajax response was:' + xhr.responseText); - } - }); - $("#msg").ajaxSuccess(function (evt, request, settings) { - $(this).append("
  • Successful Request!
  • "); - }); -} - -function test_allSelector() { - var elementCount = $("*").css("border", "3px solid red").length; - $("body").prepend("

    " + elementCount + " elements found

    "); - var elementCount2 = $("#test").find("*").css("border", "3px solid red").length; - $("body").prepend("

    " + elementCount2 + " elements found

    "); -} - -function test_animate() { - $('#clickme').click(function () { - $('#book').animate({ - opacity: 0.25, - left: '+=50', - height: 'toggle' - }, 5000, function () { - }); - }); - $('li').animate({ - opacity: .5, - height: '50%' - }, { - step: function (now, fx) { - var data = fx.elem.id + ' ' + fx.prop + ': ' + now; - $('body').append('
    ' + data + '
    '); - } - }); - $('#clickme').click(function () { - $('#book').animate({ - width: ['toggle', 'swing'], - height: ['toggle', 'swing'], - opacity: 'toggle' - }, 5000, 'linear', function () { - $(this).after('
    Animation complete.
    '); - }); - }); - $('#clickme').click(function () { - $('#book').animate({ - width: 'toggle', - height: 'toggle' - }, { - duration: 5000, - specialEasing: { - width: 'linear', - height: 'easeOutBounce' - }, - complete: function () { - $(this).after('
    Animation complete.
    '); + function isFunction() { + function type_guard(obj: object) { + if ($.isFunction(obj)) { + obj(); } - }); - }); - $("#go").click(function () { - $("#block").animate({ - width: "70%", - opacity: 0.4, - marginLeft: "0.6in", - fontSize: "3em", - borderWidth: "10px" - }, 1500); - }); - $("#right").click(function () { - $(".block").animate({ "left": "+=50px" }, "slow"); - }); - $("#left").click(function () { - $(".block").animate({ "left": "-=50px" }, "slow"); - }); - $("#go1").click(function () { - $("#block1").animate({ width: "90%" }, { queue: false, duration: 3000 }) - .animate({ fontSize: "24px" }, 1500) - .animate({ borderRightWidth: "15px" }, 1500); - }); - $("#go2").click(function () { - $("#block2").animate({ width: "90%" }, 1000) - .animate({ fontSize: "24px" }, 1000) - .animate({ borderLeftWidth: "15px" }, 1000); - }); - $("#go3").click(function () { - $("#go1").add("#go2").click(); - }); - $("#go4").click(function () { - $("div").css({ width: "", fontSize: "", borderWidth: "" }); - }); - $("#go").click(function () { - $(".block:first").animate({ - left: 100 - }, { - duration: 1000, - step: function (now, fx) { - $(".block:gt(0)").css("left", now); + } + } + + function isNumeric() { + function type_guard(obj: boolean) { + if ($.isNumeric(obj)) { + obj.toFixed(); } - }); - }); - $("p").animate({ - height: "toggle", opacity: "toggle" - }, "slow"); - $("p").animate({ - left: 50, opacity: 1 - }, 500); - $("p").animate({ - left: "50px", opacity: 1 - }, { duration: 500, queue: false }); - $("p").animate({ - opacity: "show" - }, "slow", "easein"); - $("p").animate({ - height: "toggle", opacity: "toggle" - }, { duration: "slow" }); - $("p").animate({ - opacity: "show" - }, { duration: "slow", easing: "easein" }); - $("p").animate({ - height: 200, width: 400, opacity: 0.5 - }, 1000, "linear", function () { - alert("all done"); - }); -} - -function test_animatedSelector() { - $("#run").click(function () { - $("div:animated").toggleClass("colored"); - }); - function animateIt() { - $("#mover").slideToggle("slow", animateIt); - } - animateIt(); -} - -function test_slideToggle() { - $("button").click(function () { - $("p").slideToggle("slow"); - }); - - $("#aa").click(function () { - $("div:not(.still)").slideToggle("slow", function () { - var n = parseInt($("span").text(), 10); - $("span").text(n + 1); - }); - }); -} - -function test_toggle() { - $(".target").toggle(); - - $("#clickme").click(function () { - $("#book").toggle("slow", function () { - // Animation complete. - }); - }); - - $("#foo").toggle(true); - - $("button").click(function () { - $("p").toggle(); - }); - - $("button").click(function () { - $("p").toggle("slow"); - }); - - var flip = 0; - $("button").click(function () { - $("p").toggle(flip++ % 2 === 0); - }); -} - -function test_append() { - $('.inner').append('

    Test

    '); - $('.container').append($('h2')).append(document.createDocumentFragment()); - - var $newdiv1 = $('
    '), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - - $('body').append($newdiv1, [newdiv2, existingdiv1]); -} - -function test_appendTo() { - $('

    Test

    ').appendTo('.inner'); - $('h2').appendTo($('.container')); -} - -function test_attr() { - var title = $("em").attr("title"); - $("em").attr("title", null); // Delete an attribute. - $("div").text(title); - $('#greatphoto').attr('alt', 'Beijing Brush Seller'); - $('#greatphoto') - .attr('title', 'Photo by Kelly Clark'); - $('#greatphoto').attr({ - alt: 'Beijing Brush Seller', - title: 'photo by Kelly Clark' - }); - $('#greatphoto').attr('title', function (i, val) { - return val + ' - photo by Kelly Clark' - }); - $("div").attr("id", function (arr) { - return "div-id" + arr; - }) - .each(function () { - $("span", this).html("(ID = '" + this.id + "')"); - }); - $("img").attr("src", function () { - return "/images/" + this.title; - }); -} - -function test_attributeSelectors() { - $('a[hreflang|="en"]').css('border', '3px dotted green'); - $('input[name*="man"]').val('has man in it!'); - $('input[name~="man"]').val('mr. man is in it!'); - $('input[name$="letter"]').val('a letter'); - $('input[value="Hot Fuzz"]').next().text(" Hot Fuzz"); - $('input[name!="newsletter"]').next().append('; not newsletter'); - $('input[name^="news"]').val('news here!'); -} - -function test_before() { - $('.inner').before('

    Test

    '); - $('.container').before($('h2')).before(document.createDocumentFragment()); - $("
    ").before("

    "); - var $newdiv1 = $('
    '), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - $('p').first().before($newdiv1, [newdiv2, existingdiv1]); -} - -function test_bind() { - $('#foo').bind('click', function () { - alert('User clicked on "foo."'); - }); - $('#foo').bind('mouseenter mouseleave', function () { - $(this).toggleClass('entered'); - }); - $('#foo').bind({ - click: function () { }, - mouseenter: function () { } - }); - $('#foo').bind('click', function () { - alert($(this).text()); - }); - $(document).ready(function () { - $('#foo').bind('click', function (event) { - alert('The mouse cursor is at (' - + event.pageX + ', ' + event.pageY + ')'); - }); - }); - var message = 'Spoon!'; - $('#foo').bind('click', function () { - alert(message); - }); - message = 'Not in the face!'; - $('#bar').bind('click', function () { - alert(message); - }); - var message = 'Spoon!'; - $('#foo').bind('click', { msg: message }, function (event) { - alert(event.data.msg); - }); - message = 'Not in the face!'; - $('#bar').bind('click', { msg: message }, function (event) { - alert(event.data.msg); - }); - $("p").bind("click", function (event) { - var str = "( " + event.pageX + ", " + event.pageY + " )"; - $("span").text("Click happened! " + str); - }); - $("p").bind("dblclick", function () { - $("span").text("Double-click happened in " + this.nodeName); - }); - $("p").bind("mouseenter mouseleave", function (event) { - $(this).toggleClass("over"); - }); - $("p").bind("click", function () { - alert($(this).text()); - }); - function handler(event) { - alert(event.data.foo); - } - $("p").bind("click", { foo: "bar" }, handler) - $("form").bind("submit", function () { return false; }) - $("form").bind("submit", function (event) { - event.preventDefault(); - }); - $("form").bind("submit", function (event) { - event.stopPropagation(); - }); - $("p").bind("myCustomEvent", function (e, myName?, myValue?) { - $(this).text(myName + ", hi there!"); - $("span").stop().css("opacity", 1) - .text("myName = " + myName) - .fadeIn(30).fadeOut(1000); - }); - $("button").click(function () { - $("p").trigger("myCustomEvent", ["John"]); - }); - $("div.test").bind({ - click: function () { - $(this).addClass("active"); - }, - mouseenter: function () { - $(this).addClass("inside"); - }, - mouseleave: function () { - $(this).removeClass("inside"); } - }); -} + } -function test_unbind() { - $("#foo").unbind(); - - $("#foo").unbind("click"); - - var handler = function () { - alert("The quick brown fox jumps over the lazy dog."); - }; - $("#foo").bind("click", handler); - $("#foo").unbind("click", handler); - - $("#foo").bind("click", function () { - alert("The quick brown fox jumps over the lazy dog."); - }); - - // Will NOT work - $("#foo").unbind("click", function () { - alert("The quick brown fox jumps over the lazy dog."); - }); - - $("#foo").bind("click.myEvents", handler); - - $("#foo").unbind("click"); - - $("#foo").unbind("click.myEvents"); - - $("#foo").unbind(".myEvents"); - - var timesClicked = 0; - $("#foo").bind("click", function (event) { - alert("The quick brown fox jumps over the lazy dog."); - timesClicked++; - if (timesClicked >= 3) { - $(this).unbind(event); + function isPlainObject() { + function type_guard(obj: object) { + if ($.isPlainObject(obj)) { + obj['key'] = true; + } } - }); - - function aClick() { - $("div").show().fadeOut("slow"); } - $("#bind").click(function () { - $("#theone") - .bind("click", aClick) - .text("Can Click!"); - }); - $("#unbind").click(function () { - $("#theone") - .unbind("click", aClick) - .text("Does nothing..."); - }); - $("p").unbind(); - - $("p").unbind("click"); - - var foo = function () { - // Code to handle some kind of event - }; - - $("p").bind("click", foo); // ... Now foo will be called when paragraphs are clicked ... - - $("p").unbind("click", foo); // ... foo will no longer be called. -} - -function test_blur() { - $('#target').blur(function () { - alert('Handler for .blur() called.'); - }); - $('#other').click(function () { - $('#target').blur(); - - }); - $("p").blur(); -} - -interface JQueryStatic { Topic; } -function test_callbacks() { - function fn1(value) { - console.log(value); + function isWindow() { + function type_guard(obj: object) { + if ($.isWindow(obj)) { + obj.location.href === 'href'; + } + } } - function fn2(value) { - fn1("fn2 says:" + value); - return false; - } - var callbacks = $.Callbacks(); - var callbacks2 = $.Callbacks("once"); - callbacks.add(fn1); - callbacks.fire("foo!"); - callbacks.add(fn2); - callbacks.fire("bar!"); - callbacks.remove(fn2); - callbacks.fire("foobar"); - var topics = {}; - jQuery.Topic = function (id) { - var callbacks, - method, - topic = id && topics[id]; - if (!topic) { - callbacks = jQuery.Callbacks(); - topic = { - publish: callbacks.fire, - subscribe: callbacks.add, - unsubscribe: callbacks.remove + function map() { + function object() { + const testObj = { + myProp: true, + name: 'Rogers', }; - if (id) { - topics[id] = topic; - } - } - return topic; - }; - $.Topic("mailArrived").subscribe(fn1); - $.Topic("mailArrived").subscribe(fn2); - $.Topic("mailSent").subscribe(fn1); - $.Topic("mailArrived").publish("hello world!"); - $.Topic("mailSent").publish("woo! mail!"); - $.Topic("mailArrived").subscribe(fn1); - var dfd = $.Deferred(); - var topic = $.Topic("mailArrived"); - dfd.done(topic.publish); - dfd.resolve("its been published!"); -} - -function test_callbacksFunctions() { - var foo = function (value) { - console.log('foo:' + value); - } - var bar = function (value) { - console.log('bar:' + value); - } - var callbacks = $.Callbacks(); - callbacks.add(foo); - callbacks.fire('hello'); - callbacks.add(bar); - callbacks.fire('world'); - callbacks.disable(); - - // Test the disabled state of the list - console.log(callbacks.disabled()); - // Outputs: true - - callbacks.empty(); - callbacks.fire('hello'); - console.log(callbacks.fired()); - callbacks.fireWith(window, ['foo', 'bar']); - var foo2 = function (value1, value2) { - console.log('Received:' + value1 + ',' + value2); - }; - console.log(callbacks.has(foo2)); - callbacks.lock(); - console.log(callbacks.locked()); - callbacks.remove(foo); -} - -function test_change() { - $('.target').change(function () { - alert('Handler for .change() called.'); - }); - $('#other').click(function () { - $('.target').change(); - }); - $("input[type='text']").change(function () { }); - $("input[type='text']").change(); -} - -function test_children() { - $('ul.level-2').children().css('background-color', 'red'); - $("#container").click(function (e) { - $("*").removeClass("hilite"); - var $kids = $(e.target).children(); - var len = $kids.addClass("hilite").length; - - $("#results span:first").text(len); - //$("#results span:last").text(e.target.tagName); - - e.preventDefault(); - return false; - }); - $("div").children(".selected").css("color", "blue"); -} - -function test_clearQueue() { - $("#start").click(function () { - var myDiv = $("div"); - myDiv.show("slow"); - myDiv.animate({ left: '+=200' }, 5000); - myDiv.queue(function () { - var _this = $(this); - _this.addClass("newcolor"); - _this.dequeue(); - }); - myDiv.animate({ left: '-=200' }, 1500); - myDiv.queue(function () { - var _this = $(this); - _this.removeClass("newcolor"); - _this.dequeue(); - }); - myDiv.slideUp(); - - }); - $("#stop").click(function () { - var myDiv = $("div"); - myDiv.clearQueue(); - myDiv.stop(); - }); -} - -function test_click() { - $("#target").click(function () { - alert("Handler for .click() called."); - }); - $("#other").click(function () { - $("#target").click(); - }); - $("p").click(function () { - $(this).slideUp(); - }); - $("p").click(); -} - -function test_submit() { - $("#target").submit(function () { - alert("Handler for .submit() called."); - }); - $("#target").submit(); -} - -function test_trigger() { - - $("#foo").on("click", function () { - alert($(this).text()); - }); - $("#foo").trigger("click"); - - $("#foo").on("custom", function (event, param1?, param2?) { - alert(param1 + "\n" + param2); - }); - $("#foo").trigger("custom", ["Custom", "Event"]); - - $("button:first").click(function () { - update($("span:first")); - }); - - $("button:last").click(function () { - $("button:first").trigger("click"); - update($("span:last")); - }); - - function update(j) { - var n = parseInt(j.text(), 10); - j.text(n + 1); - } - - $("form:first").trigger("submit"); - - var event = jQuery.Event("submit"); - $("form:first").trigger(event); - if (event.isDefaultPrevented()) { - // Perform an action... - } - - $("p") - .click(function (event, a, b) { - // When a normal click fires, a and b are undefined - // for a trigger like below a refers to "foo" and b refers to "bar" - }) - .trigger("click", ["foo", "bar"]); - - var event = jQuery.Event("logged"); - (event).user = "foo"; - (event).pass = "bar"; - $("body").trigger(event); - - // Adapted from jQuery documentation which may be wrong on this occasion - var event2 = jQuery.Event("logged"); - $("body").trigger(event2, { - type: "logged", - user: "foo", - pass: "bar" - }); -} - -function test_clone() { - $('.hello').clone().appendTo('.goodbye'); - var $elem = $('#elem').data({ "arr": [1] }), - $clone = $elem.clone(true) - .data("arr", $.extend([], $elem.data("arr"))); - $("b").clone().prependTo("p"); - $('#copy').append($('#orig .elem') - .clone() - .children('a') - .prepend('foo - ') - .parent() - .clone()); -} - -function test_prepend() { - $('.inner').prepend('

    Test

    '); - $('.container').prepend($('h2')).prepend(document.createDocumentFragment()); - - var $newdiv1 = $('
    '), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - - $('body').prepend($newdiv1, [newdiv2, existingdiv1]); -} - -function test_prependTo() { - $("

    Test

    ").prependTo(".inner"); - $("h2").prependTo($(".container")); - $("span").prependTo("#foo"); -} - -function test_closest() { - $('li.item-a').closest('ul') - .css('background-color', 'red'); - $('li.item-a').closest('li') - .css('background-color', 'red'); - var listItemII = document.getElementById('ii'); - $('li.item-a').closest('ul', listItemII) - .css('background-color', 'red'); - $('li.item-a').closest('#one', listItemII) - .css('background-color', 'green'); - $(document).bind("click", function (e) { - $(e.target).closest("li").toggleClass("hilight"); - }); - var $listElements = $("li").css("color", "blue"); - $(document).bind("click", function (e) { - //$(e.target).closest($listElements).toggleClass("hilight"); - }); -} - -function test_contains() { - jQuery.contains(document.documentElement, document.body); - jQuery.contains(document.body, document.documentElement); -} - -function test_contents() { - $('.container').contents().filter(function () { - return this.nodeType == 3; - }) - .wrap('

    ') - .end() - .filter('br') - .remove(); - $("#frameDemo").contents().find("a").css("background-color", "#BADA55"); -} - -function test_context() { - $("ul") - .append("
  • " + $("ul").context + "
  • ") - .append("
  • " + $("ul", document.body).context.nodeName + "
  • "); -} - -function test_css() { - $("div").click(function () { - var color = $(this).css("background-color"); - $("#result").html("That div is " + color + "."); - }); - $('div.example').css('width', function (index) { - return index * 50; - }); - $("p").mouseover(function () { - $(this).css("color", "red"); - }); - $("#box").one("click", function () { - $(this).css("width", "+=200"); - }); - var words = $("p:first").text().split(" "); - var text = words.join(" "); - $("p:first").html("" + text + ""); - $("span").click(function () { - $(this).css("background-color", "yellow"); - }); - $("p").hover(function () { - $(this).css({ 'background-color': 'yellow', 'font-weight': 'bolder' }); - }, function () { - var cssObj = { - 'background-color': '#ddd', - 'font-weight': '', - 'color': 'rgb(0,40,244)' - } - $(this).css(cssObj); - }); - $("div").click(function () { - $(this).css({ - width: function (index, value) { - return parseFloat(value) * 1.2; - }, - height: function (index, value) { - return parseFloat(value) * 1.2; - } - }); - }); - var dims = $("#box").css([ "width", "height", "backgroundColor" ]); -} - -function test_cssHooks() { - if (!$.cssHooks) { - throw ("jQuery 1.4.3 or above is required for this plugin to work"); - } - $.cssHooks["someCSSProp"] = { - get: function (elem, computed, extra) { }, - set: function (elem, value) { } - }; - function styleSupport(prop) { - var vendorProp, supportedProp, - capProp = prop.charAt(0).toUpperCase() + prop.slice(1), - prefixes = ["Moz", "Webkit", "O", "ms"], - div = document.createElement("div"); - - if (prop in div.style) { - supportedProp = prop; - } else { - for (var i = 0; i < prefixes.length; i++) { - vendorProp = prefixes[i] + capProp; - if (vendorProp in div.style) { - supportedProp = vendorProp; - break; + const results = $.map(testObj, (propertyOfObject, key) => { + switch (key) { + case 'myProp': + return 1; + case 'name': + return false; } - } - } - div = null; - $.support[prop] = supportedProp; - return supportedProp; - } - styleSupport("borderRadius"); - - $.cssNumber["someCSSProp"] = true; - $.fx.step["someCSSProp"] = function (fx) { - $.cssHooks["someCSSProp"].set(fx.elem, fx.now + fx.unit); - }; -} - -function test_data() { - $('body').data('foo', 52); - $('body').data('bar', { myType: 'test', count: 40 }); - $('body').data('foo'); - $('body').data(); - $("div").data("test", { first: 16, last: "pizza!" }); - $("span:first").text($("div").data("test").first); - $("span:last").text($("div").data("test").last); - alert($('body').data('foo')); - alert($('body').data()); - alert($("body").data("foo")); - $("body").data("bar", "foobar"); - alert($("body").data("bar")); - $("div").data("role") === "page"; - $("div").data("lastValue") === 43; - $("div").data("hidden") === true; - $("div").data("options").name === "John"; - var value; - switch ($("button").index(this)) { - case 0: - value = $("div").data("blah"); - break; - case 1: - $("div").data("blah", "hello"); - value = "Stored!"; - break; - case 2: - $("div").data("blah", 86); - value = "Stored!"; - break; - case 3: - $("div").removeData("blah"); - value = "Removed!"; - break; - } - $("span").text("" + value); - jQuery.data(document.body, 'foo', 52); - jQuery.data(document.body, 'bar', 'test'); - var div = $("div")[0]; - jQuery.data(div, "test", { first: 16, last: "pizza!" }); - $("span:first").text(jQuery.data(div, "test").first); - $("span:last").text(jQuery.data(div, "test").last); - $.data(document.getElementById("id"), "", 8).toFixed(2); - $.data(document.getElementById("id"), "", "8").toUpperCase(); -} - -function test_removeData() { - $("span:eq(0)").text("" + $("div").data("test1")); - $("div").data("test1", "VALUE-1"); - $("div").data("test2", "VALUE-2"); - $("span:eq(1)").text("" + $("div").data("test1")); - $("div").removeData("test1"); - $("span:eq(2)").text("" + $("div").data("test1")); - $("span:eq(3)").text("" + $("div").data("test2")); -} - -function test_jQuery_removeData() { - var div = $("div")[0]; - $("span:eq(0)").text("" + $("div").data("test1")); - jQuery.data(div, "test1", "VALUE-1"); - jQuery.data(div, "test2", "VALUE-2"); - $("span:eq(1)").text("" + jQuery.data(div, "test1")); - jQuery.removeData(div, "test1"); - $("span:eq(2)").text("" + jQuery.data(div, "test1")); - $("span:eq(3)").text("" + jQuery.data(div, "test2")); -} - -function test_removeDataAll() { - var el = $("div"); - el.data("test1", "VALUE-1"); - el.data("test2", "VALUE-2"); - el.removeData(); -} - -function test_dblclick() { - $('#target').dblclick(function () { - alert('Handler for .dblclick() called.'); - }); - $('#other').click(function () { - $('#target').dblclick(); - }); - $("p").dblclick(function () { alert("Hello World!"); }); - var divdbl = $("div:first"); - divdbl.dblclick(function () { - divdbl.toggleClass('dbl'); - }); - $('#target').dblclick(); -} - -function test_delay() { - $('#foo').slideUp(300).delay(800).fadeIn(400); - $("button").click(function () { - $("div.first").slideUp(300).delay(800).fadeIn(400); - $("div.second").slideUp(300).fadeIn(400); - }); -} - -function test_delegate() { - $("table").delegate("td", "click", function () { - $(this).toggleClass("chosen"); - }); - $("table").on("click", "td", function () { - $(this).toggleClass("chosen"); - }); - $("body").delegate("p", "click", function () { - $(this).after("

    Another paragraph!

    "); - }); - $("body").delegate("p", "click", function () { - alert($(this).text()); - }); - $("body").delegate("a", "click", function () { return false; }); - $("body").delegate("a", "click", function (event) { - event.preventDefault(); - }); - $("body").delegate("p", "myCustomEvent", function (e, myName?, myValue?) { - $(this).text("Hi there!"); - $("span").stop().css("opacity", 1) - .text("myName = " + myName) - .fadeIn(30).fadeOut(1000); - }); - $("button").click(function () { - $("p").trigger("myCustomEvent"); - }); -} - -function test_undelegate() { - function aClick() { - $("div").show().fadeOut("slow"); - } - $("#bind").click(function () { - $("body") - .delegate("#theone", "click", aClick) - .find("#theone").text("Can Click!"); - }); - $("#unbind").click(function () { - $("body") - .undelegate("#theone", "click", aClick) - .find("#theone").text("Does nothing..."); - }); - - $("p").undelegate(); - - $("p").undelegate("click"); - - var foo = function () { - // Code to handle some kind of event - }; - - // ... Now foo will be called when paragraphs are clicked ... - $("body").delegate("p", "click", foo); - - // ... foo will no longer be called. - $("body").undelegate("p", "click", foo); - - var foo = function () { - // Code to handle some kind of event - }; - - // Delegate events under the ".whatever" namespace - $("form").delegate(":button", "click.whatever", foo); - - $("form").delegate("input[type='text'] ", "keypress.whatever", foo); - - // Unbind all events delegated under the ".whatever" namespace - $("form").undelegate(".whatever"); -} - -function test_dequeue() { - $("button").click(function () { - $("div").animate({ left: '+=200px' }, 2000); - $("div").animate({ top: '0px' }, 600); - $("div").queue(function () { - $(this).toggleClass("red"); - $(this).dequeue(); - }); - $("div").animate({ left: '10px', top: '30px' }, 700); - }); -} - -function test_queue() { - - $("#show").click(function () { - var n = jQuery.queue($("div")[0], "fx"); - $("span").text("Queue length is: " + n.length); - }); - - function runIt() { - $("div") - .show("slow") - .animate({ - left: "+=200" - }, 2000) - .slideToggle(1000) - .slideToggle("fast") - .animate({ - left: "-=200" - }, 1500) - .hide("slow") - .show(1200) - .slideUp("normal", runIt); - } - - runIt(); - - $(document.body).click(function () { - var divs = $("div") - .show("slow") - .animate({ left: "+=200" }, 2000); - jQuery.queue(divs[0], "fx", function () { - $(this).addClass("newcolor"); - jQuery.dequeue(this); - }); - divs.animate({ left: "-=200" }, 500); - jQuery.queue(divs[0], "fx", function () { - $(this).removeClass("newcolor"); - jQuery.dequeue(this); - }); - divs.slideUp(); - }); - - $("#start").click(function () { - var divs = $("div") - .show("slow") - .animate({ left: "+=200" }, 5000); - jQuery.queue(divs[0], "fx", function () { - $(this).addClass("newcolor"); - jQuery.dequeue(this); - }); - divs.animate({ left: "-=200" }, 1500); - jQuery.queue(divs[0], "fx", function () { - $(this).removeClass("newcolor"); - jQuery.dequeue(this); - }); - divs.slideUp(); - }); - $("#stop").click(function () { - jQuery.queue($("div")[0], "fx", []); - $("div").stop(); - }); -} - -function test_detach() { - $("p").click(function () { - $(this).toggleClass("off"); - }); - var p; - $("button").click(function () { - if (p) { - p.appendTo("body"); - p = null; - } else { - p = $("p").detach(); - } - }); -} - -function test_each() { - var numArray: number[]; - numArray = $.each([1, 2, 3, 4], function (index: number, value: number) { - alert(index + ': ' + value); - }); - numArray = $.each([1, 2, 3, 4], function (index: number, value: number) { - alert(index + ': ' + value); - return value < 2; - }); - - var res: {one: number, 2: string}; - res = $.each({ one: 1, 2: "two" }, function(key: string, value: any) { - alert(key + ': ' + value); - }); - res = $.each({ one: 1, 2: "two" }, function(key: string, value: any) { - alert(key + ': ' + value); - return key === "2"; - }); - - var map = { - 'flammable': 'inflammable', - 'duh': 'no duh' - }; - $.each(map, function (key, value) { - alert(key + ': ' + value); - }); - var arr = ["one", "two", "three", "four", "five"]; - var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 }; - jQuery.each(arr, function () { - $("#" + this).text("Mine is " + this + "."); - return (this != "three"); - }); - jQuery.each(obj, function (i, val) { - $("#" + i).append(document.createTextNode(" - " + val)); - }); - $.each(['a', 'b', 'c'], function (i, l) { - alert("Index #" + i + ": " + l); - }); - $.each({ name: "John", lang: "JS" }, function (k, v) { - alert("Key: " + k + ", Value: " + v); - }); - $.each([{a: 1}, {a: 2}, {a: 3}], function (i, o) { - alert("Index #" + i + ": " + o.a); - }); - $('li').each(function (index) { - alert(index + ': ' + $(this).text()); - }); - $(document.body).click(function () { - $("div").each(function (i) { - if (this.style.color != "blue") { - this.style.color = "blue"; - } else { - this.style.color = ""; - } - }); - }); - $("span").click(function () { - $("li").each(function () { - $(this).toggleClass("example"); - }); - }); - $("button").click(function () { - $("div").each(function (index, domEle) { - // domEle == this - $(domEle).css("backgroundColor", "yellow"); - if ($(this).is("#stop")) { - $("span").text("Stopped at div index #" + index); - return false; - } - }); - }); -} - -function test_empty() { - $('.hello').empty(); -} - -function test_end() { - $('ul.first').find('.foo').css('background-color', 'red') - .end().find('.bar').css('background-color', 'green'); - $('ul.first').find('.foo') - .css('background-color', 'red') - .end().find('.bar') - .css('background-color', 'green') - .end(); -} - -function test_eq() { - $('li').eq(2).css('background-color', 'red'); - $('li').eq(-2).css('background-color', 'red'); - $('li').eq(5).css('background-color', 'red'); - $("body").find("div").eq(2).addClass("blue"); -} - -function test_error() { - $('#book') - .error(function () { - alert('Handler for .error() called.') - }) - .attr("src", "missing.png"); - $("img") - .error(function () { - $(this).hide(); - }) - .attr("src", "missing.png"); - jQuery.error("Oups"); - jQuery.error = (message?: string) => { - console.error(message); return this; - }; -} - -function test_eventParams() { - $("p").click(function (event) { - event.currentTarget === this; - }); - $(".box").on("click", "button", function (event) { - $(event.delegateTarget).css("background-color", "red"); - }); - $("a").click(function (event) { - event.isDefaultPrevented(); - event.preventDefault(); - event.isDefaultPrevented(); - }); - function immediatePropStopped(e) { - var msg = ""; - if (e.isImmediatePropagationStopped()) { - msg = "called" - } else { - msg = "not called"; - } - $("#stop-log").append("
    " + msg + "
    "); - } - $("button").click(function (event) { - immediatePropStopped(event); - event.stopImmediatePropagation(); - immediatePropStopped(event); - }); - function propStopped(e) { - var msg = ""; - if (e.isPropagationStopped()) { - msg = "called"; - } else { - msg = "not called"; - } - $("#stop-log").append("
    " + msg + "
    "); - } - $("button").click(function (event) { - propStopped(event); - event.stopPropagation(); - propStopped(event); - }); - $("p").bind("test.something", function (event) { - alert(event.namespace); - }); - $("button").click(function (event) { - $("p").trigger("test.something"); - }); - $(document).bind('mousemove', function (e) { - $("#log").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY); - }); - $("a").click(function (event) { - event.preventDefault(); - $('
    ') - .append('default ' + event.type + ' prevented') - .appendTo('#log'); - }); - $("a").mouseout(function (event) { - alert(event.relatedTarget.nodeName); - }); - $("button").click(function (event) { - return "hey"; - }); - $("button").click(function (event) { - $("p").html(event.result); - }); - $("p").click(function (event) { - event.stopImmediatePropagation(); - }); - $("p").click(function (event) { - $(this).css("background-color", "#f00"); - }); - $("div").click(function (event) { - $(this).css("background-color", "#f00"); - }); - $("p").click(function (event) { - event.stopPropagation(); - }); - $("body").click(function (event) { - //bugfix, duplicate identifier. see: http://stackoverflow.com/questions/14824143/duplicate-identifier-nodename-in-jquery-d-ts - //$("#log").html("clicked: " + event.target.nodeName); - }); - $('#whichkey').bind('keydown', function (e) { - $('#log').html(e.type + ': ' + e.which); - }); - $('#whichkey').bind('mousedown', function (e) { - $('#log').html(e.type + ': ' + e.which); - }); - $(window).on('mousewheel', (e) => { - var delta = (e.originalEvent).deltaY; - }); - $( "p" ).click(function( event ) { - alert( event.currentTarget === this ); // true - }); -} - -function test_extend() { - var object1 = { - apple: 0, - banana: { weight: 52, price: 100 }, - cherry: 97 - }; - var object2 = { - banana: { price: 200 }, - durian: 100 - }; - $.extend(object1, object2); - var printObj = typeof JSON != "undefined" ? JSON.stringify : function (obj) { - var arr = []; - $.each(obj, function (key, val) { - var next = key + ": "; - next += $.isPlainObject(val) ? printObj(val) : val; - arr.push(next); - }); - return "{ " + arr.join(", ") + " }"; - }; - $("#log").append(printObj(object1)); - - var defaults = { validate: false, limit: 5, name: "foo" }; - var options = { validate: true, name: "bar" }; - var settings: typeof defaults = $.extend({}, defaults, options); -} - -function test_fadeIn() { - $('#clickme').click(function () { - $('#book').fadeIn('slow', function () { }); - }); - $(document.body).click(function () { - $("div:hidden:first").fadeIn("slow"); - }); - $("a").click(function () { - $("div").fadeIn(3000, function () { - $("span").fadeIn(100); - }); - return false; - }); -} - -function test_fadeOut() { - $('#clickme').click(function () { - $('#book').fadeOut('slow', function () { }); - }); - $("p").click(function () { - $("p").fadeOut("slow"); - }); - $("span").click(function () { - $(this).fadeOut(1000, function () { - $("div").text("'" + $(this).text() + "' has faded!"); - $(this).remove(); - }); - }); - $("span").hover(function () { - $(this).addClass("hilite"); - }, function () { - $(this).removeClass("hilite"); - }); - $("#btn1").click(function () { - function complete() { - $("
    ").text(this.id).appendTo("#log"); - } - $("#box1").fadeOut(1600, "linear", complete); - $("#box2").fadeOut(1600, complete); - }); - $("#btn2").click(function () { - $("div").show(); - $("#log").empty(); - }); -} - -function test_fadeTo() { - $('#clickme').click(function () { - $('#book').fadeTo('slow', 0.5, function () { }); - }); - $("p:first").click(function () { - $(this).fadeTo("slow", 0.33); - }); - $("div").click(function () { - $(this).fadeTo("fast", Math.random()); - }); - var getPos = function (n) { - return (Math.floor(n) * 90) + "px"; - }; - $("p").each(function (n) { - var r = Math.floor(Math.random() * 3); - var tmp = $(this).text(); - $(this).text($("p:eq(" + r + ")").text()); - $("p:eq(" + r + ")").text(tmp); - $(this).css("left", getPos(n)); - }); - $("div").each(function (n) { - $(this).css("left", getPos(n)); - }) - .css("cursor", "pointer") - .click(function () { - $(this).fadeTo(250, 0.25, function () { - $(this).css("cursor", "") - .prev().css({ - "font-weight": "bolder", - "font-style": "italic" - }); - }); - }); -} - -function test_fadeToggle() { - $("button:first").click(function () { - $("p:first").fadeToggle("slow", "linear"); - }); - $("button:last").click(function () { - $("p:last").fadeToggle("fast", function () { - $("#log").append("
    finished
    "); - }); - }); -} - -function test_filter() { - $('li').filter(':even').css('background-color', 'red'); - $('li').filter(function (index) { - return index % 3 === 2; - }).css('background-color', 'red'); - $("div").css("background", "#b4b0da") - .filter(function (index) { - return index === 1 || $(this).attr("id") === "fourth"; - }) - .css("border", "3px double red"); - $("div").filter(document.getElementById("unique")); - $("div").filter($("#unique")); -} - -function test_find() { - $('li.item-ii').find('li').css('background-color', 'red'); - var item1 = $('li.item-1')[0]; - $('li.item-ii').find(item1).css('background-color', 'red'); - var $spans = $('span'); - $("p").find($spans).css('color', 'red'); - var newText = $("p").text().split(" ").join(" "); - newText = "" + newText + ""; - $("p").html(newText) - .find('span') - .hover(function () { - $(this).addClass("hilite"); - }, - function () { - $(this).removeClass("hilite"); - }) - .end() - .find(":contains('t')") - .css({ "font-style": "italic", "font-weight": "bolder" }); -} - -function test_finish() { - $(".box").finish(); -} - -function test_first() { - $('li').first().css('background-color', 'red'); -} - -function test_focus() { - $('#target').focus(function () { - alert('Handler for .focus() called.'); - }); - $('#other').click(function () { - $('#target').focus(); - }); - $("input").focus(function () { - $(this).next("span").css('display', 'inline').fadeOut(1000); - }); - $("input[type=text]").focus(function () { - $(this).blur(); - }); - $(document).ready(function () { - $("#login").focus(); - }); -} - -function test_focusin() { - $("p").focusin(function () { - $(this).find("span").css('display', 'inline').fadeOut(1000); - }); -} - -function test_focusout() { - var fo = 0, b = 0; - $("p").focusout(function () { - fo++; - $("#fo") - .text("focusout fired: " + fo + "x"); - }).blur(function () { - b++; - $("#b") - .text("blur fired: " + b + "x"); - }); -} - -function test_easing() { - const easing = jQuery.easing; - - function test_easing_function( name: string, fn: JQueryEasingFunction ) { - const step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error - for( let i = 0; i <= 1; i += step ) { - console.log( `$.easing.${name}(${i}): ${fn.call(easing, i)}` ); - } - } - - test_easing_function( "linear", easing.linear ); - test_easing_function( "swing", easing.swing ); -} - -function test_fx() { - jQuery.fx.interval = 100; - $("input").click(function () { - $("div").toggle(3000); - }); - var toggleFx = function () { - $.fx.off = !$.fx.off; - }; - toggleFx(); - $("button").click(toggleFx) - $("input").click(function () { - $("div").toggle("slow"); - }); -} - -function test_get() { - $.get('ajax/test.html', function (data) { - $('.result').html(data); - alert('Load was performed.'); - }); - var jqxhr = $.get("example.php", function () { - alert("success"); - }) - .done(function () { alert("second success"); }) - .fail(function () { alert("error"); }); - - $.get("test.php"); - $.get("test.php", { name: "John", time: "2pm" }); - $.get("test.php", { 'choices[]': ["Jon", "Susan"] }); - $.get("test.php", function (data) { - alert("Data Loaded: " + data); - }); - $.get("test.cgi", { name: "John", time: "2pm" }, - function (data) { - alert("Data Loaded: " + data); - }); - $.get("test.php", - function (data) { - $('body').append("Name: " + data.name) - .append("Time: " + data.time); - }, "json"); - alert($('li').get()); - $('li').get(0); - $('li')[0]; - alert($('li').get(-1)); - function disp(divs) { - var a = []; - for (var i = 0; i < divs.length; i++) { - a.push(divs[i].innerHTML); - } - $("span").text(a.join(" ")); - } - disp($("div").get().reverse()); - $("*", document.body).click(function (e) { - e.stopPropagation(); - var domEl = $(this).get(0); - $("span:first").text("Clicked on - " + domEl.tagName); - }); -} - -function test_getJSON() { - $.getJSON('ajax/test.json', function (data) { - var items = []; - $.each(data, function (key, val) { - items.push('
  • ' + val + '
  • '); - }); - $('
      ', { - 'class': 'my-new-list', - html: items.join('') - }).appendTo('body'); - }); - var jqxhr = $.getJSON("example.json", function () { - alert("success"); - }) - .done(function () { alert("second success"); }) - .fail(function () { alert("error"); }); - $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", - { - tags: "mount rainier", - tagmode: "any", - format: "json" - }, - function (data) { - $.each(data.items, function (i, item) { - $("").attr("src", item.media.m).appendTo("#images"); - if (i === "3") return false; - }); - }); - $.getJSON("test.js", function (json) { - alert("JSON Data: " + json.users[3].name); - }); - $.getJSON("test.js", { name: "John", time: "2pm" }, function (json) { - alert("JSON Data: " + json.users[3].name); - }); -} - -function test_getScript() { - $.getScript("ajax/test.js", function (data, textStatus, jqxhr) { - console.log(data); - console.log(textStatus); - console.log(jqxhr.status); - console.log('Load was performed.'); - }); - $.getScript("ajax/test.js") - .done(function (script, textStatus) { - console.log(textStatus); - }) - .fail(function (jqxhr, settings, exception) { - $("div.log").text("Triggered ajaxError handler."); - }); - $("div.log").ajaxError(function (e, jqxhr, settings, exception) { - if (settings.dataType == 'script') { - $(this).text("Triggered ajaxError handler."); - } - }); - $.ajaxSetup({ - cache: true - }); - $.getScript("/scripts/jquery.color.js", function () { - $("#go").click(function () { - $(".block").animate({ backgroundColor: "pink" }, 1000) - .delay(500) - .animate({ backgroundColor: "blue" }, 1000); - }); - }); -} - -function test_jQueryget() { - console.log($("li").get(0)); - console.log($("li")[0]); - console.log($("li").get(-1)); - $("*", document.body).click(function (event) { - event.stopPropagation(); - var domElement = $(this).get(0); - $("span:first").text("Clicked on - " + domElement.nodeName); - }); - - function display(divs) { - var a = []; - for (var i = 0; i < divs.length; i++) { - a.push(divs[i].innerHTML); - } - $("span").text(a.join(" ")); - } - display($("div").get().reverse()); -} - -function test_globalEval() { - jQuery.globalEval("var newVar = true;"); -} - -function test_grep() { - var arr = [1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1]; - $("div").text(arr.join(", ")); - arr = jQuery.grep(arr, function (n, i) { - return (n != 5 && i > 4); - }); - $("p").text(arr.join(", ")); - var arr2 = jQuery.grep(arr, function (a) { return a != 9; }); - $("span").text(arr.join(", ")); - $.grep([0, 1, 2], function (n, i) { - return n > 0; - }, true); - var arr3 = $.grep(["a", "b", "c"], function (n, i) { return n !== "b"; }); -} - -function test_has() { - $('li').has('ul').css('background-color', 'red'); - $("ul").append("
    • " + ($("ul").has("li").length ? "Yes" : "No") + "
    • "); - $("ul").has("li").addClass("full"); -} - -function test_hasClass() { - $('#mydiv').hasClass('foo'); - $("div#result1").append($("p:first").hasClass("selected").toString()); - $("div#result2").append($("p:last").hasClass("selected").toString()); - $("div#result3").append($("p").hasClass("selected").toString()); -} - -function test_hasData() { - var $p = jQuery("p"), p = $p[0]; - $p.append(jQuery.hasData(p) + " "); - $.data(p, "testing", 123); - $p.append(jQuery.hasData(p) + " "); - $.removeData(p, "testing"); - $p.append(jQuery.hasData(p) + " "); - $p.on('click', function () { }); - $p.append(jQuery.hasData(p) + " "); - $p.off('click'); - $p.append(jQuery.hasData(p) + " "); -} - -function test_jQuery_proxy() { - - function test1() { - var me = { - type: "zombie", - test: function (event?) { - // Without proxy, `this` would refer to the event target - // use event.target to reference that element. - var element = event.target; - $(element).css("background-color", "red"); - - // With proxy, `this` refers to the me object encapsulating - // this function. - $("#log").append("Hello " + this.type + "
      "); - $("#test").off("click", this.test); - } - }; - - var you = { - type: "person", - test: function (event?) { - $("#log").append(this.type + " "); - } - }; - - // Execute you.test() in the context of the `you` object - // no matter where it is called - // i.e. the `this` keyword will refer to `you` - var youClick = $.proxy(you.test, you); - - // attach click handlers to #test - $("#test") - // this === "zombie"; handler unbound after first click - .on("click", $.proxy(me.test, me)) - - // this === "person" - .on("click", youClick) - - // this === "zombie" - .on("click", $.proxy(you.test, me)) - - // this === "