diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts index 3a6b7d6bf1..818899e829 100644 --- a/angular-jwt/angular-jwt-tests.ts +++ b/angular-jwt/angular-jwt-tests.ts @@ -15,3 +15,18 @@ var $jwtInterceptor: ng.jwt.IJwtInterceptor; $jwtInterceptor.tokenGetter = () => { return expToken; } + + +var authManager: ng.jwt.IAuthManagerServiceProvider; + +// Indicate the user is authenticated +authManager.authenticate(); + +// Indicate the user is unauthenticated +authManager.unauthenticate(); + +// Keep the user authenticated +authManager.checkAuthOnRefresh(); + +// Redirect the user on unauthorized requests +authManager.redirectWhenUnauthenticated(); \ No newline at end of file diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts index eb02cf24df..d1f9eb085f 100644 --- a/angular-jwt/angular-jwt.d.ts +++ b/angular-jwt/angular-jwt.d.ts @@ -27,4 +27,11 @@ declare namespace angular.jwt { interface IJwtInterceptor { tokenGetter(...params : any[]): string; } + + interface IAuthManagerServiceProvider { + authenticate(): void; + unauthenticate(): void; + checkAuthOnRefresh(): void; + redirectWhenUnauthenticated(): void; + } } diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 111ba86cce..3d5e5a7b19 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.5 // Project: http://angularjs.org -// Definitions by: Diego Vilar +// Definitions by: Diego Vilar , Georgii Dolzhykov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -238,7 +238,6 @@ declare namespace angular { * @param directiveFactory An injectable directive factory function. */ directive(name: string, inlineAnnotatedFunction: any[]): IModule; - directive(name: string, injectionFunction: Function): IModule; directive(object: Object): IModule; /** * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index 8b9f53a8ab..f562b59d3d 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -4,55 +4,29 @@ import lambda = require('aws-lambda'); var str: string; var date: Date; -var sns: lambda.SNS; -var kinesis: lambda.Kinesis; -var recordsList: lambda.Record[]; var anyObj: any; var num: number; -var identity: lambda.Identity; +var identity: lambda.CognitoIdentity; var error: Error; - -/* Records */ -var records: lambda.Records; - -recordsList = records.Records; - -/* Record */ -var record: lambda.Record; - -str = record.EventVersion; -str = record.EventSubscriptionArn; -str = record.EnventSource; -sns = record.Sns; -kinesis = record.kinesis; - -/* SNS */ -str = sns.Type; -str = sns.MessageId; -str = sns.TopicArn; -str = sns.Subject; -str = sns.Message; -date = sns.Timestamp; - -/* Kinesis */ -var kinesis: lambda.Kinesis; - -str = kinesis.data; +var b: boolean; +var clientCtx: lambda.ClientContext; /* Context */ var context: lambda.Context; -context.log(str, anyObj); -context.fail(str); -context.succeed(str); -context.succeed(anyObj); -context.succeed(str, anyObj); +b = context.callbackWaitsForEmptyEventLoop; +str = context.functionName; +str = context.functionVersion; +str = context.invokedFunctionArn; +num = context.memoryLimitInMB; str = context.awsRequestId; -num = context.getRemainingTimeInMillis(); +str = context.logGroupName; +str = context.logStreamName; identity = context.identity; +clientCtx = context.clientContext; -/* Identity */ -var identity: lambda.Identity; +/* CognitoIdentity */ +var identity: lambda.CognitoIdentity; str = identity.cognitoIdentityId; str = identity.cognitoIdentityPoolId; diff --git a/aws-lambda/aws-lambda.d.ts b/aws-lambda/aws-lambda.d.ts index 081c6e0e3e..c9a66a3783 100644 --- a/aws-lambda/aws-lambda.d.ts +++ b/aws-lambda/aws-lambda.d.ts @@ -1,55 +1,68 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: Michael Skarum +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "aws-lambda" { + // Context + // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html + interface Context { + // Properties + callbackWaitsForEmptyEventLoop: boolean; + functionName: string; + functionVersion: string; + invokedFunctionArn: string; + memoryLimitInMB: number; + awsRequestId: string; + logGroupName: string; + logStreamName: string; + identity?: CognitoIdentity; + clientContext?: ClientContext; + + // Functions + getRemainingTimeInMillis(): number; - export interface Records { - Records: Record[]; - } - interface Record { - EventVersion: string; - EventSubscriptionArn: string; - EnventSource: string; - Sns: SNS; - kinesis: Kinesis; - } - interface SNS { - Type: string; - MessageId: string; - TopicArn: string; - Subject: string; - Message: string; - Timestamp: Date; - } - - interface Kinesis { - data: string; - } - - export interface Context { + // Functions for compatibility with earlier Node.js Runtime v0.10.42 log(message: string, object: any): void; fail(message: string): void; succeed(message: string): void; succeed(object: any): void; - succeed(message: string, object: any): void; - awsRequestId: string; - getRemainingTimeInMillis(): number; - /** Information about the Amazon Cognito identity provider when invoked through the AWS Mobile SDK. It can be null. */ - identity?: Identity; + succeed(message: string, object: any): void; } - - interface Identity { + + interface CognitoIdentity { cognitoIdentityId: string; cognitoIdentityPoolId: string; } - + + interface ClientContext { + client: ClientContextClient; + Custom?: any; + env: ClientContextEnv; + } + + interface ClientContextClient { + installationId: string; + appTitle: string; + appVersionName: string; + appVersionCode: string; + appPackageName: string; + } + + interface ClientContextEnv { + platformVersion: string; + platform: string; + make: string; + model: string; + locale: string; + } + /** * Optional callback parameter. + * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html * - * @param error – an optional parameter that you can use to provide results of the failed Lambda function execution. - * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. + * @param error – an optional parameter that you can use to provide results of the failed Lambda function execution. + * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ export type Callback = (error?: Error, result?: any) => void; } \ No newline at end of file diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index cb35f34e97..90f56d0702 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -235,6 +235,7 @@ declare module "aws-sdk" { upload(params?: s3.PutObjectRequest, options?: s3.UploadOptions, callback?: (err: Error, data: any) => void): void; listObjects(params: s3.ListObjectRequest, callback: (err: Error, data: s3.ListObjectResponse) => void): void; listObjectsV2(params: s3.ListObjectV2Request, callback: (err: Error, data: s3.ListObjectV2Response) => void): void; + waitFor(state: string, params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; } export class STS { diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index afd6014598..6fa0f9c475 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -17,7 +17,7 @@ declare namespace Microsoft.WindowsAzure { login(provider: string, token: string): asyncPromise; login(provider: string, callback: (error: any, user: User) => void ): void; login(provider: string): asyncPromise; - logout(): void; + logout(): asyncPromise; getTable(tableName: string): MobileServiceTable; withFilter(serviceFilter: (request: any, next: (request: any, callback: (error: any, response: any) => void) => void, callback: (error: any, response: any) => void) => void): MobileServiceClient; /** diff --git a/backlog-js/backlog-js-tests.ts b/backlog-js/backlog-js-tests.ts new file mode 100644 index 0000000000..979eb57ca4 --- /dev/null +++ b/backlog-js/backlog-js-tests.ts @@ -0,0 +1,88 @@ +/// + +import * as backlogjs from 'backlog-js'; + +const host = 'example.backlog.jp'; +const apiKey = 'apiKey'; +const clientId = 'clientId'; +const clientSecret = 'clientSecret'; +const redirectUri = 'redirectUri'; +const state = 'state'; +const code = 'code'; +const refreshToken = 'refreshToken'; +const configure = { host, apiKey } +const credentials = { clientId, clientSecret } + +const oauth2 = new backlogjs.OAuth2(credentials); +oauth2.getAuthorizationURL({ host, redirectUri, state }); +oauth2.getAccessToken({ host, code, redirectUri }).then(data => {}).catch(err => {}); +oauth2.refreshAccessToken({ host, refreshToken }).then(data => {}).catch(err => {}); + +const backlog = new backlogjs.Backlog(configure); +backlog.getSpace().then(data => { }).catch(err => { }); +backlog.getSpaceActivities({ + activityTypeId: [ + backlogjs.Option.ActivityType.IssueCreated, + backlogjs.Option.ActivityType.IssueUpdated + ], + minId: 1, + maxId: 2, + count: 3, + order: "asc" +}).then(data => { }).catch(err => { }); +backlog.getSpaceDiskUsage().then(data => { }).catch(err => { }); +backlog.getSpaceIcon().then(data => { }).catch(err => { }); +backlog.postSpaceAttachment(new FormData()).then(data => { }).catch(err => { }); +backlog.getUsers().then(data => { }).catch(err => { }); +backlog.getUser(1).then(data => { }).catch(err => { }); +backlog.postUser({ + userId: 'string', + password: 'string', + name: 'string', + mailAddress: 'string', + roleType: backlogjs.Option.User.RoleType.Admin +}).then(data => { }).catch(err => { }); +backlog.patchUser(1, { + password: 'string', + name: 'string', + mailAddress: 'string', + roleType: backlogjs.Option.User.RoleType.Admin +}).then(data => { }).catch(err => { }); +backlog.deleteUser(1).then(data => { }).catch(err => { }); +backlog.getMyself().then(data => { }).catch(err => { }); +backlog.getUserActivities(1, { + activityTypeId: [ + backlogjs.Option.ActivityType.IssueCreated, + backlogjs.Option.ActivityType.IssueUpdated + ], + minId: 1, + maxId: 2, + count: 3, + order: "asc" +}).then(data => { }).catch(err => { }); +backlog.getUserStars(1, { + minId: 1, + maxId: 2, + count: 3, + order: "asc" +}).then(data => { }).catch(err => { }); +backlog.getUserStarsCount(1, { + since: 'YYYY-MM-DD', + until: 'YYYY-MM-DD' +}).then(data => { }).catch(err => { }); +backlog.getRecentlyViewedIssues({ + order: 'asc', + offset: 1, + count: 2 +}).then(data => { }).catch(err => { }); +backlog.getRecentlyViewedProjects({ + order: 'asc', + offset: 1, + count: 2 +}).then(data => { }).catch(err => { }); +backlog.getRecentlyViewedWikis({ + order: 'asc', + offset: 1, + count: 2 +}).then(data => { }).catch(err => { }); +backlog.getUserIcon(1).then(data => {}).catch(err => {}); diff --git a/backlog-js/backlog-js.d.ts b/backlog-js/backlog-js.d.ts new file mode 100644 index 0000000000..353e7e90cd --- /dev/null +++ b/backlog-js/backlog-js.d.ts @@ -0,0 +1,695 @@ +// Type definitions for backlog-js 0.9.0 +// Project: https://github.com/nulab/backlog-js +// Definitions by: Yuichi Watanabe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module 'backlog-js' { + + class Request { + private configure; + constructor(configure: { + host: string; + apiKey?: string; + accessToken?: string; + timeout?: number; + }); + get(path: string, params?: any): Promise; + post(path: string, params?: any): Promise; + put(path: string, params: any): Promise; + patch(path: string, params: any): Promise; + delete(path: string, params?: any): Promise; + request(options: { + method: string; + path: string; + params?: Params | FormData; + }): Promise; + checkStatus(response: IResponse): Promise; + parseJSON(response: IResponse): Promise; + private toFormData(params); + private toQueryString(params); + webAppBaseURL: string; + restBaseURL: string; + } + + type Params = { + [index: string]: number | string | number[] | string[]; + }; + + export class Backlog extends Request { + constructor(configure: { + host: string; + apiKey?: string; + accessToken?: string; + timeout?: number; + }); + getSpace(): Promise; + getSpaceActivities(params: Option.Space.GetActivitiesParams): Promise; + getSpaceNotification(): Promise; + putSpaceNotification(params: Option.Space.PutSpaceNotificationParams): Promise; + getSpaceDiskUsage(): Promise; + getSpaceIcon(): Promise; + postSpaceAttachment(form: FormData): Promise; + getUsers(): Promise; + getUser(userId: number): Promise; + postUser(params: Option.User.PostUserParams): Promise; + patchUser(userId: number, params: Option.User.PatchUserParams): Promise; + deleteUser(userId: number): Promise; + getMyself(): Promise; + getUserActivities(userId: number, params: Option.User.GetUserActivitiesParams): Promise; + getUserStars(userId: number, params: Option.User.GetUserStarsParams): Promise; + getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise; + getRecentlyViewedIssues(params: Option.User.GetRecentlyViewedParams): Promise; + getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise; + getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise; + getUserIcon(userId: number): Promise; + getGroups(params: Option.Group.GetGroupsParams): Promise; + postGroups(params: Option.Group.PostGroupsParams): Promise; + getGroup(groupId: number): Promise; + patchGroup(groupId: number, params: Option.Group.PatchGroupParams): Promise; + deleteGroup(groupId: number): Promise; + getStatuses(): Promise; + getResolutions(): Promise; + getPriorities(): Promise; + postProject(params: Option.Project.PostProjectParams): Promise; + getProjects(params?: Option.Project.GetProjectsParams): Promise; + getProject(projectIdOrKey: string): Promise; + patchProject(projectIdOrKey: string, params: Option.Project.PatchProjectParams): Promise; + deleteProject(projectIdOrKey: string): Promise; + getProjectActivities(projectIdOrKey: string, params: Option.Space.GetActivitiesParams): Promise; + getProjectUsers(projectIdOrKey: string): Promise; + deleteProjectUsers(projectIdOrKey: string, params: Option.Project.DeleteProjectUsersParams): Promise; + postProjectAdministrators(projectIdOrKey: string, params: Option.Project.PostProjectAdministrators): Promise; + getProjectAdministrators(projectIdOrKey: string): Promise; + deleteProjectAdministrators(projectIdOrKey: string, params: Option.Project.DeleteProjectAdministrators): Promise; + getIssueTypes(projectIdOrKey: string): Promise; + postIssueType(projectIdOrKey: string, params: Option.Project.PostIssueTypeParams): Promise; + patchIssueType(projectIdOrKey: string, id: number, params: Option.Project.PatchIssueTypeParams): Promise; + deleteIssueType(projectIdOrKey: string, id: number, params: Option.Project.DeleteIssueTypeParams): Promise; + getCategories(projectIdOrKey: string): Promise; + postCategories(projectIdOrKey: string, params: Option.Project.PostCategoriesParams): Promise; + patchCategories(projectIdOrKey: string, id: number, params: Option.Project.PatchCategoriesParams): Promise; + deleteCategories(projectIdOrKey: string, id: number): Promise; + getVersions(projectIdOrKey: string): Promise; + postVersions(projectIdOrKey: string, params: Option.Project.PostVersionsParams): Promise; + patchVersions(projectIdOrKey: string, id: number, params: Option.Project.PatchVersionsParams): Promise; + deleteVersions(projectIdOrKey: string, id: number): Promise; + getCustomFields(projectIdOrKey: string): Promise; + postCustomField(projectIdOrKey: string, params: Option.Project.PostCustomFieldParams | Option.Project.PostCustomFieldWithNumericParams | Option.Project.PostCustomFieldWithDateParams | Option.Project.PostCustomFieldWithListParams): Promise; + patchCustomField(projectIdOrKey: string, id: number, params: Option.Project.PatchCustomFieldParams | Option.Project.PatchCustomFieldWithNumericParams | Option.Project.PatchCustomFieldWithDateParams | Option.Project.PatchCustomFieldWithListParams): Promise; + deleteCustomField(projectIdOrKey: string, id: number): Promise; + postCustomFieldItem(projectIdOrKey: string, id: number, params: Option.Project.PostCustomFieldItemParams): Promise; + patchCustomFieldItem(projectIdOrKey: string, id: number, itemId: number, params: Option.Project.PatchCustomFieldItemParams): Promise; + deleteCustomFieldItem(projectIdOrKey: string, id: number, params: Option.Project.PostCustomFieldItemParams): Promise; + getSharedFiles(projectIdOrKey: string, path: string, params: Option.Project.GetSharedFilesParams): Promise; + getProjectsDiskUsage(projectIdOrKey: string): Promise; + getWebhooks(projectIdOrKey: string): Promise; + postWebhook(projectIdOrKey: string, params: Option.Project.PostWebhookParams): Promise; + getWebhook(projectIdOrKey: string, webhookId: string): Promise; + patchWebhook(projectIdOrKey: string, webhookId: string, params: Option.Project.PatchWebhookParams): Promise; + deleteWebhook(projectIdOrKey: string, webhookId: string): Promise; + postIssue(params: Option.Issue.PostIssueParams): Promise; + patchIssue(issueIdOrKey: string, params: Option.Issue.PatchIssueParams): Promise; + getIssues(params?: Option.Issue.GetIssuesParams): Promise; + getIssue(issueIdOrKey: string): Promise; + getIssuesCount(params?: Option.Issue.GetIssuesParams): Promise; + deleteIssuesCount(issueIdOrKey: string): Promise; + getIssueComments(issueIdOrKey: string, params: Option.Issue.GetIssueCommentsParams): Promise; + postIssueComments(issueIdOrKey: string, params: Option.Issue.PostIssueCommentsParams): Promise; + getIssueCommentsCount(issueIdOrKey: string): Promise; + getIssueComment(issueIdOrKey: string, commentId: number): Promise; + patchIssueComment(issueIdOrKey: string, commentId: number, params: Option.Issue.PatchIssueCommentParams): Promise; + getIssueCommentNotifications(issueIdOrKey: string, commentId: number): Promise; + postIssueCommentNotifications(issueIdOrKey: string, commentId: number, prams: Option.Issue.IssueCommentNotifications): Promise; + getIssueAttachments(issueIdOrKey: string): Promise; + deleteIssueAttachment(issueIdOrKey: string, attachmentId: string): Promise; + getIssueSharedFiles(issueIdOrKey: string): Promise; + linkIssueSharedFiles(issueIdOrKey: string, params: Option.Issue.LinkIssueSharedFilesParams): Promise; + unlinkIssueSharedFile(issueIdOrKey: string, id: number): Promise; + getWikis(projectIdOrKey: number): Promise; + getWikisCount(projectIdOrKey: number): Promise; + getWikisTags(projectIdOrKey: number): Promise; + postWiki(params: Option.Wiki.PostWikiParams): Promise; + getWiki(wikiId: number): Promise; + patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise; + deleteWiki(wikiId: number, mailNotify: boolean): Promise; + getWikisAttachments(wikiId: number): Promise; + postWikisAttachments(wikiId: number, attachmentId: number[]): Promise; + deleteWikisAttachments(wikiId: number, attachmentId: number): Promise; + getWikisSharedFiles(wikiId: number): Promise; + linkWikisSharedFiles(wikiId: number, fileId: number[]): Promise; + unlinkWikisSharedFiles(wikiId: number, id: number): Promise; + getWikisHistory(wikiId: number, params: Option.Wiki.GetWikisHistoryParams): Promise; + getWikisStars(wikiId: number): Promise; + postStar(params: Option.Project.PostStarParams): Promise; + getNotifications(params: Option.Notification.GetNotificationsParams): Promise; + getNotificationsCount(params: Option.Notification.GetNotificationsCountParams): Promise; + resetNotificationsMarkAsRead(): Promise; + markAsReadNotification(id: number): Promise; + getGitRepositories(projectIdOrKey: string): Promise; + getGitRepository(projectIdOrKey: string, repoIdOrName: string): Promise; + getPullRequests(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.GetPullRequestsParams): Promise; + getPullRequestsCount(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.GetPullRequestsParams): Promise; + postPullRequest(projectIdOrKey: string, repoIdOrName: string, params: Option.PullRequest.PostPullRequestParams): Promise; + getPullRequest(projectIdOrKey: string, repoIdOrName: string, number: number): Promise; + patchPullRequest(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.PatchPullRequestParams): Promise; + getPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.GetPullRequestCommentsParams): Promise; + postPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, params: Option.PullRequest.PostPullRequestCommentsParams): Promise; + getPullRequestCommentsCount(projectIdOrKey: string, repoIdOrName: string, number: number): Promise; + patchPullRequestComments(projectIdOrKey: string, repoIdOrName: string, number: number, commentId: number, params: Option.PullRequest.PatchPullRequestCommentsParams): Promise; + getPullRequestAttachments(projectIdOrKey: string, repoIdOrName: string, number: number): Promise; + deletePullRequestAttachment(projectIdOrKey: string, repoIdOrName: string, number: number, attachmentId: number): Promise; + getProjectIcon(projectIdOrKey: string): Promise; + getSharedFile(projectIdOrKey: string, sharedFileId: number): Promise; + getIssueAttachment(issueIdOrKey: string, attachmentId: number): Promise; + getWikiAttachment(wikiId: number, attachmentId: number): Promise; + getPullRequestAttachment(projectIdOrKey: string, repoIdOrName: string, number: number, attachmentId: number): Promise; + private download(path); + private upload(path, params); + private parseFileData(response); + } + + export class OAuth2 { + private credentials; + private timeout; + constructor(credentials: Option.OAuth2.Credentials, timeout?: number); + getAuthorizationURL(options: { + host: string; + redirectUri?: string; + state?: string; + }): string; + getAccessToken(options: { + host: string; + code: string; + redirectUri?: string; + }): Promise; + refreshAccessToken(options: { + host: string; + refreshToken: string; + }): Promise; + } + + import { PassThrough } from 'stream'; + export namespace Entity { + export namespace File { + export type FileData = NodeFileData | BrowserFileData; + export interface NodeFileData { + body: PassThrough; + url: string; + filename: string; + } + export interface BrowserFileData { + body: any; + url: string; + blob?: () => Promise; + } + } + export namespace OAuth2 { + export interface AccessToken { + access_token: string; + token_type: string; + expires_in: number; + refresh_token: string; + } + } + } + + + export namespace Option { + export type Order = "asc" | "desc"; + export enum ActivityType { + Undefined = -1, + IssueCreated = 1, + IssueUpdated = 2, + IssueCommented = 3, + IssueDeleted = 4, + WikiCreated = 5, + WikiUpdated = 6, + WikiDeleted = 7, + FileAdded = 8, + FileUpdated = 9, + FileDeleted = 10, + SvnCommitted = 11, + GitPushed = 12, + GitRepositoryCreated = 13, + IssueMultiUpdated = 14, + ProjectUserAdded = 15, + ProjectUserRemoved = 16, + NotifyAdded = 17, + PullRequestAdded = 18, + PullRequestUpdated = 19, + PullRequestCommented = 20, + PullRequestMerged = 21, + } + export namespace Notification { + export interface GetNotificationsParams { + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + export interface GetNotificationsCountParams { + alreadyRead: boolean; + resourceAlreadyRead: boolean; + } + } + export namespace Space { + export interface GetActivitiesParams { + activityTypeId?: ActivityType[]; + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + export interface PutSpaceNotificationParams { + content: string; + } + } + export namespace User { + export interface PostUserParams { + userId: string; + password: string; + name: string; + mailAddress: string; + roleType: RoleType; + } + export interface PatchUserParams { + password?: string; + name?: string; + mailAddress?: string; + roleType?: RoleType; + } + export enum RoleType { + Admin = 1, + User = 2, + Reporter = 3, + Viewer = 4, + GuestReporter = 5, + GuestViewer = 6, + } + export interface GetUserActivitiesParams { + activityTypeId?: ActivityType[]; + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + export interface GetUserStarsParams { + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + export interface GetUserStarsCountParams { + since?: string; + until?: string; + } + export interface GetRecentlyViewedParams { + order?: Order; + offset?: number; + count?: number; + } + } + export namespace Group { + export interface GetGroupsParams { + order?: Order; + offset?: number; + count?: number; + } + export interface PostGroupsParams { + name: string; + members?: string[]; + } + export interface PatchGroupParams { + name?: string; + members?: string[]; + } + } + export namespace Project { + export type TextFormattingRule = "backlog" | "markdown"; + export interface PostProjectParams { + name: string; + key: string; + chartEnabled: boolean; + projectLeaderCanEditProjectLeader?: boolean; + subtaskingEnabled: boolean; + textFormattingRule: TextFormattingRule; + } + export interface PatchProjectParams { + name?: string; + key?: string; + chartEnabled?: boolean; + subtaskingEnabled?: boolean; + projectLeaderCanEditProjectLeader?: boolean; + textFormattingRule?: TextFormattingRule; + archived?: boolean; + } + export interface GetProjectsParams { + archived?: boolean; + all?: boolean; + } + export interface DeleteProjectUsersParams { + userId: number; + } + export interface PostProjectAdministrators { + userId: number; + } + export interface DeleteProjectAdministrators { + userId: number; + } + export type IssueTypeColor = "#e30000" | "#990000" | "#934981" | "#814fbc" | "#2779ca" | "#007e9a" | "#7ea800" | "#ff9200" | "#ff3265" | "#666665"; + export interface PostIssueTypeParams { + name: string; + color: IssueTypeColor; + } + export interface PatchIssueTypeParams { + name?: string; + color?: IssueTypeColor; + } + export interface DeleteIssueTypeParams { + substituteIssueTypeId: number; + } + export interface PostCategoriesParams { + name: string; + } + export interface PatchCategoriesParams { + name: string; + } + export interface PostVersionsParams { + name: string; + description: string; + startDate: string; + releaseDueDate: string; + } + export interface PatchVersionsParams { + name: string; + description?: string; + startDate?: string; + releaseDueDate?: string; + archived?: boolean; + } + export interface PostCustomFieldParams { + typeId: FieldType; + name: string; + applicableIssueTypes?: number[]; + description?: string; + required?: boolean; + } + export interface PostCustomFieldWithNumericParams extends PostCustomFieldParams { + min?: number; + max?: number; + initialValue?: number; + unit?: string; + } + export interface PostCustomFieldWithDateParams extends PostCustomFieldParams { + min?: string; + max?: string; + initialValueType?: number; + initialDate?: string; + initialShift?: number; + } + export interface PostCustomFieldWithListParams extends PostCustomFieldParams { + items?: string[]; + allowInput?: boolean; + allowAddItem?: boolean; + } + export interface PatchCustomFieldParams { + name?: string; + applicableIssueTypes?: number[]; + description?: string; + required?: boolean; + } + export interface PatchCustomFieldWithNumericParams extends PatchCustomFieldParams { + min?: number; + max?: number; + initialValue?: number; + unit?: string; + } + export interface PatchCustomFieldWithDateParams extends PatchCustomFieldParams { + min?: string; + max?: string; + initialValueType?: number; + initialDate?: string; + initialShift?: number; + } + export interface PatchCustomFieldWithListParams extends PatchCustomFieldParams { + items?: string[]; + allowInput?: boolean; + allowAddItem?: boolean; + } + export interface PostCustomFieldItemParams { + name: string; + } + export interface PatchCustomFieldItemParams { + name: string; + } + export interface GetSharedFilesParams { + order?: Order; + offset?: number; + count?: number; + } + export interface PostWebhookParams { + name?: string; + description?: string; + hookUrl?: string; + allEvent?: boolean; + activityTypeIds?: number[]; + } + export interface PatchWebhookParams { + name?: string; + description?: string; + hookUrl?: string; + allEvent?: boolean; + activityTypeIds?: number[]; + } + export enum FieldType { + Text = 1, + TextArea = 2, + Numeric = 3, + Date = 4, + SingleList = 5, + MultipleList = 6, + CheckBox = 7, + Radio = 8, + } + export interface PostStarParams { + issueId?: number; + commentId?: number; + wikiId?: number; + pullRequestId?: number; + pullRequestCommentId?: number; + } + } + export namespace Issue { + export interface PostIssueParams { + projectId: number; + summary: string; + priorityId: number; + issueTypeId: number; + parentIssueId?: number; + description?: string; + startDate?: string; + dueDate?: string; + estimatedHours?: number; + actualHours?: number; + categoryId?: number[]; + versionId?: number[]; + milestoneId?: number[]; + assigneeId?: number; + notifiedUserId?: number[]; + attachmentId?: number[]; + [customField_: string]: any; + } + export interface PatchIssueParams { + summary?: string; + parentIssueId?: number; + description?: string; + statusId?: number; + resolutionId?: number; + startDate?: string; + dueDate?: string; + estimatedHours?: number; + actualHours?: number; + issueTypeId?: number; + categoryId?: number[]; + versionId?: number[]; + milestoneId?: number[]; + priorityId?: number; + assigneeId?: number; + notifiedUserId?: number[]; + attachmentId?: number[]; + comment?: string; + [customField_: string]: any; + } + export interface GetIssuesParams { + projectId?: number[]; + issueTypeId?: number[]; + categoryId?: number[]; + versionId?: number[]; + milestoneId?: number[]; + statusId?: number[]; + priorityId?: number[]; + assigneeId?: number[]; + createdUserId?: number[]; + resolutionId?: number[]; + parentChild?: ParentChildType; + attachment?: boolean; + sharedFile?: boolean; + sort?: SortKey; + order?: Order; + offset?: number; + count?: number; + createdSince?: string; + createdUntil?: string; + updatedSince?: string; + updatedUntil?: string; + startDateSince?: string; + startDateUntil?: string; + dueDateSince?: string; + dueDateUntil?: string; + id?: number[]; + parentIssueId?: number[]; + keyword: string; + [customField_: string]: any; + } + export enum ParentChildType { + All = 0, + NotChild = 1, + Child = 2, + NotChildNotParent = 3, + Parent = 4, + } + export type SortKey = "issueType" | "category" | "version" | "milestone" | "summary" | "status" | "priority" | "attachment" | "sharedFile" | "created" | "createdUser" | "updated" | "updatedUser" | "assignee" | "startDate" | "dueDate" | "estimatedHours" | "actualHours" | "childIssue"; + export interface GetIssueCommentsParams { + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + export interface PostIssueCommentsParams { + content: string; + notifiedUserId?: number[]; + attachmentId?: number[]; + } + export interface PatchIssueCommentParams { + content: string; + } + export interface IssueCommentNotifications { + notifiedUserId: number[]; + } + export interface LinkIssueSharedFilesParams { + fileId: number[]; + } + } + export namespace PullRequest { + export interface GetPullRequestsParams { + statusId?: number[]; + assigneeId?: number[]; + issueId?: number[]; + createdUserId?: number[]; + offset?: number; + count?: number; + } + export interface PostPullRequestParams { + summary: string; + description: string; + base: string; + branch: string; + issueId?: number; + assigneeId?: number; + notifiedUserId?: number[]; + attachmentId?: number[]; + } + export interface PatchPullRequestParams { + summary?: string; + description?: string; + issueId?: number; + assigneeId?: number; + notifiedUserId?: number[]; + comment?: string[]; + } + export interface GetPullRequestCommentsParams { + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + export interface PostPullRequestCommentsParams { + content: string; + notifiedUserId?: number[]; + } + export interface PatchPullRequestCommentsParams { + content: string; + } + } + export namespace Wiki { + export interface PostWikiParams { + projectId: number; + name: string; + content: string; + mailNotify?: boolean; + } + export interface PatchWikiParams { + name?: string; + content?: string; + mailNotify?: boolean; + } + export interface GetWikisHistoryParams { + minId?: number; + maxId?: number; + count?: number; + order?: Order; + } + } + export namespace OAuth2 { + export interface Credentials { + clientId: string; + clientSecret: string; + } + } + } + + export namespace Error { + export class BacklogError extends global.Error { + private _name; + private _url; + private _status; + private _body; + private _response; + constructor(name: BacklogErrorNameType, response: IResponse, body?: { + errors: BacklogErrorMessage[]; + }); + name: BacklogErrorNameType; + url: string; + status: number; + body: { + errors: BacklogErrorMessage[]; + }; + response: IResponse; + } + export class BacklogApiError extends BacklogError { + constructor(response: IResponse, body?: { + errors: BacklogErrorMessage[]; + }); + } + export class BacklogAuthError extends BacklogError { + constructor(response: IResponse, body?: { + errors: BacklogErrorMessage[]; + }); + } + export class UnexpectedError extends BacklogError { + constructor(response: IResponse); + } + export interface BacklogErrorMessage { + message: string; + code: number; + errorInfo: string; + moreInfo: string; + } + export type BacklogErrorNameType = 'BacklogApiError' | 'BacklogAuthError' | 'UnexpectedError'; + } + +} diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index 59cef89b1a..d7995438c1 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -82,6 +82,7 @@ var voidProm: Promise; var fooProm: Promise; var barProm: Promise; +var barOrVoidProm: Promise; var fooOrBarProm: Promise; var bazProm: Promise; @@ -221,12 +222,12 @@ barProm = fooProm.then((value: Foo) => { }, (reason: any) => { return barProm; }); -barProm = fooProm.then((value: Foo) => { +barOrVoidProm = fooProm.then((value: Foo) => { return bar; }, (reason: any) => { return; }); -barProm = fooProm.then((value: Foo) => { +barOrVoidProm = fooProm.then((value: Foo) => { return bar; }, (reason: any) => { return voidProm; diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 042347f096..35b506542a 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -47,8 +47,10 @@ class Bluebird implements Bluebird.Thenable, Bluebird.Inspection { /** * Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. */ - then(onFulfill: (value: R) => U | Bluebird.Thenable, onReject?: (error: any) => U | Bluebird.Thenable): Bluebird; - then(onFulfill: (value: R) => U | Bluebird.Thenable, onReject?: (error: any) => void | Bluebird.Thenable): Bluebird; + then(onFulfill: (value: R) => U1 | Bluebird.Thenable, onReject: (error: any) => U2 | Bluebird.Thenable): Bluebird; + then(onFulfill: (value: R) => U | Bluebird.Thenable, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + then(onFulfill: (value: R) => U | Bluebird.Thenable): Bluebird; + then(): Bluebird; /** * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. diff --git a/chai-things/chai-things-tests.ts b/chai-things/chai-things-tests.ts index de6a4c3ffe..c49ac3b468 100644 --- a/chai-things/chai-things-tests.ts +++ b/chai-things/chai-things-tests.ts @@ -18,9 +18,19 @@ function test_somethingSyntax() { array.should.include.something.with.property('b', 2); array.should.not.include.something.with.property('b', 3); + chai.expect(array).to.include.something(); + chai.expect(array).to.include.something.that.deep.equals({ b: 2 }); + chai.expect(array).to.include.something.that.not.deep.equals({ b: 2 }); + chai.expect(array).not.to.include.something.that.deep.equals({ c: 3 }); + chai.expect(array).to.include.something.that.not.deep.equals({ c: 3 }); + chai.expect(array).to.include.something.with.property('b', 2); + chai.expect(array).not.to.include.something.with.property('b', 3); + var array2 = [{ a: 'b' }, { a: 'b' }]; array2.should.include.something.that.have.property("a"); array2.should.include.something.that.have.property("a").not.equal("d"); + chai.expect(array2).to.include.something.that.have.property("a"); + chai.expect(array2).to.include.something.that.have.property("a").not.equal("d"); } function test_somethingVariantsSyntax() { @@ -35,6 +45,16 @@ function test_somethingVariantsSyntax() { array.should.include.one.that.deep.equals({ b: 2 }); array.should.include.some(); array.should.include.some.that.deep.equal({ b: 2 }); + + chai.expect(array).to.include.a.thing(); + chai.expect(array).to.include.a.thing.that.deep.equals({ b: 2 }); + chai.expect(array).to.include.an.item(); + chai.expect(array).to.include.an.item.that.deep.equals({ b: 2 }); + chai.expect(array).to.include.one.that.deep.equals({ b: 2 }); + chai.expect(array).to.include.some(); + chai.expect(array).to.include.some.that.deep.equal({ b: 2 }); + chai.expect(array).to.contain.a.thing(); + chai.expect(array).to.contain.a.thing.with.property('a', 1); } function test_allSyntax() { diff --git a/chai-things/chai-things.d.ts b/chai-things/chai-things.d.ts index 2636c9dcea..18c138ff38 100644 --- a/chai-things/chai-things.d.ts +++ b/chai-things/chai-things.d.ts @@ -23,6 +23,15 @@ declare namespace Chai { any: Anything; } + interface Include { + (item: any): any; + a: Item; + an: Item; + one: Something; + some: Something; + something: Something; + } + interface Anything extends Assertion { (): any; that: Assertion; diff --git a/colors/colors-tests.ts b/colors/colors-tests.ts index 15fd5ab4e5..1b9b12834e 100644 --- a/colors/colors-tests.ts +++ b/colors/colors-tests.ts @@ -3,9 +3,15 @@ import colors = require("colors"); +colors.enabled = true; + console.log(colors.black.underline('test')); console.log(colors.rainbow.black.blue.gray('test')); console.log(colors.random.reset.bgWhite.dim('test')); console.log('test'.black.underline); console.log('test'.rainbow.black.blue.gray); console.log('test'.random.reset.bgWhite.dim); + +colors.enabled = false; + +console.log(colors.black.underline('test')); diff --git a/colors/colors.d.ts b/colors/colors.d.ts index 7a78240287..8ce8cca8b7 100644 --- a/colors/colors.d.ts +++ b/colors/colors.d.ts @@ -47,6 +47,8 @@ declare module "colors" { namespace e { export function setTheme(theme:any): void; + export var enabled: boolean; + export var black: Color; export var red: Color; export var green: Color; diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index d6ada278c2..aa17cd331e 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -1,30 +1,32 @@ /// +/// function StepSample() { type Callback = cucumber.CallbackStepDefinition; + type Table = cucumber.TableDefinition; var step = this; var hook = this; - + hook.Before(function(scenario, callback){ scenario.isFailed() && callback.pending(); }) - + hook.Around(function(scenario, runScenario) { scenario.isFailed() && runScenario(null, function(){ console.log('finish tasks'); }); }); - + hook.registerHandler('AfterFeatures', function (event, callback) { callback(); }); - + step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback:Callback) { this.visit('https://github.com/cucumber/cucumber-js', callback); }); step.When(/^I go to the README file$/, function(title:string, callback:Callback) { - callback.pending(); + callback(null, 'pending'); }); step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback:Callback) { @@ -36,5 +38,43 @@ function StepSample() { callback(new Error("Expected to be on page with title " + title)); } }); + + // Type for data_table.js on + // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js + + step.Given(/^a table step with Table raw$/, function(table:Table){ + var expected = [ + ['Cucumber', 'Cucumis sativus'], + ['Burr Gherkin', 'Cucumis anguria'] + ]; + + assert.deepEqual(table.raw(), expected); + }); + + step.Given(/^a table step with Table rows$/, function(table: Table){ + var expected = [ + ['Apricot', '5'], + ['Brocolli', '2'], + ['Cucumber', '10'] + ]; + assert.deepEqual(table.rows(), expected) + }); + + step.Given(/^a table step with Table rowHash$/, function(table:Table){ + var expected = { + 'Cucumber': 'Cucumis sativus', + 'Burr Gherkin': 'Cucumis anguria' + }; + assert.deepEqual(table.rowsHash(), expected) + }); + + step.Given(/^a table step$/, function(table:Table){ + var expected = [ + {'Vegetable': 'Apricot', 'Rating': '5'}, + {'Vegetable': 'Brocolli', 'Rating': '2'}, + {'Vegetable': 'Cucumber', 'Rating': '10'} + ]; + assert.deepEqual(table.hashes(), expected) + }); } diff --git a/cucumber/cucumber.d.ts b/cucumber/cucumber.d.ts index 6c4273e4e0..a415a478e2 100644 --- a/cucumber/cucumber.d.ts +++ b/cucumber/cucumber.d.ts @@ -7,11 +7,20 @@ declare namespace cucumber { export interface CallbackStepDefinition{ pending : () => PromiseLike; - (errror?:any):void; + (errror?:any, pending?: string):void; } + export interface TableDefinition{ + raw: () => Array; + rows: () => Array; + rowsHash: () => {}; + hashes: () => {}; + } + + type StepDefinitionParam = string | CallbackStepDefinition | TableDefinition; + interface StepDefinitionCode { - (...stepArgs: Array): PromiseLike | any | void; + (...stepArgs: Array): PromiseLike | any | void; } interface StepDefinitionOptions{ diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 3ad327ffc3..d539b7439d 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -297,7 +297,7 @@ declare namespace d3 { * @param value the function to compute data for each node */ datum(value: (datum: Datum, index: number, outerIndex: number) => NewDatum): Update; - + /** * Set the data item for each node in the selection. * @param value the constant element to use for each node @@ -415,7 +415,7 @@ declare namespace d3 { select(name: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection; call(func: (selection: Enter, ...args: any[]) => any, ...args: any[]): Enter; - + empty(): boolean; size(): number; } @@ -1078,7 +1078,7 @@ declare namespace d3 { * Return the min and max simultaneously. */ export function extent(array: T[], accessor: (datum: T, index: number) => string): [string, string]; - + /** * Return the min and max simultaneously. */ @@ -2928,6 +2928,8 @@ declare namespace d3 { start(): Force; + tick(): Force; + alpha(): number; alpha(value: number): Force; diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts index bca5721240..eaab995a36 100644 --- a/dojo/dojo.d.ts +++ b/dojo/dojo.d.ts @@ -5686,7 +5686,23 @@ declare namespace dojo { * @param dest The object to which to copy/add all properties contained in source. If dest is falsy, thena new object is manufactured before copying/adding properties begins. * @param sources One of more objects from which to draw all properties to copy into dest. sources are processedleft-to-right and if more than one of these objects contain the same property name, the right-mostvalue "wins". */ - mixin(dest: Object, source: Object, sources?: Object[]): Object; + mixin(dest: T): T; + mixin( + dest: T, + source: U + ): T & U; + mixin( + dest: T, + source1: U, + source2: V + ): T & U & V; + mixin( + dest: T, + source1: U, + source2: V, + source3: W + ): T & U & V & W; + mixin(dest: Object, ...sources: Object[]): T; /** * similar to hitch() except that the scope object is left to be * whatever the execution context eventually becomes. diff --git a/elastic.js/elastic.js.d.ts b/elastic.js/elastic.js.d.ts index 850d1ccdfa..9bf5f6a9dc 100644 --- a/elastic.js/elastic.js.d.ts +++ b/elastic.js/elastic.js.d.ts @@ -19,7 +19,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -40,7 +40,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -58,7 +58,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -107,7 +107,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -139,7 +139,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -161,7 +161,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -226,7 +226,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets if the Query should be enhanced with a @@ -278,7 +278,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -298,7 +298,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost factor. @@ -314,7 +314,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -335,7 +335,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -362,7 +362,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -382,7 +382,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -425,7 +425,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -454,7 +454,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the analyzer name used to analyze the Query object. @@ -522,7 +522,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -536,7 +536,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets analyzer used to analyze the suggest text. @@ -593,7 +593,7 @@ declare module elasticjs { Retrieves the internal suggest object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets if transpositions should be counted as one or two changes, defaults @@ -635,7 +635,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -666,7 +666,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -693,7 +693,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -805,7 +805,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -839,7 +839,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enables caching of the facetFilter @@ -986,7 +986,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Allows you to specify a different value field to aggrerate over. @@ -1023,7 +1023,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -1086,7 +1086,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1110,7 +1110,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the decay value which defines how documents are scored at the distance @@ -1165,7 +1165,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1185,7 +1185,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the accuracy. How similar the suggested terms at least @@ -1285,7 +1285,7 @@ declare module elasticjs { Retrieves the internal generator object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1389,7 +1389,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -1419,7 +1419,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1438,7 +1438,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -1489,7 +1489,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -1521,7 +1521,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1531,7 +1531,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enables caching of the facetFilter @@ -1573,7 +1573,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1595,7 +1595,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -1616,7 +1616,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1636,7 +1636,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -1662,7 +1662,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1684,7 +1684,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -1734,7 +1734,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1766,7 +1766,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enables caching of the facetFilter @@ -1813,7 +1813,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1823,7 +1823,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -1864,7 +1864,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -1908,7 +1908,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -1946,7 +1946,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* The analyzer that will be used to analyze the text. Defaults to the @@ -2000,7 +2000,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -2035,7 +2035,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* The analyzer that will be used to analyze the text. Defaults to the @@ -2091,7 +2091,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -2116,7 +2116,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value of the Query. @@ -2179,7 +2179,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Set to false to use classic Levenshtein edit distance. @@ -2208,7 +2208,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the bottom-right coordinate of the bounding box @@ -2284,7 +2284,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -2344,7 +2344,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the distance unit. Valid values are: @@ -2383,7 +2383,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Adds a new bounded range. @@ -2479,7 +2479,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the distance unit. Valid values are "mi" for miles or "km" @@ -2515,7 +2515,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -2601,7 +2601,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -2728,7 +2728,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -2771,7 +2771,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -2792,7 +2792,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the GeoPoint from an array point. The array must contain only @@ -2834,7 +2834,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -2853,7 +2853,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -2921,7 +2921,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -3007,7 +3007,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -3059,7 +3059,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -3079,7 +3079,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -3100,7 +3100,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -3119,7 +3119,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -3185,7 +3185,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -3232,7 +3232,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the child document type to search against @@ -3256,7 +3256,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -3317,7 +3317,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -3360,7 +3360,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -3390,7 +3390,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Set's the boundary characters. When highlighting a field that is @@ -3462,7 +3462,7 @@ declare module elasticjs { Sets arbitrary options that can be passed to the highlighter implementation in use. */ - options(opts: string, oField: Object): Highlight; + options(opts: string, oField: string): Highlight; /* Sets the order of highlight fragments. You can apply the option @@ -3508,7 +3508,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the highligher type. You can apply the option @@ -3539,7 +3539,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -3621,7 +3621,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -3655,7 +3655,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enables caching of the facetFilter @@ -3762,7 +3762,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Allows you to specify a different value field to aggrerate over. @@ -3793,7 +3793,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -3848,7 +3848,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -3859,7 +3859,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the type as a single type or an array of types. If type is a @@ -3896,7 +3896,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the document id of the indexed shape. @@ -3919,7 +3919,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the type which the shape is indexed under. @@ -3945,7 +3945,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -4006,7 +4006,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -4036,7 +4036,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4057,7 +4057,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -4115,7 +4115,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4133,7 +4133,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -4177,7 +4177,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -4216,7 +4216,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -4227,7 +4227,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4248,7 +4248,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the analyzer name used to analyze the Query object. @@ -4377,7 +4377,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the type of the MatchQuery. Valid values are @@ -4411,7 +4411,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -4443,7 +4443,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4453,7 +4453,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -4485,7 +4485,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4507,7 +4507,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -4539,7 +4539,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4559,7 +4559,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -4585,7 +4585,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4603,7 +4603,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -4657,7 +4657,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* The analyzer that will be used to analyze the text. Defaults to the @@ -4748,7 +4748,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4767,7 +4767,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* The analyzer that will be used to analyze the text. Defaults to the @@ -4860,7 +4860,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -4883,7 +4883,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the analyzer name used to analyze the Query object. @@ -5022,7 +5022,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the type of the MultiMatchQuery. Valid values are @@ -5061,7 +5061,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -5087,7 +5087,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -5113,7 +5113,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value of the nested Query. @@ -5190,7 +5190,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -5227,7 +5227,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -5246,7 +5246,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -5300,7 +5300,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -5388,7 +5388,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -5437,7 +5437,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Compression controls memory usage and approximation error. The compression @@ -5496,7 +5496,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -5518,7 +5518,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets analyzer used to analyze the suggest text. @@ -5625,7 +5625,7 @@ declare module elasticjs { Retrieves the internal suggest object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the token limit. @@ -5649,7 +5649,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -5698,7 +5698,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value of the Query. @@ -5743,7 +5743,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* The prefix value. @@ -5780,7 +5780,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enables caching of the facetFilter @@ -5827,7 +5827,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -5853,7 +5853,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -5888,7 +5888,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -5899,7 +5899,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -5922,7 +5922,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets whether or not wildcard characters (* and ?) are allowed as the @@ -6114,7 +6114,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets whether or not queries against multiple fields should be combined using Lucene's @@ -6140,7 +6140,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Adds a filter whose matching documents will have the score function applied. @@ -6156,7 +6156,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -6181,7 +6181,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -6223,7 +6223,7 @@ declare module elasticjs { /* Adds a range to the list of exsiting range expressions. */ - range(from: string, to: string, key: string): RangeAggregation; + range(from: number, to?: number, key?: string): RangeAggregation; /* Allows you generate or modify the terms using a script. @@ -6239,7 +6239,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -6271,7 +6271,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Adds a new bounded range. @@ -6356,7 +6356,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Allows you to specify an alternate value field to be used to compute statistical information. @@ -6385,7 +6385,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -6476,7 +6476,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value of the Query. @@ -6537,7 +6537,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -6557,7 +6557,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -6630,7 +6630,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value of the Query. @@ -6698,7 +6698,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* The regexp value. @@ -6721,7 +6721,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add an aggregation. This method can be called multiple times @@ -6769,7 +6769,7 @@ declare module elasticjs { by making multiple request. This parameters specifies the starting result/document number point. Combine with size() to achieve paging. */ - from(f: any[]): Request; + from(f: number): Request; /* Performs highlighting based on the Highlight @@ -6827,7 +6827,7 @@ declare module elasticjs { It is recommended to use Sort objects when possible. */ - sort(fieldName: string): Request; + sort(fieldName?: string | any[] | Sort, order?: string): Request; /* Allows to control how the _source field is returned with every hit. @@ -6859,7 +6859,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Enables score computation and tracking during sorting. Be default, @@ -6889,7 +6889,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the weight assigned to the original query of the rescoring. @@ -6921,7 +6921,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the window_size parameter of the rescoring. @@ -6936,7 +6936,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Adds a filter whose matching documents will have the score function applied. @@ -6947,7 +6947,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -6969,7 +6969,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* If execeptions thrown from the script should be ignored or not. @@ -6997,7 +6997,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7015,7 +7015,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -7071,7 +7071,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Adds a filter whose matching documents will have the score function applied. @@ -7098,7 +7098,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7119,7 +7119,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the coordinates for the shape definition. Note, the coordinates @@ -7137,7 +7137,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the shape type. Can be set to one of: point, linestring, polygon, @@ -7163,7 +7163,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -7237,7 +7237,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7258,7 +7258,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the sort order to ascending (asc). Same as calling @@ -7393,7 +7393,7 @@ declare module elasticjs { Retrieves the internal script object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the script sort type. Valid values are: @@ -7433,7 +7433,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -7454,7 +7454,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7474,7 +7474,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -7490,7 +7490,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7509,7 +7509,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -7543,7 +7543,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7562,7 +7562,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -7583,7 +7583,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7602,7 +7602,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -7620,7 +7620,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7640,7 +7640,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -7661,7 +7661,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7693,7 +7693,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enables caching of the facetFilter @@ -7762,7 +7762,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7786,7 +7786,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -7818,7 +7818,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7854,7 +7854,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the text to get suggestions for. If not set, the global @@ -7866,7 +7866,7 @@ declare module elasticjs { Retrieves the internal suggest object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7888,7 +7888,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -7920,7 +7920,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -7940,7 +7940,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -7994,7 +7994,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -8015,7 +8015,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -8034,7 +8034,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Add a nested aggregation. This method can be called multiple times @@ -8134,7 +8134,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the type of the field value for use in scripts. Current values are: @@ -8169,7 +8169,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Allows you to return all terms, even if the frequency count is 0. This should not be @@ -8301,7 +8301,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -8320,7 +8320,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -8416,7 +8416,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -8451,7 +8451,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -8483,7 +8483,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Allows you to return all terms, even if the frequency count is 0. This should not be @@ -8579,7 +8579,7 @@ declare module elasticjs { Retrieves the internal facet object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the field for which statistical information will be generated. @@ -8612,7 +8612,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the accuracy. How similar the suggested terms at least @@ -8716,7 +8716,7 @@ declare module elasticjs { Retrieves the internal suggest object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -8740,7 +8740,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -8787,7 +8787,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the child document type to search against @@ -8810,7 +8810,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Enable or disable caching of the filter @@ -8858,7 +8858,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the field to operate on. @@ -8890,7 +8890,7 @@ declare module elasticjs { Retrieves the internal agg object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; } @@ -8915,7 +8915,7 @@ declare module elasticjs { /* The type of ejs object. For internal use only. */ - _type(): String; + _type(): string; /* Sets the boost value for documents matching the Query. @@ -8960,7 +8960,7 @@ declare module elasticjs { Retrieves the internal query object. This is typically used by internal API functions so use with caution. */ - toJSON(): String; + toJSON(): any; /* Sets the wildcard query value. diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index 39656ce685..7061f08746 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -79,8 +79,9 @@ declare module "fs-extra" { export interface CopyOptions { clobber?: boolean preserveTimestamps?: boolean - dereference?: boolean + dereference?: boolean filter?: CopyFilter + recursive?: boolean } export interface OpenOptions { diff --git a/fullCalendar/fullCalendar.d.ts b/fullCalendar/fullCalendar.d.ts index fd43e51c5f..81ce91d119 100644 --- a/fullCalendar/fullCalendar.d.ts +++ b/fullCalendar/fullCalendar.d.ts @@ -25,15 +25,17 @@ declare namespace FullCalendar { end: moment.Moment; } + export interface Header { + left: string; + center: string; + right: string; + } + export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions { // General display - http://fullcalendar.io/docs/display/ - header?: { - left: string; - center: string; - right: string; - } - theme?: boolean + header?: boolean | Header; + theme?: boolean; buttonIcons?: { prev: string; next: string; @@ -50,7 +52,7 @@ declare namespace FullCalendar { contentHeight?: number; aspectRatio?: number; handleWindowResize?: boolean; - views?: ViewSpecificOptions; + views?: ViewSpecificOptions; viewRender?: (view: ViewObject, element: JQuery) => void; viewDestroy?: (view: ViewObject, element: JQuery) => void; dayRender?: (date: Date, cell: HTMLTableDataCellElement) => void; diff --git a/geojson2osm/geojson2osm-tests.ts b/geojson2osm/geojson2osm-tests.ts new file mode 100644 index 0000000000..c7bfc05b85 --- /dev/null +++ b/geojson2osm/geojson2osm-tests.ts @@ -0,0 +1,47 @@ +/// +/// + +import { geojson2osm } from 'geojson2osm' + +const features: GeoJSON.FeatureCollection = { + type: 'FeatureCollection', + features: [{ + type: 'Feature', + properties: { + 'building:colour': '#9F8169', + 'building:levels': 21, + building: 'yes', + height: 57, + }, + geometry: { + type: 'Polygon', + coordinates: [ + [ + [ + -434.2249470949173, + -13.15996269397843, + ], + [ + -434.2249470949173, + -13.159751140560356, + ], + [ + -434.2242631316185, + -13.159751140560356, + ], + [ + -434.2242631316185, + -13.15996269397843, + ], + [ + -434.2249470949173, + -13.15996269397843, + ], + ], + ], + }, + }, + ], +} + +geojson2osm(features) diff --git a/geojson2osm/geojson2osm.d.ts b/geojson2osm/geojson2osm.d.ts new file mode 100644 index 0000000000..58393411f1 --- /dev/null +++ b/geojson2osm/geojson2osm.d.ts @@ -0,0 +1,15 @@ +// Type definitions for geojson2osm 0.0.5 +// Project: https://github.com/Rub21/geojson2osm +// Definitions by: Denis Carriere +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'geojson2osm' { + /** + * Converts GeoJSON features to OpenStreetMap XML. + * @param features Input features + * @returns OpenStreetMap XML + */ + export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any +} diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 97d29bbf04..0eaa0b9c3d 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -61,6 +61,7 @@ declare namespace google.maps { backgroundColor?: string; center?: LatLng|LatLngLiteral; disableDefaultUI?: boolean; + clickableIcons?: boolean; disableDoubleClickZoom?: boolean; draggable?: boolean; draggableCursor?: string; diff --git a/gulp/gulp.d.ts b/gulp/gulp.d.ts index 74968ddcc5..f4314bd2f2 100644 --- a/gulp/gulp.d.ts +++ b/gulp/gulp.d.ts @@ -5,9 +5,11 @@ /// /// +/// declare module "gulp" { import Orchestrator = require("orchestrator"); + import VinylFile = require("vinyl"); namespace gulp { interface Gulp extends Orchestrator { @@ -92,7 +94,7 @@ declare module "gulp" { * @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: string) => string), opt?: DestOptions): NodeJS.ReadWriteStream; + (outFolder: string|((file: VinylFile) => string), opt?: DestOptions): NodeJS.ReadWriteStream; } interface SrcMethod { @@ -149,7 +151,7 @@ declare module "gulp" { * 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 */ diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index d8c98ae25f..140d102a8c 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -176,6 +176,7 @@ class IonicTestController { var currentStateName: string = this.$ionicHistory.currentStateName(); this.$ionicHistory.goBack(5); + this.$ionicHistory.removeBackView(); this.$ionicHistory.clearHistory(); this.$ionicHistory.clearCache().then(() => console.log("done clearing cache!")); this.$ionicHistory.nextViewOptions({ diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index fae9cdbf63..1df593037b 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -213,6 +213,7 @@ declare namespace ionic { currentStateName(): string; goBack(backCount?: number): void; + removeBackView(): void; clearHistory(): void; clearCache(): angular.IPromise; nextViewOptions(options: IonicHistoryNextViewOptions): void; diff --git a/ioredis/ioredis.d.ts b/ioredis/ioredis.d.ts index 983ed39f10..60eccd0272 100644 --- a/ioredis/ioredis.d.ts +++ b/ioredis/ioredis.d.ts @@ -197,6 +197,8 @@ declare module IORedis { hmget(...args: any[]): any; hincrby(args: any[], callback?: ResCallbackT): any; hincrby(...args: any[]): any; + hincrbyfloat(args: any[], callback?: ResCallbackT): any; + hincrbyfloat(...args: any[]): any; hdel(args: any[], callback?: ResCallbackT): any; hdel(...args: any[]): any; hlen(args: any[], callback?: ResCallbackT): any; @@ -478,6 +480,8 @@ declare module IORedis { hmget(...args: any[]): Pipeline; hincrby(args: any[], callback?: ResCallbackT): Pipeline; hincrby(...args: any[]): Pipeline; + hincrbyfloat(args: any[], callback?: ResCallbackT): Pipeline; + hincrbyfloat(...args: any[]): Pipeline; hdel(args: any[], callback?: ResCallbackT): Pipeline; hdel(...args: any[]): Pipeline; hlen(args: any[], callback?: ResCallbackT): Pipeline; diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 37848203df..c75309b45e 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -752,6 +752,10 @@ schema = Joi.alternatives(schema, anySchema, boolSchema); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- +schema = Joi.lazy(() => schema) + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + Joi.validate(value, obj); Joi.validate(value, schema); Joi.validate(value, schema, validOpts); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 3ba51d7383..b827903f9b 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -816,6 +816,13 @@ declare module 'joi' { export function alternatives(): AlternativesSchema; export function alternatives(types: Schema[]): AlternativesSchema; export function alternatives(type1: Schema, type2: Schema, ...types: Schema[]): AlternativesSchema; + + /** + * Generates a placeholder schema for a schema that you would provide with the fn. + * Supports the same methods of the any() type. + * This is mostly useful for recursive schemas + */ + export function lazy(cb: () => Schema): Schema; /** * Validates a value using the given schema and options. diff --git a/jquery-mockjax/jquery-mockjax-tests.ts b/jquery-mockjax/jquery-mockjax-tests.ts index 6fae52eb07..36ebd7e64c 100644 --- a/jquery-mockjax/jquery-mockjax-tests.ts +++ b/jquery-mockjax/jquery-mockjax-tests.ts @@ -9,7 +9,7 @@ class Tests { run(): void { const self = this; - var t = QUnit.test; + let t = QUnit.test; QUnit.begin(() => { @@ -36,7 +36,7 @@ class Tests { responseText: 'Hello Word' }); - var xhr = $.ajax({ + let xhr = $.ajax({ url: '/xmlhttprequest', complete: () => { } }); @@ -67,7 +67,7 @@ class Tests { }); t('Intercept asynchronized proxy calls', (assert) => { - var done = assert.async(); + let done = assert.async(); $.mockjax({ url: '/proxy', proxy: 'test_proxy.json' @@ -85,7 +85,7 @@ class Tests { }); t('Intercept and proxy (sub-ajax request)', (assert) => { - var done = assert.async(); + let done = assert.async(); $.mockjax({ url: '/proxy', @@ -104,7 +104,7 @@ class Tests { }); t('Proxy type specification', (assert) => { - var done = assert.async(); + let done = assert.async(); $.mockjax({ url: '/proxy', @@ -124,7 +124,7 @@ class Tests { }); t('Support 1.5 $.ajax(url, settings) signature.', (assert) => { - var done = assert.async(); + let done = assert.async(); $.mockjax({ url: '/resource', @@ -141,9 +141,9 @@ class Tests { }); t('Dynamic response callback', (assert) => { - var done = assert.async(); + let done = assert.async(); - var settings: MockJaxSettings = { + let settings: MockJaxSettings = { url: '/response-callback', response: (settings) => { settings.responseText = settings.data.response + ' 2'; @@ -165,8 +165,36 @@ class Tests { } }); }); + + t('Asyncronous response callback', (assert) => { + let done = assert.async(); + + let settings: MockJaxSettings = { + url: '/async-response-callback', + response: (settings, completed) => { + setTimeout(() => { + settings.responseText = settings.data.response + ' 3'; + completed(); + }, 10); + } + }; + + $.mockjax(settings); + + $.ajax({ + url: '/async-response-callback', + dataType: 'text', + data: { + response: 'Hello world' + }, + error: self._noErrorCallbackExpected, + complete: (xhr) => { + assert.equal(xhr.responseText, 'Hello world 3', 'Response Text matches'); + done(); + } + }); + }); } } -var tests = new Tests(); -tests.run(); +new Tests().run(); diff --git a/jquery-mockjax/jquery-mockjax.d.ts b/jquery-mockjax/jquery-mockjax.d.ts index 7505a30e6f..c054f33317 100644 --- a/jquery-mockjax/jquery-mockjax.d.ts +++ b/jquery-mockjax/jquery-mockjax.d.ts @@ -22,7 +22,7 @@ interface MockJaxSettings { isTimeout?: boolean; dataType?: string; contentType?: string; - response?: (settings: any) => void; + response?: (settings: any, done?: Function) => void; responseText?: string | Object; responseXml?: string; proxy?: string; diff --git a/js-data-http/js-data-http-tests.ts b/js-data-http/js-data-http-tests.ts index 390e20aa9e..9f0c4c3169 100644 --- a/js-data-http/js-data-http-tests.ts +++ b/js-data-http/js-data-http-tests.ts @@ -1,9 +1,15 @@ +/// /// +import * as axios from 'axios'; + var adapter = new DSHttpAdapter(); var store = new JSData.DS(); store.registerAdapter('http', adapter, { default: true }); +adapter.defaults.basePath = '/api'; +adapter.http = axios; + var ADocument:JSData.DSResourceDefinition = store.defineResource('document'); ADocument.inject({ id: 5, author: 'John' }); diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts index cde3b4a2e1..04d07f5a38 100644 --- a/js-data-http/js-data-http.d.ts +++ b/js-data-http/js-data-http.d.ts @@ -15,6 +15,8 @@ declare namespace JSData { forceTrailingSlash?: boolean; log?: boolean | ((message?:any, ...optionalParams:any[])=> void); error?: boolean | ((message?:any, ...optionalParams:any[])=> void); + basePath?: string; + verbsUseBasePath?: string; } interface DSHttpAdapterPromiseResolveType { @@ -28,6 +30,9 @@ declare namespace JSData { new(options?:DSHttpAdapterOptions):DSHttpAdapter; + defaults: DSHttpAdapterOptions; + http: any; + // DSHttpAdapter uses axios so options are axios config objects. HTTP(options?:Object):JSDataPromise; DEL(url:string, data?:Object, options?:Object):JSDataPromise; diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts index 7c66952162..9bbbfdfd64 100644 --- a/js-data/js-data-tests.ts +++ b/js-data/js-data-tests.ts @@ -600,3 +600,5 @@ customActionResource.emit("DS.change", customActionResource, customActionResourc customActionResourceInstance.on("DS.change", myEvtHandler); customActionResourceInstance.off("DS.change", myEvtHandler); customActionResourceInstance.emit("DS.change", customActionResource, customActionResourceInstance); + +JSData.DSUtils.Promise = Promise; \ No newline at end of file diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index f7fc785c82..58bef671b1 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -342,6 +342,7 @@ declare namespace JSData { declare var JSData:{ DS: JSData.DS; DSErrors: JSData.DSErrors; + DSUtils: any; }; //Support node require diff --git a/jsdom/jsdom.d.ts b/jsdom/jsdom.d.ts index c6ebde2ce3..2efebc059f 100644 --- a/jsdom/jsdom.d.ts +++ b/jsdom/jsdom.d.ts @@ -68,6 +68,7 @@ declare module "jsdom" { export function createCookieJar(): CookieJar; export function nodeLocation(node: Node): any; export function reconfigureWindow(window: Window, newProps: WindowProperties): void; + export function changeURL(window: Window, url: string): void; export function jQueryify(window: Window, jqueryUrl: string, callback: (window: Window, jquery: JQuery) => any): void; diff --git a/jsts/jsts-tests.ts b/jsts/jsts-tests.ts index 3b37d0f185..e9c00fd52a 100644 --- a/jsts/jsts-tests.ts +++ b/jsts/jsts-tests.ts @@ -1,4 +1,7 @@ /// + +import * as jsts from 'jsts'; + var str: string; var n: number; var bool: boolean; @@ -142,4 +145,4 @@ obj = gjw.write(g); var wr: jsts.io.WKTReader = new jsts.io.WKTReader(); g = wr.read(str); -wr.reducePrecision(g); \ No newline at end of file +wr.reducePrecision(g); diff --git a/jsts/jsts.d.ts b/jsts/jsts.d.ts index 909dbbf7a1..f06b5c7f51 100644 --- a/jsts/jsts.d.ts +++ b/jsts/jsts.d.ts @@ -1664,3 +1664,7 @@ declare namespace jsts { } } } + +declare module "jsts" { + export = jsts; +} diff --git a/koa-compress/koa-compress.d.ts b/koa-compress/koa-compress.d.ts index c4cd2af582..49a0bb5f1b 100644 --- a/koa-compress/koa-compress.d.ts +++ b/koa-compress/koa-compress.d.ts @@ -37,5 +37,6 @@ declare module "koa-compress" { */ function compress(options?: CompressOptions): { (ctx: Koa.Context, next?: () => any): any }; + namespace compress {} export = compress; } diff --git a/koa-favicon/koa-favicon.d.ts b/koa-favicon/koa-favicon.d.ts index 618683fc76..e09c685173 100644 --- a/koa-favicon/koa-favicon.d.ts +++ b/koa-favicon/koa-favicon.d.ts @@ -31,5 +31,6 @@ declare module "koa-favicon" { }): { (ctx: Koa.Context, next?: () => any): any }; + namespace favicon {} export = favicon; } diff --git a/koa-json-error/koa-json-error-tests.ts b/koa-json-error/koa-json-error-tests.ts new file mode 100644 index 0000000000..37aae696b0 --- /dev/null +++ b/koa-json-error/koa-json-error-tests.ts @@ -0,0 +1,13 @@ +/// +/// +/// + +import * as Koa from "koa"; +import * as error from "koa-json-error"; +import { assign } from "lodash"; + +const app = new Koa(); + +app.use(error({ + preFormat: err => assign({}, err) +})); \ No newline at end of file diff --git a/koa-json-error/koa-json-error.d.ts b/koa-json-error/koa-json-error.d.ts new file mode 100644 index 0000000000..491ead463e --- /dev/null +++ b/koa-json-error/koa-json-error.d.ts @@ -0,0 +1,36 @@ +// Type definitions for koa-json-error v3.x +// Project: https://github.com/koajs/json-error +// Definitions by: Mudkip +// Definitions: https://github.com/mudkipme/DefinitelyTyped + +/// + +declare module "koa-json-error" { + + import * as Koa from "koa"; + + interface JSONErrorOptions { + /** + * Perform some task before calling `options.format`. Must be a function with the original err as its only argument. + */ + preFormat?: { (err: Error): any }; + + /** + * Runs inmediatly after `options.preFormat`. It receives two arguments: the original `err` and the output of `options.preFormat`. It should `return` a newly formatted error. + */ + format?: { (err: Error, obj: any): any }; + + /** + * Runs inmediatly after `options.format`. It receives two arguments: the original `err` and the output of `options.format`. It should `return` a newly formatted error. + */ + postFormat?: { (err: Error, obj: any): any }; + } + + /** + * Error handler for pure Koa 2.0.0+ JSON apps + */ + function jsonError(options?: JSONErrorOptions) : { (ctx: Koa.Context, next?: () => any): any }; + + namespace jsonError {} + export = jsonError; +} \ No newline at end of file diff --git a/koa-router/koa-router-tests.ts b/koa-router/koa-router-tests.ts index 36d3e6c1c8..d2bae290a4 100644 --- a/koa-router/koa-router-tests.ts +++ b/koa-router/koa-router-tests.ts @@ -23,11 +23,11 @@ router .put('/users/:id', function (ctx, next) { ctx.body = ctx.params.id; }) - .del('/users/:id', function (ctx, next) { + .del('/users/:id', function () { // ... }); -router.get('user', '/users/:id', function (ctx, next) { +router.get('user', '/users/:id', function (ctx) { ctx.body = "sdsd"; }); diff --git a/koa-router/koa-router.d.ts b/koa-router/koa-router.d.ts index 25ec962dad..81a961b93a 100644 --- a/koa-router/koa-router.d.ts +++ b/koa-router/koa-router.d.ts @@ -49,11 +49,11 @@ declare module "koa-router" { } export interface IMiddleware { - (ctx: Router.IRouterContext, next?: () => any): any; + (ctx: Router.IRouterContext, next: () => Promise): any; } export interface IParamMiddleware { - (param: string, ctx: Router.IRouterContext, next?: () => any): any; + (param: string, ctx: Router.IRouterContext, next: () => Promise): any; } export interface IRouterAllowedMethodsOptions { @@ -83,10 +83,8 @@ declare module "koa-router" { regexp: RegExp; path: string; - constructor(path: string, methods: string[], middleware: Router.IMiddleware, opts?: Layer.ILayerOptions); - constructor(path: string, methods: string[], middleware: Array, opts?: Layer.ILayerOptions); - constructor(path: RegExp, methods: string[], middleware: Router.IMiddleware, opts?: Layer.ILayerOptions); - constructor(path: RegExp, methods: string[], middleware: Array, opts?: Layer.ILayerOptions); + constructor(path: string | RegExp, methods: string[], middleware: Router.IMiddleware, opts?: Layer.ILayerOptions); + constructor(path: string | RegExp, methods: string[], middleware: Array, opts?: Layer.ILayerOptions); /** * Returns whether request `path` matches route. @@ -96,7 +94,7 @@ declare module "koa-router" { /** * Returns map of URL parameters for given `path` and `paramNames`. */ - params(path: string, captures: string[], existingParams?: Object): Object; + params(path: string | RegExp, captures: string[], existingParams?: Object): Object; /** * Returns array of regexp url path captures. @@ -138,61 +136,61 @@ declare module "koa-router" { * "down" the middleware stack. */ use(...middleware: Array): Router; - use(path: string, ...middleware: Array): Router; + use(path: string | RegExp, ...middleware: Array): Router; /** * HTTP get method */ - get(name: string, path: string, ...middleware: Array): Router; - get(path: string, ...middleware: Array): Router; + get(name: string, path: string | RegExp, ...middleware: Array): Router; + get(path: string | RegExp, ...middleware: Array): Router; /** * HTTP post method */ - post(name: string, path: string, ...middleware: Array): Router; - post(path: string, ...middleware: Array): Router; + post(name: string, path: string | RegExp, ...middleware: Array): Router; + post(path: string | RegExp, ...middleware: Array): Router; /** * HTTP put method */ - put(name: string, path: string, ...middleware: Array): Router; - put(path: string, ...middleware: Array): Router; + put(name: string, path: string | RegExp, ...middleware: Array): Router; + put(path: string | RegExp, ...middleware: Array): Router; /** * HTTP delete method */ - delete(name: string, path: string, ...middleware: Array): Router; - delete(path: string, ...middleware: Array): Router; + delete(name: string, path: string | RegExp, ...middleware: Array): Router; + delete(path: string | RegExp, ...middleware: Array): Router; /** * Alias for `router.delete()` because delete is a reserved word */ - del(name: string, path: string, ...middleware: Array): Router; - del(path: string, ...middleware: Array): Router; + del(name: string, path: string | RegExp, ...middleware: Array): Router; + del(path: string | RegExp, ...middleware: Array): Router; /** * HTTP head method */ - head(name: string, path: string, ...middleware: Array): Router; - head(path: string, ...middleware: Array): Router; + head(name: string, path: string | RegExp, ...middleware: Array): Router; + head(path: string | RegExp, ...middleware: Array): Router; /** * HTTP options method */ - options(name: string, path: string, ...middleware: Array): Router; - options(path: string, ...middleware: Array): Router; + options(name: string, path: string | RegExp, ...middleware: Array): Router; + options(path: string | RegExp, ...middleware: Array): Router; /** * HTTP path method */ - patch(name: string, path: string, ...middleware: Array): Router; - patch(path: string, ...middleware: Array): Router; + patch(name: string, path: string | RegExp, ...middleware: Array): Router; + patch(path: string | RegExp, ...middleware: Array): Router; /** * Register route with all methods. */ - all(name: string, path: string, ...middleware: Array): Router; - all(path: string, ...middleware: Array): Router; + all(name: string, path: string | RegExp, ...middleware: Array): Router; + all(path: string | RegExp, ...middleware: Array): Router; /** * Set the path prefix for a Router instance that was already initialized. @@ -226,7 +224,7 @@ declare module "koa-router" { /** * Create and register a route. */ - register(path: string, methods: string[], middleware: Router.IMiddleware, opts?: Object): Layer; + register(path: string | RegExp, methods: string[], middleware: Router.IMiddleware, opts?: Object): Layer; /** * Lookup route with given `name`. @@ -254,7 +252,7 @@ declare module "koa-router" { /** * Generate URL from url pattern and given `params`. */ - static url(path: string, params: Object): string; + static url(path: string | RegExp, params: Object): string; } export = Router; diff --git a/masonry-layout/masonry-layout-tests.ts b/masonry-layout/masonry-layout-tests.ts index e83a898f54..65f629db10 100644 --- a/masonry-layout/masonry-layout-tests.ts +++ b/masonry-layout/masonry-layout-tests.ts @@ -1,48 +1,48 @@ -// test file for masonry-layout.d.ts - -/// -/// - -//import {Masonry} from "./masonry-layout.d.ts"; - -// responsive layouts -function testResponsiveLayouts() { - $('.grid').masonry({ - itemSelector: '.grid-item', - columnWidth: '.grid-sizer', - percentPosition: true - }); -} - -// recommended Options -function testRecommendedOptions() { - $('.grid').masonry({ - columnWidth: 200, - itemSelector: '.grid-item' - }); - - var msnry = new Masonry.Masonry('.grid', { - columnWidth: 200, - itemSelector: '.grid-item' - }); -} - -// extended Options -function testExtendedOptions() { - var msnry = new Masonry.Masonry('.grid', { - itemSelector: '.grid-item', - columnWidth: '.grid-sizer', - percentPosition: true, - gutter: '.gutter-sizer', - stamp: '.stamp', - fitWidth: true, - originLeft: true, - originTop: true, - containerStyle: { - position: 'relative' - }, - transitionDuration: '0.4s', - resize: true, - initLayout: true - }); -} +// test file for masonry-layout.d.ts + +/// +/// + +//import {Masonry} from "./masonry-layout.d.ts"; + +// responsive layouts +function testResponsiveLayouts() { + $('.grid').masonry({ + itemSelector: '.grid-item', + columnWidth: '.grid-sizer', + percentPosition: true + }); +} + +// recommended Options +function testRecommendedOptions() { + $('.grid').masonry({ + columnWidth: 200, + itemSelector: '.grid-item' + }); + + var msnry = new Masonry.Masonry('.grid', { + columnWidth: 200, + itemSelector: '.grid-item' + }); +} + +// extended Options +function testExtendedOptions() { + var msnry = new Masonry.Masonry('.grid', { + itemSelector: '.grid-item', + columnWidth: '.grid-sizer', + percentPosition: true, + gutter: '.gutter-sizer', + stamp: '.stamp', + fitWidth: true, + originLeft: true, + originTop: true, + containerStyle: { + position: 'relative' + }, + transitionDuration: '0.4s', + resize: true, + initLayout: true + }); +} diff --git a/masonry-layout/masonry-layout.d.ts b/masonry-layout/masonry-layout.d.ts index 0923a8f463..a76796096b 100644 --- a/masonry-layout/masonry-layout.d.ts +++ b/masonry-layout/masonry-layout.d.ts @@ -1,70 +1,70 @@ -// Type definitions for Masonry 4.0.0 -// Project: https://github.com/desandro/masonry -// Definitions by: Mark Wilson -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -// Modified from original definitions by: -// Travis Brown < https://github.com/warriorrocker> - -declare module Masonry { - - class Masonry implements MasonryGrid { - constructor(options?: MasonryOptions); - constructor(selector: string, options?: MasonryOptions); - } - - interface MasonryGrid { - masonry?(): void; - masonry?(eventName: string, listener: any): void; - - // layout - layout?(): void; - layoutItems?(items: Array, isStill?: boolean): void; - stamp?(elements: Array): void; - unstamp?(elements: Array): void; - - // add and remove items - appended?(elements: Array): void; - prepended?(elements: Array): void; - addItems?(elements: Array): void; - remove?(elements: Array): void; - - // events - on?(eventName: string, listener: any): void; - off?(eventName: string, listener: any): void; - once?(eventName: string, listener: any): void; - - // utilities - reloadItems?(): void; - destroy?(): void; - getItemElements?(): Array; - data?(element: Element): Masonry; - } - - interface MasonryOptions { - - // layout - itemSelector?: string; - columnWidth?: any; - percentPosition?: boolean; - gutter?: any; - stamp?: string; - fitWidth?: boolean; - originLeft?: boolean; - originTop?: boolean; - - // setup - containerStyle?: Object; - transitionDuration?: any; - resize?: boolean; - initLayout?: boolean; - } -} - -interface JQuery { - masonry(options?: Masonry.MasonryOptions): JQuery; -} - - +// Type definitions for Masonry 4.0.0 +// Project: https://github.com/desandro/masonry +// Definitions by: Mark Wilson +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +// Modified from original definitions by: +// Travis Brown < https://github.com/warriorrocker> + +declare module Masonry { + + class Masonry implements MasonryGrid { + constructor(options?: MasonryOptions); + constructor(selector: string, options?: MasonryOptions); + } + + interface MasonryGrid { + masonry?(): void; + masonry?(eventName: string, listener: any): void; + + // layout + layout?(): void; + layoutItems?(items: Array, isStill?: boolean): void; + stamp?(elements: Array): void; + unstamp?(elements: Array): void; + + // add and remove items + appended?(elements: Array): void; + prepended?(elements: Array): void; + addItems?(elements: Array): void; + remove?(elements: Array): void; + + // events + on?(eventName: string, listener: any): void; + off?(eventName: string, listener: any): void; + once?(eventName: string, listener: any): void; + + // utilities + reloadItems?(): void; + destroy?(): void; + getItemElements?(): Array; + data?(element: Element): Masonry; + } + + interface MasonryOptions { + + // layout + itemSelector?: string; + columnWidth?: any; + percentPosition?: boolean; + gutter?: any; + stamp?: string; + fitWidth?: boolean; + originLeft?: boolean; + originTop?: boolean; + + // setup + containerStyle?: Object; + transitionDuration?: any; + resize?: boolean; + initLayout?: boolean; + } +} + +interface JQuery { + masonry(options?: Masonry.MasonryOptions): JQuery; +} + + diff --git a/mongoose/README.md b/mongoose/README.md index 411f6ace2e..9becde8b89 100644 --- a/mongoose/README.md +++ b/mongoose/README.md @@ -49,7 +49,7 @@ interface IUser extends Document { data: any[]; } -var UserModel: Model = mongoose.model('User', UserSchema); +var UserModel: Model = model('User', UserSchema); var user = new UserModel({name: 'Jane'}); user.username; // IUser properties are available diff --git a/musicmetadata/musicmetadata.d.ts b/musicmetadata/musicmetadata.d.ts index b772468546..0e951f8d08 100644 --- a/musicmetadata/musicmetadata.d.ts +++ b/musicmetadata/musicmetadata.d.ts @@ -19,8 +19,8 @@ declare module "musicmetadata" { declare namespace MM { export interface Options { - duration: boolean; - fileSize: number; + duration?: boolean; + fileSize?: number; } export interface Metadata { @@ -45,4 +45,4 @@ declare namespace MM { format: string; data: Buffer; } -} \ No newline at end of file +} diff --git a/ncp/ncp-tests.ts b/ncp/ncp-tests.ts index f1ce04c21e..06f818e0f8 100644 --- a/ncp/ncp-tests.ts +++ b/ncp/ncp-tests.ts @@ -8,6 +8,9 @@ opts = {}; opts = { filter: /abc/ }; +opts = { + filter: (filename: string) => true +}; opts = { transform: (read: NodeJS.ReadableStream, write: NodeJS.WritableStream) => { diff --git a/ncp/ncp.d.ts b/ncp/ncp.d.ts index 50393195e6..b76fa5c912 100644 --- a/ncp/ncp.d.ts +++ b/ncp/ncp.d.ts @@ -10,7 +10,7 @@ declare module 'ncp' { function ncp (source: string, destination: string, options: Options, callback: (err: Error) => void): void; interface Options { - filter? : RegExp; + filter? : RegExp | ((filename: string) => boolean); transform? : (read: NodeJS.ReadableStream, write: NodeJS.WritableStream) => void; clobber? : boolean; stopOnErr? : boolean; diff --git a/nock/nock-tests.ts b/nock/nock-tests.ts index bc936a05b8..ffb456b420 100644 --- a/nock/nock-tests.ts +++ b/nock/nock-tests.ts @@ -97,6 +97,12 @@ inst = inst.log(() => { }); +inst = inst.delay(2000); +inst = inst.delayBody(2000); +inst = inst.delayConnection(2000); +inst.getTotalDelay(); +inst = inst.socketDelay(2000); + inst.done(); bool = inst.isDone(); inst.restore(); diff --git a/nock/nock.d.ts b/nock/nock.d.ts index b82721da78..615ec0d3ca 100644 --- a/nock/nock.d.ts +++ b/nock/nock.d.ts @@ -96,7 +96,10 @@ declare module "nock" { log(out: () => void): Scope; delay(timeMs: number): Scope; + delayBody(timeMs: number): Scope; delayConnection(timeMs: number): Scope; + getTotalDelay(): number; + socketDelay(timeMs: number): Scope; times(repeats: number): Scope; once(): Scope; diff --git a/node/node-0.10.d.ts b/node/node-0.10.d.ts index 80b46a475c..9055ec82a7 100644 --- a/node/node-0.10.d.ts +++ b/node/node-0.10.d.ts @@ -688,6 +688,7 @@ declare module "child_process" { pid: number; kill(signal?: string): void; send(message: any, sendHandle: any): void; + connected: boolean; disconnect(): void; } diff --git a/node/node-0.11.d.ts b/node/node-0.11.d.ts index 212768c21a..91cfef468d 100644 --- a/node/node-0.11.d.ts +++ b/node/node-0.11.d.ts @@ -611,6 +611,7 @@ declare module "child_process" { pid: number; kill(signal?: string): void; send(message: any, sendHandle: any): void; + connected: boolean; disconnect(): void; } diff --git a/node/node-0.12.d.ts b/node/node-0.12.d.ts index 49091419a8..4459ebe96a 100644 --- a/node/node-0.12.d.ts +++ b/node/node-0.12.d.ts @@ -829,6 +829,7 @@ declare module "child_process" { pid: number; kill(signal?: string): void; send(message: any, sendHandle?: any): void; + connected: boolean; disconnect(): void; unref(): void; } diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 321c386655..2be7c6aae3 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -545,6 +545,7 @@ declare module "child_process" { pid: number; kill(signal?: string): void; send(message: any, sendHandle: any): void; + connected: boolean; disconnect(): void; } diff --git a/node/node-4-tests.ts b/node/node-4-tests.ts index 9db708b910..5a25f1fa20 100644 --- a/node/node-4-tests.ts +++ b/node/node-4-tests.ts @@ -839,4 +839,16 @@ namespace errors_tests { const myObject = {}; Error.captureStackTrace(myObject); } -} \ No newline at end of file +} + +/////////////////////////////////////////////////////////// +/// Console Tests : https://nodejs.org/api/console.html /// +/////////////////////////////////////////////////////////// + +import * as c from "console"; +namespace console_tests{ + { + assert(c === console); + } +} + diff --git a/node/node-4.d.ts b/node/node-4.d.ts index 4516331d7d..6c45fa2f75 100644 --- a/node/node-4.d.ts +++ b/node/node-4.d.ts @@ -1036,6 +1036,7 @@ declare module "child_process" { pid: number; kill(signal?: string): void; send(message: any, sendHandle?: any): void; + connected: boolean; disconnect(): void; unref(): void; } @@ -2407,3 +2408,7 @@ declare module "constants" { declare module "process" { export = process; } + +declare module "console" { + export = console; +} diff --git a/node/node-tests.ts b/node/node-tests.ts index af214a4385..890d050d76 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -21,6 +21,7 @@ import * as os from "os"; import * as vm from "vm"; import * as string_decoder from "string_decoder"; import * as stream from "stream"; +import * as timers from "timers"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; @@ -134,7 +135,7 @@ class Networker extends events.EventEmitter { } } -var errno: number; +var errno: string; fs.readFile('testfile', (err, data) => { if (err && err.errno) { errno = err.errno; @@ -165,6 +166,22 @@ fs.watch('/tmp/foo-', { console.log(event, filename); }); +fs.access('/path/to/folder', (err) => {}); + +fs.access(Buffer.from(''), (err) => {}); + +fs.access('/path/to/folder', fs.constants.F_OK | fs.constants.R_OK, (err) => {}); + +fs.access(Buffer.from(''), fs.constants.F_OK | fs.constants.R_OK, (err) => {}); + +fs.accessSync('/path/to/folder'); + +fs.accessSync(Buffer.from('')); + +fs.accessSync('path/to/folder', fs.constants.W_OK | fs.constants.X_OK); + +fs.accessSync(Buffer.from(''), fs.constants.W_OK | fs.constants.X_OK); + /////////////////////////////////////////////////////// /// Buffer tests : https://nodejs.org/api/buffer.html /////////////////////////////////////////////////////// @@ -263,9 +280,11 @@ function bufferTests() { let buffer = new Buffer('123'); let val: [number, number]; + /* comment out for --target es5 for (let entry of buffer.entries()) { val = entry; } + */ } { @@ -286,18 +305,22 @@ function bufferTests() { let buffer = new Buffer('123'); let val: number; + /* comment out for --target es5 for (let key of buffer.keys()) { val = key; } + */ } { let buffer = new Buffer('123'); let val: number; + /* comment out for --target es5 for (let value of buffer.values()) { val = value; } + */ } // Imported Buffer from buffer module works properly @@ -982,6 +1005,31 @@ namespace vm_tests { } } +///////////////////////////////////////////////////// +/// Timers tests : https://nodejs.org/api/timers.html +///////////////////////////////////////////////////// + +namespace timers_tests { + { + let immediateId = timers.setImmediate(function(){ console.log("immediate"); }); + timers.clearImmediate(immediateId); + } + { + let counter = 0; + let timeout = timers.setInterval(function(){ console.log("interval"); }, 20); + timeout.unref(); + timeout.ref(); + timers.clearInterval(timeout); + } + { + let counter = 0; + let timeout = timers.setTimeout(function(){ console.log("timeout"); }, 20); + timeout.unref(); + timeout.ref(); + timers.clearTimeout(timeout); + } +} + ///////////////////////////////////////////////////////// /// Errors Tests : https://nodejs.org/api/errors.html /// ///////////////////////////////////////////////////////// @@ -1001,4 +1049,15 @@ namespace process_tests{ var eventEmitter: events.EventEmitter; eventEmitter = process; // Test that process implements EventEmitter... } -} \ No newline at end of file +} + +/////////////////////////////////////////////////////////// +/// Console Tests : https://nodejs.org/api/console.html /// +/////////////////////////////////////////////////////////// + +import * as c from "console"; +namespace console_tests{ + { + assert(c === console); + } +} diff --git a/node/node.d.ts b/node/node.d.ts index 6b043fbe83..412645280d 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -233,7 +233,7 @@ declare var Buffer: { ************************************************/ declare namespace NodeJS { export interface ErrnoException extends Error { - errno?: number; + errno?: string; code?: string; path?: string; syscall?: string; @@ -372,7 +372,7 @@ declare namespace NodeJS { arch: string; platform: string; memoryUsage(): MemoryUsage; - nextTick(callback: Function): void; + nextTick(callback: Function, ...args: any[]): void; umask(mask?: number): number; uptime(): number; hrtime(time?: number[]): number[]; @@ -456,6 +456,8 @@ declare namespace NodeJS { } } +interface IterableIterator {} + /** * @deprecated */ @@ -464,7 +466,7 @@ interface NodeBuffer extends Uint8Array { toString(encoding?: string, start?: number, end?: number): string; toJSON(): any; equals(otherBuffer: Buffer): boolean; - compare(otherBuffer: Buffer): number; + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; slice(start?: number, end?: number): Buffer; writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; @@ -655,6 +657,9 @@ declare module "http" { } export interface IncomingMessage extends events.EventEmitter, stream.Readable { httpVersion: string; + httpVersionMajor: string; + httpVersionMinor: string; + connection: any; headers: any; rawHeaders: string[]; trailers: any; @@ -894,6 +899,7 @@ declare module "os" { export function freemem(): number; export function cpus(): CpuInfo[]; export function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] }; + export function userInfo(options?: {encoding: string}): { username: string, uid: number, gid: number, shell: any, homedir: string } export var EOL: string; } @@ -967,7 +973,7 @@ declare module "punycode" { declare module "repl" { import * as stream from "stream"; - import * as events from "events"; + import * as readline from "readline"; export interface ReplOptions { prompt?: string; @@ -979,8 +985,17 @@ declare module "repl" { useGlobal?: boolean; ignoreUndefined?: boolean; writer?: Function; + completer?: Function; + replMode?: any; + breakEvalOnSigint?: any; } - export function start(options: ReplOptions): events.EventEmitter; + + export interface REPLServer extends readline.ReadLine { + defineCommand(keyword: string, cmd: Function | { help: string, action: Function }): void; + displayPrompt(preserveCursor?: boolean): void + } + + export function start(options: ReplOptions): REPLServer; } declare module "readline" { @@ -1273,6 +1288,32 @@ declare module "dns" { export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[]; + + //Error codes + export var NODATA: string; + export var FORMERR: string; + export var SERVFAIL: string; + export var NOTFOUND: string; + export var NOTIMP: string; + export var REFUSED: string; + export var BADQUERY: string; + export var BADNAME: string; + export var BADFAMILY: string; + export var BADRESP: string; + export var CONNREFUSED: string; + export var TIMEOUT: string; + export var EOF: string; + export var FILE: string; + export var NOMEM: string; + export var DESTRUCTION: string; + export var BADSTR: string; + export var BADFLAGS: string; + export var NONAME: string; + export var BADHINTS: string; + export var NOTINITIALIZED: string; + export var LOADIPHLPAPI: string; + export var ADDRGETNETWORKPARAMS: string; + export var CANCELLED: string; } declare module "net" { @@ -1375,19 +1416,35 @@ declare module "dgram" { port: number; } + interface BindOptions { + port: number; + address?: string; + exclusive?: boolean; + } + + interface SocketOptions { + type: string; + reuseAddr?: boolean; + } + export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + export function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; interface Socket extends events.EventEmitter { - send(buf: Buffer, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; - send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; + send(msg: Buffer | String | any[], port: number, address: string, callback?: (error: Error, bytes: number) => void): void; + send(msg: Buffer | String | any[], offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; bind(port?: number, address?: string, callback?: () => void): void; - close(): void; + bind(options: BindOptions, callback?: Function): void; + close(callback?: any): void; address(): AddressInfo; setBroadcast(flag: boolean): void; + setTTL(ttl: number): void; setMulticastTTL(ttl: number): void; setMulticastLoopback(flag: boolean): void; addMembership(multicastAddress: string, multicastInterface?: string): void; dropMembership(multicastAddress: string, multicastInterface?: string): void; + ref(): void; + unref(): void; } } @@ -1660,14 +1717,23 @@ declare module "fs" { export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string | Buffer) => any): FSWatcher; export function exists(path: string | Buffer, callback?: (exists: boolean) => void): void; export function existsSync(path: string | Buffer): boolean; - /** Constant for fs.access(). File is visible to the calling process. */ - export var F_OK: number; - /** Constant for fs.access(). File can be read by the calling process. */ - export var R_OK: number; - /** Constant for fs.access(). File can be written by the calling process. */ - export var W_OK: number; - /** Constant for fs.access(). File can be executed by the calling process. */ - export var X_OK: number; + + interface Constants { + /** Constant for fs.access(). File is visible to the calling process. */ + F_OK: number; + + /** Constant for fs.access(). File can be read by the calling process. */ + R_OK: number; + + /** Constant for fs.access(). File can be written by the calling process. */ + W_OK: number; + + /** Constant for fs.access(). File can be executed by the calling process. */ + X_OK: number; + } + + export const constants: Constants; + /** Tests a user's permissions for the file specified by path. */ export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; @@ -1688,6 +1754,8 @@ declare module "fs" { fd?: number; mode?: number; }): WriteStream; + export function fdatasync(fd: number, callback: Function): void; + export function fdatasyncSync(fd: number): void; } declare module "path" { @@ -2136,12 +2204,14 @@ declare module "crypto" { export function createSign(algorithm: string): Signer; export interface Signer extends NodeJS.WritableStream { update(data: any): void; - sign(private_key: string, output_format: string): string; + sign(private_key: string): Buffer; + sign(private_key: string, output_format: 'latin1' | 'hex' | 'base64'): string; } export function createVerify(algorith: string): Verify; export interface Verify extends NodeJS.WritableStream { update(data: any): void; - verify(object: string, signature: string, signature_format?: string): boolean; + verify(object: string, signature: Buffer): boolean; + verify(object: string, signature: string, signature_format: 'latin1' | 'hex' | 'base64'): boolean; } export function createDiffieHellman(prime_length: number): DiffieHellman; export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; @@ -2178,6 +2248,15 @@ declare module "crypto" { export function getCiphers(): string[]; export function getCurves(): string[]; export function getHashes(): string[]; + export interface ECDH { + computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string | Buffer; + generateKeys(encoding?: string, format?: string): string | Buffer; + getPrivateKey(encoding?: string): string | Buffer; + getPublicKey(encodind?: string): string | Buffer; + setPrivateKey(private_key: string | Buffer, encoding?: string): void; + setPublicKey(publick_key: string | Buffer, encoding?: string): void; + } + export function createECDH(curve_name: string): ECDH; } declare module "stream" { @@ -2303,6 +2382,18 @@ declare module "util" { export function isError(object: any): boolean; export function inherits(constructor: any, superConstructor: any): void; export function debuglog(key: string): (msg: string, ...param: any[]) => void; + export function isBoolean(object: any): boolean; + export function isBuffer(object: any): boolean; + export function isFunction(object: any): boolean; + export function isNull(object: any): boolean; + export function isNullOrUndefined(object: any): boolean; + export function isNumber(object: any): boolean; + export function isObject(object: any): boolean; + export function isPrimitive(object: any): boolean; + export function isString(object: any): boolean; + export function isSymbol(object: any): boolean; + export function isUndefined(object: any): boolean; + export function deprecate(fn: Function, message: string): Function; } declare module "assert" { @@ -2378,6 +2469,9 @@ declare module "domain" { bind(cb: (err: Error, data: any) => any): any; intercept(cb: (data: any) => any): any; dispose(): void; + members: any[]; + enter(): void; + exit(): void; } export function create(): Domain; @@ -2628,8 +2722,48 @@ declare module "constants" { export var W_OK: number; export var X_OK: number; export var UV_UDP_REUSEADDR: number; + export var SIGQUIT: number; + export var SIGTRAP: number; + export var SIGIOT: number; + export var SIGBUS: number; + export var SIGUSR1: number; + export var SIGUSR2: number; + export var SIGPIPE: number; + export var SIGALRM: number; + export var SIGCHLD: number; + export var SIGSTKFLT: number; + export var SIGCONT: number; + export var SIGSTOP: number; + export var SIGTSTP: number; + export var SIGTTIN: number; + export var SIGTTOU: number; + export var SIGURG: number; + export var SIGXCPU: number; + export var SIGXFSZ: number; + export var SIGVTALRM: number; + export var SIGPROF: number; + export var SIGIO: number; + export var SIGPOLL: number; + export var SIGPWR: number; + export var SIGSYS: number; + export var SIGUNUSED: number; + export var defaultCoreCipherList: string; + export var defaultCipherList: string; } declare module "process" { export = process; } + +declare module "timers" { + export function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; + export function clearTimeout(timeoutId: NodeJS.Timer): void; + export function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; + export function clearInterval(intervalId: NodeJS.Timer): void; + export function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; + export function clearImmediate(immediateId: any): void; +} + +declare module "console" { + export = console; +} \ No newline at end of file diff --git a/notify.js/notify.js.d.ts b/notify.js/notify.js.d.ts index ae31ea6317..49fd3415ec 100644 --- a/notify.js/notify.js.d.ts +++ b/notify.js/notify.js.d.ts @@ -1,131 +1,131 @@ -// Type definitions for notify.js -// Project: https://github.com/notifyjs/notifyjs -// Definitions by: Bahman Nikkhahan -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace NotifyJS { - interface NotificationOptions { - // whether to hide the notification on click - clickToHide: boolean; - // whether to auto-hide the notification - autoHide: boolean; - // if autoHide, hide after milliseconds - autoHideDelay: number; - // show the arrow pointing at the element - arrowShow: boolean; - // arrow size in pixels - arrowSize: number; - // position defines the notification position though uses the defaults below - position: string; - // default positions - elementPosition: string; - globalPosition: string; - // default style - style: string; - // default class (string or [string]) - className: string; - // show animation - showAnimation: string; - // show animation duration - showDuration: number; - // hide animation - hideAnimation: string; - // hide animation duration - hideDuration: number; - // padding between element and notification - gap: number; - } - - interface JQueryStaticNotify { - /** - * notify user - * @param element a jquery element - * @param notificationdata global notification data - * @param options notification options - */ - (element?: any, notificationdata?: any, options?: NotificationOptions): JQueryStatic; - - /** - * Add style - * @param styleName style name - * @param styleDefinition style definition object - */ - addStyle(styleName: string, styleDefinition: any): any; - - /** - * Remove style - * @param styleName style name - */ - removeStyle(styleName: string): any; - - /** - * Get style - * @param styleName style name - */ - getStyle(styleName: string): any; - - /** - * Insert css - * @param cssText css text to insert - */ - insertCSS(cssText: string): any; - - /** - * Set defaults for notifications - * @param options notification iptions - */ - defaults(options: NotificationOptions): any; - } - - interface JQueryStatic { - notify: JQueryStaticNotify; - } - - interface JQueryNotify { - /** - * notify user - * @param element a jquery element - * @param notificationdata global notification data - * @param options notification options - */ - (element?: any, notificationdata?: any, options?: NotificationOptions): JQuery; - - /** - * Add style - * @param styleName style name - * @param styleDefinition style definition object - */ - addStyle(styleName: string, styleDefinition: any): any; - - /** - * Remove style - * @param styleName style name - */ - removeStyle(styleName: string): any; - - /** - * Get style - * @param styleName style name - */ - getStyle(styleName: string): any; - - /** - * Insert css - * @param cssText css text to insert - */ - insertCSS(cssText: string): any; - - /** - * Set defaults for notifications - * @param options notification iptions - */ - defaults(options: NotificationOptions): any; - - } - - interface JQuery { - notify: JQueryStaticNotify; - } -} +// Type definitions for notify.js +// Project: https://github.com/notifyjs/notifyjs +// Definitions by: Bahman Nikkhahan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace NotifyJS { + interface NotificationOptions { + // whether to hide the notification on click + clickToHide: boolean; + // whether to auto-hide the notification + autoHide: boolean; + // if autoHide, hide after milliseconds + autoHideDelay: number; + // show the arrow pointing at the element + arrowShow: boolean; + // arrow size in pixels + arrowSize: number; + // position defines the notification position though uses the defaults below + position: string; + // default positions + elementPosition: string; + globalPosition: string; + // default style + style: string; + // default class (string or [string]) + className: string; + // show animation + showAnimation: string; + // show animation duration + showDuration: number; + // hide animation + hideAnimation: string; + // hide animation duration + hideDuration: number; + // padding between element and notification + gap: number; + } + + interface JQueryStaticNotify { + /** + * notify user + * @param element a jquery element + * @param notificationdata global notification data + * @param options notification options + */ + (element?: any, notificationdata?: any, options?: NotificationOptions): JQueryStatic; + + /** + * Add style + * @param styleName style name + * @param styleDefinition style definition object + */ + addStyle(styleName: string, styleDefinition: any): any; + + /** + * Remove style + * @param styleName style name + */ + removeStyle(styleName: string): any; + + /** + * Get style + * @param styleName style name + */ + getStyle(styleName: string): any; + + /** + * Insert css + * @param cssText css text to insert + */ + insertCSS(cssText: string): any; + + /** + * Set defaults for notifications + * @param options notification iptions + */ + defaults(options: NotificationOptions): any; + } + + interface JQueryStatic { + notify: JQueryStaticNotify; + } + + interface JQueryNotify { + /** + * notify user + * @param element a jquery element + * @param notificationdata global notification data + * @param options notification options + */ + (element?: any, notificationdata?: any, options?: NotificationOptions): JQuery; + + /** + * Add style + * @param styleName style name + * @param styleDefinition style definition object + */ + addStyle(styleName: string, styleDefinition: any): any; + + /** + * Remove style + * @param styleName style name + */ + removeStyle(styleName: string): any; + + /** + * Get style + * @param styleName style name + */ + getStyle(styleName: string): any; + + /** + * Insert css + * @param cssText css text to insert + */ + insertCSS(cssText: string): any; + + /** + * Set defaults for notifications + * @param options notification iptions + */ + defaults(options: NotificationOptions): any; + + } + + interface JQuery { + notify: JQueryStaticNotify; + } +} diff --git a/notify.js/notify.js.tests.ts b/notify.js/notify.js.tests.ts index f533b47288..505f3c4ec5 100644 --- a/notify.js/notify.js.tests.ts +++ b/notify.js/notify.js.tests.ts @@ -1,53 +1,53 @@ -/// -/// - -// setting defaults for notification plugin -$.notify.defaults({ - clickToHide: true, - autoHide: false, - autoHideDelay: 5000, - arrowShow: true, - arrowSize: 5, - position: 'top center', - elementPosition: 'bottom left', - globalPosition: 'top center', - style: 'bootstrap', - className: 'error', - showAnimation: 'slideDown', - showDuration: 400, - hideAnimation: 'slideUp', - hideDuration: 200, - gap: 2 -}); - -$(".elem-demo").notify("Hello Box"); -$.notify("Access granted", "success"); -$.notify("Do not press this button", "info"); -$.notify('hello !!', { - style: 'happyblue' -}); -$.notify('hello !!', { - style: 'happyblue' -}); -//add a new style 'foo' -$.notify.addStyle('foo', { - html: - "
" + - "
" + - "
" + - "
" + - "" + - "" + - "
" + - "
" + - "
" -}); - -$.notify({ - title: 'Would you like some Foo ?', - button: 'Confirm' -}, { - style: 'foo', - autoHide: false, - clickToHide: false +/// +/// + +// setting defaults for notification plugin +$.notify.defaults({ + clickToHide: true, + autoHide: false, + autoHideDelay: 5000, + arrowShow: true, + arrowSize: 5, + position: 'top center', + elementPosition: 'bottom left', + globalPosition: 'top center', + style: 'bootstrap', + className: 'error', + showAnimation: 'slideDown', + showDuration: 400, + hideAnimation: 'slideUp', + hideDuration: 200, + gap: 2 +}); + +$(".elem-demo").notify("Hello Box"); +$.notify("Access granted", "success"); +$.notify("Do not press this button", "info"); +$.notify('hello !!', { + style: 'happyblue' +}); +$.notify('hello !!', { + style: 'happyblue' +}); +//add a new style 'foo' +$.notify.addStyle('foo', { + html: + "
" + + "
" + + "
" + + "
" + + "" + + "" + + "
" + + "
" + + "
" +}); + +$.notify({ + title: 'Would you like some Foo ?', + button: 'Confirm' +}, { + style: 'foo', + autoHide: false, + clickToHide: false }); \ No newline at end of file diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index ec180bf45d..00922aeb3b 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -1,4 +1,4 @@ -// Type definitions for OpenLayers v3.6.0 +// Type definitions for OpenLayers v3.18.2 // Project: http://openlayers.org/ // Definitions by: Wouter Goedhart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -48,6 +48,25 @@ declare namespace olx { extent: ol.Extent; } + interface RotateOptions { + /*** CSS class name. Default is ol-rotate.*/ + className?: string; + /*** Text label to use for the rotate button. Default is ⇧. Instead of text, also a Node (e.g. a span element) can be used.*/ + label?: string | Element; + /*** Text label to use for the rotate tip. Default is Reset rotation.*/ + tipLabel?: string; + /*** Animation duration in milliseconds. Default is 250.*/ + duration?: number; + /*** Hide the control when rotation is 0. Default is true.*/ + autoHide?: boolean; + /*** Function called when the control should be re-rendered. This is called in a requestAnimationFrame callback.*/ + render?: Function; + /*** Function called when the control is clicked. This will override the default resetNorth.*/ + resetNorth?: Function; + /*** Target.*/ + target?: Element; + } + interface AttributionOptions { /** HTML markup for this attribution. */ @@ -211,6 +230,30 @@ declare namespace olx { /** experimental Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds. The default is true. */ wrapX?: boolean; } + interface OSMOptions { + /** Attributions */ + attributions?: ol.AttributionLike; + /** Cache size. Default is 2048. */ + cacheSize?: number; + /** + * The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL + * renderer or if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. Default is anonymous. + */ + crossOrigin?: string; + /** Max zoom. Default is 19. */ + maxZoom?: number; + /** Whether the layer is opaque. Default is true. */ + opaque?: boolean; + /** Maximum allowed reprojection error (in pixels). Default is 0.5. Higher values can increase reprojection performance, but decrease precision. */ + reprojectionErrorThreshold?: number; + /** Optional function to load a tile given a URL. */ + tileLoadFunction?: ol.TileLoadFunctionType; + /** URL template. Must include {x}, {y} or {-y}, and {z} placeholders. Default is https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png. */ + url?: string; + /** Whether to wrap the world horizontally. Default is true. */ + wrapX?: boolean; + } /** * Object literal with config options for the map logo. */ @@ -791,24 +834,24 @@ declare namespace olx { */ wrapX?: boolean; } - + interface ClusterOptions extends VectorOptions{ - + /** * Minimum distance in pixels between clusters. Default is 20. */ distance?: number; - + extent?: ol.Extent; - + geometryFunction?: any; - + projection?: ol.proj.ProjectionLike; - + source: ol.source.Vector; - + } - + interface WMTSOptions { attributions?: Array; crossOrigin?: string; @@ -1127,6 +1170,8 @@ declare namespace ol { interface ImageLoadFunctionType { (image: ol.Image, url: string): void } + type AttributionLike = string | Array | ol.Attribution | Array + /** * An attribution for a layer source. */ @@ -2422,9 +2467,9 @@ declare namespace ol { * @returns Control.s */ function defaults(options?: olx.control.DefaultsOptions): ol.Collection; - + namespace ScaleLine { - + /** * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. */ @@ -2433,29 +2478,29 @@ declare namespace ol { class Control extends ol.Object{ constructor(options: olx.control.ControlOptions); - + /** * Get the map associated with this control. */ getMap():ol.Map; - + /** - * Remove the control from its current map and attach it to the new map. + * Remove the control from its current map and attach it to the new map. * Subclasses may set up event handlers to get notified about changes to the map here. */ setMap(map: ol.Map):void; - + /** - * This function is used to set a target element for the control. - * It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). - * If no target is set in the options passed to the control constructor and if setTarget is not called then the control is + * This function is used to set a target element for the control. + * It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). + * If no target is set in the options passed to the control constructor and if setTarget is not called then the control is * added to the map's overlay container. */ setTarget(target: Element | string):void; - - + + } - + class Attribution extends Control { } @@ -2469,20 +2514,21 @@ declare namespace ol { } class Rotate extends Control { + constructor(opt_options?: olx.RotateOptions); } class ScaleLine extends Control { - + /** * Return the units to use in the scale line. */ getUnits(): ScaleLine.Units; - + /** * Set the units to use in the scale line. */ setUnits(units: ScaleLine.Units): void; - + } class Zoom extends Control{ @@ -4061,7 +4107,7 @@ declare namespace ol { * @argument map. */ setMap(map: ol.Map): void; - + /** * Set Z-index of the layer, which is used to order layers before rendering. The default Z-index is 0. */ @@ -4254,12 +4300,13 @@ declare namespace ol { } class OSM extends XYZ { + constructor(opt_options?: olx.OSMOptions); } class Source extends ol.Object { - + constructor(options: any); - + /** * Get the projection of the source. * @return Projection. diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 3a7d6b25f8..84fbc76027 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -1072,7 +1072,7 @@ declare namespace Parse { title?: string; } - interface SendOptions { + interface SendOptions extends UseMasterKeyOption { success?: () => void; error?: (error: Error) => void; } diff --git a/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts new file mode 100644 index 0000000000..7b1f23a3fd --- /dev/null +++ b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +cordova.plugins.barcodeScanner.scan( + function (result) { + alert("We got a barcode\n" + + "Result: " + result.text + "\n" + + "Format: " + result.format + "\n" + + "Cancelled: " + result.cancelled); + }, + function (error) { + alert("Scanning failed: " + error); + }, + { + "preferFrontCamera" : true, // iOS and Android + "showFlipCameraButton" : true, // iOS and Android + "prompt" : "Place a barcode inside the scan area", // supported on Android only + "formats" : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED + "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device + } +); + + +cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) { + alert("encode success: " + success); + }, function(fail) { + alert("encoding failed: " + fail); + } +); \ No newline at end of file diff --git a/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner.d.ts b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner.d.ts new file mode 100644 index 0000000000..85bde977b7 --- /dev/null +++ b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner.d.ts @@ -0,0 +1,37 @@ +// Type definitions for phonegap-plugin-barcodescanner +// Project: https://github.com/phonegap/phonegap-plugin-barcodescanner +// Definitions by: Nathan Ainslie +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface CordovaPlugins { + barcodeScanner: phonegapBarcode.BarcodeScanner; +} + +declare namespace phonegapBarcode { + interface BarcodeScanResult { + text: string; + format: string; + cancelled: boolean; + } + + interface BarcodeScanOptions { + preferFrontCamera?: boolean; + showFlipCameraButton?: boolean; + prompt?: string; + formats?: string; + orientation?: "landscape" | "portrait"; + } + + interface EncodingType { + TEXT_TYPE: any; + EMAIL_TYPE: any; + PHONE_TYPE: any; + SMS_TYPE: any; + } + + interface BarcodeScanner { + scan: (success: ((result: BarcodeScanResult) => any), failure?: ((err: any) => any), opts?: BarcodeScanOptions) => void; + encode: (encodingType: EncodingType, data: string, success: ((result: any) => any), failure?: ((err: any) => any)) => void; + Encode: EncodingType; + } +} \ No newline at end of file diff --git a/pino/pino-tests.ts b/pino/pino-tests.ts index 9a2c423222..4a1470db24 100644 --- a/pino/pino-tests.ts +++ b/pino/pino-tests.ts @@ -26,6 +26,12 @@ var instance = PINO({ } }) +var pretty = PINO.pretty() +var instance2 = PINO({ + name: 'app', + safe: true +}, pretty) + var logger = instance logger.child({ a: 'property' }).info('hello child!') diff --git a/pino/pino.d.ts b/pino/pino.d.ts index 1d7049cf05..0a51c49275 100644 --- a/pino/pino.d.ts +++ b/pino/pino.d.ts @@ -41,8 +41,8 @@ declare module 'pino' { } interface Pino { - (optionsOrStream?: LoggerOptions | stream.Writable): Logger - (options: LoggerOptions, stream: stream.Writable): Logger + (optionsOrStream?: LoggerOptions | stream.Writable | stream.Readable): Logger + (options: LoggerOptions, stream: stream.Writable | stream.Readable): Logger levels: { values: LevelLabelsToValues labels: LevelValuesToLabels diff --git a/progress/progress.d.ts b/progress/progress.d.ts index 6eb55a917e..79c769deaa 100644 --- a/progress/progress.d.ts +++ b/progress/progress.d.ts @@ -114,6 +114,11 @@ declare module "progress" * Terminates a progress bar. */ terminate():void; + + /** + * Completed status of progress (Boolean) + */ + complete:boolean; } namespace ProgressBar { } diff --git a/quill/quill-tests.ts b/quill/quill-tests.ts index 3a87bd5948..5116ace525 100644 --- a/quill/quill-tests.ts +++ b/quill/quill-tests.ts @@ -1,10 +1,6 @@ /// -/// - -//export var Quill = require("quill"); function test_quill() { - var quillEditor = new Quill('#editor', { modules: { @@ -14,6 +10,31 @@ function test_quill() { }); } +function test_deleteText() { + var quillEditor = new Quill('#editor'); + quillEditor.deleteText(0, 10); +} + +function test_disable() { + let quillEditor = new Quill('#Editor'); + quillEditor.disable(); +} + +function test_enable() { + let quillEditor = new Quill('#Editor'); + quillEditor.enable(); +} + +function test_getContents() { + var quillEditor = new Quill('#editor'); + var delta: QuillJS.DeltaStatic = quillEditor.getContents(); +} + +function test_getLength() { + var quillEditor = new Quill('#editor'); + var num: number = quillEditor.getLength(); +} + function test_getText() { var quillEditor = new Quill('#editor'); var strValue: string = quillEditor.getText(); @@ -29,26 +50,11 @@ function test_getText_substring() { var strValue: string = quillEditor.getText(0, 10); } -function test_getLength() { - var quillEditor = new Quill('#editor'); - var num: number = quillEditor.getLength(); -} - -function test_getContents() { - var quillEditor = new Quill('#editor'); - var delta: DeltaStatic = quillEditor.getContents(); -} - function test_insertText() { var quillEditor = new Quill('#editor'); quillEditor.insertText(0, "Hello World"); } -function test_deleteText() { - var quillEditor = new Quill('#editor'); - quillEditor.deleteText(0, 10); -} - function test_formatText() { var quillEditor = new Quill('#editor'); quillEditor.formatText(0, 5, 'bold', true); @@ -63,15 +69,28 @@ function test_formatText2() { }); } -function test_formatLine() { +function test_formatLine1() { + var quillEditor = new Quill('#editor'); + quillEditor.formatLine(1, 3, 'api'); +} + +function test_formatLine2() { var quillEditor = new Quill('#editor'); quillEditor.formatLine(1, 3, 'align', 'right'); } +function test_formatLine3() { + var quillEditor = new Quill('#editor'); + quillEditor.formatLine(1, 3, { + 'align': 'right', + 'bold': false, + }); +} + function test_insertEmbed() { var quillEditor = new Quill('#editor'); - quillEditor.insertEmbed(10, 'image', 'http://quilljs.com/images/cloud.png'); + quillEditor.insertEmbed(10, 'image', 'http://com/images/cloud.png'); } function test_updateContents() { @@ -96,12 +115,6 @@ function test_setContents() { ]); } -function test_setHTML() { - var quillEditor = new Quill('#editor'); - - quillEditor.setHTML('
Hello
'); -} - function test_setText() { var quillEditor = new Quill('#editor'); quillEditor.setText('Hello\n'); @@ -113,10 +126,10 @@ function test_getSelection() { var range = quillEditor.getSelection(); if (range) { - if (range.start == range.end) { - console.log('User cursor is at index', range.start); + if (range.index == range.length) { + console.log('User cursor is at index', range.index); } else { - var text = quillEditor.getText(range.start, range.end); + var text = quillEditor.getText(range.index, range.length); console.log('User has highlighted: ', text); } } else { @@ -129,11 +142,6 @@ function test_setSelection() { quillEditor.setSelection(0, 5); } -function test_prepareFormat() { - var quillEditor = new Quill('#editor'); - quillEditor.prepareFormat('bold', true); -} - function test_focus() { var quillEditor = new Quill('#editor'); quillEditor.focus(); @@ -144,14 +152,6 @@ function test_getBounds() { quillEditor.setText('Hello\nWorld\n'); } -function test_addModule() { - var quillEditor = new Quill('#editor'); - - var toolbar = quillEditor.addModule('toolbar', { - container: '#toolbar-container' - }); -} - function test_getModule() { var quillEditor = new Quill('#editor'); @@ -159,15 +159,16 @@ function test_getModule() var toolbar = quillEditor.getModule('toolbar'); } - -function test_addFormat() -{ - var quillEditor = new Quill('#editor'); - quillEditor.addFormat('strike', { tag: 'S', prepare: 'strikeThrough' }); -} - function test_addContainer() { var quillEditor = new Quill('#editor'); quillEditor.addContainer('ql-custom'); } + +function test_on_EventType1(){ + var quillEditor = new Quill('#editor'); + quillEditor.on('text-change', (newDelta, oldDelta, source)=>{ + // happened + }); + +} diff --git a/quill/quill.d.ts b/quill/quill.d.ts index 3cef088442..885f6bdc34 100644 --- a/quill/quill.d.ts +++ b/quill/quill.d.ts @@ -1,118 +1,94 @@ -// Type definitions for Quill +// Type definitions for Quill v1.0.0 // Project: http://quilljs.com // Definitions by: Sumit // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +declare namespace QuillJS { -declare interface DeltaStatic{ - ops? : Array; - retain?: any, - delete?: any, - insert?: any, - attributes?: any + export interface QuillOptionsStatic { + debug?: string, + modules?: { [key: string]: any }, + placeholder?: string, + readOnly?: boolean, + theme?: string + } + + export interface BoundsStatic { + left: number, + top: number, + height: number, + width: number + } + + export interface DeltaStatic { + ops?: Array; + retain?: any, + delete?: any, + insert?: any, + attributes?: any + } + + export interface RangeStatic { + new (): RangeStatic; + index: number; + length: number; + } + + type sourceType = "api" | "user" | "silent"; + type formatsType = { [key: string]: any }; + + export interface QuillStatic { + new (selector: string, options?: QuillOptionsStatic): QuillStatic; + deleteText(start: number, end: number, source?: sourceType): void; + disable(): void; + enable(enabled?: boolean): void; + getContents(start?: number, end?: number): DeltaStatic; + getLength(): number; + getText(start?: number, end?: number): string; + insertEmbed(index: number, type: string, url: string, source?: sourceType): void; + insertText(index: number, text: string, source?: sourceType): void; + insertText(index: number, text: string, format: string, value: string, source?: sourceType): void; + insertText(index: number, text: string, formats: formatsType, source?: sourceType): void; + pasteHTML(): string; + setContents(delta: DeltaStatic, source?: sourceType): void; + setText(text: string, source?: sourceType): void; + update(source?: string): void; + updateContents(delta: DeltaStatic, source?: sourceType): void; + + format(name: string, value: any, source?: sourceType): void; + formatLine(index: number, length: number, source?: sourceType): void; + formatLine(index: number, length: number, format: string, value: any, source?: sourceType): void; + formatLine(index: number, length: number, formats: formatsType, source?: sourceType): void; + formatText(index: number, length: number, source?: sourceType): void; + formatText(index: number, length: number, format: string, value: any, source?: sourceType): void; + formatText(index: number, length: number, formats: formatsType, source?: sourceType): void; + getFormat(range?: RangeStatic): formatsType; + getFormat(index: number, length?: number): formatsType; + removeFormat(index: Number, length: Number, source?: sourceType): void; + + blur(): void; + focus(): void; + getBounds(index: number, length?: number): BoundsStatic; + getSelection(focus?: boolean): RangeStatic; + hasFocus(): boolean; + setSelection(index: number, length: number, source?: sourceType): void; + setSelection(range: RangeStatic, source?: sourceType): void; + + on(eventName: string, callback: ((delta: T, oldContents: T, source: string) => void) | + ((name: string, ...args: any[]) => void)): QuillStatic; + once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; + off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; + + debug(level: string): void; + import(path: string): any; + register(path: string, def: any, suppressWarning?: boolean): void; + register(defs: formatsType, suppressWarning?: boolean): void; + addContainer(className: string, refNode?: any): any; + getModule(name: string): any + } } -declare interface RangeStatic{ - new(): RangeStatic; - start: number; - end: number; -} - -declare interface QuillStatic { - new(selector: string, options?: Object):QuillStatic; - - on(eventName: string, callback: (delta: DeltaStatic, source: string) => void): EventEmitter2; - addModule(id: string, options: any) : Object; - - getText(): string; - getText(start: number): string; - getText(start: number, end: number): string; - - getLength(): number; - - getContents(): DeltaStatic; - getContents(start: number): DeltaStatic; - getContents(start: number, end: number): DeltaStatic; - - getHTML(): string; - - insertText(index: number, text: string): void; - insertText(index: number, text: string, name: string, value: string): void; - insertText(index: number, text: string, formats: any): void; - insertText(index: number, text: string, source: string) : void; - insertText(index: number, text: string, name: string, value: string, source: string): void; - insertText(index: number, text: string, formats: any, source: string): void; - - deleteText(start: number, end: number): void; - deleteText(start: number, end: number, source: string): void; - - formatText(start: number, end: number): void; - formatText(start: number, end: number, name: string, value: boolean): void; - formatText(start: number, end: number, formats: any): void; - formatText(start: number, end: number, source: string): void; - formatText(start: number, end: number, name: string, value: string, source: string): void; - formatText(start: number, end: number, formats: string, source: string): void; - - - formatLine(start: number, end: number): void; - formatLine(start: number, end: number, name: string, value: boolean): void; - formatLine(start: number, end: number, formats: any): void; - formatLine(start: number, end: number, source: string): void; - formatLine(start: number, end: number, name: string, value: string, source: string): void; - formatLine(start: number, end: number, formats: any, source: string): void; - - - insertEmbed(index: number, type: string, url: string): void; - insertEmbed(index: number, type: string, url: string, source: string): void; - - updateContents(delta: DeltaStatic): void; - - setContents(delta: DeltaStatic): void; - - setHTML(html: string): void; - - setText(text: string): void; - - getSelection(): RangeStatic; - - setSelection(start: number, end: number): void; - setSelection(start: number, end: number, source: string): void; - setSelection(range: RangeStatic): void; - setSelection(range: RangeStatic, source: string): void; - - prepareFormat(format: string, value: boolean): void; - - focus(): void; - - getBounds(index: number): any; - - registerModule(name: string, callback: (quill: QuillStatic, options: any) => {}): any; - - addModule(name: string, options: any): any; - - getModule(name: string): any; - - onModuleLoad(name: string, callback: (input: any) => {}): void; - - addFormat(name: string, config: any): void; - - addContainer(cssClass: string, before?: number): HTMLDivElement; -} - -declare module "Range" -{ - var Range: RangeStatic; - export = Range; -} - -declare var Delta: DeltaStatic; - -declare module "Delta"{ - export = Delta; -} - -declare var Quill: QuillStatic; +declare var Quill: QuillJS.QuillStatic; declare module "Quill" { export = Quill; diff --git a/radium/radium-tests.tsx b/radium/radium-tests.tsx index c8379b39b2..b8ad3928dd 100644 --- a/radium/radium-tests.tsx +++ b/radium/radium-tests.tsx @@ -43,6 +43,12 @@ class TestComponentWithConfig extends React.Component<{ a?: number }, {}> { }} > +
) diff --git a/radium/radium.d.ts b/radium/radium.d.ts index 1989156877..0cb4304d96 100644 --- a/radium/radium.d.ts +++ b/radium/radium.d.ts @@ -1,6 +1,6 @@ -// Type definitions for radium 0.17.1 +// Type definitions for radium 0.18.1 // Project: https://github.com/formidablelabs/radium -// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov +// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov , Mikael Hermansson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -19,10 +19,10 @@ declare module 'radium' { */ export interface StyleProps { /** - * An object of CSS rules to render. Each key of the rules object is a CSS selector and the value is an object - * of styles. If rules is empty, the component will render nothing. + * An object of styles, or an object of CSS rules to render. Each key of the rules object is a CSS + * selector and the value is an object of styles. If rules is empty, the component will render nothing. */ - rules: StyleRules; + rules: React.CSSProperties | StyleRules; /** * A string that any included selectors in rules will be appended to. * Use to scope styles in the component to a particular element. A good use case might be to generate a unique diff --git a/ravenjs/ravenjs-tests.ts b/ravenjs/ravenjs-tests.ts index db0ddd6932..eafa48871c 100644 --- a/ravenjs/ravenjs-tests.ts +++ b/ravenjs/ravenjs-tests.ts @@ -44,3 +44,5 @@ Raven.setUserContext({ Raven.captureMessage('Broken!'); Raven.captureMessage('Broken!', {tags: { key: "value" }}); + +Raven.showReportDialog(options); diff --git a/ravenjs/ravenjs.d.ts b/ravenjs/ravenjs.d.ts index ae891a7cda..e7e68b69aa 100644 --- a/ravenjs/ravenjs.d.ts +++ b/ravenjs/ravenjs.d.ts @@ -183,6 +183,8 @@ interface RavenStatic { /** If you need to conditionally check if raven needs to be initialized or not, you can use the isSetup function. It will return true if Raven is already initialized. */ isSetup(): boolean; + + showReportDialog(options: RavenOptions): void; } interface RavenTransportOptions { diff --git a/rbush/rbush-tests.ts b/rbush/rbush-tests.ts new file mode 100644 index 0000000000..305f4b7205 --- /dev/null +++ b/rbush/rbush-tests.ts @@ -0,0 +1,41 @@ +/// + +import * as rbush from 'rbush'; + +interface IndexedRect extends rbush.BBox { + index: number; +} + +function test_rbush() { + var index = rbush(); + + index + .clear() + .insert({ + minX: 0, + minY: 0, + maxX: 10, + maxY: 10, + index: 0, + }); + + index.all(); + index.fromJSON(index.toJSON()); + + index.search({ + minX: 5, + maxX: 15, + minY: 5, + maxY: 11, + }) + + index.load([ + { + minX: 0, + minY: 0, + maxX: 10, + maxY: 10, + index: 0, + } + ]) +} diff --git a/rbush/rbush.d.ts b/rbush/rbush.d.ts new file mode 100644 index 0000000000..6c04ce241c --- /dev/null +++ b/rbush/rbush.d.ts @@ -0,0 +1,110 @@ +// Type definitions for rbush 2.0.1 +// Project: https://github.com/mourner/rbush +// Definitions by: Dan Vanderkam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace rbush { + export interface BBox { + minX: number; + minY: number; + maxX: number; + maxY: number; + } + + export interface RBush { + /** + * Insert an item. To insert many items, use load(). + */ + insert(item: T): RBush; + + /** + * Bulk-insert the given data into the tree. + * + * Bulk insertion is usually ~2-3 times faster than inserting items one by one. + * After bulk loading (bulk insertion into an empty tree), subsequent query + * performance is also ~20-30% better. + * + * Note that when you do bulk insertion into an existing tree, it bulk-loads + * the given data into a separate tree and inserts the smaller tree into the + * larger tree. This means that bulk insertion works very well for clustered + * data (where items in one update are close to each other), but makes query + * performance worse if the data is scattered. + */ + load(items: T[]): RBush; + + /** + * Remove a previously inserted item. + * + * By default, RBush removes objects by reference. However, you can pass a + * custom equals function to compare by value for removal, which is useful + * when you only have a copy of the object you need removed (e.g. loaded + * from server). + */ + remove(item: T, equals?: (a: T, b: T) => boolean): RBush; + + /** Remove all items */ + clear(): RBush; + + /** + * Returns an array of data items (points or rectangles) that the given + * bounding box intersects. + * + * Note that the search method accepts a bounding box in {minX, minY, maxX, maxY} + * format regardless of the format specified in the constructor (which only + * affects inserted objects). + */ + search(bbox: BBox): T[]; + + /** Returns all items of the tree. */ + all(): T[]; + + /** + * Returns true if there are any items intersecting the given bounding box, + * otherwise false. + */ + collides(bbox: BBox): boolean; + + /** + * Export data as JSON object. + * + * Importing and exporting as JSON allows you to use RBush on both the server + * (using Node.js) and the browser combined, e.g. first indexing the data on + * the server and and then importing the resulting tree data on the client + * for searching. + * + * Note that the nodeSize option passed to the constructor must be the same + * in both trees for export/import to work properly. + */ + toJSON(): any; + + /** + * Import previously exported data. + * + * Importing and exporting as JSON allows you to use RBush on both the server + * (using Node.js) and the browser combined, e.g. first indexing the data on + * the server and and then importing the resulting tree data on the client + * for searching. + * + * Note that the nodeSize option passed to the constructor must be the same + * in both trees for export/import to work properly. + */ + fromJSON(data: any): RBush; + } + + interface IRBush { + /** + * Create a spatial index. + * + * An optional argument to rbush defines the maximum number of entries in a tree node. + * 9 (used by default) is a reasonable choice for most applications. Higher value means\ + * faster insertion and slower search, and vice versa. + */ + (nodeSize?: number): RBush; + (nodeSize: number, formatter: string[]): RBush; + } +} + +declare module 'rbush' { + const temp: rbush.IRBush; + export = temp; +} diff --git a/react-daterange-picker/react-daterange-picker-tests.tsx b/react-daterange-picker/react-daterange-picker-tests.tsx new file mode 100644 index 0000000000..98665fddb6 --- /dev/null +++ b/react-daterange-picker/react-daterange-picker-tests.tsx @@ -0,0 +1,178 @@ +/// +/// + +// Test app from https://github.com/onefinestay/react-daterange-picker/blob/master/example/index.jsx +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import * as moment from 'moment'; +import 'moment-range'; +import * as DateRangePicker from 'react-daterange-picker'; + +interface AppProps extends ReactDateRangePicker.Props { +} + +class App extends React.Component { + constructor(props: AppProps, context: any) { + super(props, context); + + this.state = {}; + } + + handleSelect(value: AppProps, states: any): void { + this.setState({value, states}); + } + + render(): any { + return ( +
+ +
+ + +
+
+ ); + } +} + +class DateSinglePicker extends React.Component { + constructor(props : AppProps, context: any) { + super(props, context); + + this.state = {}; + } + + handleSelect(value: AppProps) { + this.setState({value: value}); + } + + render() { + return ( +
+ +
+ +
+
+ ); + } +} + +export class Main extends React.Component { + + render() { + const stateDefinitions: ReactDateRangePicker.StateDefinitions = { + available: { + color: '#ffffff', + label: 'Available', + }, + enquire: { + color: '#ffd200', + label: 'Enquire', + }, + unavailable: { + selectable: false, + color: '#78818b', + label: 'Unavailable', + } + }; + + const dateRanges = [ + { + state: 'enquire', + range: moment.range( + moment().add(2, 'weeks').subtract(5, 'days'), + moment().add(2, 'weeks').add(6, 'days') + ), + }, + { + state: 'unavailable', + range: moment.range( + moment().add(3, 'weeks'), + moment().add(3, 'weeks').add(5, 'days') + ), + }, + ]; + + const initialStart = moment().add(1, 'weeks').startOf('day'); + const initialEnd = moment().add(1, 'weeks').add(3, 'days').startOf('day'); + const range = moment.range(initialStart, initialEnd); + + return ( +
+
+ +
+ +
+

Examples

+ +
+

Range with no date states

+ +
+ +
+

Range with day-long ranges allowed

+ +
+ +
+

Range with no minimum date

+ +
+
+

Single with no date states

+ +
+
+
+ ); + } +} + +const MainFactory = React.createFactory(Main); + +ReactDOM.render( + MainFactory(), + document.getElementById('app') +); diff --git a/react-daterange-picker/react-daterange-picker.d.ts b/react-daterange-picker/react-daterange-picker.d.ts new file mode 100644 index 0000000000..4754e77140 --- /dev/null +++ b/react-daterange-picker/react-daterange-picker.d.ts @@ -0,0 +1,77 @@ +// Type definitions for React Daterange Picker v1.1.0 +// Project: https://github.com/onefinestay/react-daterange-picker +// Definitions by: UNCOVER TRUTH Inc. +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// + +declare module 'react-daterange-picker' { + import DateRangePicker = ReactDateRangePicker.DateRangePicker; + export = DateRangePicker; +} + +declare namespace ReactDateRangePicker { + import React = __React; + + interface Props extends React.Props<{}> { + bemBlock?: string; + bemNamespace?: string; + dateStates?: DateState[]; + defaultState?: string; + disableNavigation?: boolean; + // Use Number Literal Types after TypeScript 2.0 GA released. + firstOfWeek?: number; // React.PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]) + helpMessage?: string; + initialFromValue?: boolean; + initialDate?: Date; + initialMonth?: number; + initialYear?: number; + initialRange?: {}; + maximumDate?: Date; + minimumDate?: Date; + numberOfCalendars?: number; + onHighlightDate?(date: Date): void; + onHighlightRange?(date: Date): void; + onSelect?(value: Props): void; + onSelectStart?(value: moment.Moment): void; + paginationArrowComponent?: PaginationArrow; + selectedLabel?: string; + selectionType?: 'single' |'range'; + singleDateRange?: boolean; + showLegend?: boolean; + stateDefinitions?: StateDefinitions; + value?: moment.Moment | moment.Range; + } + + interface DateState { + state: string; + range: moment.Range; + } + + interface StateDefinitions { + [key: string]: StateDefinition; + } + + interface StateDefinition { + color: string; + label: string; + selectable?: boolean; + } + + interface PaginationArrowProps extends React.Props<{}> { + disabled?: boolean; + onTrigger?(): void; + direction?: 'next' | 'previous'; + } + + class PaginationArrow extends React.Component { + } + + class DateRangePicker extends React.Component { + } + + namespace DateRangePicker { + } +} diff --git a/redux-form/redux-form.d.ts b/redux-form/redux-form.d.ts index e0fd8ead8d..1efd564fae 100644 --- a/redux-form/redux-form.d.ts +++ b/redux-form/redux-form.d.ts @@ -11,6 +11,8 @@ declare module 'redux-form' { import { Component, SyntheticEvent, FormEventHandler } from 'react'; import { Dispatch, ActionCreator, Reducer } from 'redux'; + export const actionTypes: {[actionName:string]: string}; + export type FieldValue = any; export type FormData = {[fieldName:string]: FieldValue}; @@ -39,7 +41,7 @@ declare module 'redux-form' { * The error for this field if its value is not passing validation. Both * synchronous and asynchronous validation errors will be reported here. */ - error?: string[]; + error?: any; /** * The value for this field as supplied in initialValues to the form. @@ -163,7 +165,7 @@ declare module 'redux-form' { * result from the synchronous validation function, the asynchronous * validation, or the rejected promise from onSubmit. */ - error?: string[]; + error?: any; /** * The form data, in the form { field1: , field2: }. The diff --git a/redux-mock-store/redux-mock-store-tests.ts b/redux-mock-store/redux-mock-store-tests.ts index 4a6045c288..960591f8fb 100644 --- a/redux-mock-store/redux-mock-store-tests.ts +++ b/redux-mock-store/redux-mock-store-tests.ts @@ -1,6 +1,6 @@ /// -import configureStore from 'redux-mock-store'; +import configureStore, {IStore} from 'redux-mock-store'; // Redux store API tests // The following test are taken from ../redux/redux-tests.ts @@ -25,10 +25,11 @@ function loggingMiddleware() { }; } -const storeMock = configureStore([loggingMiddleware]); +const storeMock = configureStore([loggingMiddleware]); const initialState = 0 -let store = storeMock(initialState); +let store: IStore; +store = storeMock(initialState); store.subscribe(() => { // ... @@ -40,4 +41,4 @@ store.dispatch({ type: 'INCREMENT' }); // Additional mock store API tests var actions: Array = store.getActions(); -store.clearActions(); \ No newline at end of file +store.clearActions(); diff --git a/redux-mock-store/redux-mock-store.d.ts b/redux-mock-store/redux-mock-store.d.ts index 770603826a..6cc463e2d1 100644 --- a/redux-mock-store/redux-mock-store.d.ts +++ b/redux-mock-store/redux-mock-store.d.ts @@ -10,9 +10,9 @@ declare module 'redux-mock-store' { function createMockStore(middlewares?:Redux.Middleware[]):mockStore - type mockStore = (state?:T) => IStore; + export type mockStore = (state?:T) => IStore; - type IStore = { + export type IStore = { dispatch(action: any):any getState():T getActions():Object[] @@ -21,4 +21,4 @@ declare module 'redux-mock-store' { } export default createMockStore -} \ No newline at end of file +} diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index 5a5927284f..e7febe94d3 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -23,6 +23,7 @@ declare module 'request-promise' { finally(handler: () => PromiseLike): Promise; finally(handler: () => TResult): Promise; promise(): Promise; + cancel(): void; } interface RequestPromiseOptions extends request.CoreOptions { diff --git a/resolve-from/resolve-from-tests.ts b/resolve-from/resolve-from-tests.ts index 840a19b861..7c9e8e17f1 100644 --- a/resolve-from/resolve-from-tests.ts +++ b/resolve-from/resolve-from-tests.ts @@ -1,6 +1,11 @@ /// -// Much better testing in https://github.com/typed-typings/typed-resolve-from -if (typeof resolveFrom !== 'function') { - throw new Error('resolveFrom is not a function'); -} +import resolveFrom1 = require('resolve-from'); +import * as resolveFrom2 from 'resolve-from'; + +let from: string; +let moduleId: string; +let result: string; + +result = resolveFrom1(from, moduleId); +result = resolveFrom2(from, moduleId); diff --git a/resolve-from/resolve-from.d.ts b/resolve-from/resolve-from.d.ts index a8d0441136..4b8c92a516 100644 --- a/resolve-from/resolve-from.d.ts +++ b/resolve-from/resolve-from.d.ts @@ -1,9 +1,15 @@ // Type definitions for resolve-from // Project: https://github.com/sindresorhus/resolve-from -// Definitions by: unional +// Definitions by: unional , tswaters // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function resolveFrom(fromDir: string, moduleId: string): string; declare module "resolve-from" { + + function resolveFrom(fromDir: string, moduleId: string): string; + + namespace resolveFrom { + + } + export = resolveFrom; } diff --git a/revalidator/revalidator-tests.ts b/revalidator/revalidator-tests.ts index b65c9f971b..8c622b3bee 100644 --- a/revalidator/revalidator-tests.ts +++ b/revalidator/revalidator-tests.ts @@ -1,3 +1,95 @@ /// +import revalidator = require('revalidator'); + +let someObject = { + hello: true, + there: 'string' +}; + +let schema: Revalidator.JSONSchema = { + +}; + +revalidator.validate(someObject, { + properties: { + url: { + description: 'the url the object should be stored at', + type: 'string', + pattern: '^/[^#%&*{}\\:<>?\/+]+$', + required: true + }, + challenge: { + description: 'a means of protecting data (insufficient for production, used as example)', + type: 'string', + minLength: 5 + }, + body: { + description: 'what to store at the url', + type: 'any', + default: null + }, + obj: { + type: 'object', + properties: { + items: { + type: 'object', + properties: { + title: { + type: 'string', + maxLength: 140, + conditions: { + optional: function () { + return !this.published; + } + } + }, + date: { type: 'string', format: 'date', messages: { format: "must be a valid %{expected} and nothing else" } }, + body: { type: 'string' }, + tags: { + type: 'array', + uniqueItems: true, + minItems: 2, + items: { + type: 'string', + pattern: /[a-z ]+/ + } + }, + tuple: { + type: 'array', + minItems: 2, + maxItems: 2, + items: { + type: ['string', 'number'] + } + }, + author: { type: 'string', pattern: /^[\w ]+$/i, required: true, messages: { required: "is essential for survival" } }, + published: { type: 'boolean', 'default': false }, + category: { type: 'string' }, + palindrome: { + type: 'string', conform: function (val) { + return val == val.split("").reverse().join(""); + } + }, + name: { + type: 'string', default: '', conform: function (val, data) { + return (val === data.hello); + } + } + }, + patternProperties: { + '^_': { + type: 'boolean', default: false + } + } + } + } + } + } +}, { + validateFormats: true, + validateFormatsStrict: false, + validateFormatExtensions: true, + additionalProperties: false, + cast: false + }).valid === true; -revalidator.validate(null, null, null); \ No newline at end of file diff --git a/revalidator/revalidator.d.ts b/revalidator/revalidator.d.ts index 63f492e9c3..2c20e9876b 100644 --- a/revalidator/revalidator.d.ts +++ b/revalidator/revalidator.d.ts @@ -4,10 +4,27 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module Revalidator { - interface RevalidatorStatic { - validate(object: any, schema: ISchema, options: any): IReturnMessage; + + interface IOptions { + /** Enforce format constraints (default true) */ + validateFormats?: boolean; + /** When validateFormats is true treat unrecognized formats as validation errors (default false) */ + validateFormatsStrict?: boolean; + /** When validateFormats is true also validate formats defined in validate.formatExtensions (default true) */ + validateFormatExtensions?: boolean; + /** When additionalProperties is true allow additional unvisited properties on the object. (default true) */ + additionalProperties?: boolean; + /** Enforce casting of some types (for integers/numbers are only supported) when it's possible, e.g. "42" => 42, but "forty2" => "forty2" for the integer type. */ + cast?: boolean; } + interface RevalidatorStatic { + validate(object: T, schema: JSONSchema, options?: IOptions): IReturnMessage; + } + + type Types = 'string' | 'number' | 'integer' | 'array' | 'boolean' | 'object' | 'null' | 'any'; + type Formats = 'url' | 'email' | 'ip-address' | 'ipv6' | 'date-time' | 'date' | 'time' | 'color' | 'host-name' | 'utc-millisec' | 'regex'; + interface IErrrorProperty { property: string; message: string; @@ -18,26 +35,59 @@ declare module Revalidator { errors: IErrrorProperty[]; } - interface ISchema { - required?: boolean; - type: string; - pattern?: any; - maxLength?: number; - minLength?: number; - minimum?: number; - maximum?: number; - allowEmpty: boolean; - exclusiveMinimum: number; - exclusiveMaximum?: number; - divisibleBy?: number; - minItems?: number; - maxItems?: number; - uniqueItems?: boolean; - enum?: any; - format?: string; - conform?: (data:any) => boolean; - depdendencies?: string; + interface JSONSchema { + properties?: ISchemas; + } + interface ISchemas { + [index: string]: ISchema|JSONSchema; + } + + interface ISchema { + /**The type of value should be equal to the expected value */ + type: Types|Types[]; + /**If true, the value should not be undefined */ + required?: boolean; + /**The expected value regex needs to be satisfied by the value */ + pattern?: RegExp|string; + /**The length of value must be greater than or equal to expected value */ + maxLength?: number; + /**Description for this object */ + description?: string; + /**The length of value must be lesser than or equal to expected value */ + minLength?: number; + /**Value must be greater than or equal to the expected value */ + minimum?: number; + /**Value must be lesser than or equal to the expected value */ + maximum?: number; + /**If false, the value must not be an empty string */ + allowEmpty?: boolean; + /**Value must be greater than expected value */ + exclusiveMinimum?: number; + /**Value must be lesser than expected value */ + exclusiveMaximum?: number; + /**Value must be divisible by expected value */ + divisibleBy?: number; + /**Value must contain more than expected number of items */ + minItems?: number; + /**Value must contain fewer than expected number of items */ + maxItems?: number; + /**Value must hold a unique set of values */ + uniqueItems?: boolean; + /**Value must be present in the array of expected values */ + enum?: any[]; + /**Custom messages for different constraints */ + message?: string; + /**Custom messages for different constraints */ + messages?: {[index: string]: string}; + /**Default value */ + default?: any; + /**Value must be a valid format */ + format?: Formats; + /**Value must conform to constraint denoted by expected value */ + conform?: (value: any, data?: T) => boolean; + /**Value is valid only if the dependent value is valid */ + dependencies?: string; } } diff --git a/riot-api-nodejs/riot-api-nodejs.d.ts b/riot-api-nodejs/riot-api-nodejs.d.ts index 05fb20e81f..83db2c68d9 100644 --- a/riot-api-nodejs/riot-api-nodejs.d.ts +++ b/riot-api-nodejs/riot-api-nodejs.d.ts @@ -321,13 +321,13 @@ declare module "riot-api-nodejs" { * get league of legends status * @param {RiotGamesAPI.LolStatus.Shard[]} callback data callback */ - getSatus(): Promise; + getStatus(): Promise; /** * get status for a given region * @param {region_e} region region * @param {RiotGamesAPI.LolStatus.Shard} callback data callback */ - getSatusByRegion(region: region_e): Promise; + getStatusByRegion(region: region_e): Promise; /** * get match infos for a given match ID * @param {number} matchId Match ID diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index ad95f39ef3..ec65a0f8d4 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -752,7 +752,7 @@ declare namespace SocketIO { * A dictionary of all the rooms that we have in this namespace * The rooms are made of a `sockets` key which is the dictionary of sockets per ID */ - rooms: {[room: string]: {sockets: {[id: string]: boolean }}}; + rooms: {[room: string]: {sockets: {[id: string]: boolean }, length: number }}; /** * A dictionary of all the socket ids that we're dealing with, and all diff --git a/sql.js/sql.js-tests.ts b/sql.js/sql.js-tests.ts index 40fceb8fbd..ece6e536e4 100644 --- a/sql.js/sql.js-tests.ts +++ b/sql.js/sql.js-tests.ts @@ -1,8 +1,8 @@ /// /// -import fs = require("fs"); -import SQL = require("sql.js"); +import * as fs from "fs"; +import * as SQL from "sql.js"; var DB_PATH = "data.db"; @@ -34,6 +34,8 @@ db.run(insertRecordStatement, { "@content": "Content 2" }); +var n = db.getRowsModified(); + try { // This query will throw exception: primary key constraint failed. db.run(insertRecordStatement, { @@ -79,3 +81,14 @@ function dbAccessDone(): void { // Finally, close the database connection and release the resources in memory. db.close(); } + +// Create a database +var db2 = new SQL.Database(); + +// You can also use javascript functions inside your SQL code +// Create the js function you need +function add(a: number, b: number): number {return a+b;} +// Specifies the SQL function's name, the number of it's arguments, and the js function to use +db2.create_function("add_js", add); +// Run a query in which the function is used +db2.run("INSERT INTO hello VALUES (add_js(7, 3), add_js('Hello ', 'world'));"); // Inserts 10 and 'Hello world' diff --git a/sql.js/sql.js.d.ts b/sql.js/sql.js.d.ts index 67f0a183c2..c5ebb67023 100644 --- a/sql.js/sql.js.d.ts +++ b/sql.js/sql.js.d.ts @@ -8,6 +8,7 @@ declare module "sql.js" { class Database { + constructor(); constructor(data: Buffer); constructor(data: Uint8Array); constructor(data: number[]); @@ -29,6 +30,10 @@ declare module "sql.js" { export(): Uint8Array; close(): void; + + getRowsModified(): number; + + create_function(name: string, func: Function): void; } class Statement { diff --git a/swiper/swiper.d.ts b/swiper/swiper.d.ts index 78ad2813a4..2be39474d2 100644 --- a/swiper/swiper.d.ts +++ b/swiper/swiper.d.ts @@ -122,8 +122,7 @@ declare class SwiperSlide { } declare class Swiper { - constructor(container: string, options?: SwiperOptions); - constructor(container: Element, options?: SwiperOptions); + constructor(container: string|Element, options?: SwiperOptions); // Properties width: number; diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 15510a5821..9e70f1e898 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r79 +// Type definitions for three.js r80 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -149,6 +149,7 @@ declare namespace THREE { export const UnsignedShort4444Type: PixelType; export const UnsignedShort5551Type: PixelType; export const UnsignedShort565Type: PixelType; + export const UnsignedInt248Type: PixelType; // Pixel formats export enum PixelFormat { } @@ -159,6 +160,7 @@ declare namespace THREE { export const LuminanceAlphaFormat: PixelFormat; export const RGBEFormat: PixelFormat; export const DepthFormat: PixelFormat; + export const DepthStencilFormat: PixelFormat; // Compressed texture formats // DDS / ST3C Compressed texture formats @@ -246,8 +248,8 @@ declare namespace THREE { getEffectiveWeight(): number; fadeIn(duration: number): AnimationAction; fadeOut(duration: number): AnimationAction; - crossFadeFrom(fadeOutAction: AnimationAction,duration: number, warp: boolean): AnimationAction; - crossFadeTo(fadeInAction: AnimationAction,duration: number, warp: boolean): AnimationAction; + crossFadeFrom(fadeOutAction: AnimationAction, duration: number, warp: boolean): AnimationAction; + crossFadeTo(fadeInAction: AnimationAction, duration: number, warp: boolean): AnimationAction; stopFading(): AnimationAction; setEffectiveTimeScale(timeScale: number): AnimationAction; getEffectiveTimeScale(): number; @@ -673,7 +675,7 @@ declare namespace THREE { array: ArrayLike; itemSize: number; dynamic: boolean; - updateRange: {offset:number, count:number}; + updateRange: {offset: number, count: number}; version: number; normalized: boolean; needsUpdate: boolean; @@ -684,11 +686,11 @@ declare namespace THREE { copy(source: BufferAttribute): BufferAttribute; copyAt(index1: number, attribute: BufferAttribute, index2: number): BufferAttribute; copyArray(array: ArrayLike): BufferAttribute; - copyColorsArray(colors: {r:number, g:number, b:number}[]): BufferAttribute; - copyIndicesArray(indices: {a:number, b:number, c:number}[]): BufferAttribute; - copyVector2sArray(vectors: {x:number, y:number}[]): BufferAttribute; - copyVector3sArray(vectors: {x:number, y:number, z:number}[]): BufferAttribute; - copyVector4sArray(vectors: {x:number, y:number, z:number, w:number}[]): BufferAttribute; + copyColorsArray(colors: {r: number, g: number, b: number}[]): BufferAttribute; + copyIndicesArray(indices: {a: number, b: number, c: number}[]): BufferAttribute; + copyVector2sArray(vectors: {x: number, y: number}[]): BufferAttribute; + copyVector3sArray(vectors: {x: number, y: number, z: number}[]): BufferAttribute; + copyVector4sArray(vectors: {x: number, y: number, z: number, w: number}[]): BufferAttribute; set(value: ArrayLike, offset?: number): BufferAttribute; getX(index: number): number; setX(index: number, x: number): BufferAttribute; @@ -802,8 +804,8 @@ declare namespace THREE { center(): Vector3; - setFromObject(object: Object3D) : void; - updateFromObject(object: Object3D) : void; + setFromObject(object: Object3D): void; + updateFromObject(object: Object3D): void; fromGeometry(geometry: Geometry, settings?: any): BufferGeometry; @@ -1317,7 +1319,7 @@ declare namespace THREE { dispose(): void; - //These properties do not exist in a normal Geometry class, but if you use the instance that was passed by JSONLoader, it will be added. + // These properties do not exist in a normal Geometry class, but if you use the instance that was passed by JSONLoader, it will be added. bones: Bone[]; animation: AnimationClip; animations: AnimationClip[]; @@ -1339,7 +1341,7 @@ declare namespace THREE { */ export class InstancedBufferAttribute extends BufferAttribute { constructor(data: ArrayLike, itemSize: number, meshPerAttribute?: number); - + meshPerAttribute: number; clone(): InstancedBufferAttribute; @@ -1352,9 +1354,9 @@ declare namespace THREE { export class InstancedBufferGeometry extends BufferGeometry { constructor(); - groups: {start:number, count:number, instances:number}[]; + groups: {start: number, count: number, instances: number}[]; maxInstancedCount: number; - + addGroup(start: number, count: number, instances: number): void; clone(): InstancedBufferGeometry; copy(source: InstancedBufferGeometry): InstancedBufferGeometry; @@ -1388,7 +1390,7 @@ declare namespace THREE { */ export class InstancedInterleavedBuffer extends InterleavedBuffer { constructor(array: ArrayLike, stride: number, meshPerAttribute?: number); - + meshPerAttribute: number; clone(): InstancedInterleavedBuffer; @@ -1726,9 +1728,9 @@ declare namespace THREE { params: RaycasterParameters; precision: number; linePrecision: number; - + set(origin: Vector3, direction: Vector3): void; - setFromCamera(coords: { x: number; y: number;}, camera: Camera ): void; + setFromCamera(coords: { x: number; y: number; }, camera: Camera ): void; intersectObject(object: Object3D, recursive?: boolean): Intersection[]; intersectObjects(objects: Object3D[], recursive?: boolean): Intersection[]; } @@ -1792,6 +1794,7 @@ declare namespace THREE { copy(source: LightShadow): LightShadow; clone(recursive?: boolean): LightShadow; + toJSON(): any; } /** @@ -1988,7 +1991,7 @@ declare namespace THREE { static Handlers: LoaderHandler; } - export interface LoaderHandler{ + export interface LoaderHandler { handlers: (RegExp | Loader)[]; add(regex: RegExp, loader: Loader): void; @@ -2027,6 +2030,7 @@ declare namespace THREE { manager: LoadingManager; crossOrigin: string; + withCredentials: string; path: string; /** @@ -2035,7 +2039,8 @@ declare namespace THREE { */ load(url: string, onLoad?: (image: HTMLImageElement) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): HTMLImageElement; setCrossOrigin(crossOrigin: string): ImageLoader; - setPath(value: any): ImageLoader; + setWithCredentials(value: string): ImageLoader; + setPath(value: string): ImageLoader; } /** @@ -2134,6 +2139,7 @@ declare namespace THREE { manager: LoadingManager; crossOrigin: string; + withCredentials: string; path: string; /** @@ -2143,6 +2149,7 @@ declare namespace THREE { */ load(url: string, onLoad?: (texture: Texture) => void): Texture; setCrossOrigin(crossOrigin: string): TextureLoader; + setWithCredentials(value: string): TextureLoader; setPath(path: string): TextureLoader; } @@ -2747,7 +2754,7 @@ declare namespace THREE { export interface ShaderMaterialParameters extends MaterialParameters { defines?: any; - uniforms?: any; + uniforms?: any; vertexShader?: string; fragmentShader?: string; lineWidth?: number; @@ -2881,7 +2888,7 @@ declare namespace THREE { applyMatrix4(matrix: Matrix4): Box3; translate(offset: Vector3): Box3; equals(box: Box3): boolean; - + empty(): any; // deprecated, use isEmpty() isIntersectionBox(b: any): any; // deprecated, use intersectsBox() isIntersectionSphere(s: any): any; // deprecated, use intersectsSphere() @@ -3169,7 +3176,7 @@ declare namespace THREE { export class Euler { constructor(x?: number, y?: number, z?: number, order?: string); - + x: number; y: number; z: number; @@ -3180,7 +3187,7 @@ declare namespace THREE { clone(): Euler; copy(euler: Euler): Euler; setFromRotationMatrix(m: Matrix4, order?: string, update?: boolean): Euler; - setFromQuaternion(q:Quaternion, order?: string, update?: boolean): Euler; + setFromQuaternion(q: Quaternion, order?: string, update?: boolean): Euler; setFromVector3( v: Vector3, order?: string ): Euler; reorder(newOrder: string): Euler; equals(euler: Euler): boolean; @@ -3482,7 +3489,7 @@ declare namespace THREE { * Sets the position component for this matrix from vector v. */ setPosition(v: Vector3): Matrix4; - + /** * Sets this matrix to the inverse of matrix m. @@ -3718,7 +3725,7 @@ declare namespace THREE { * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/. */ static slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): Quaternion; - + static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number, t: number): Quaternion; // deprecated @@ -3751,7 +3758,7 @@ declare namespace THREE { intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; applyMatrix4(matrix4: Matrix4): Ray; equals(ray: Ray): boolean; - + // deprecated isIntersectionBox(b: any): any; isIntersectionPlane(p: any): any; @@ -4348,7 +4355,7 @@ declare namespace THREE { * Sets all values of this vector. */ setScalar(scalar: number): Vector4; - + /** * Sets X component of this vector. */ @@ -4501,7 +4508,7 @@ declare namespace THREE { interpolate_(i1: number, t0: number, t: number, t1: number): any; } - + export class DiscreteInterpolant extends Interpolant { constructor(parameterPositions: any, samplesValues: any, sampleSize: number, resultBuffer?: any); @@ -4721,7 +4728,7 @@ declare namespace THREE { domElement: HTMLCanvasElement; render(scene: Scene, camera: Camera): void; - setSize(width:number, height:number, updateStyle?:boolean): void; + setSize(width: number, height: number, updateStyle?: boolean): void; } export interface WebGLRendererParameters { @@ -4899,7 +4906,7 @@ declare namespace THREE { getPrecision(): string; getPixelRatio(): number; setPixelRatio(value: number): void; - + getSize(): { width: number; height: number; }; /** @@ -4933,12 +4940,12 @@ declare namespace THREE { setClearColor(color: Color, alpha?: number): void; setClearColor(color: string, alpha?: number): void; setClearColor(color: number, alpha?: number): void; - + /** * Returns a float with the current clear alpha. Ranges from 0 to 1. */ getClearAlpha(): number; - + setClearAlpha(alpha: number): void; /** @@ -4950,7 +4957,7 @@ declare namespace THREE { clearColor(): void; clearDepth(): void; clearStencil(): void; - clearTarget(renderTarget:WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; + clearTarget(renderTarget: WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; resetGLState(): void; dispose(): void; @@ -5163,7 +5170,7 @@ declare namespace THREE { uv_pars_vertex: string; uv_vertex: string; worldpos_vertex: string; - } + }; export interface Shader { uniforms: IUniform; @@ -5307,7 +5314,7 @@ declare namespace THREE { export function clone(uniforms_src: any): any; } - export class Uniform { + export class Uniform { constructor(value: any); constructor(type: string, value: any); // deprecated @@ -5335,7 +5342,7 @@ declare namespace THREE { init(planes: any[], enableLocalClipping: boolean, camera: Camera): boolean; beginShadows(): void; endShadows(): void; - setState(planes: any[], clipShadows: boolean, camera: Camera, cache: boolean, fromCache: boolean): void; + setState(planes: any[], clipShadows: boolean, camera: Camera, cache: boolean, fromCache: boolean): void; } export interface WebGLCapabilitiesParameters { @@ -5378,7 +5385,7 @@ declare namespace THREE { export class WebGLLights { constructor(gl: WebGLRenderingContext, properties: any, info: any); - + get(light: any): any; } @@ -5390,7 +5397,7 @@ declare namespace THREE { render(start: any, count: number): void; renderInstances(geometry: any, start: any, count: number): void; } - + export class WebGLObjects { constructor(gl: WebGLRenderingContext, properties: any, info: any); @@ -5401,7 +5408,7 @@ declare namespace THREE { export class WebGLProgram { constructor(renderer: WebGLRenderer, code: string, material: ShaderMaterial, parameters: WebGLRendererParameters); - + id: number; code: string; usedTimes: number; @@ -5428,7 +5435,7 @@ declare namespace THREE { } export class WebGLTextures { - constructor(gl: any, extensions: any, state: any, properties:any, capabilities: any, paramThreeToGL: Function, info: any); + constructor(gl: any, extensions: any, state: any, properties: any, capabilities: any, paramThreeToGL: Function, info: any); setTexture2D(texture: any, slot: number): void; setTextureCube(texture: any, slot: number): void; @@ -5451,7 +5458,7 @@ declare namespace THREE { static splitDynamic(seq: any, values: any[]): any[]; static evalDynamic(seq: any, values: any[], object: any, camera: any): any[]; } - + export class WebGLProperties { constructor(); @@ -5479,7 +5486,7 @@ declare namespace THREE { // deprecated cullFace: any; } - + export class WebGLState { constructor(gl: any, extensions: any, paramThreeToGL: Function); @@ -5559,7 +5566,7 @@ declare namespace THREE { // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// export class LensFlarePlugin { constructor(renderer: WebGLRenderer, flares: any[]); - + render(scene: Scene, camera: Camera, viewportWidth: number, viewportHeight: number): void; } @@ -5570,7 +5577,7 @@ declare namespace THREE { } // Scenes ///////////////////////////////////////////////////////////////////// - + /** * Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras. */ @@ -5590,12 +5597,14 @@ declare namespace THREE { background: any; copy(source: Scene, recursive?: boolean): Scene; + toJSON(meta?: any): any; } export interface IFog { - name:string; + name: string; color: Color; - clone():IFog; + clone(): IFog; + toJSON(): any; } /** @@ -5604,7 +5613,7 @@ declare namespace THREE { export class Fog implements IFog { constructor(hex: number, near?: number, far?: number); - name:string; + name: string; /** * Fog color. @@ -5623,6 +5632,7 @@ declare namespace THREE { far: number; clone(): Fog; + toJSON(): any; } /** @@ -5641,6 +5651,7 @@ declare namespace THREE { density: number; clone(): FogExp2; + toJSON(): any; } // Textures ///////////////////////////////////////////////////////////////////// @@ -5949,7 +5960,7 @@ declare namespace THREE { * Returns a vector for point at relative position in curve according to arc length * getPointAt(u: number): T; */ - getPointAt(u: number):T; + getPointAt(u: number): T; /** * Get sequence of points using getPoint( t ) @@ -6096,7 +6107,7 @@ declare namespace THREE { export class ClosedSplineCurve3 extends CatmullRomCurve3 {} // deprecated, use CatmullRomCurve3 export class SplineCurve3 extends CatmullRomCurve3 {} // will be deprecated, use CatmullRomCurve3 - + export class CubicBezierCurve extends Curve { constructor(v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2); @@ -6116,7 +6127,7 @@ declare namespace THREE { getPoint(t: number): Vector3; } - + export class EllipseCurve extends Curve { constructor(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number); @@ -6148,7 +6159,7 @@ declare namespace THREE { getPoint(t: number): Vector3; } - + export class QuadraticBezierCurve extends Curve { constructor( v0: Vector2, v1: Vector2, v2: Vector2 ); @@ -6172,7 +6183,7 @@ declare namespace THREE { points: Vector2[]; } - + // Extras / Geometries ///////////////////////////////////////////////////////////////////// export class BoxBufferGeometry extends BufferGeometry { @@ -6487,7 +6498,7 @@ declare namespace THREE { bevelEnabled: boolean; bevelThickness: number; bevelSize: number; - } + }; } export class TorusBufferGeometry extends BufferGeometry { @@ -6735,6 +6746,6 @@ declare namespace THREE { } } -declare module 'three' { +declare module "three" { export = THREE; } diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index cb5dfaa393..0891d6d304 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -5074,7 +5074,7 @@ interface _Chain { * Wrapped type `any[]`. * @see _.all **/ - all(iterator?: _.ListIterator, context?: any): _Chain; + all(iterator?: _.ListIterator, context?: any): _ChainSingle; /** * @see _.all @@ -5390,18 +5390,18 @@ interface _Chain { * Wrapped type `any[]`. * @see _.indexOf **/ - indexOf(value: T, isSorted?: boolean): _ChainSingle; + indexOf(value: T, isSorted?: boolean): _ChainSingle; /** * @see _.indexOf **/ - indexOf(value: T, startFrom: number): _ChainSingle; + indexOf(value: T, startFrom: number): _ChainSingle; /** * Wrapped type `any[]`. * @see _.lastIndexOf **/ - lastIndexOf(value: T, from?: number): _ChainSingle; + lastIndexOf(value: T, from?: number): _ChainSingle; /** * @see _.findIndex @@ -5417,7 +5417,7 @@ interface _Chain { * Wrapped type `any[]`. * @see _.sortedIndex **/ - sortedIndex(value: T, iterator?: (x: T) => any, context?: any): _Chain; + sortedIndex(value: T, iterator?: (x: T) => any, context?: any): _ChainSingle; /** * Wrapped type `number`.