From b57d44c4c9bfff531b35a9210b9d2d3a84d24aba Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Tue, 19 Feb 2019 02:02:28 +0500 Subject: [PATCH 001/265] Adjust the export to work with esModuleInterop --- types/mongo-sanitize/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 44c5d04a7d..1c5308d55c 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -1,9 +1,9 @@ // Type definitions for mongo-sanitize 1.0 // Project: https://github.com/vkarpov15/mongo-sanitize -// Definitions by: Cedric Cazin +// Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -export function sanitize(v: T): T; +declare function sanitize(v: T): T; -export as namespace mongoSanitize; +export = sanitize; From 5bf116d71b09273334b70f5e96a272ad5fa4c104 Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Tue, 19 Feb 2019 02:19:33 +0500 Subject: [PATCH 002/265] Tests, TS version --- types/mongo-sanitize/index.d.ts | 2 +- types/mongo-sanitize/mongo-sanitize-tests.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 1c5308d55c..aedff46b0b 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vkarpov15/mongo-sanitize // Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 3.3 declare function sanitize(v: T): T; diff --git a/types/mongo-sanitize/mongo-sanitize-tests.ts b/types/mongo-sanitize/mongo-sanitize-tests.ts index 4d4534bbeb..3f86dc256e 100644 --- a/types/mongo-sanitize/mongo-sanitize-tests.ts +++ b/types/mongo-sanitize/mongo-sanitize-tests.ts @@ -1,11 +1,11 @@ -import * as mongoSanitize from 'mongo-sanitize'; +import sanitize from "mongo-sanitize"; -const objectSanitized = mongoSanitize.sanitize({ $gt: 5, a: 1 }); +const objectSanitized = sanitize({ $gt: 5, a: 1 }); -const arraySanitized = mongoSanitize.sanitize([1, 2, 3]); +const arraySanitized = sanitize([1, 2, 3]); class Clazz { $gt = 5; a = 1; } -const classSanitized = mongoSanitize.sanitize(new Clazz()); +const classSanitized = sanitize(new Clazz()); From aae346fe6e88be2931eeddf03dca99aa78dc2aa5 Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Tue, 19 Feb 2019 19:02:05 -0700 Subject: [PATCH 003/265] [jest-each] Update: templatize .each() - Replace `any` with templates. - Update Jest website to fix failing test. fix #33079 --- types/jest/index.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 29b3210cc2..b5ee488b2b 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Jest 24.0 -// Project: http://facebook.github.io/jest/ +// Project: https://jestjs.io // Definitions by: Asana // Ivo Stratev // jwbay @@ -263,7 +263,20 @@ declare namespace jest { } interface Each { - (cases: any[]): (name: string, fn: (...args: any[]) => any) => void; + // Exclusively arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T) => any + ) => void; + // Not arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T[]) => any + ) => void; + (cases: ReadonlyArray>): ( + name: string, + fn: (...args: any[]) => any + ) => void; (strings: TemplateStringsArray, ...placeholders: any[]): ( name: string, fn: (arg: any) => any From 0de529dbcd9e8daf7e523ffc4c3aceb58a4cbe5e Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 22 Feb 2019 12:12:35 +0100 Subject: [PATCH 004/265] fix(mongodb): add collation option to findOneAndReplace and FindOneAndDelete --- types/mongodb/index.d.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index a3725382e4..dac421a22a 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -879,8 +879,8 @@ export interface Collection { findOne(filter: FilterQuery, options: FindOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ findOneAndDelete(filter: FilterQuery, callback: MongoCallback>): void; - findOneAndDelete(filter: FilterQuery, options?: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }): Promise>; - findOneAndDelete(filter: FilterQuery, options: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback>): void; + findOneAndDelete(filter: FilterQuery, options?: FindOneAndDeleteOption): Promise>; + findOneAndDelete(filter: FilterQuery, options: FindOneAndDeleteOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndReplace */ findOneAndReplace(filter: FilterQuery, replacement: Object, callback: MongoCallback>): void; findOneAndReplace(filter: FilterQuery, replacement: Object, options?: FindOneAndReplaceOption): Promise>; @@ -1292,7 +1292,7 @@ export interface CollectionAggregationOptions { * Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ bypassDocumentValidation?: boolean; - hint?: string | object; + hint?: string | object; raw?: boolean; promoteLongs?: boolean; promoteValues?: boolean; @@ -1407,6 +1407,7 @@ export interface FindOneAndReplaceOption extends CommonOptions { maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean; + collation?: CollationDocument; } /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndUpdate */ @@ -1414,6 +1415,17 @@ export interface FindOneAndUpdateOption extends FindOneAndReplaceOption { arrayFilters?: Object[]; } +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ +export interface FindOneAndDeleteOption { + projection?: Object; + sort?: Object; + maxTimeMS?: number; + session?: ClientSession; + collation?: CollationDocument; +} + + + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoHaystackSearch */ export interface GeoHaystackSearchOptions { readPreference?: ReadPreference | string; From a7fa1098d53d363688fd874854bb82c1daae0cc5 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 11:03:30 -0500 Subject: [PATCH 005/265] Added type definitions for dragscroll --- dragscroll/dragscroll-tests.ts | 3 +++ dragscroll/dragscroll.d.ts | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 dragscroll/dragscroll-tests.ts create mode 100644 dragscroll/dragscroll.d.ts diff --git a/dragscroll/dragscroll-tests.ts b/dragscroll/dragscroll-tests.ts new file mode 100644 index 0000000000..de6b8060a4 --- /dev/null +++ b/dragscroll/dragscroll-tests.ts @@ -0,0 +1,3 @@ +import dragscroll from "dragscroll"; + +dragscroll.reset(); \ No newline at end of file diff --git a/dragscroll/dragscroll.d.ts b/dragscroll/dragscroll.d.ts new file mode 100644 index 0000000000..dbef7bf897 --- /dev/null +++ b/dragscroll/dragscroll.d.ts @@ -0,0 +1,7 @@ +// Type definitions for dragscroll v 0.0.8 +// Project: https://github.com/asvd/dragscroll +// Definitions by: Sean Kelly +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare module "dragscroll" { + function reset(i?: number, el?: HTMLElement[]): void +} \ No newline at end of file From dc4bfe4928669a2f45db1ba5558861e5e1334b85 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 11:10:21 -0500 Subject: [PATCH 006/265] Added type definitions for dragscroll --- dragscroll/tsconfig.json | 23 +++++++++++++++++++++++ dragscroll/tslint.json | 1 + types/dragscroll/tsconfig.json | 23 +++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 dragscroll/tsconfig.json create mode 100644 dragscroll/tslint.json create mode 100644 types/dragscroll/tsconfig.json diff --git a/dragscroll/tsconfig.json b/dragscroll/tsconfig.json new file mode 100644 index 0000000000..f43363abe3 --- /dev/null +++ b/dragscroll/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "base64-js-tests.ts" + ] +} \ No newline at end of file diff --git a/dragscroll/tslint.json b/dragscroll/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/dragscroll/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/dragscroll/tsconfig.json b/types/dragscroll/tsconfig.json new file mode 100644 index 0000000000..f43363abe3 --- /dev/null +++ b/types/dragscroll/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "base64-js-tests.ts" + ] +} \ No newline at end of file From 8ebb426b6ab2bb78eea99d9617e70d4b974ac6cf Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 11:19:42 -0500 Subject: [PATCH 007/265] Added Dragscroll to @types --- dragscroll/dragscroll-tests.ts | 3 -- dragscroll/tsconfig.json | 23 ---------- dragscroll/tslint.json | 1 - types/dragscroll/dragscroll-tests.ts | 3 ++ .../dragscroll/index.d.ts | 6 +-- types/dragscroll/tsconfig.json | 43 +++++++++---------- types/dragscroll/tslint.json | 1 + 7 files changed, 28 insertions(+), 52 deletions(-) delete mode 100644 dragscroll/dragscroll-tests.ts delete mode 100644 dragscroll/tsconfig.json delete mode 100644 dragscroll/tslint.json create mode 100644 types/dragscroll/dragscroll-tests.ts rename dragscroll/dragscroll.d.ts => types/dragscroll/index.d.ts (65%) create mode 100644 types/dragscroll/tslint.json diff --git a/dragscroll/dragscroll-tests.ts b/dragscroll/dragscroll-tests.ts deleted file mode 100644 index de6b8060a4..0000000000 --- a/dragscroll/dragscroll-tests.ts +++ /dev/null @@ -1,3 +0,0 @@ -import dragscroll from "dragscroll"; - -dragscroll.reset(); \ No newline at end of file diff --git a/dragscroll/tsconfig.json b/dragscroll/tsconfig.json deleted file mode 100644 index f43363abe3..0000000000 --- a/dragscroll/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "base64-js-tests.ts" - ] -} \ No newline at end of file diff --git a/dragscroll/tslint.json b/dragscroll/tslint.json deleted file mode 100644 index 2750cc0197..0000000000 --- a/dragscroll/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/dragscroll/dragscroll-tests.ts b/types/dragscroll/dragscroll-tests.ts new file mode 100644 index 0000000000..4158b6c9da --- /dev/null +++ b/types/dragscroll/dragscroll-tests.ts @@ -0,0 +1,3 @@ +import * as dragscroll from "dragscroll"; + +dragscroll.reset(); \ No newline at end of file diff --git a/dragscroll/dragscroll.d.ts b/types/dragscroll/index.d.ts similarity index 65% rename from dragscroll/dragscroll.d.ts rename to types/dragscroll/index.d.ts index dbef7bf897..4598f31bd5 100644 --- a/dragscroll/dragscroll.d.ts +++ b/types/dragscroll/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for dragscroll v 0.0.8 -// Project: https://github.com/asvd/dragscroll +// Project: https://github.com/asvd/dragscroll#readme // Definitions by: Sean Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "dragscroll" { - function reset(i?: number, el?: HTMLElement[]): void -} \ No newline at end of file + function reset(i?: number, el?: any[]): void; +} diff --git a/types/dragscroll/tsconfig.json b/types/dragscroll/tsconfig.json index f43363abe3..14917b2a74 100644 --- a/types/dragscroll/tsconfig.json +++ b/types/dragscroll/tsconfig.json @@ -1,23 +1,22 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "base64-js-tests.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dragscroll-tests.ts" + ] +} diff --git a/types/dragscroll/tslint.json b/types/dragscroll/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dragscroll/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 63b91c6efbc87ebffa6e8355c9ca8b036466fe77 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 11:27:09 -0500 Subject: [PATCH 008/265] Added strictFunctionTypes to Dragscroll --- types/dragscroll/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/dragscroll/tsconfig.json b/types/dragscroll/tsconfig.json index 14917b2a74..bc17d2f0c7 100644 --- a/types/dragscroll/tsconfig.json +++ b/types/dragscroll/tsconfig.json @@ -13,7 +13,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": false }, "files": [ "index.d.ts", From 12d17c2b36c8f24ec11baa5e64b1552cebd3a66a Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 11:36:12 -0500 Subject: [PATCH 009/265] lint --- types/dragscroll/dragscroll-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragscroll/dragscroll-tests.ts b/types/dragscroll/dragscroll-tests.ts index 4158b6c9da..fcf4818bf4 100644 --- a/types/dragscroll/dragscroll-tests.ts +++ b/types/dragscroll/dragscroll-tests.ts @@ -1,3 +1,3 @@ import * as dragscroll from "dragscroll"; -dragscroll.reset(); \ No newline at end of file +dragscroll.reset(); From e10db0f11b9a784426fb54dcff67f0119cc8ba79 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 12:02:36 -0500 Subject: [PATCH 010/265] lint --- types/dragscroll/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts index 4598f31bd5..5270b2e82a 100644 --- a/types/dragscroll/index.d.ts +++ b/types/dragscroll/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dragscroll v 0.0.8 +// Type definitions for dragscroll v 0.0 // Project: https://github.com/asvd/dragscroll#readme // Definitions by: Sean Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 837128adf0f83b000e13bcc03c7862eef7e43860 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 22 Feb 2019 22:46:15 +0500 Subject: [PATCH 011/265] feat(unsplash-js): initialize types --- types/unsplash-js/index.d.ts | 232 +++++++++++++++++++++++++ types/unsplash-js/tsconfig.json | 22 +++ types/unsplash-js/tslint.json | 1 + types/unsplash-js/unsplash-js-tests.ts | 0 4 files changed, 255 insertions(+) create mode 100644 types/unsplash-js/index.d.ts create mode 100644 types/unsplash-js/tsconfig.json create mode 100644 types/unsplash-js/tslint.json create mode 100644 types/unsplash-js/unsplash-js-tests.ts diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts new file mode 100644 index 0000000000..de2272c422 --- /dev/null +++ b/types/unsplash-js/index.d.ts @@ -0,0 +1,232 @@ +// Type definitions for unsplash-js 5.0 +// Project: https://github.com/unsplash/unsplash-js#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default class Unsplash { + public auth: Auth; + public categories: CategoriesApi; + public collections: CollectionApi; + public currentUser: CurrentUserApi; + public users: UserApi; + public photos: PhotoApi; + public search: SearchApi; + public stats: StatsApi; + + constructor(options: { + apiUrl: string; + apiVersion: string; + applicationId: string; + secret: string; + callbackUrl?: string; + bearerToken?: string; + headers?: { [key: string]: string }; + }); + + private request(requestOptions: { + url: string; + method: string; + query: object; + headers: object; + body: object; + oauth: boolean; + }): Promise; +} + +export function toJson(response: any): any; + +export class PhotoApi { + public listPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + public listCuratedPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + public searchPhotos( + query: string, + categories: ReadonlyArray, + page: number, + perPage: number + ): Promise; + + public getPhoto( + id: string, + width?: number, + height?: number, + rectangle?: ReadonlyArray + ): Promise; + + public getPhotoStats(id: string): Promise; + + public getRandomPhoto(options: { + width?: number; + height?: number; + query?: string; + username?: string; + featured?: boolean; + collections?: ReadonlyArray; + count?: number; + }): Promise; + + public uploadPhoto(photo: object): void; + + public likePhoto(id: string): Promise; + + public unlikePhoto(id: string): Promise; + + public downloadPhoto(photo: { + links: { download_location: string }; + }): Promise; +} + +export class CollectionApi { + public listCollections( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + public listCuratedCollections( + page?: number, + perPage?: number + ): Promise; + public listFeaturedCollections( + page?: number, + perPage?: number + ): Promise; + public getCollection(id: number): Promise; + + public getCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + public getCuratedCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + public createCollection( + title: string, + description?: string, + private?: boolean + ): Promise; + + public updateCollection( + id: number, + title?: string, + description?: string, + private?: boolean + ): Promise; + + public deleteCollection(id: number): Promise; + + public addPhotoToCollection( + collectionId: number, + photoId: string + ): Promise; + + public removePhotoFromCollection( + collectionId: number, + photoId: string + ): Promise; + + public listRelatedCollections(collectionId: number): Promise; +} + +export class SearchApi { + public photos( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + public users( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + public collections( + keyword: string, + page?: number, + per_page?: number + ): Promise; +} + +export class StatsApi { + public total(): Promise; +} + +export class CurrentUserApi { + public profile(): Promise; + + public updateProfile(options: { + username: string; + firstName: string; + lastName: string; + email: string; + url: string; + location: string; + bio: string; + instagramUsername: string; + }): Promise; +} + +export class UserApi { + public profile(username: string): Promise; + + public statistics( + username: string, + resolution?: string, + quantity?: string + ): Promise; + + public photos( + username: string, + page?: number, + perPage?: number, + orderBy?: string, + stats?: boolean + ): Promise; + + public likes( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + public collections( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; +} + +export class CategoriesApi { + public listCategories(): Promise; + public category(id: any): Promise; + public categoryPhotos( + id: any, + page?: number, + perPage?: number + ): Promise; +} + +export class Auth { + public getAuthenticationUrl(scopes?: ReadonlyArray): string; + public userAuthentication(code: string): object; + public setBearerToken(accessToken: string): void; +} diff --git a/types/unsplash-js/tsconfig.json b/types/unsplash-js/tsconfig.json new file mode 100644 index 0000000000..79f45318aa --- /dev/null +++ b/types/unsplash-js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "unsplash-js-tests.ts" + ] +} diff --git a/types/unsplash-js/tslint.json b/types/unsplash-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/unsplash-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unsplash-js/unsplash-js-tests.ts b/types/unsplash-js/unsplash-js-tests.ts new file mode 100644 index 0000000000..e69de29bb2 From 01227c77e87b0d9b33b235e0eaf10b55a8561644 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 13:09:16 -0500 Subject: [PATCH 012/265] link --- types/dragscroll/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts index 5270b2e82a..1a90b53761 100644 --- a/types/dragscroll/index.d.ts +++ b/types/dragscroll/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for dragscroll v 0.0 // Project: https://github.com/asvd/dragscroll#readme -// Definitions by: Sean Kelly +// Definitions by: Sean Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "dragscroll" { function reset(i?: number, el?: any[]): void; From e9101940b93a76db98185299ada0cbb24dc5d213 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 13:13:38 -0500 Subject: [PATCH 013/265] link --- types/dragscroll/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts index 1a90b53761..5270b2e82a 100644 --- a/types/dragscroll/index.d.ts +++ b/types/dragscroll/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for dragscroll v 0.0 // Project: https://github.com/asvd/dragscroll#readme -// Definitions by: Sean Kelly +// Definitions by: Sean Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "dragscroll" { function reset(i?: number, el?: any[]): void; From 79bde2d2a407f19afe7e41e3b4cfa54de2c478d5 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 13:19:24 -0500 Subject: [PATCH 014/265] link --- types/dragscroll/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts index 5270b2e82a..ebf6cb6815 100644 --- a/types/dragscroll/index.d.ts +++ b/types/dragscroll/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for dragscroll v 0.0 // Project: https://github.com/asvd/dragscroll#readme -// Definitions by: Sean Kelly +// Definitions by: Sean Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "dragscroll" { function reset(i?: number, el?: any[]): void; From c31d394c731e00895e7f9b4486f316237b2e1763 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Fri, 22 Feb 2019 13:26:20 -0500 Subject: [PATCH 015/265] single module --- types/dragscroll/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts index ebf6cb6815..cd125c6591 100644 --- a/types/dragscroll/index.d.ts +++ b/types/dragscroll/index.d.ts @@ -2,6 +2,4 @@ // Project: https://github.com/asvd/dragscroll#readme // Definitions by: Sean Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "dragscroll" { - function reset(i?: number, el?: any[]): void; -} +export function reset(i ?: number, el ?: any): void; From 8d0a6d8bbc1beac9d935e438a41c880b201272bf Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Sat, 23 Feb 2019 21:39:43 +0800 Subject: [PATCH 016/265] Adding types for amap-js-api --- types/amap-js-api/array-bounds.d.ts | 10 + types/amap-js-api/bounds.d.ts | 12 + types/amap-js-api/browser.d.ts | 51 +++ types/amap-js-api/common.d.ts | 22 ++ types/amap-js-api/convert-from.d.ts | 15 + types/amap-js-api/dom-util.d.ts | 31 ++ types/amap-js-api/event.d.ts | 59 +++ types/amap-js-api/geometry-util.d.ts | 122 +++++++ types/amap-js-api/index.d.ts | 48 +++ types/amap-js-api/layer/building.d.ts | 30 ++ types/amap-js-api/layer/flexible.d.ts | 20 ++ types/amap-js-api/layer/layer.d.ts | 20 ++ types/amap-js-api/layer/layerGroup.d.ts | 21 ++ types/amap-js-api/layer/massMarks.d.ts | 47 +++ types/amap-js-api/layer/mediaLayer.d.ts | 35 ++ types/amap-js-api/layer/tileLayer.d.ts | 37 ++ types/amap-js-api/layer/wms.d.ts | 29 ++ types/amap-js-api/layer/wmts.d.ts | 25 ++ types/amap-js-api/lngLat.d.ts | 17 + types/amap-js-api/map.d.ts | 187 ++++++++++ types/amap-js-api/overlay/bezierCurve.d.ts | 22 ++ types/amap-js-api/overlay/circle.d.ts | 49 +++ types/amap-js-api/overlay/circleMarker.d.ts | 4 + types/amap-js-api/overlay/contextMenu.d.ts | 23 ++ types/amap-js-api/overlay/ellipse.d.ts | 27 ++ types/amap-js-api/overlay/geoJSON.d.ts | 43 +++ types/amap-js-api/overlay/icon.d.ts | 16 + types/amap-js-api/overlay/infoWindow.d.ts | 37 ++ types/amap-js-api/overlay/marker.d.ts | 103 ++++++ types/amap-js-api/overlay/markerShape.d.ts | 21 ++ types/amap-js-api/overlay/overlay.d.ts | 37 ++ types/amap-js-api/overlay/overlayGroup.d.ts | 30 ++ types/amap-js-api/overlay/pathOverlay.d.ts | 20 ++ types/amap-js-api/overlay/polygon.d.ts | 32 ++ types/amap-js-api/overlay/polyline.d.ts | 46 +++ types/amap-js-api/overlay/rectangle.d.ts | 21 ++ types/amap-js-api/overlay/shapeOverlay.d.ts | 30 ++ types/amap-js-api/overlay/text.d.ts | 19 + types/amap-js-api/pixel.d.ts | 17 + types/amap-js-api/size.d.ts | 10 + types/amap-js-api/test/arryBounds.ts | 18 + types/amap-js-api/test/bounds.ts | 30 ++ types/amap-js-api/test/browser.ts | 141 ++++++++ types/amap-js-api/test/convert-from.ts | 25 ++ types/amap-js-api/test/dom-util.ts | 47 +++ types/amap-js-api/test/event.ts | 75 ++++ types/amap-js-api/test/geometry-util.ts | 158 ++++++++ types/amap-js-api/test/layer/buildings.ts | 40 +++ types/amap-js-api/test/layer/canvasLayer.ts | 53 +++ types/amap-js-api/test/layer/flexible.ts | 54 +++ types/amap-js-api/test/layer/imageLayer.ts | 51 +++ types/amap-js-api/test/layer/layer.ts | 34 ++ types/amap-js-api/test/layer/layerGroup.ts | 115 ++++++ types/amap-js-api/test/layer/massMarks.ts | 83 +++++ types/amap-js-api/test/layer/tileLayer.ts | 60 ++++ types/amap-js-api/test/layer/videoLayer.ts | 51 +++ types/amap-js-api/test/layer/wms.ts | 89 +++++ types/amap-js-api/test/layer/wmts.ts | 69 ++++ types/amap-js-api/test/lnglat.ts | 48 +++ types/amap-js-api/test/map.ts | 338 ++++++++++++++++++ types/amap-js-api/test/overlay/bezierCurve.ts | 155 ++++++++ types/amap-js-api/test/overlay/circle.ts | 150 ++++++++ types/amap-js-api/test/overlay/contextMenu.ts | 48 +++ types/amap-js-api/test/overlay/ellipse.ts | 117 ++++++ types/amap-js-api/test/overlay/geoJSON.ts | 106 ++++++ types/amap-js-api/test/overlay/icon.ts | 32 ++ types/amap-js-api/test/overlay/infoWindow.ts | 81 +++++ types/amap-js-api/test/overlay/marker.ts | 195 ++++++++++ types/amap-js-api/test/overlay/markerShape.ts | 26 ++ types/amap-js-api/test/overlay/overlay.ts | 27 ++ .../amap-js-api/test/overlay/overlayGroup.ts | 108 ++++++ types/amap-js-api/test/overlay/polygon.ts | 123 +++++++ types/amap-js-api/test/overlay/polyline.ts | 139 +++++++ types/amap-js-api/test/overlay/rectangle.ts | 121 +++++++ types/amap-js-api/test/overlay/text.ts | 169 +++++++++ types/amap-js-api/test/pixel.ts | 42 +++ types/amap-js-api/test/preset.ts | 29 ++ types/amap-js-api/test/size.ts | 16 + types/amap-js-api/test/util.ts | 79 ++++ types/amap-js-api/test/view2d.ts | 22 ++ types/amap-js-api/tsconfig.json | 20 ++ types/amap-js-api/tslint.json | 10 + types/amap-js-api/type-util.d.ts | 12 + types/amap-js-api/util.d.ts | 37 ++ types/amap-js-api/view2D.d.ts | 13 + 85 files changed, 4901 insertions(+) create mode 100644 types/amap-js-api/array-bounds.d.ts create mode 100644 types/amap-js-api/bounds.d.ts create mode 100644 types/amap-js-api/browser.d.ts create mode 100644 types/amap-js-api/common.d.ts create mode 100644 types/amap-js-api/convert-from.d.ts create mode 100644 types/amap-js-api/dom-util.d.ts create mode 100644 types/amap-js-api/event.d.ts create mode 100644 types/amap-js-api/geometry-util.d.ts create mode 100644 types/amap-js-api/index.d.ts create mode 100644 types/amap-js-api/layer/building.d.ts create mode 100644 types/amap-js-api/layer/flexible.d.ts create mode 100644 types/amap-js-api/layer/layer.d.ts create mode 100644 types/amap-js-api/layer/layerGroup.d.ts create mode 100644 types/amap-js-api/layer/massMarks.d.ts create mode 100644 types/amap-js-api/layer/mediaLayer.d.ts create mode 100644 types/amap-js-api/layer/tileLayer.d.ts create mode 100644 types/amap-js-api/layer/wms.d.ts create mode 100644 types/amap-js-api/layer/wmts.d.ts create mode 100644 types/amap-js-api/lngLat.d.ts create mode 100644 types/amap-js-api/map.d.ts create mode 100644 types/amap-js-api/overlay/bezierCurve.d.ts create mode 100644 types/amap-js-api/overlay/circle.d.ts create mode 100644 types/amap-js-api/overlay/circleMarker.d.ts create mode 100644 types/amap-js-api/overlay/contextMenu.d.ts create mode 100644 types/amap-js-api/overlay/ellipse.d.ts create mode 100644 types/amap-js-api/overlay/geoJSON.d.ts create mode 100644 types/amap-js-api/overlay/icon.d.ts create mode 100644 types/amap-js-api/overlay/infoWindow.d.ts create mode 100644 types/amap-js-api/overlay/marker.d.ts create mode 100644 types/amap-js-api/overlay/markerShape.d.ts create mode 100644 types/amap-js-api/overlay/overlay.d.ts create mode 100644 types/amap-js-api/overlay/overlayGroup.d.ts create mode 100644 types/amap-js-api/overlay/pathOverlay.d.ts create mode 100644 types/amap-js-api/overlay/polygon.d.ts create mode 100644 types/amap-js-api/overlay/polyline.d.ts create mode 100644 types/amap-js-api/overlay/rectangle.d.ts create mode 100644 types/amap-js-api/overlay/shapeOverlay.d.ts create mode 100644 types/amap-js-api/overlay/text.d.ts create mode 100644 types/amap-js-api/pixel.d.ts create mode 100644 types/amap-js-api/size.d.ts create mode 100644 types/amap-js-api/test/arryBounds.ts create mode 100644 types/amap-js-api/test/bounds.ts create mode 100644 types/amap-js-api/test/browser.ts create mode 100644 types/amap-js-api/test/convert-from.ts create mode 100644 types/amap-js-api/test/dom-util.ts create mode 100644 types/amap-js-api/test/event.ts create mode 100644 types/amap-js-api/test/geometry-util.ts create mode 100644 types/amap-js-api/test/layer/buildings.ts create mode 100644 types/amap-js-api/test/layer/canvasLayer.ts create mode 100644 types/amap-js-api/test/layer/flexible.ts create mode 100644 types/amap-js-api/test/layer/imageLayer.ts create mode 100644 types/amap-js-api/test/layer/layer.ts create mode 100644 types/amap-js-api/test/layer/layerGroup.ts create mode 100644 types/amap-js-api/test/layer/massMarks.ts create mode 100644 types/amap-js-api/test/layer/tileLayer.ts create mode 100644 types/amap-js-api/test/layer/videoLayer.ts create mode 100644 types/amap-js-api/test/layer/wms.ts create mode 100644 types/amap-js-api/test/layer/wmts.ts create mode 100644 types/amap-js-api/test/lnglat.ts create mode 100644 types/amap-js-api/test/map.ts create mode 100644 types/amap-js-api/test/overlay/bezierCurve.ts create mode 100644 types/amap-js-api/test/overlay/circle.ts create mode 100644 types/amap-js-api/test/overlay/contextMenu.ts create mode 100644 types/amap-js-api/test/overlay/ellipse.ts create mode 100644 types/amap-js-api/test/overlay/geoJSON.ts create mode 100644 types/amap-js-api/test/overlay/icon.ts create mode 100644 types/amap-js-api/test/overlay/infoWindow.ts create mode 100644 types/amap-js-api/test/overlay/marker.ts create mode 100644 types/amap-js-api/test/overlay/markerShape.ts create mode 100644 types/amap-js-api/test/overlay/overlay.ts create mode 100644 types/amap-js-api/test/overlay/overlayGroup.ts create mode 100644 types/amap-js-api/test/overlay/polygon.ts create mode 100644 types/amap-js-api/test/overlay/polyline.ts create mode 100644 types/amap-js-api/test/overlay/rectangle.ts create mode 100644 types/amap-js-api/test/overlay/text.ts create mode 100644 types/amap-js-api/test/pixel.ts create mode 100644 types/amap-js-api/test/preset.ts create mode 100644 types/amap-js-api/test/size.ts create mode 100644 types/amap-js-api/test/util.ts create mode 100644 types/amap-js-api/test/view2d.ts create mode 100644 types/amap-js-api/tsconfig.json create mode 100644 types/amap-js-api/tslint.json create mode 100644 types/amap-js-api/type-util.d.ts create mode 100644 types/amap-js-api/util.d.ts create mode 100644 types/amap-js-api/view2D.d.ts diff --git a/types/amap-js-api/array-bounds.d.ts b/types/amap-js-api/array-bounds.d.ts new file mode 100644 index 0000000000..419d8e4b1d --- /dev/null +++ b/types/amap-js-api/array-bounds.d.ts @@ -0,0 +1,10 @@ +declare namespace AMap { + class ArrayBounds { + constructor(bounds: LocationValue[]); + bounds: LngLat[]; + contains(point: LocationValue): boolean; + // internal + toBounds(): Bounds; + getCenter(): LngLat; + } +} diff --git a/types/amap-js-api/bounds.d.ts b/types/amap-js-api/bounds.d.ts new file mode 100644 index 0000000000..63e880fe65 --- /dev/null +++ b/types/amap-js-api/bounds.d.ts @@ -0,0 +1,12 @@ +declare namespace AMap { + class Bounds { + constructor(southWest: LngLat, northEast: LngLat); + contains(point: LocationValue): boolean; + getCenter(): LngLat; + getSouthWest(): LngLat; + getSouthEast(): LngLat; + getNorthEast(): LngLat; + getNorthWest(): LngLat; + toString(): string; + } +} diff --git a/types/amap-js-api/browser.d.ts b/types/amap-js-api/browser.d.ts new file mode 100644 index 0000000000..71bfaa8fea --- /dev/null +++ b/types/amap-js-api/browser.d.ts @@ -0,0 +1,51 @@ +declare namespace AMap { + namespace Browser { + const ua: string; + const mobile: boolean; + const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other'; + const mac: boolean; + const windows: boolean; + const ios: boolean; + const iPad: boolean; + const iPhone: boolean; + const android: boolean; + const android23: boolean; + const chrome: boolean; + const firefox: boolean; + const safari: boolean; + const wechat: boolean; + const uc: boolean; + const qq: boolean; + const ie: boolean; + const ie6: boolean; + const ie7: boolean; + const ie8: boolean; + const ie9: boolean; + const ie10: boolean; + const ie11: boolean; + const edge: boolean; + const ielt9: boolean; + const baidu: boolean; + const isLocalStorage: boolean; + const isGeolocation: boolean; + const mobileWebkit: boolean; + const mobileWebkit3d: boolean; + const mobileOpera: boolean; + const retina: boolean; + const touch: boolean; + const msPointer: boolean; + const pointer: boolean; + const webkit: boolean; + const ie3d: boolean; + const webkit3d: boolean; + const gecko3d: boolean; + const opera3d: boolean; + const any3d: boolean; + const isCanvas: boolean; + const isSvg: boolean; + const isVML: boolean; + const isWorker: boolean; + const isWebsocket: boolean; + function isWebGL(): boolean; + } +} diff --git a/types/amap-js-api/common.d.ts b/types/amap-js-api/common.d.ts new file mode 100644 index 0000000000..3d51dc719e --- /dev/null +++ b/types/amap-js-api/common.d.ts @@ -0,0 +1,22 @@ +declare namespace AMap { + type SizeValue = Size | [number, number]; + type LocationValue = LngLat | [number, number]; + type Lang = 'zh_cn' | 'en' | 'zh_en'; + + type Event = { type: N } & + (V extends HTMLElement ? { value: V } + : V extends object ? V + : V extends undefined ? {} + : { value: V }); + type MapsEvent = Event; + + type StrokeLineJoin = 'miter' | 'round' | 'bevel'; + type StrokeLineCap = 'butt' | 'round' | 'square'; + type StrokeStyle = 'dashed' | 'solid'; + + type AnimationName = 'AMAP_ANIMATION_NONE' | 'AMAP_ANIMATION_DROP' | 'AMAP_ANIMATION_BOUNCE'; +} diff --git a/types/amap-js-api/convert-from.d.ts b/types/amap-js-api/convert-from.d.ts new file mode 100644 index 0000000000..9fe1f1e76d --- /dev/null +++ b/types/amap-js-api/convert-from.d.ts @@ -0,0 +1,15 @@ +declare namespace AMap { + namespace convertFrom { + interface Result { + info: string; // 'ok' + locations: LngLat[]; + } + type Type = 'gps' | 'baidu' | 'mapbar'; + type SearchStatus = 'complete' | 'error'; + } + function convertFrom( + lnglat: LocationValue | LocationValue[], + type: convertFrom.Type | null, + callback: (status: convertFrom.SearchStatus, result: string | convertFrom.Result) => void + ): void; +} diff --git a/types/amap-js-api/dom-util.d.ts b/types/amap-js-api/dom-util.d.ts new file mode 100644 index 0000000000..d83a2ca69a --- /dev/null +++ b/types/amap-js-api/dom-util.d.ts @@ -0,0 +1,31 @@ +declare namespace AMap { + namespace DomUtil { + function getViewport(dom: HTMLElement): Size; + + function getViewportOffset(dom: HTMLElement): Pixel; + + function create( + tagName: K, + parent?: HTMLElement, + className?: string + ): HTMLElementTagNameMap[K]; + + function setClass(dom: HTMLElement, className?: string): void; + + function hasClass(dom: HTMLElement, className: string): boolean; + + function addClass(dom: HTMLElement, className: string): void; + + function removeClass(dom: HTMLElement, className: string): void; + + function setOpacity(dom: HTMLElement, opacity: number): void; + + function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void; + + function setCss(dom: HTMLElement | HTMLElement[], style: Partial): typeof DomUtil; // this + + function empty(dom: HTMLElement): void; + + function remove(dom: HTMLElement): void; + } +} diff --git a/types/amap-js-api/event.d.ts b/types/amap-js-api/event.d.ts new file mode 100644 index 0000000000..d8ff5753c9 --- /dev/null +++ b/types/amap-js-api/event.d.ts @@ -0,0 +1,59 @@ +declare namespace AMap { + abstract class EventEmitter { + on( + eventName: string, + // tslint:disable-next-line:no-unnecessary-generics + handler: (this: C, event: E) => void, + context?: C, + once?: boolean, + unshift?: boolean + ): this; + + off( + eventName: string, + // tslint:disable-next-line + handler: ((this: C, event: E) => void) | 'mv', + context?: C + ): this; + + emit(eventName: string, data?: any): this; + } + + namespace event { + interface EventListener { + type: T; + } + + function addDomListener( + // tslint:disable-next-line: no-unnecessary-generics + instance: HTMLElementTagNameMap[N], + eventName: E, + handler: (this: C, event: HTMLElementEventMap[E]) => void, + context?: C + ): EventListener<0>; + + function addListener( + // tslint:disable-next-line: no-unnecessary-generics + instance: I, + eventName: string, + // tslint:disable-next-line: no-unnecessary-generics + handler: (this: C, event: E) => void, + // tslint:disable-next-line: no-unnecessary-generics + context?: C + ): EventListener<1>; + + function addListenerOnce( + // tslint:disable-next-line: no-unnecessary-generics + instance: I, + eventName: string, + // tslint:disable-next-line: no-unnecessary-generics + handler: (this: C, event: E) => void, + // tslint:disable-next-line: no-unnecessary-generics + context?: C + ): EventListener<1>; + + function removeListener(listener: EventListener<0 | 1>): void; + + function trigger(instance: EventEmitter, eventName: string, data?: any): void; + } +} diff --git a/types/amap-js-api/geometry-util.d.ts b/types/amap-js-api/geometry-util.d.ts new file mode 100644 index 0000000000..03f6800088 --- /dev/null +++ b/types/amap-js-api/geometry-util.d.ts @@ -0,0 +1,122 @@ +declare namespace AMap { + namespace GeometryUtil { + function distance( + point1: LocationValue, + point2: LocationValue | LocationValue[] + ): number; + + function ringArea(ring: LocationValue[]): number; + + function isClockwise(path: LocationValue[]): boolean; + + function distanceOfLine(line: LocationValue[]): number; + + function ringRingClip( + ring1: LocationValue[], + ring2: LocationValue[] + ): Array<[number, number]>; + + function doesRingRingIntersect( + ring1: LocationValue[], + ring2: LocationValue[] + ): boolean; + + function doesLineRingIntersect( + line: LocationValue[], + ring: LocationValue[] + ): boolean; + + function doesLineLineIntersect( + line1: LocationValue[], + line2: LocationValue[] + ): boolean; + + function doesSegmentPolygonIntersect( + point1: LocationValue, + point2: LocationValue, + polygon: LocationValue[][] + ): boolean; + + function doesSegmentRingIntersect( + point1: LocationValue, + point2: LocationValue, + ring: LocationValue[] + ): boolean; + + function doesSegmentLineIntersect( + point1: LocationValue, + point2: LocationValue, + line: LocationValue[] + ): boolean; + + function doesSegmentsIntersect( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + point4: LocationValue + ): boolean; + + function isPointInRing(point: LocationValue, ring: LocationValue[]): boolean; + + function isRingInRing(ring1: LocationValue[], ring2: LocationValue[]): boolean; + + function isPointInPolygon(point: LocationValue, polygon: LocationValue[][]): boolean; + + function makesureClockwise(path: Array<[number, number]>): Array<[number, number]>; + + function makesureAntiClockwise(path: Array<[number, number]>): Array<[number, number]>; + + function closestOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): [number, number]; + + function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number]; + + function distanceToSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): number; + + function distanceToLine(point: LocationValue, line: LocationValue[]): number; + + function isPointOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + tolerance?: number + ): boolean; + + function isPointOnLine( + point: LocationValue, + line: LocationValue[], + tolerance?: number + ): boolean; + + function isPointOnRing( + point: LocationValue, + ring: LocationValue[], + tolerance?: number + ): boolean; + + function isPointOnPolygon( + point: LocationValue, + polygon: LocationValue[][], + tolerance?: number + ): boolean; + + function doesPolygonPolygonIntersect( + polygon1: LocationValue[], + polygon2: LocationValue[] + ): boolean; + + function distanceToPolygon(point: LocationValue, polygon: LocationValue[]): number; + + function triangulateShape( + shape1: LngLat[] | Pixel[] | [number, number], + shape2: LngLat[] | Pixel[] | [number, number] + ): number[]; + } +} diff --git a/types/amap-js-api/index.d.ts b/types/amap-js-api/index.d.ts new file mode 100644 index 0000000000..54f79c08ea --- /dev/null +++ b/types/amap-js-api/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for non-npm package amap-js-sdk 1.4 +// Project: https://lbs.amap.com/api/javascript-api/summary +// Definitions by: breeze9527 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/types/amap-js-api/layer/building.d.ts b/types/amap-js-api/layer/building.d.ts new file mode 100644 index 0000000000..30dd7c4092 --- /dev/null +++ b/types/amap-js-api/layer/building.d.ts @@ -0,0 +1,30 @@ +declare namespace AMap { + namespace Buildings { + interface Options extends Layer.Options { + zooms?: [number, number]; + opacity?: number; + heightFactor?: number; + visible?: boolean; + zIndex?: number; + // inner + merge?: boolean; + sort?: boolean; + } + interface AreaStyle { + color1: string; + path: LocationValue[]; + color2?: string; + visible?: boolean; + rejectTexture?: boolean; + } + interface Style { + hideWithoutStyle?: boolean; + areas: AreaStyle[]; + } + } + + class Buildings extends Layer { + constructor(opts?: Buildings.Options); + setStyle(style: Buildings.Style): void; + } +} diff --git a/types/amap-js-api/layer/flexible.d.ts b/types/amap-js-api/layer/flexible.d.ts new file mode 100644 index 0000000000..bdb4001a7c --- /dev/null +++ b/types/amap-js-api/layer/flexible.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace TileLayer { + namespace Flexible { + interface Options extends TileLayer.Options { + createTile?( + x: number, + y: number, + z: number, + success: (tile: HTMLImageElement | HTMLCanvasElement) => void, + fail: () => void + ): void; + cacheSize?: number; + visible?: boolean; + } + } + class Flexible extends TileLayer { + constructor(options?: Flexible.Options); + } + } +} diff --git a/types/amap-js-api/layer/layer.d.ts b/types/amap-js-api/layer/layer.d.ts new file mode 100644 index 0000000000..8f35d949fd --- /dev/null +++ b/types/amap-js-api/layer/layer.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace Layer { + interface Options { + map?: Map; + } + } + + abstract class Layer extends EventEmitter { + getContainer(): HTMLDivElement | undefined; + getZooms(): [number, number]; + setOpacity(alpha: number): void; + getOpacity(): number; + show(): void; + hide(): void; + setMap(map?: Map | null): void; + getMap(): Map | null | undefined; + setzIndex(index: number): void; + getzIndex(): number; + } +} diff --git a/types/amap-js-api/layer/layerGroup.d.ts b/types/amap-js-api/layer/layerGroup.d.ts new file mode 100644 index 0000000000..4cc463eef7 --- /dev/null +++ b/types/amap-js-api/layer/layerGroup.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + class LayerGroup extends Layer { + constructor(layers: L | L[]); + addLayer(layer: L | L[]): this; + addLayers(layers: L | L[]): this; + getLayers(): L[]; + getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null; + hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean; + removeLayer(layer: L | L[]): this; + removeLayers(layer: L | L[]): this; + clearLayers(): this; + eachLayer(iterator: (this: C, layer: L, index: number, list: L[]) => void, context?: C): void; + + // overwrite + setMap(map?: Map): this; + hide(): this; + show(): this; + reload(): this; + setOptions(options: any): this; + } +} diff --git a/types/amap-js-api/layer/massMarks.d.ts b/types/amap-js-api/layer/massMarks.d.ts new file mode 100644 index 0000000000..1ab5464a5b --- /dev/null +++ b/types/amap-js-api/layer/massMarks.d.ts @@ -0,0 +1,47 @@ +declare namespace AMap { + namespace MassMarks { + interface EventMap { + click: UIEvent<'click', I>; + dblclick: UIEvent<'dblclick', I>; + mousedown: UIEvent<'mousedown', I>; + mouseup: UIEvent<'mouseup', I>; + mouseover: UIEvent<'mouseover', I>; + mouseout: UIEvent<'mouseout', I>; + touchstart: UIEvent<'touchstart', I>; + touchend: UIEvent<'touchend', I>; + } + + interface Style { + anchor: Pixel; + url: string; + size: Size; + rotation?: number; + } + + type UIEvent = Event ? D : Data; + }>; + + interface Options extends Layer.Options { + zIndex?: number; + cursor?: string; + alwayRender?: boolean; + style: Style | Style[]; + // rejectMapMask + } + interface Data { + lnglat: LocationValue; + style?: number; + } + } + + class MassMarks extends Layer { + constructor(data: D[] | string, opts: MassMarks.Options); + setStyle(style: MassMarks.Style | MassMarks.Style[]): void; + getStyle(): MassMarks.Style | MassMarks.Style[]; + setData(data: D[] | string): void; + getData(): Array> & { lnglat: LngLat }>; + clear(): void; + } +} diff --git a/types/amap-js-api/layer/mediaLayer.d.ts b/types/amap-js-api/layer/mediaLayer.d.ts new file mode 100644 index 0000000000..a38f5ba025 --- /dev/null +++ b/types/amap-js-api/layer/mediaLayer.d.ts @@ -0,0 +1,35 @@ +declare namespace AMap { + namespace MediaLayer { + interface Options extends Layer.Options { + bounds?: Bounds; + visible?: boolean; + zooms?: [number, number]; + opacity?: number; + } + } + + abstract class MediaLayer extends Layer { + constructor(options?: MediaLayer.Options); + setBounds(bounds: Bounds): void; + getBounds(): Bounds; + setOptions(options: Partial): void; + getOptions(): Partial; + getElement(): E | null; + } + + class ImageLayer extends MediaLayer { + setImageUrl(url: string): void; + getImageUrl(): string | undefined; + } + + class VideoLayer extends MediaLayer { + setVideoUrl(source: string | string[]): void; + getVideoUrl(): string | string[] | undefined; + } + + class CanvasLayer extends MediaLayer { + setCanvas(canvas: HTMLCanvasElement): void; + getCanvas(): HTMLCanvasElement | undefined; + reFresh(): void; + } +} diff --git a/types/amap-js-api/layer/tileLayer.d.ts b/types/amap-js-api/layer/tileLayer.d.ts new file mode 100644 index 0000000000..7576a70664 --- /dev/null +++ b/types/amap-js-api/layer/tileLayer.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace TileLayer { + interface EventMap { + complete: Event<'complete'>; + } + + interface Options extends Layer.Options { + tileSize?: number; + tileUrl?: string; + errorUrl?: string; + getTileUrl?: string | ((x: number, y: number, level: number) => string); + zIndex?: number; + opacity?: number; + zooms?: [number, number]; + detectRetina?: boolean; + } + class Satellite extends TileLayer { } + class RoadNet extends TileLayer { } + + namespace Traffic { + interface Options extends TileLayer.Options { + autoRefresh?: boolean; + interval?: number; + } + } + class Traffic extends TileLayer { + constructor(options?: Traffic.Options); + } + } + + class TileLayer extends Layer { + constructor(options?: TileLayer.Options); + getTiles(): string[]; + reload(): void; + setTileUrl(url: string | ((x: number, y: number, level: number) => string)): void; + } +} diff --git a/types/amap-js-api/layer/wms.d.ts b/types/amap-js-api/layer/wms.d.ts new file mode 100644 index 0000000000..c4561ddf14 --- /dev/null +++ b/types/amap-js-api/layer/wms.d.ts @@ -0,0 +1,29 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMS { + interface Params { + VERSION?: string; + LAYERS?: string; + STYLES?: string; + FORMAT?: string; + TRANSPARENT?: 'TRUE' | 'FALSE'; + BGCOLOR?: string; + EXCEPTIONS?: string; + TIME?: string; + ELEVATION?: string; + } + interface Options extends Flexible.Options { + url: string; + params: Params; + blend?: boolean; + } + } + class WMS extends Flexible { + constructor(options: WMS.Options); + setUrl(url: string): void; + getUrl(): string; + setParams(params: WMS.Params): void; + getParams(): WMS.Params; + } + } +} diff --git a/types/amap-js-api/layer/wmts.d.ts b/types/amap-js-api/layer/wmts.d.ts new file mode 100644 index 0000000000..5d85e5df48 --- /dev/null +++ b/types/amap-js-api/layer/wmts.d.ts @@ -0,0 +1,25 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMTS { + interface Params { + Version?: string; + Layer?: string; + Style?: string; + Format?: string; + } + interface Options extends Flexible.Options { + url: string; + params: Params; + blend?: boolean; + } + } + + class WMTS extends Flexible { + constructor(options: WMTS.Options); + setUrl(url: string): void; + getUrl(): string; + setParams(params: WMTS.Params): void; + getParams(): WMTS.Params; + } + } +} diff --git a/types/amap-js-api/lngLat.d.ts b/types/amap-js-api/lngLat.d.ts new file mode 100644 index 0000000000..4247002b2b --- /dev/null +++ b/types/amap-js-api/lngLat.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + class LngLat { + constructor(lng: number, lat: number, noAutofix?: boolean); + offset(east: number, north: number): LngLat; + distance(lnglat: LngLat | LngLat[]): number; + getLng(): number; + getLat(): number; + equals(lnglat: LngLat): boolean; + toString(): string; + + // internal + add(lnglat: LngLat, noAutofix?: boolean): LngLat; + subtract(lnglat: LngLat, noAutofix?: boolean): LngLat; + divideBy(num: number, noAutofix?: boolean): LngLat; + multiplyBy(num: number, noAutofix?: boolean): LngLat; + } +} diff --git a/types/amap-js-api/map.d.ts b/types/amap-js-api/map.d.ts new file mode 100644 index 0000000000..46edc68577 --- /dev/null +++ b/types/amap-js-api/map.d.ts @@ -0,0 +1,187 @@ +declare namespace AMap { + namespace Map { + type Feature = 'bg' | 'point' | 'road' | 'building'; + type ViewMode = '2D' | '3D'; + interface Options { + view?: View2D; + layers?: Layer[]; + zoom?: number; + center?: LocationValue; + labelzIndex?: number; + zooms?: [number, number]; + lang?: Lang; + defaultCursor?: string; + crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326'; + animateEnable?: boolean; + isHotspot?: boolean; + defaultLayer?: TileLayer; + rotateEnable?: boolean; + resizeEnable?: boolean; + showIndoorMap?: boolean; + expandZoomRange?: boolean; + dragEnable?: boolean; + zoomEnable?: boolean; + doubleClickZoom?: boolean; + keyboardEnable?: boolean; + jogEnable?: boolean; + scrollWheel?: boolean; + touchZoom?: boolean; + touchZoomCenter?: number; + mapStyle?: string; + features?: Feature[] | 'all' | Feature; + showBuildingBlock?: boolean; + viewMode?: ViewMode; + pitch?: number; + pitchEnable?: boolean; + buildingAnimation?: boolean; + skyColor?: string; + preloadMode?: boolean; + mask?: Array<[number, number]> | Array> | Array>>; + maxPitch?: number; + rotation?: number; + forceVector?: boolean; + + // internal + baseRender?: 'vw' | 'd' | 'dv' | 'v'; + overlayRender?: 'c' | 'd'; + showLabel?: boolean; + gridMapForeign?: boolean; + logoUrl?: string; + logoUrlRetina?: string; + copyright?: string; + turboMode?: boolean; + workerMode?: boolean; + // continuousZoomEnable?: boolean; + // showFog: boolean; + // yaw: number; + // scale: number; + // detectRetina: number; + } + interface Status { + animateEnable: boolean; + doubleClickZoom: boolean; + dragEnable: boolean; + isHotspot: boolean; + jogEnable: boolean; + keyboardEnable: boolean; + pitchEnable: boolean; + resizeEnable: boolean; + rotateEnable: boolean; + scrollWheel: boolean; + touchZoom: boolean; + zoomEnable: boolean; + } + type HotspotEvent = Event; + interface EventMap { + click: MapsEvent<'click', Map>; + dblclick: MapsEvent<'dblclick', Map>; + rightclick: MapsEvent<'rightclick', Map>; + rdblclick: MapsEvent<'rdblclick', Map>; + mouseup: MapsEvent<'mouseup', Map>; + mousedown: MapsEvent<'mousedown', Map>; + mousemove: MapsEvent<'mousemove', Map>; + mousewheel: MapsEvent<'mousewheel', Map>; + mouseover: MapsEvent<'mouseover', Map>; + mouseout: MapsEvent<'mouseout', Map>; + touchstart: MapsEvent<'touchstart', Map>; + touchmove: MapsEvent<'touchmove', Map>; + touchend: MapsEvent<'touchend', Map>; + contextmenu: MapsEvent<'contextmenu', Map>; + + hotspotclick: HotspotEvent<'hotspotclick'>; + hotspotover: HotspotEvent<'hotspotover'>; + hotspotout: HotspotEvent<'hotspotout'>; + + complete: Event<'complete'>; + mapmove: Event<'mapmove'>; + movestart: Event<'movestart'>; + moveend: Event<'moveend'>; + zoomchange: Event<'zoomchange'>; + zoomstart: Event<'zoomstart'>; + zoomend: Event<'zoomend'>; + dragstart: Event<'dragstart'>; + dragging: Event<'dragging'>; + dragend: Event<'dragend'>; + resize: Event<'resize'>; + } + } + + class Map extends EventEmitter { + constructor(container: string | HTMLElement, opts?: Map.Options); + poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + detailOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + getZoom(): number; + getLayers(): Layer[]; + getCenter(): LngLat; + getContainer(): HTMLElement | null; + getCity(callback: (cityData: { + city: string; + citycode: string; + district: string; + province: string | never[]; // province is empty array when getCity fail + }) => void): void; + getBounds(): Bounds; + getLabelzIndex(): number; + getLimitBounds(): Bounds; + getLang(): Lang; + getSize(): Size; + getRotation(): number; + getStatus(): Map.Status; + getDefaultCursor(): string; + getResolution(point?: LocationValue): number; + getScale(dpi?: number): number; + setZoom(level: number): void; + setLabelzIndex(index: number): void; + setLayers(layers: Layer[]): void; + add(overlay: Overlay | Overlay[]): void; + remove(overlay: Overlay | Overlay[]): void; + getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[]; + setCenter(center: LocationValue): void; + setZoomAndCenter(zoomLevel: number, center: LocationValue): void; + setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void; + setBounds(bound: Bounds): Bounds; + setLimitBounds(bound: Bounds): void; + clearLimitBounds(): void; + setLang(lang: Lang): void; + setRotation(rotation: number): void; + setStatus(status: Partial): void; + setDefaultCursor(cursor: string): void; + zoomIn(): void; + zoomOut(): void; + panTo(position: LocationValue): void; + panBy(x: number, y: number): void; + setFitView( + overlayList?: Overlay | Overlay[], + immediately?: boolean, + avoid?: [number, number, number, number], + maxZoom?: number + ): Bounds | false | undefined; + clearMap(): void; + destroy(): void; + plugin(name: string | string[], callback: () => void): this; + addControl(control: {}): void; // TODO + removeControl(control: {}): void; // TODO + clearInfoWindow(): void; + pixelToLngLat(pixel: Pixel, level?: number): LngLat; + lnglatToPixel(lnglat: LocationValue, level?: number): Pixel; + containerToLngLat(pixel: Pixel): LngLat; + lngLatToContainer(lnglat: LocationValue): Pixel; + lnglatTocontainer(lnglat: LocationValue): Pixel; + setMapStyle(style: string): void; + getMapStyle(): string; + setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void; + getFeatures(): Map.Feature | Map.Feature[] | 'all'; + setDefaultLayer(layer: TileLayer): void; + setPitch(pitch: number): void; + getPitch(): number; + getViewMode_(): Map.ViewMode; + lngLatToGeodeticCoord(lnglat: LocationValue): Pixel; + geodeticCoordToLngLat(pixel: Pixel): LngLat; + } +} diff --git a/types/amap-js-api/overlay/bezierCurve.d.ts b/types/amap-js-api/overlay/bezierCurve.d.ts new file mode 100644 index 0000000000..5778cb72a6 --- /dev/null +++ b/types/amap-js-api/overlay/bezierCurve.d.ts @@ -0,0 +1,22 @@ +declare namespace AMap { + namespace BezierCurve { + interface EventMap extends Polyline.EventMap { } + type Options = Merge, { + // internal + path: Array>>; + tolerance?: number; + interpolateNumLimit?: [number | number]; + }>; + + interface GetOptionsResult extends Polyline.GetOptionsResult { + path: Array; + } + } + class BezierCurve extends Polyline { + constructor(options: BezierCurve.Options); + getOptions(): Partial>; + // internal + getInterpolateLngLats(): LngLat[]; + getSerializedPath(): number[][]; + } +} diff --git a/types/amap-js-api/overlay/circle.d.ts b/types/amap-js-api/overlay/circle.d.ts new file mode 100644 index 0000000000..2a1cbd9020 --- /dev/null +++ b/types/amap-js-api/overlay/circle.d.ts @@ -0,0 +1,49 @@ +declare namespace AMap { + namespace Circle { + interface EventMap extends ShapeOverlay.EventMap { + setCenter: Event<'setCenter'>; + setRadius: Event<'setRadius'>; + } + + interface Options { + map?: Map; + zIndex?: number; + center?: LocationValue; + bubble?: boolean; + cursor?: string; + radius?: number; + strokeColor?: string; + strokeOpcity?: number; + strokeWeight?: number; + fillColor?: string; + fillOpacity?: number; + strokeStyle?: StrokeStyle; + extData?: ExtraData; + strokeDasharray?: number[]; + + // internal + visible?: boolean; + unit?: 'meter' | 'px'; // 'might be typo' + } + + type GetOptionsResult = Merge, { + path: LngLat[]; + center: LngLat; + radius: number; + }>; + } + + class Circle extends ShapeOverlay { + constructor(options?: Circle.Options); + setCenter(center: LocationValue, preventEvent?: boolean): void; + getCenter(): LngLat | undefined; + getBounds(): Bounds | null; + setRadius(radius: number, preventEvent?: boolean): void; + getRadius(): number; + setOptions(options?: Circle.Options): void; + getOptions(): Partial>; + contains(point: LocationValue): boolean; + // internal + getPath(count?: number): LngLat[]; + } +} diff --git a/types/amap-js-api/overlay/circleMarker.d.ts b/types/amap-js-api/overlay/circleMarker.d.ts new file mode 100644 index 0000000000..13e4162f46 --- /dev/null +++ b/types/amap-js-api/overlay/circleMarker.d.ts @@ -0,0 +1,4 @@ +declare namespace AMap { + // tslint:disable-next-line; + class CircleMarker extends Circle {} +} diff --git a/types/amap-js-api/overlay/contextMenu.d.ts b/types/amap-js-api/overlay/contextMenu.d.ts new file mode 100644 index 0000000000..72c7fc2852 --- /dev/null +++ b/types/amap-js-api/overlay/contextMenu.d.ts @@ -0,0 +1,23 @@ +declare namespace AMap { + namespace ContextMenu { + interface Options { + content?: string | HTMLElement; + // internal + visible?: boolean; + } + + interface EventMap { + items: Event<'items'>; + open: Event<'open', { target: I }>; + close: Event<'close', { target: I }>; + } + } + + class ContextMenu extends Overlay { + constructor(options?: ContextMenu.Options); + addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void; + removeItem(test: string, fn: (this: HTMLLIElement) => void): void; + open(map: Map, position: LocationValue): void; + close(): void; + } +} diff --git a/types/amap-js-api/overlay/ellipse.d.ts b/types/amap-js-api/overlay/ellipse.d.ts new file mode 100644 index 0000000000..55feaf3112 --- /dev/null +++ b/types/amap-js-api/overlay/ellipse.d.ts @@ -0,0 +1,27 @@ +declare namespace AMap { + namespace Ellipse { + interface EventMap extends ShapeOverlay.EventMap { + setPath: Event<'setPath'>; + setCenter: Event<'setCenter'>; + } + + interface Options extends Polygon.Options { + center?: LocationValue; + radius?: [number, number]; + } + type GetOptionsResult = Merge, { + radius: [number, number]; + }>; + } + + class Ellipse extends Polygon { + constructor(options?: Ellipse.Options); + getCenter(): LngLat | undefined; + setCenter(center: LocationValue, preventEvent?: boolean): void; + setOptions(options: Ellipse.Options): void; + + // internal + setRadius(radius: [number, number], preventEvent?: boolean): void; + getRadius(): [number, number]; + } +} diff --git a/types/amap-js-api/overlay/geoJSON.d.ts b/types/amap-js-api/overlay/geoJSON.d.ts new file mode 100644 index 0000000000..75098a59f0 --- /dev/null +++ b/types/amap-js-api/overlay/geoJSON.d.ts @@ -0,0 +1,43 @@ +declare namespace AMap { + namespace GeoJSON { + type Geometry = { + type: 'Point'; + coordinates: [number, number]; + } | { + type: 'MultiPoint' | 'LineString' | 'Polygon'; + coordinates: Array<[number, number]>; + } | { + type: 'MultiLineString' | 'MultiPolygon'; + coordinates: Array>; + } | { + type: 'GeometryCollection'; + geometries: Geometry[]; + }; + + type GeoJSONObject = { + type: 'Feature'; + properties: any; + geometry: Geometry; + } | { + type: 'FeatureCollection', + properties: any; + features: GeoJSONObject[]; + }; + interface Options { + geoJSON?: GeoJSONObject | GeoJSONObject[]; + getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker; + getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline; + getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon; + coordsToLatLng?(lnglat: LngLat): LngLat; + + // internal + coordsToLatLngs?(lnglats: LngLat[]): LngLat[]; + } + } + + class GeoJSON extends OverlayGroup { + constructor(options?: GeoJSON.Options); + importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void; + toGeoJSON(): GeoJSON.GeoJSONObject[]; + } +} diff --git a/types/amap-js-api/overlay/icon.d.ts b/types/amap-js-api/overlay/icon.d.ts new file mode 100644 index 0000000000..be300feef3 --- /dev/null +++ b/types/amap-js-api/overlay/icon.d.ts @@ -0,0 +1,16 @@ +declare namespace AMap { + namespace Icon { + interface Options { + size?: SizeValue; + imageOffset?: Pixel; + image?: string; + imageSize?: SizeValue; + } + } + + class Icon extends EventEmitter { + constructor(options?: Icon.Options); + setImageSize(size: SizeValue): void; + getImageSize(): Size; + } +} diff --git a/types/amap-js-api/overlay/infoWindow.d.ts b/types/amap-js-api/overlay/infoWindow.d.ts new file mode 100644 index 0000000000..54bedd95a8 --- /dev/null +++ b/types/amap-js-api/overlay/infoWindow.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace InfoWindow { + interface EventMap { + change: Event<'change', { target: I }>; + open: Event<'open', { target: I }>; + close: Event<'close', { target: I }>; + } + + interface Options extends Overlay.Options { + isCustom?: boolean; + autoMove?: boolean; + closeWhenClickMap?: boolean; + content?: string | HTMLElement; + size?: SizeValue; + offset?: Pixel; + position?: LocationValue; + showShadow?: boolean; + // internal + height?: number; + } + } + + class InfoWindow extends Overlay { + constructor(options?: InfoWindow.Options); + open(map: Map, position?: LocationValue): void; + close(): void; + getIsOpen(): boolean; + setContent(content: string | HTMLElement): void; + getContent(): string | HTMLElement | undefined; + setPosition(lnglat: LocationValue): void; + getPosition(): LngLat | undefined; + setSize(size: SizeValue): void; + getSize(): Size | undefined; + // internal + setOffset(offset: Pixel): void; + } +} diff --git a/types/amap-js-api/overlay/marker.d.ts b/types/amap-js-api/overlay/marker.d.ts new file mode 100644 index 0000000000..e24ce7be8f --- /dev/null +++ b/types/amap-js-api/overlay/marker.d.ts @@ -0,0 +1,103 @@ +declare namespace AMap { + namespace Marker { + interface EventMap { + click: MapsEvent<'click', I>; + dblclick: MapsEvent<'dblclick', I>; + rightclick: MapsEvent<'rightclick', I>; + mousemove: MapsEvent<'mousemove', I>; + mouseover: MapsEvent<'mouseover', I>; + mouseout: MapsEvent<'mouseout', I>; + mousedown: MapsEvent<'mousedown', I>; + mouseup: MapsEvent<'mouseup', I>; + dragstart: MapsEvent<'dragstart', I>; + dragging: MapsEvent<'dragging', I>; + dragend: MapsEvent<'dragend', I>; + moving: Event<'moving', { passwdPath: LngLat[]; }>; + moveend: Event<'moveend'>; + movealong: Event<'movealong'>; + touchstart: MapsEvent<'touchstart', I>; + touchmove: MapsEvent<'touchmove', I>; + touchend: MapsEvent<'touchend', I>; + } + + interface Label { + content?: string; + offset?: Pixel; + } + + interface Options extends Overlay.Options { + position?: LocationValue; + offset?: Pixel; + icon?: string | Icon; + content?: string | HTMLElement; + topWhenClick?: boolean; + bubble?: boolean; + draggable?: boolean; + raiseOnDrag?: boolean; + cursor?: string; + visible?: boolean; + zIndex?: number; + angle?: number; + autoRotation?: boolean; + animation?: AnimationName; + shadow?: Icon | string; + title?: string; + shape?: MarkerShape; + label?: Label; + zooms?: [number, number]; + + // internal + topWhenMouseOver?: boolean; + height?: number; + } + } + + class Marker extends Overlay { + constructor(options?: Marker.Options); + markOnAMAP(obj?: { name?: string, position?: LocationValue }): void; + getOffset(): Pixel; + setOffset(offset: Pixel): void; + setAnimation(animate: AnimationName, prevent?: boolean): void; + getAnimation(): AnimationName; + setClickable(cilckable: boolean): void; + getClickable(): boolean; + getPosition(): LngLat | undefined; + setPosition(position: LocationValue): void; + setAngle(angle: number): void; + setLabel(label?: Marker.Label): void; + getLabel(): Marker.Label | undefined; + getAngle(): number; + setzIndex(index: number): void; + getzIndex(): number; + setIcon(content: string | Icon): void; + getIcon(): string | Icon | undefined; + setDraggable(draggable: boolean): void; + getDraggable(): boolean; + setCursor(cursor: string): void; + setContent(content: string | HTMLElement): void; + getContent(): string | HTMLElement; + moveAlong( + path: LngLat[], + speed: number, + timingFunction?: (t: number) => number, + circleable?: boolean + ): void; + moveTo( + path: LocationValue, + speed: number, + timingFunction?: (t: number) => number + ): void; + stopMove(): void; + pauseMove(): boolean; + resumeMove(): boolean; + setMap(map: null | Map): void; + setTitle(title: string): void; + getTitle(): string | undefined; + setTop(isTop: boolean): void; + getTop(): boolean; + setShadow(icon?: Icon | string): void; + getShadow(): Icon | undefined | string; + setShape(shape?: MarkerShape): void; + getShape(): MarkerShape | undefined; + } +} diff --git a/types/amap-js-api/overlay/markerShape.d.ts b/types/amap-js-api/overlay/markerShape.d.ts new file mode 100644 index 0000000000..c8efd93850 --- /dev/null +++ b/types/amap-js-api/overlay/markerShape.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + namespace MarkerShape { + interface CircleOptions { + type: 'circle'; + coords: [number, number, number]; + } + interface PolyOptions { + type: 'poly'; + coords: number[]; + } + interface RectOptions { + type: 'rect'; + coords: [number, number, number, number]; + } + type Options = CircleOptions | PolyOptions | RectOptions; + } + + class MarkerShape { + constructor(options: MarkerShape.Options); + } +} diff --git a/types/amap-js-api/overlay/overlay.d.ts b/types/amap-js-api/overlay/overlay.d.ts new file mode 100644 index 0000000000..1726b39c3e --- /dev/null +++ b/types/amap-js-api/overlay/overlay.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace Overlay { + interface EventMap { + touchstart: MapsEvent<'touchstart', I>; + touchmove: MapsEvent<'touchmove', I>; + touchend: MapsEvent<'touchend', I>; + click: MapsEvent<'click', I>; + rightclick: MapsEvent<'rightclick', I>; + dblclick: MapsEvent<'dblclick', I>; + mousemove: MapsEvent<'mousemove', I>; + mouseover: MapsEvent<'mouseover', I>; + mousedown: MapsEvent<'mousedown', I>; + mouseup: MapsEvent<'mouseup', I>; + } + interface Options { + map?: Map; + cursor?: string; + extData?: ExtraData; + bubble?: boolean; + clickable?: boolean; + draggable?: boolean; + } + } + abstract class Overlay extends EventEmitter { + constructor(options?: Overlay.Options); + show(): void; + hide(): void; + getMap(): Map | null | undefined; + setMap(map: Map | null): void; + setExtData(extData: ExtraData): void; + getExtData(): ExtraData | {}; + + // internal + setHeight(height?: number | string): void; + getHeight(): number | string; + } +} diff --git a/types/amap-js-api/overlay/overlayGroup.d.ts b/types/amap-js-api/overlay/overlayGroup.d.ts new file mode 100644 index 0000000000..d397505b04 --- /dev/null +++ b/types/amap-js-api/overlay/overlayGroup.d.ts @@ -0,0 +1,30 @@ +type ReferOverlayOptions = + O extends AMap.BezierCurve ? AMap.BezierCurve.Options + : O extends AMap.Polyline ? AMap.Polyline.Options + : O extends AMap.Circle ? AMap.Circle.Options + : O extends AMap.Ellipse ? AMap.Ellipse.Options + : O extends AMap.Polygon ? AMap.Polygon.Options + : O extends AMap.Text ? AMap.Text.Options + : O extends AMap.Marker ? AMap.Marker.Options + : O extends AMap.Rectangle ? AMap.Rectangle.Options + : any; + +declare namespace AMap { + class OverlayGroup extends Overlay { + constructor(overlays?: O | O[]); + addOverlay(overlay: O | O[]): this; + addOverlays(overlay: O | O[]): this; + getOverlays(): O[]; + hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean; + removeOverlay(overlay: O | O[]): this; + removeOverlays(overlay: O | O[]): this; + clearOverlays(): this; + eachOverlay(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this; + setMap(map: null | Map): this; + setOptions(options: ReferOverlayOptions): this; + show(): this; + hide(): this; + + getOverlay(finder: ((this: null, item: O, index: number, list: O[]) => boolean) | O): O | null; + } +} diff --git a/types/amap-js-api/overlay/pathOverlay.d.ts b/types/amap-js-api/overlay/pathOverlay.d.ts new file mode 100644 index 0000000000..de21aa35a7 --- /dev/null +++ b/types/amap-js-api/overlay/pathOverlay.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace PathOverlay { + interface EventMap extends ShapeOverlay.EventMap { } + interface Options extends Overlay.Options { + visible?: boolean; + zIndex?: number; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + strokeStyle?: StrokeStyle; + strokeDasharray?: number[]; + lineJoin?: StrokeLineJoin; + lineCap?: StrokeLineCap; + } + } + abstract class PathOverlay extends ShapeOverlay { + constructor(options?: PathOverlay.Options); + getBounds(): Bounds | (this extends Rectangle ? undefined : null); + } +} diff --git a/types/amap-js-api/overlay/polygon.d.ts b/types/amap-js-api/overlay/polygon.d.ts new file mode 100644 index 0000000000..8792e0e135 --- /dev/null +++ b/types/amap-js-api/overlay/polygon.d.ts @@ -0,0 +1,32 @@ +declare namespace AMap { + namespace Polygon { + interface EventMap extends PathOverlay.EventMap { } + interface Options extends PathOverlay.Options { + path?: LocationValue[] | LocationValue[][]; + fillColor?: string; + fillOpacity?: number; + } + + interface GetOptionsResult extends ShapeOverlay.GetOptionsResult { + fillColor: string; + fillOpacity: number; + path: LngLat[] | LngLat[][]; + lineJoin: StrokeLineJoin; + texture: string; + } + } + + class Polygon extends PathOverlay { + constructor(options?: Polygon.Options); + setPath(path: LocationValue[] | LocationValue[][]): void; + getPath(): LngLat[] | LngLat[][]; + setOptions(options: Polygon.Options): void; + getOptions(): Partial< + this extends Omit ? Ellipse.GetOptionsResult : + this extends Omit ? Rectangle.GetOptionsResult : + Polygon.GetOptionsResult + >; + getArea(): number; + contains(point: LocationValue): boolean; + } +} diff --git a/types/amap-js-api/overlay/polyline.d.ts b/types/amap-js-api/overlay/polyline.d.ts new file mode 100644 index 0000000000..207279b208 --- /dev/null +++ b/types/amap-js-api/overlay/polyline.d.ts @@ -0,0 +1,46 @@ +declare namespace AMap { + namespace Polyline { + interface EventMap extends PathOverlay.EventMap { } + interface GetOptionsResult extends ShapeOverlay.GetOptionsResult { + isOutline: boolean; + outlineColor: string; + geodesic: boolean; + path: LngLat[]; + lineJoin: StrokeLineJoin; + lineCap: StrokeLineCap; + borderWeight: number; + showDir: boolean; + dirColor: string; + dirImg: string; + } + + interface Options extends PathOverlay.Options { + isOutline?: boolean; + outlineColor?: string; + geodesic?: boolean; + dirColor?: string; + borderWeight?: number; + showDir?: boolean; + // internal + path?: LocationValue[]; + } + } + + class Polyline extends PathOverlay { + constructor(options?: BezierCurve.Options | Polyline.Options); + setPath( + path: this extends Omit ? + Array>> + : LocationValue[] + ): void; + getPath(): this extends Omit ? + Array + : LngLat[]; + getLength(): number; + setOptions(options: this extends Omit ? + Partial> + : Polyline.Options + ): void; + getOptions(): Partial>; + } +} diff --git a/types/amap-js-api/overlay/rectangle.d.ts b/types/amap-js-api/overlay/rectangle.d.ts new file mode 100644 index 0000000000..259e2072de --- /dev/null +++ b/types/amap-js-api/overlay/rectangle.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + namespace Rectangle { + interface EventMap extends Polygon.EventMap { + setBounds: Event<'setBounds'>; + } + + interface Options extends Polygon.Options { + bounds?: Bounds; + } + type GetOptionsResult = Merge, { + path: LngLat[]; + bounds: Bounds; + texture: string; + }>; + } + class Rectangle extends Polygon { + constructor(options?: Rectangle.Options); + setBounds(bounds: Bounds, preventEvent?: boolean): void; + setOptions(options: Partial): void; + } +} diff --git a/types/amap-js-api/overlay/shapeOverlay.d.ts b/types/amap-js-api/overlay/shapeOverlay.d.ts new file mode 100644 index 0000000000..b8f239aac1 --- /dev/null +++ b/types/amap-js-api/overlay/shapeOverlay.d.ts @@ -0,0 +1,30 @@ +declare namespace AMap { + namespace ShapeOverlay { + interface EventMap extends Overlay.EventMap { + show: Event<'show', { target: I }>; + hide: Event<'hide', { target: I }>; + options: Event<'options'>; + change: Event<'change', { target: I }>; + } + interface GetOptionsResult { + map: Map; + zIndex: number; + strokeColor: string; + strokeOpacity: number; + strokeWeight: number; + strokeStyle: StrokeStyle; + strokeDasharray: number[]; + extData: ExtraData | {}; + bubble: boolean; + clickable: boolean; + } + } + abstract class ShapeOverlay extends Overlay { + abstract setOptions(options: {}): void; + abstract getOptions(): {}; + getzIndex(): number; + setzIndex(zIndex: number): void; + getVisible(): boolean; + setDraggable(draggable: boolean): void; + } +} diff --git a/types/amap-js-api/overlay/text.d.ts b/types/amap-js-api/overlay/text.d.ts new file mode 100644 index 0000000000..db15ae08ce --- /dev/null +++ b/types/amap-js-api/overlay/text.d.ts @@ -0,0 +1,19 @@ +declare namespace AMap { + namespace Text { + type TextAlign = 'left' | 'right' | 'center'; + type VerticalAlign = 'top' | 'middle' | 'bottom'; + interface EventMap extends Marker.EventMap { } + interface Options extends Marker.Options { + text?: string; + textAlign?: TextAlign; + verticalAlign?: VerticalAlign; + } + } + + class Text extends Marker { + constructor(options?: Text.Options); + getText(): string; + setText(text: string): void; + setStyle(style: object): void; + } +} diff --git a/types/amap-js-api/pixel.d.ts b/types/amap-js-api/pixel.d.ts new file mode 100644 index 0000000000..fab4605b7a --- /dev/null +++ b/types/amap-js-api/pixel.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + class Pixel { + constructor(x: number, y: number, round?: boolean); + getX(): number; + getY(): number; + equals(point: Pixel): boolean; + toString(): string; + + // internal + add(offset: {x: number; y: number}, round?: boolean): Pixel; + round(): Pixel; + floor(): Pixel; + length(): number; + direction(): null | number; + toFixed(decimals?: number): this; + } +} diff --git a/types/amap-js-api/size.d.ts b/types/amap-js-api/size.d.ts new file mode 100644 index 0000000000..12a1e25423 --- /dev/null +++ b/types/amap-js-api/size.d.ts @@ -0,0 +1,10 @@ +declare namespace AMap { + class Size { + constructor(width: number, height: number); + getWidth(): number; + getHeight(): number; + toString(): string; + // internal + contains(size: { x: number; y: number }): boolean; + } +} diff --git a/types/amap-js-api/test/arryBounds.ts b/types/amap-js-api/test/arryBounds.ts new file mode 100644 index 0000000000..1ccc4d0488 --- /dev/null +++ b/types/amap-js-api/test/arryBounds.ts @@ -0,0 +1,18 @@ +import { + lnglat +} from './preset'; + +// $ExpectType ArrayBounds +const arrayBounds = new AMap.ArrayBounds([lnglat, lnglat, lnglat]); + +// $ExpectType LngLat[] +arrayBounds.bounds; + +// $ExpectType boolean +arrayBounds.contains(lnglat); + +// $ExpectType Bounds +arrayBounds.toBounds(); + +// $ExpectType LngLat +arrayBounds.getCenter(); diff --git a/types/amap-js-api/test/bounds.ts b/types/amap-js-api/test/bounds.ts new file mode 100644 index 0000000000..d22ba697f9 --- /dev/null +++ b/types/amap-js-api/test/bounds.ts @@ -0,0 +1,30 @@ +import { + lnglat, + lnglatTuple +} from './preset'; + +// $ExpectType Bounds +const bounds = new AMap.Bounds(lnglat, lnglat); + +// $ExpectType boolean +bounds.contains(lnglat); +// $ExpectType boolean +bounds.contains(lnglatTuple); + +// $ExpectType LngLat +bounds.getCenter(); + +// $ExpectType LngLat +bounds.getSouthWest(); + +// $ExpectType LngLat +bounds.getSouthEast(); + +// $ExpectType LngLat +bounds.getNorthEast(); + +// $ExpectType LngLat +bounds.getNorthWest(); + +// $ExpectType string +bounds.toString(); diff --git a/types/amap-js-api/test/browser.ts b/types/amap-js-api/test/browser.ts new file mode 100644 index 0000000000..b80d8cd3ff --- /dev/null +++ b/types/amap-js-api/test/browser.ts @@ -0,0 +1,141 @@ +const brwoser = AMap.Browser; + +// $ExpectType string +brwoser.ua; + +// $ExpectType boolean +brwoser.mobile; + +const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other' = brwoser.plat; + +// $ExpectType boolean +brwoser.mac; + +// $ExpectType boolean +brwoser.windows; + +// $ExpectType boolean +brwoser.ios; + +// $ExpectType boolean +brwoser.iPad; + +// $ExpectType boolean +brwoser.iPhone; + +// $ExpectType boolean +brwoser.android; + +// $ExpectType boolean +brwoser.android23; + +// $ExpectType boolean +brwoser.chrome; + +// $ExpectType boolean +brwoser.firefox; + +// $ExpectType boolean +brwoser.safari; + +// $ExpectType boolean +brwoser.wechat; + +// $ExpectType boolean +brwoser.uc; + +// $ExpectType boolean +brwoser.qq; + +// $ExpectType boolean +brwoser.ie; + +// $ExpectType boolean +brwoser.ie6; + +// $ExpectType boolean +brwoser.ie7; + +// $ExpectType boolean +brwoser.ie8; + +// $ExpectType boolean +brwoser.ie9; + +// $ExpectType boolean +brwoser.ie10; + +// $ExpectType boolean +brwoser.ie11; + +// $ExpectType boolean +brwoser.edge; + +// $ExpectType boolean +brwoser.ielt9; + +// $ExpectType boolean +brwoser.baidu; + +// $ExpectType boolean +brwoser.isLocalStorage; + +// $ExpectType boolean +brwoser.isGeolocation; + +// $ExpectType boolean +brwoser.mobileWebkit; + +// $ExpectType boolean +brwoser.mobileWebkit3d; + +// $ExpectType boolean +brwoser.mobileOpera; + +// $ExpectType boolean +brwoser.retina; + +// $ExpectType boolean +brwoser.touch; + +// $ExpectType boolean +brwoser.msPointer; + +// $ExpectType boolean +brwoser.pointer; + +// $ExpectType boolean +brwoser.webkit; + +// $ExpectType boolean +brwoser.ie3d; + +// $ExpectType boolean +brwoser.webkit3d; + +// $ExpectType boolean +brwoser.gecko3d; + +// $ExpectType boolean +brwoser.opera3d; + +// $ExpectType boolean +brwoser.any3d; + +// $ExpectType boolean +brwoser.isCanvas; + +// $ExpectType boolean +brwoser.isSvg; + +// $ExpectType boolean +brwoser.isVML; + +// $ExpectType boolean +brwoser.isWorker; + +// $ExpectType boolean +brwoser.isWebsocket; + +// $ExpectType boolean +brwoser.isWebGL(); diff --git a/types/amap-js-api/test/convert-from.ts b/types/amap-js-api/test/convert-from.ts new file mode 100644 index 0000000000..8cb9b8502c --- /dev/null +++ b/types/amap-js-api/test/convert-from.ts @@ -0,0 +1,25 @@ +import { + lnglat, + lnglatTuple +} from './preset'; + +declare const convertType: 'baidu' | 'mapbar' | 'gps' | null; +// $ExpectType void +AMap.convertFrom(lnglat, convertType, (status, result) => { + const temp: 'complete' | 'error' = status; + if (typeof result !== 'string') { + // $ExpectType string + result.info; + // $ExpectType LngLat[] + result.locations; + } else { + // $ExpectType string + result; + } +}); +// $ExpectType void +AMap.convertFrom([lnglat], null, () => { }); +// $ExpectType void +AMap.convertFrom(lnglatTuple, null, () => { }); +// $ExpectType void +AMap.convertFrom([lnglatTuple], null, () => { }); diff --git a/types/amap-js-api/test/dom-util.ts b/types/amap-js-api/test/dom-util.ts new file mode 100644 index 0000000000..6cb0bce511 --- /dev/null +++ b/types/amap-js-api/test/dom-util.ts @@ -0,0 +1,47 @@ +import { div } from './preset'; + +const util = AMap.DomUtil; + +// $ExpectType Size +util.getViewport(div); + +// $ExpectType Pixel +util.getViewportOffset(div); + +// $ExpectType HTMLDivElement +util.create('div'); +// $ExpectType HTMLAnchorElement +util.create('a'); +// $ExpectType HTMLDivElement +util.create('div', div); +// $ExpectType HTMLDivElement +util.create('div', div, 'className'); + +// $ExpectType void +util.setClass(div); +// $ExpectType void +util.setClass(div, 'className'); + +// $ExpectType boolean +util.hasClass(div, 'className'); + +// $ExpectType void +util.removeClass(div, 'className'); + +// $ExpectType void +util.setOpacity(div, 1); + +// $ExpectType void +util.rotate(div, 10); +// $ExpectType void +util.rotate(div, 10, { x: 10, y: 10 }); + +const util2: typeof AMap.DomUtil = util.setCss(div, { textAlign: 'left' }); +// $ExpectError +util.setCss(div, { textAlign: 10 }); + +// $ExpectType void +util.empty(div); + +// $ExpectType void +util.remove(div); diff --git a/types/amap-js-api/test/event.ts b/types/amap-js-api/test/event.ts new file mode 100644 index 0000000000..8678045158 --- /dev/null +++ b/types/amap-js-api/test/event.ts @@ -0,0 +1,75 @@ +import { + lnglat, + pixel, + map +} from './preset'; +declare var div: HTMLDivElement; +declare var input: HTMLInputElement; + +// $ExpectType Map +map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; +}); + +// $ExpectType EventListener<0> +AMap.event.addDomListener(div, 'click', event => { + // $ExpectType number + event.clientX; +}); + +// $ExpectType EventListener<1> +AMap.event.addListener(map, 'hotspotclick', function (event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); +AMap.event.addListener(map, 'click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); + +// $ExpectType EventListener<1> +AMap.event.addListenerOnce(map, 'hotspotclick', function (event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); + +declare const eventListener: AMap.event.EventListener<0>; +// $ExpectType void +AMap.event.removeListener(eventListener); + +// $ExpectType void +AMap.event.trigger(map, 'click', { + lnglat, + pixel, + target: map +}); +// $ExpectType void +AMap.event.trigger(map, 'hotspotclick', { + lnglat, + name: 'name', + id: 'id', + isIndoorPOI: true +}); +// $ExpectType void +AMap.event.trigger(map, 'complete'); diff --git a/types/amap-js-api/test/geometry-util.ts b/types/amap-js-api/test/geometry-util.ts new file mode 100644 index 0000000000..98a8263fb0 --- /dev/null +++ b/types/amap-js-api/test/geometry-util.ts @@ -0,0 +1,158 @@ +import { + lnglat as point, + lnglatTuple as pointTuple +} from './preset'; + +const line = [point]; +const lineTuple = [pointTuple]; +const ring = [point]; +const ringTuple = [pointTuple]; +const polygon = [ring]; +const polygonTuple = [ringTuple]; +const util = AMap.GeometryUtil; + +// $ExpectType number +util.distance(point, point); +// $ExpectType number +util.distance(pointTuple, pointTuple); +// $ExpectType number +util.distance(point, line); +// $ExpectType number +util.distance(pointTuple, lineTuple); + +// $ExpectType number +util.ringArea(ring); +// $ExpectType number +util.ringArea(ringTuple); + +// $ExpectType boolean +util.isClockwise(ring); +// $ExpectType boolean +util.isClockwise(ringTuple); + +// $ExpectType number +util.distanceOfLine(line); +// $ExpectType number +util.distanceOfLine(lineTuple); + +// $ExpectType [number, number][] +util.ringRingClip(ring, ring); +// $ExpectType [number, number][] +util.ringRingClip(ringTuple, ringTuple); + +// $ExpectType boolean +util.doesRingRingIntersect(ring, ring); +// $ExpectType boolean +util.doesRingRingIntersect(ringTuple, ringTuple); + +// $ExpectType boolean +util.doesLineRingIntersect(line, ring); +// $ExpectType boolean +util.doesLineRingIntersect(lineTuple, ringTuple); + +// $ExpectType boolean +util.doesLineLineIntersect(line, line); +// $ExpectType boolean +util.doesLineLineIntersect(lineTuple, lineTuple); + +// $ExpectType boolean +util.doesSegmentPolygonIntersect(point, point, polygon); +// $ExpectType boolean +util.doesSegmentPolygonIntersect(pointTuple, pointTuple, polygonTuple); + +// $ExpectType boolean +util.doesSegmentRingIntersect(point, point, ring); +// $ExpectType boolean +util.doesSegmentRingIntersect(pointTuple, pointTuple, ringTuple); + +// $ExpectType boolean +util.doesSegmentLineIntersect(point, point, line); +// $ExpectType boolean +util.doesSegmentLineIntersect(pointTuple, pointTuple, lineTuple); + +// $ExpectType boolean +util.doesSegmentsIntersect(point, point, point, point); +// $ExpectType boolean +util.doesSegmentsIntersect(pointTuple, pointTuple, pointTuple, pointTuple); + +// $ExpectType boolean +util.isPointInRing(point, ring); +// $ExpectType boolean +util.isPointInRing(pointTuple, ringTuple); + +// $ExpectType boolean +util.isRingInRing(ring, ring); +// $ExpectType boolean +util.isRingInRing(ringTuple, ringTuple); + +// $ExpectType boolean +util.isPointInPolygon(point, polygon); +// $ExpectType boolean +util.isPointInPolygon(pointTuple, polygonTuple); + +// $ExpectType [number, number][] +util.makesureClockwise(lineTuple); + +// $ExpectType [number, number][] +util.makesureAntiClockwise(lineTuple); + +// $ExpectType [number, number] +util.closestOnSegment(point, point, point); +// $ExpectType [number, number] +util.closestOnSegment(pointTuple, pointTuple, pointTuple); + +// $ExpectType [number, number] +util.closestOnSegment(point, point, point); +// $ExpectType [number, number] +util.closestOnSegment(pointTuple, pointTuple, pointTuple); + +// $ExpectType [number, number] +util.closestOnLine(point, line); +// $ExpectType [number, number] +util.closestOnLine(pointTuple, lineTuple); + +// $ExpectType number +util.distanceToSegment(point, point, point); +// $ExpectType number +util.distanceToSegment(pointTuple, pointTuple, pointTuple); + +// $ExpectType number +util.distanceToLine(point, line); +// $ExpectType number +util.distanceToLine(pointTuple, lineTuple); + +// $ExpectType boolean +util.isPointOnSegment(point, point, point); +// $ExpectType boolean +util.isPointOnSegment(point, point, point, 1); +// $ExpectType boolean +util.isPointOnSegment(pointTuple, pointTuple, pointTuple); +// $ExpectType boolean +util.isPointOnSegment(pointTuple, pointTuple, pointTuple, 1); + +// $ExpectType boolean +util.isPointOnLine(point, line); +// $ExpectType boolean +util.isPointOnLine(point, line, 1); +// $ExpectType boolean +util.isPointOnLine(pointTuple, lineTuple); +// $ExpectType boolean +util.isPointOnLine(pointTuple, lineTuple, 1); + +// $ExpectType boolean +util.isPointOnRing(point, ring); +// $ExpectType boolean +util.isPointOnRing(point, ring, 1); +// $ExpectType boolean +util.isPointOnRing(pointTuple, ringTuple); +// $ExpectType boolean +util.isPointOnRing(pointTuple, ringTuple, 1); + +// $ExpectType boolean +util.isPointOnPolygon(point, polygon); +// $ExpectType boolean +util.isPointOnPolygon(point, polygon, 1); +// $ExpectType boolean +util.isPointOnPolygon(pointTuple, polygonTuple); +// $ExpectType boolean +util.isPointOnPolygon(pointTuple, polygonTuple, 1); diff --git a/types/amap-js-api/test/layer/buildings.ts b/types/amap-js-api/test/layer/buildings.ts new file mode 100644 index 0000000000..209b3c490b --- /dev/null +++ b/types/amap-js-api/test/layer/buildings.ts @@ -0,0 +1,40 @@ +declare var map: AMap.Map; +declare var lnglat: AMap.LngLat; + +// $ExpectType Buildings +var buildings = new AMap.Buildings(); +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +new AMap.Buildings({ + zooms: [1, 18], + opacity: 0.8, + heightFactor: 1, + visible: true, + zIndex: 10, + map +}); + +buildings.setStyle({ + hideWithoutStyle: false, + areas: [ + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [[1, 2]] + }, + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [lnglat] + }, + { + color1: 'ff99ff00', + path: [lnglat] + }, + ] +}); diff --git a/types/amap-js-api/test/layer/canvasLayer.ts b/types/amap-js-api/test/layer/canvasLayer.ts new file mode 100644 index 0000000000..577d032b2c --- /dev/null +++ b/types/amap-js-api/test/layer/canvasLayer.ts @@ -0,0 +1,53 @@ +import { + map, + bounds +} from '../preset'; + +declare const canvas: HTMLCanvasElement; + +// $ExpectType CanvasLayer +new AMap.CanvasLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType CanvasLayer +new AMap.CanvasLayer(); +// $ExpectType CanvasLayer +new AMap.CanvasLayer({}); +// $ExpectType CanvasLayer +const canvasLayer = new AMap.CanvasLayer({ + bounds +}); + +// $ExpectType void +canvasLayer.setMap(null); +// $ExpectType void +canvasLayer.setMap(map); + +// $ExpectType Map | null | undefined +canvasLayer.getMap(); + +// $ExpectType void +canvasLayer.show(); + +// $ExpectType void +canvasLayer.hide(); + +// $ExpectType number +canvasLayer.getzIndex(); + +// $ExpectType void +canvasLayer.setzIndex(10); + +// $ExpectType HTMLCanvasElement | null +canvasLayer.getElement(); + +// $ExpectType void +canvasLayer.setCanvas(canvas); + +// $ExpectType HTMLCanvasElement | undefined +canvasLayer.getCanvas(); diff --git a/types/amap-js-api/test/layer/flexible.ts b/types/amap-js-api/test/layer/flexible.ts new file mode 100644 index 0000000000..5a0e3f7aa7 --- /dev/null +++ b/types/amap-js-api/test/layer/flexible.ts @@ -0,0 +1,54 @@ +import { + map +} from '../preset'; + +const img = document.createElement('img'); +const canvas = document.createElement('canvas'); + +// $ExpectType Flexible +new AMap.TileLayer.Flexible(); +// $ExpectType Flexible +new AMap.TileLayer.Flexible({}); +// $ExpectType Flexible +const flexible = new AMap.TileLayer.Flexible({ + createTile(x, y, z, success, fail) { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + z; + // $ExpectType void + success(img); + // $ExpectType void + success(canvas); + // $ExpectType void + fail(); + }, + cacheSize: 10, + opacity: 1, + visible: true, + map, + zIndex: 1, + zooms: [1, 2] +}); + +// $ExpectType void +flexible.setMap(null); +// $ExpectType void +flexible.setMap(map); + +// $ExpectType Map | null | undefined +flexible.getMap(); + +// $ExpectType void +flexible.show(); + +// $ExpectType void +flexible.hide(); + +// $ExpectType void +flexible.setzIndex(10); + +// $ExpectType number +flexible.getzIndex(); diff --git a/types/amap-js-api/test/layer/imageLayer.ts b/types/amap-js-api/test/layer/imageLayer.ts new file mode 100644 index 0000000000..06b9fc076e --- /dev/null +++ b/types/amap-js-api/test/layer/imageLayer.ts @@ -0,0 +1,51 @@ +import { + map, + bounds +} from '../preset'; + +// $ExpectType ImageLayer +new AMap.ImageLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType ImageLayer +new AMap.ImageLayer(); +// $ExpectType ImageLayer +new AMap.ImageLayer({}); +// $ExpectType ImageLayer +const imageLayer = new AMap.ImageLayer({ + bounds +}); + +// $ExpectType void +imageLayer.setMap(null); +// $ExpectType void +imageLayer.setMap(map); + +// $ExpectType Map | null | undefined +imageLayer.getMap(); + +// $ExpectType void +imageLayer.show(); + +// $ExpectType void +imageLayer.hide(); + +// $ExpectType number +imageLayer.getzIndex(); + +// $ExpectType void +imageLayer.setzIndex(10); + +// $ExpectType HTMLImageElement | null +imageLayer.getElement(); + +// $ExpectType void +imageLayer.setImageUrl('url'); + +// $ExpectType string | undefined +imageLayer.getImageUrl(); diff --git a/types/amap-js-api/test/layer/layer.ts b/types/amap-js-api/test/layer/layer.ts new file mode 100644 index 0000000000..921c90e52d --- /dev/null +++ b/types/amap-js-api/test/layer/layer.ts @@ -0,0 +1,34 @@ +declare var layer: AMap.Layer; +declare var map: AMap.Map; + +// $ExpectError +new AMap.Layer(); + +// $ExpectType HTMLDivElement | undefined +layer.getContainer(); + +// $ExpectType [number, number] +layer.getZooms(); + +// $ExpectType void +layer.setOpacity(1); + +// $ExpectType number +layer.getOpacity(); + +// $ExpectType void +layer.show(); + +// $ExpectType void +layer.hide(); + +// $ExpectType void +layer.setMap(); +// $ExpectType void +layer.setMap(map); + +// $ExpectType void +layer.setzIndex(1); + +// $ExpectType number +layer.getzIndex(); diff --git a/types/amap-js-api/test/layer/layerGroup.ts b/types/amap-js-api/test/layer/layerGroup.ts new file mode 100644 index 0000000000..bcad7d6f50 --- /dev/null +++ b/types/amap-js-api/test/layer/layerGroup.ts @@ -0,0 +1,115 @@ +declare var map: AMap.Map; +declare var tileLayer: AMap.TileLayer; +declare var massMarksLayer: AMap.MassMarks; +declare var layer: AMap.Layer; + +// $ExpectError +new AMap.LayerGroup(); + +// $ExpectType LayerGroup +new AMap.LayerGroup(tileLayer); +// $ExpectType LayerGroup +new AMap.LayerGroup([tileLayer]); + +declare var layerGruop: AMap.LayerGroup; + +// $ExpectType LayerGroup +layerGruop.addLayer(tileLayer); +// $ExpectType LayerGroup +layerGruop.addLayer([tileLayer]); +// $ExpectError +layerGruop.addLayer(massMarksLayer); + +// $ExpectType TileLayer[] +layerGruop.getLayers(); + +// $ExpectType TileLayer | null +layerGruop.getLayer(function (item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); + +layerGruop.hasLayer(function (item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); +layerGruop.hasLayer(tileLayer); + +// $ExpectType LayerGroup +layerGruop.removeLayer(tileLayer); +// $ExpectType LayerGroup +layerGruop.removeLayer([tileLayer]); + +// $ExpectType LayerGroup +layerGruop.clearLayers(); + +layerGruop.eachLayer(function (item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType TileLayer + this; +}); +layerGruop.eachLayer(function (item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType LayerGroup +layerGruop.setMap(map); + +// $ExpectType LayerGroup +layerGruop.hide(); + +// $ExpectType LayerGroup +layerGruop.show(); + +// $ExpectType LayerGroup +layerGruop.reload(); + +// $ExpectType LayerGroup +layerGruop.setOptions({}); + +// $ExpectType LayerGroup +layerGruop.setOptions({ + tileSize: 256 +}); +// layerGruop.setOptions({ +// // $ExpectError +// interval: 1 +// }); + +declare var layerGroup2: AMap.LayerGroup; + +layerGroup2.addLayer(tileLayer); + +layerGroup2.addLayer(massMarksLayer); + +layerGroup2.setOptions({ + test: 1 +}); diff --git a/types/amap-js-api/test/layer/massMarks.ts b/types/amap-js-api/test/layer/massMarks.ts new file mode 100644 index 0000000000..5f4bfbf455 --- /dev/null +++ b/types/amap-js-api/test/layer/massMarks.ts @@ -0,0 +1,83 @@ +declare var pixel: AMap.Pixel; +declare var size: AMap.Size; +declare var lnglat: AMap.LngLat; +var massMarksStyle1 = { + anchor: pixel, + url: '', + size, + rotation: 1 +}; +var massMarksStyle2 = { + anchor: pixel, + url: '', + size +}; +var massMarksData1 = { + lnglat +}; + +interface CustomData extends AMap.MassMarks.Data { + name: string; + id: string; +} +var massMarksCustomData: CustomData = { + lnglat: [1, 2], + style: 1, + name: '', + id: '' +}; + +// $ExpectError +new AMap.MassMarks(); +// $ExpectError +new AMap.MassMarks([], {}); + +new AMap.MassMarks([], { + style: [massMarksStyle1, massMarksStyle2] +}); +new AMap.MassMarks([massMarksData1], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType MassMarks +var massMarks = new AMap.MassMarks([massMarksCustomData], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType void +massMarks.setStyle(massMarksStyle1); +// $ExpectType void +massMarks.setStyle([massMarksStyle1]); + +// $ExpectType Style | Style[] +massMarks.getStyle(); + +// $ExpectType void +massMarks.setData(''); + +// $ExpectError +massMarks.setData(massMarksData1); +// $ExpectError +massMarks.setData(massMarksCustomData); + +var _customData = massMarks.getData()[0]; +// $ExpectType string +_customData.name; +// $ExpectType string +_customData.id; +// $ExpectType LngLat +_customData.lnglat; + +// $ExpectType void +massMarks.clear(); + +massMarks.on('click', (event: AMap.MassMarks.EventMap['click']) => { + // $ExpectType "click" + event.type; + + // $ExpectType CustomData + event.data; + + // $ExpectType MassMarks + event.target; +}); diff --git a/types/amap-js-api/test/layer/tileLayer.ts b/types/amap-js-api/test/layer/tileLayer.ts new file mode 100644 index 0000000000..7e4e2dc2e4 --- /dev/null +++ b/types/amap-js-api/test/layer/tileLayer.ts @@ -0,0 +1,60 @@ +declare var map: AMap.Map; + +// $ExpectType TileLayer +var tileLayer = new AMap.TileLayer(); + +// $ExpectType TileLayer +new AMap.TileLayer({}); + +// $ExpectType TileLayer +new AMap.TileLayer({ + map, + tileSize: 256, + tileUrl: '', + errorUrl: '', + getTileUrl: (x, y, z) => '', + zIndex: 1, + opacity: 0.1, + zooms: [3, 18], + detectRetina: true +}); + +// $ExpectType string[] +tileLayer.getTiles(); + +// $ExpectType void +tileLayer.reload(); + +// $ExpectType void +tileLayer.setTileUrl(''); +// $ExpectType void +tileLayer.setTileUrl((x, y, level) => { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + level; + return ''; +}); + +// Traffic + +// $ExpectType Traffic +let trafficLayer = new AMap.TileLayer.Traffic(); +// $ExpectType Traffic +new AMap.TileLayer.Traffic({}); +// $ExpectType Traffic +new AMap.TileLayer.Traffic({ + autoRefresh: true, + interval: 180 +}); + +// $ExpectType TileLayer +tileLayer.on('complete', () => { }); + +tileLayer.off('complete', () => { }); + +tileLayer.emit('complete'); + +trafficLayer.on('complete', () => { }); diff --git a/types/amap-js-api/test/layer/videoLayer.ts b/types/amap-js-api/test/layer/videoLayer.ts new file mode 100644 index 0000000000..e34718193c --- /dev/null +++ b/types/amap-js-api/test/layer/videoLayer.ts @@ -0,0 +1,51 @@ +import { + map, + bounds +} from '../preset'; + +// $ExpectType VideoLayer +new AMap.VideoLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType VideoLayer +new AMap.VideoLayer(); +// $ExpectType VideoLayer +new AMap.VideoLayer({}); +// $ExpectType VideoLayer +const videoLayer = new AMap.VideoLayer({ + bounds +}); + +// $ExpectType void +videoLayer.setMap(null); +// $ExpectType void +videoLayer.setMap(map); + +// $ExpectType Map | null | undefined +videoLayer.getMap(); + +// $ExpectType void +videoLayer.show(); + +// $ExpectType void +videoLayer.hide(); + +// $ExpectType number +videoLayer.getzIndex(); + +// $ExpectType void +videoLayer.setzIndex(10); + +// $ExpectType HTMLVideoElement | null +videoLayer.getElement(); + +// $ExpectType void +videoLayer.setVideoUrl('url'); + +// $ExpectType string | string[] | undefined +videoLayer.getVideoUrl(); diff --git a/types/amap-js-api/test/layer/wms.ts b/types/amap-js-api/test/layer/wms.ts new file mode 100644 index 0000000000..255affa216 --- /dev/null +++ b/types/amap-js-api/test/layer/wms.ts @@ -0,0 +1,89 @@ +import { + map +} from '../preset'; + +// $ExpectType WMS +new AMap.TileLayer.WMS({ + url: 'url', + params: {} +}); +// $ExpectType WMS +const wms = new AMap.TileLayer.WMS({ + url: 'url', + blend: true, + params: { + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' + }, + zooms: [1, 2], + tileSize: 256, + opacity: 1, + zIndex: 10, + visible: true +}); + +// $ExpectType void +wms.setMap(map); +// $ExpectType void +wms.setMap(null); + +// $ExpectType Map | null | undefined +wms.getMap(); + +// $ExpectType void +wms.show(); + +// $ExpectType void +wms.hide(); + +// $ExpectType void +wms.setzIndex(10); + +// $ExpectType number +wms.getzIndex(); + +// $ExpectType void +wms.setUrl('url'); + +// $ExpectType string +wms.getUrl(); + +// $ExpectType void +wms.setParams({ + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' +}); + +const params = wms.getParams(); +// $ExpectType string | undefined +params.VERSION; +// $ExpectType string | undefined +params.LAYERS; +// $ExpectType string | undefined +params.STYLES; +// $ExpectType string | undefined +params.FORMAT; +// $ExpectType "TRUE" | "FALSE" | undefined +params.TRANSPARENT; +// $ExpectType string | undefined +params.BGCOLOR; +// $ExpectType string | undefined +params.EXCEPTIONS; +// $ExpectType string | undefined +params.TIME; +// $ExpectType string | undefined +params.ELEVATION; diff --git a/types/amap-js-api/test/layer/wmts.ts b/types/amap-js-api/test/layer/wmts.ts new file mode 100644 index 0000000000..bc167c1189 --- /dev/null +++ b/types/amap-js-api/test/layer/wmts.ts @@ -0,0 +1,69 @@ +import { + map +} from '../preset'; + +// $ExpectType WMTS +new AMap.TileLayer.WMTS({ + url: 'url', + params: {} +}); +// $ExpectType WMTS +const wmts = new AMap.TileLayer.WMTS({ + url: 'url', + blend: true, + tileSize: 256, + zooms: [1, 2], + opacity: 1, + zIndex: 10, + visible: true, + params: { + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' + } +}); + +// $ExpectType void +wmts.setMap(map); +// $ExpectType void +wmts.setMap(null); + +// $ExpectType Map | null | undefined +wmts.getMap(); + +// $ExpectType void +wmts.show(); + +// $ExpectType void +wmts.hide(); + +// $ExpectType void +wmts.setzIndex(10); + +// $ExpectType number +wmts.getzIndex(); + +// $ExpectType void +wmts.setUrl('url'); + +// $ExpectType string +wmts.getUrl(); + +// $ExpectType void +wmts.setParams({ + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' +}); + +const params = wmts.getParams(); +// $ExpectType string | undefined +params.Version; +// $ExpectType string | undefined +params.Layer; +// $ExpectType string | undefined +params.Style; +// $ExpectType string | undefined +params.Format; diff --git a/types/amap-js-api/test/lnglat.ts b/types/amap-js-api/test/lnglat.ts new file mode 100644 index 0000000000..92057953ee --- /dev/null +++ b/types/amap-js-api/test/lnglat.ts @@ -0,0 +1,48 @@ +import { + lnglat +} from './preset'; + +// $ExpectType LngLat +new AMap.LngLat(114, 22); +// $ExpectType LngLat +new AMap.LngLat(113, 21); + +// $ExpectType LngLat +lnglat.offset(1, 2); + +// $ExpectType number +lnglat.distance(lnglat); +// $ExpectType number +lnglat.distance([lnglat]); + +// $ExpectType number +lnglat.getLng(); + +// $ExpectType number +lnglat.getLat(); + +// $ExpectType boolean +lnglat.equals(lnglat); + +// $ExpectType string +lnglat.toString(); + +// $ExpectType LngLat +lnglat.add(lnglat); +// $ExpectType LngLat +lnglat.add(lnglat, true); + +// $ExpectType LngLat +lnglat.subtract(lnglat); +// $ExpectType LngLat +lnglat.subtract(lnglat, true); + +// $ExpectType LngLat +lnglat.divideBy(1); +// $ExpectType LngLat +lnglat.divideBy(1, true); + +// $ExpectType LngLat +lnglat.multiplyBy(1); +// $ExpectType LngLat +lnglat.multiplyBy(1, true); diff --git a/types/amap-js-api/test/map.ts b/types/amap-js-api/test/map.ts new file mode 100644 index 0000000000..6f2b027e60 --- /dev/null +++ b/types/amap-js-api/test/map.ts @@ -0,0 +1,338 @@ +import { + lnglat, + bounds, + lnglatTuple, + pixel +} from './preset'; + +declare const container: HTMLDivElement; +declare const tileLayer: AMap.TileLayer; + +// declare var indoorMap: AMap.IndoorMap + +// $ExpectType Map +new AMap.Map('map'); +// $ExpectType Map +new AMap.Map(container); + +// $ExpectType Map +new AMap.Map(container, {}); + +// $ExpectType Map +const map = new AMap.Map(container, { + layers: [tileLayer], + zoom: 15, + center: [1, 2], + labelzIndex: 110, + zooms: [5, 15], + lang: 'zh_cn', + defaultCursor: 'default', + crs: 'EPSG4326', + animateEnable: true, + isHotspot: false, + defaultLayer: tileLayer, + rotateEnable: true, + resizeEnable: true, + showIndoorMap: true, + // indoorMap, // TODO + expandZoomRange: true, + dragEnable: true, + zoomEnable: true, + doubleClickZoom: true, + keyboardEnable: true, + jogEnable: true, + scrollWheel: true, + touchZoom: true, + mapStyle: '', + features: ['road'], + showBuildingBlock: true, + skyColor: '#fff', + preloadMode: true, + mask: [[1, 2], [2, 3], [3, 4]] +}); + +// $ExpectType number +map.getZoom(); + +// $ExpectType Layer[] +map.getLayers(); + +// $ExpectType LngLat +map.getCenter(); + +// $ExpectType HTMLElement | null +map.getContainer(); + +map.getCity(city => { + // $ExpectType string + city.city; + // $ExpectType string + city.citycode; + // $ExpectType string + city.district; + // $ExpectType string | never[] + city.province; +}); + +// $ExpectType Bounds +map.getBounds(); + +// $ExpectType number +map.getLabelzIndex(); + +// $ExpectType Lang +map.getLang(); + +// $ExpectType Size +map.getSize(); + +// $ExpectType number +map.getRotation(); + +// $ExpectType Status +const mapStatus = map.getStatus(); +// $ExpectType boolean +mapStatus.animateEnable; +// $ExpectType boolean +mapStatus.doubleClickZoom; +// $ExpectType boolean +mapStatus.dragEnable; +// $ExpectType boolean +mapStatus.isHotspot; +// $ExpectType boolean +mapStatus.jogEnable; +// $ExpectType boolean +mapStatus.keyboardEnable; +// $ExpectType boolean +mapStatus.pitchEnable; +// $ExpectType boolean +mapStatus.resizeEnable; +// $ExpectType boolean +mapStatus.rotateEnable; +// $ExpectType boolean +mapStatus.scrollWheel; +// $ExpectType boolean +mapStatus.touchZoom; +// $ExpectType boolean +mapStatus.zoomEnable; + +// $ExpectType string +map.getDefaultCursor(); + +// $ExpectType number +map.getResolution(); + +// $ExpectType number +map.getScale(); +// $ExpectType number +map.getScale(1); + +// $ExpectType void +map.setZoom(1); + +// $ExpectType void +map.setLabelzIndex(1); + +// $ExpectType void +map.setLayers([tileLayer]); + +// $ExpectType void +map.setCenter(lnglat); +// $ExpectType void +map.setCenter([1, 2]); + +// $ExpectType void +map.setZoomAndCenter(13, lnglat); +// $ExpectType void +map.setZoomAndCenter(13, [1, 2]); + +// $ExpectType void +map.setCity('city', (coord, zoom) => { + // $ExpectType string + coord[0]; + // $ExpectType string + coord[1]; + // $ExpectType number + zoom; +}); + +// $ExpectType Bounds +map.setBounds(bounds); + +// $ExpectType void +map.setLimitBounds(bounds); + +// $ExpectType void +map.clearLimitBounds(); + +// $ExpectType void +map.setLang('zh_cn'); + +// $ExpectType void +map.setRotation(1); + +// $ExpectType void +map.setStatus({}); +// $ExpectType void +map.setStatus({ + animateEnable: true, + doubleClickZoom: true, + dragEnable: true, + isHotspot: true, + jogEnable: true, + keyboardEnable: true, + pitchEnable: false, + resizeEnable: false, + rotateEnable: false, + scrollWheel: true, + touchZoom: true, + zoomEnable: true +}); + +// $ExpectType void +map.setDefaultCursor('default'); + +// $ExpectType void +map.zoomIn(); + +// $ExpectType void +map.zoomOut(); + +// $ExpectType void +map.panTo([1, 2]); +// $ExpectType void +map.panTo(lnglat); + +// $ExpectType void +map.panBy(1, 2); + +// $ExpectType void +map.clearMap(); + +// $ExpectType Map +map.plugin('plugin name', () => { }); +// $ExpectType Map +map.plugin(['plugin name'], () => { }); + +// $ExpectType void +map.clearInfoWindow(); + +// $ExpectType LngLat +map.pixelToLngLat(pixel); +// $ExpectType LngLat +map.pixelToLngLat(pixel, 1); + +// $ExpectType Pixel +map.lnglatToPixel(lnglat); +// $ExpectType Pixel +map.lnglatToPixel(lnglat, 1); + +// $ExpectType LngLat +map.containerToLngLat(pixel); + +// $ExpectType Pixel +map.lngLatToContainer(lnglat); +// $ExpectType Pixel +map.lnglatTocontainer(lnglat); + +// $ExpectType void +map.setMapStyle(''); +// $ExpectType string +map.getMapStyle(); + +// $ExpectType void +map.setFeatures('all'); +// $ExpectType void +map.setFeatures(['bg']); + +const feature: 'all' | 'bg' | 'point' | 'road' | 'building' | AMap.Map.Feature[] = map.getFeatures(); + +// $ExpectType void +map.setDefaultLayer(tileLayer); + +// $ExpectType void +map.setPitch(1); +// $ExpectType number +map.getPitch(); + +// $ExpectType ViewMode +map.getViewMode_(); + +// $ExpectType Pixel +map.lngLatToGeodeticCoord(lnglat); +// $ExpectType Pixel +map.lngLatToGeodeticCoord(lnglatTuple); + +// $ExpectType LngLat +map.geodeticCoordToLngLat(pixel); + +// $ExpectType void +map.destroy(); + +declare function dblClickHandler(this: AMap.Map, event: AMap.Map.EventMap['dblclick']): void; + +// $ExpectType Map +map.on('click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Pixel + event.pixel; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); +// $ExpectType Map +map.on('dblclick', dblClickHandler); +// $ExpectType Map +map.on('complete', (event: AMap.Map.EventMap['complete']) => { + // $ExpectType "complete" + event.type; + // $ExpectError + event.value; +}); +// $ExpectType Map +map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType string + event.name; + // $ExpectType "hotspotclick" + event.type; +}); +// $ExpectType Map +map.on('custom', (event: AMap.Event<'custom', { test: string }>) => { + // $ExpectType "custom" + event.type; + // $ExpectType string + event.test; +}); + +// $ExpectType Map +map.off('dblclick', dblClickHandler); +// $ExpectType Map +map.off('click', 'mv'); + +// $ExpectType Map +map.emit('click', { + target: map, + lnglat, + pixel +}); + +map.emit('complete'); +// $ExpectType Map +map.emit('hotspotclick', { + lnglat, + name: '123', + id: '123', + isIndoorPOI: true +}); +// $ExpectType Map +map.emit('custom', { + test: 1 +}); +// $ExpectType Map +map.emit('custom', undefined); diff --git a/types/amap-js-api/test/overlay/bezierCurve.ts b/types/amap-js-api/test/overlay/bezierCurve.ts new file mode 100644 index 0000000000..abf0640fc9 --- /dev/null +++ b/types/amap-js-api/test/overlay/bezierCurve.ts @@ -0,0 +1,155 @@ +import { + map, + lnglat +} from '../preset'; + +interface ExtraData { + test: number; +} + +const path = [ + [1, 2, 3, 4], + [1, 2, 3], + [ + [1, 2, 3], + [1, 2] + ], + [1, 2] +]; + +// $ExpectError +new AMap.BezierCurve(); +// $ExpectError +new AMap.BezierCurve({}); +// $ExpectType BezierCurve +const bezierCurve = new AMap.BezierCurve({ + map, + path, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +// $ExpectType void +bezierCurve.setPath(path); + +// $ExpectType void +bezierCurve.setPath(path); + +// $ExpectType void +bezierCurve.setOptions({}); +bezierCurve.setOptions({ + map, + path, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +const options = bezierCurve.getOptions(); + +// $ExpectType number | undefined +options.borderWeight; +// $ExpectType boolean | undefined +options.bubble; +// $ExpectType boolean | undefined +options.clickable; +// $ExpectType string | undefined +options.dirColor; +// $ExpectType string | undefined +options.dirImg; +// $ExpectType {} | ExtraData | undefined +options.extData; +// $ExpectType boolean | undefined +options.geodesic; +// $ExpectType boolean | undefined +options.isOutline; +// $ExpectType "round" | "butt" | "square" | undefined +options.lineCap; +// $ExpectType "miter" | "round" | "bevel" | undefined +options.lineJoin; +// $ExpectType Map | undefined +options.map; +// $ExpectType string | undefined +options.outlineColor; +// $ExpectType (LngLat & { controlPoints: LngLat[]; })[] | undefined +options.path; +// $ExpectType boolean | undefined +options.showDir; +// $ExpectType string | undefined +options.strokeColor; +// $ExpectType number[] | undefined +options.strokeDasharray; +// $ExpectType number | undefined +options.strokeOpacity; +// $ExpectType "dashed" | "solid" | undefined +options.strokeStyle; +// $ExpectType number | undefined +options.strokeWeight; +// $ExpectType number | undefined +options.zIndex; + +// $ExpectType number +bezierCurve.getLength(); + +// $ExpectType Bounds | null +bezierCurve.getBounds(); + +// $ExpectType void +bezierCurve.show(); + +// $ExpectType void +bezierCurve.hide(); + +// $ExpectType void +bezierCurve.setMap(null); +bezierCurve.setMap(map); + +// $ExpectType void +bezierCurve.setExtData({ test: 1 }); +// $ExpectError +bezierCurve.setExtData({ test: '123' }); + +// $ExpectType {} | ExtraData +bezierCurve.getExtData(); + +bezierCurve.on('click', (event: AMap.BezierCurve.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType BezierCurve + event.target; +}); + +bezierCurve.on('show', (event: AMap.BezierCurve.EventMap['show']) => { + // $ExpectType "show" + event.type; + // $ExpectType BezierCurve + event.target; +}); + +bezierCurve.on('options', (event: AMap.BezierCurve.EventMap['options']) => { + // $ExpectType "options" + event.type; + // $ExpectError + event.target; +}); diff --git a/types/amap-js-api/test/overlay/circle.ts b/types/amap-js-api/test/overlay/circle.ts new file mode 100644 index 0000000000..28822b9ec9 --- /dev/null +++ b/types/amap-js-api/test/overlay/circle.ts @@ -0,0 +1,150 @@ +import { + map, + lnglat, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} + +// $ExpectType Circle +new AMap.Circle(); +new AMap.Circle({}); +// $ExpectType Circle +const circle = new AMap.Circle({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +// $ExpectType void +circle.setCenter(lnglat); +// $ExpectType void +circle.setCenter(lnglatTuple); + +// $ExpectType LngLat | undefined +circle.getCenter(); + +// $ExpectType Bounds | null +circle.getBounds(); + +// $ExpectType void +circle.setRadius(100); + +// $ExpectType number +circle.getRadius(); + +// $ExpectType void +circle.setOptions({}); +circle.setOptions({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +const options = circle.getOptions(); +// $ExpectType boolean | undefined +options.bubble; +// $ExpectType LngLat | undefined +options.center; +// $ExpectType boolean | undefined +options.clickable; +// $ExpectType {} | ExtraData | undefined +options.extData; +// $ExpectType string | undefined +options.fillColor; +// $ExpectType number | undefined +options.fillOpacity; +// $ExpectType "miter" | "round" | "bevel" | undefined +options.lineJoin; +// $ExpectType Map | undefined +options.map; +// $ExpectType LngLat[] | undefined +options.path; +// $ExpectType number | undefined +options.radius; +// $ExpectType string | undefined +options.strokeColor; +// $ExpectType number[] | undefined +options.strokeDasharray; +// $ExpectType number | undefined +options.strokeOpacity; +// $ExpectType "dashed" | "solid" | undefined +options.strokeStyle; +// $ExpectType number | undefined +options.strokeWeight; +// $ExpectType string | undefined +options.texture; +// $ExpectType number | undefined +options.zIndex; + +// $ExpectType Bounds | null +circle.getBounds(); + +// $ExpectType void +circle.hide(); + +// $ExpectType void +circle.show(); + +// $ExpectType void +circle.setMap(null); +// $ExpectType void +circle.setMap(map); + +// $ExpectType void +circle.setExtData({ test: 2 }); +// $ExpectError +circle.setExtData({ test: '1' }); + +// $ExpectType {} | ExtraData +circle.getExtData(); + +// $ExpectType boolean +circle.contains(lnglat); +// $ExpectType boolean +circle.contains(lnglatTuple); + +circle.on('click', (event: AMap.Circle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Circle + event.target; +}); + +circle.on('setCenter', (event: AMap.Circle.EventMap['setCenter']) => { + // $ExpectType "setCenter" + event.type; + // $ExpectError + event.target; +}); + +circle.on('change', (event: AMap.Circle.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType Circle + event.target; +}); diff --git a/types/amap-js-api/test/overlay/contextMenu.ts b/types/amap-js-api/test/overlay/contextMenu.ts new file mode 100644 index 0000000000..5c7173d26b --- /dev/null +++ b/types/amap-js-api/test/overlay/contextMenu.ts @@ -0,0 +1,48 @@ +import { + map, + lnglat, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} +// $ExpectType ContextMenu +new AMap.ContextMenu(); +// $ExpectType ContextMenu +new AMap.ContextMenu({}); +// $ExpectType ContextMenu +const contextMenu = new AMap.ContextMenu({ + content: '
content
', +}); + +// $ExpectType void +contextMenu.addItem('item', function () { + // $ExpectType HTMLLIElement + this; +}); +// $ExpectType void +contextMenu.addItem('item', () => { }, 1); + +// $ExpectType void +contextMenu.removeItem('item', () => {}); + +// $ExpectType void +contextMenu.open(map, lnglatTuple); +// $ExpectType void +contextMenu.open(map, lnglat); + +// $ExpectType void +contextMenu.close(); + +contextMenu.on('items', (event: AMap.ContextMenu.EventMap['items']) => { + // $ExpectType "items" + event.type; +}); + +contextMenu.on('open', (event: AMap.ContextMenu.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType ContextMenu + event.target; +}); diff --git a/types/amap-js-api/test/overlay/ellipse.ts b/types/amap-js-api/test/overlay/ellipse.ts new file mode 100644 index 0000000000..c5205d9915 --- /dev/null +++ b/types/amap-js-api/test/overlay/ellipse.ts @@ -0,0 +1,117 @@ +import { + map, + lnglat, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} +// $ExpectType Ellipse +new AMap.Ellipse(); +// $ExpectType Ellipse +new AMap.Ellipse({}); +// $ExpectType Ellipse +const ellipse = new AMap.Ellipse({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType LngLat | undefined +ellipse.getCenter(); + +// $ExpectType void +ellipse.setCenter(lnglat); +// $ExpectType void +ellipse.setCenter(lnglatTuple); + +// $ExpectType Bounds | null +ellipse.getBounds(); + +// $ExpectType void +ellipse.setOptions({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +const options = ellipse.getOptions(); + +// $ExpectType boolean | undefined +options.bubble; +// $ExpectType LngLat | undefined +options.center; +// $ExpectType boolean | undefined +options.clickable; +// $ExpectType {} | ExtraData | undefined +options.extData; +// $ExpectType string | undefined +options.fillColor; +// $ExpectType number | undefined +options.fillOpacity; +// $ExpectType "miter" | "round" | "bevel" | undefined +options.lineJoin; +// $ExpectType Map | undefined +options.map; +// $ExpectType LngLat[] | undefined +options.path; +// $ExpectType [number, number] | undefined +options.radius; +// $ExpectType string | undefined +options.strokeColor; +// $ExpectType number[] | undefined +options.strokeDasharray; +// $ExpectType number | undefined +options.strokeOpacity; +// $ExpectType "dashed" | "solid" | undefined +options.strokeStyle; +// $ExpectType number | undefined +options.strokeWeight; +// $ExpectType string | undefined +options.texture; +// $ExpectType number | undefined +options.zIndex; + +// $ExpectType void +ellipse.hide(); + +// $ExpectType void +ellipse.show(); + +// $ExpectType void +ellipse.setMap(null); +// $ExpectType void +ellipse.setMap(map); + +// $ExpectType void +ellipse.setExtData({test: 2}); +// $ExpectType {} | ExtraData +ellipse.getExtData(); + +// $ExpectType boolean +ellipse.contains(lnglat); +// $ExpectType boolean +ellipse.contains(lnglatTuple); diff --git a/types/amap-js-api/test/overlay/geoJSON.ts b/types/amap-js-api/test/overlay/geoJSON.ts new file mode 100644 index 0000000000..ee8c501472 --- /dev/null +++ b/types/amap-js-api/test/overlay/geoJSON.ts @@ -0,0 +1,106 @@ +import { + map, + lnglatTuple +} from '../preset'; + +declare const marker: AMap.Marker; +declare const polyline: AMap.Polyline; +declare const polygon: AMap.Polygon; + +interface ExtraData { + test: number; +} + +const geoJSONObject: AMap.GeoJSON.GeoJSONObject[] = [ + { + type: 'Feature', + properties: {}, + geometry: { + type: 'Point', + coordinates: lnglatTuple + } + }, + { + type: 'Feature', + properties: { test: 1 }, + geometry: { + type: 'LineString', + coordinates: [lnglatTuple, lnglatTuple] + } + } +]; + +// $ExpectType GeoJSON +new AMap.GeoJSON(); +// $ExpectType GeoJSON +new AMap.GeoJSON({}); +// $ExpectType GeoJSON +const geoJSON = new AMap.GeoJSON({ + geoJSON: geoJSONObject, + getMarker(obj, lnglat) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat + lnglat; + return marker; + }, + getPolyline(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return polyline; + }, + getPolygon(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return polygon; + }, + coordsToLatLng(coord) { + // $ExpectType LngLat + coord; + return coord; + } +}); + +// $ExpectType void +geoJSON.importData(geoJSONObject); + +// $ExpectType GeoJSON +geoJSON.removeOverlay(marker); +// $ExpectType GeoJSON +geoJSON.removeOverlay([marker]); + +// $ExpectType boolean +geoJSON.hasOverlay(marker); +// $ExpectType boolean +geoJSON.hasOverlay(m => m === marker); + +// $ExpectType GeoJSON +geoJSON.addOverlay(marker); +// $ExpectType GeoJSON +geoJSON.addOverlay([marker]); + +// $ExpectType GeoJSONObject[] +geoJSON.toGeoJSON(); + +// $ExpectType GeoJSON +geoJSON.setMap(null); +// $ExpectType GeoJSON +geoJSON.setMap(map); + +// $ExpectType GeoJSON +geoJSON.hide(); + +// $ExpectType GeoJSON +geoJSON.show(); + +type ClickEvent = AMap.MapsEvent<'click', AMap.Overlay>; +geoJSON.on('click', (event: ClickEvent) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); diff --git a/types/amap-js-api/test/overlay/icon.ts b/types/amap-js-api/test/overlay/icon.ts new file mode 100644 index 0000000000..8576685b8a --- /dev/null +++ b/types/amap-js-api/test/overlay/icon.ts @@ -0,0 +1,32 @@ +import { + size, + pixel, + icon +} from '../preset'; + +// $ExpectType Icon +new AMap.Icon(); +// $ExpectType Icon +new AMap.Icon({}); +// $ExpectType Icon +new AMap.Icon({ + size, + imageOffset: pixel, + image: 'image uri', + imageSize: size +}); +// $ExpectType Icon +new AMap.Icon({ + size: [1, 2], + imageOffset: pixel, + image: 'image uri', + imageSize: [1, 2] +}); + +// $ExpectType Size +icon.getImageSize(); + +// $ExpectType void +icon.setImageSize(size); +// $ExpectType void +icon.setImageSize([1, 2]); diff --git a/types/amap-js-api/test/overlay/infoWindow.ts b/types/amap-js-api/test/overlay/infoWindow.ts new file mode 100644 index 0000000000..3fa4b0e656 --- /dev/null +++ b/types/amap-js-api/test/overlay/infoWindow.ts @@ -0,0 +1,81 @@ +import { + map, + lnglat, + size, + pixel, + div, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} + +// $ExpectType InfoWindow +new AMap.InfoWindow(); +// $ExpectType InfoWindow +new AMap.InfoWindow({}); +// $ExpectType InfoWindow +const infoWindow = new AMap.InfoWindow({ + isCustom: false, + autoMove: false, + closeWhenClickMap: false, + content: 'content', + size: [100, 100], + offset: new AMap.Pixel(10, 10), + position: lnglat, + showShadow: true +}); + +// $ExpectType void +infoWindow.open(map); +// $ExpectType void +infoWindow.open(map, lnglat); +// $ExpectType void +infoWindow.open(map, lnglatTuple); + +// $ExpectType void +infoWindow.close(); + +// $ExpectType boolean +infoWindow.getIsOpen(); + +// $ExpectType void +infoWindow.setContent('content'); +// $ExpectType void +infoWindow.setContent(div); + +// $ExpectType string | HTMLElement | undefined +infoWindow.getContent(); + +// $ExpectType void +infoWindow.setPosition(lnglat); +// $ExpectType void +infoWindow.setPosition(lnglatTuple); + +// $ExpectType LngLat | undefined +infoWindow.getPosition(); + +// $ExpectType Size | undefined +infoWindow.getSize(); + +infoWindow.on('change', (event: AMap.InfoWindow.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +infoWindow.on('close', (event: AMap.InfoWindow.EventMap['close']) => { + // $ExpectType "close" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +infoWindow.on('open', (event: AMap.InfoWindow.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType InfoWindow + event.target; +}); diff --git a/types/amap-js-api/test/overlay/marker.ts b/types/amap-js-api/test/overlay/marker.ts new file mode 100644 index 0000000000..635ce724c8 --- /dev/null +++ b/types/amap-js-api/test/overlay/marker.ts @@ -0,0 +1,195 @@ +import { + map, + lnglat +} from '../preset'; + +declare var pixel: AMap.Pixel; +declare var domEle: HTMLElement; +declare var markerShape: AMap.MarkerShape; +declare var icon: AMap.Icon; + +interface ExtraData { + test: number; +} + +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker({}); +// $ExpectType Marker +const marker = new AMap.Marker({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType void +marker.markOnAMAP({ + name: '123', + position: [1, 2] +}); +// $ExpectType void +marker.markOnAMAP(); +// $ExpectType void +marker.markOnAMAP({}); +// $ExpectType void +marker.markOnAMAP({ + position: [1, 2], + name: '123' +}); + +// $ExpectType Pixel +marker.getOffset(); + +// $ExpectType void +marker.setOffset(pixel); + +// $ExpectType void +marker.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +marker.getAnimation(); + +// $ExpectType void +marker.setClickable(true); + +// $ExpectType boolean +marker.getClickable(); + +// $ExpectType LngLat | undefined +marker.getPosition(); + +// $ExpectType void +marker.setPosition(lnglat); + +// $ExpectType void +marker.setAngle(0); + +// $ExpectType void +marker.setLabel(); +// $ExpectType void +marker.setLabel({}); +// $ExpectType void +marker.setLabel({ + content: 'label content', + offset: pixel +}); + +// $ExpectType Label | undefined +marker.getLabel(); + +// $ExpectType number +marker.getAngle(); + +// $ExpectType void +marker.setzIndex(100); + +// $ExpectType number +marker.getzIndex(); + +// $ExpectType void +marker.setIcon('icon uri'); +// $ExpectType void +marker.setIcon(icon); + +// $ExpectType string | Icon | undefined +marker.getIcon(); + +// $ExpectType void +marker.setDraggable(true); + +// $ExpectType boolean +marker.getDraggable(); + +// $ExpectType void +marker.setCursor('default'); + +// $ExpectType void +marker.setContent('content'); +// $ExpectType void +marker.setContent(domEle); + +// $ExpectType string | HTMLElement +marker.getContent(); + +// $ExpectType void +marker.moveAlong([lnglat], 100); +// $ExpectError +marker.moveAlong([[1, 2]], 100); +// $ExpectType void +marker.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +marker.moveTo(lnglat, 100); +// $ExpectType void +marker.moveTo([1, 2], 100); +// $ExpectType void +marker.moveTo([1, 2], 100, t => t); + +// $ExpectType void +marker.stopMove(); + +// $ExpectType boolean +marker.pauseMove(); + +// $ExpectType boolean +marker.resumeMove(); + +// $ExpectType void +marker.setMap(map); + +// $ExpectType void +marker.setTitle('title'); +// $ExpectError +marker.setTitle(); + +// $ExpectType string | undefined +marker.getTitle(); + +// $ExpectType void +marker.setTop(true); + +// $ExpectType boolean +marker.getTop(); + +// $ExpectType void +marker.setShadow(); +// $ExpectType void +marker.setShadow(icon); +// $ExpectType void +marker.setShadow('shadow url'); + +// $ExpectType string | Icon | undefined +marker.getShadow(); + +// $ExpectType void +marker.setShape(); +// $ExpectType void +marker.setShape(markerShape); + +// $ExpectType MarkerShape | undefined +marker.getShape(); + +marker.on('click', (event: AMap.Marker.EventMap['click']) => { + // $ExpectType {} | ExtraData + event.target.getExtData(); +}); diff --git a/types/amap-js-api/test/overlay/markerShape.ts b/types/amap-js-api/test/overlay/markerShape.ts new file mode 100644 index 0000000000..259b68cf20 --- /dev/null +++ b/types/amap-js-api/test/overlay/markerShape.ts @@ -0,0 +1,26 @@ +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1, 1] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'poly', + coords: [1, 2, 3, 4, 5] +}); + +// $ExpectError +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1] +}); +// $ExpectError +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2, 2] +}); diff --git a/types/amap-js-api/test/overlay/overlay.ts b/types/amap-js-api/test/overlay/overlay.ts new file mode 100644 index 0000000000..6a301e7091 --- /dev/null +++ b/types/amap-js-api/test/overlay/overlay.ts @@ -0,0 +1,27 @@ +import { + map +} from '../preset'; +interface ExtraData { + test: number; +} +declare const overlay: AMap.Overlay; + +// $ExpectType void +overlay.show(); + +// $ExpectType void +overlay.hide(); + +// $ExpectType Map | null | undefined +overlay.getMap(); + +// $ExpectType void +overlay.setMap(map); +// $ExpectType void +overlay.setMap(null); + +// $ExpectError +overlay.setExtData({ any: 123 }); + +// $ExpectError ExtraData +overlay.getExtData(); diff --git a/types/amap-js-api/test/overlay/overlayGroup.ts b/types/amap-js-api/test/overlay/overlayGroup.ts new file mode 100644 index 0000000000..11e04f91cf --- /dev/null +++ b/types/amap-js-api/test/overlay/overlayGroup.ts @@ -0,0 +1,108 @@ +import { + map, + lnglat, + pixel, + circle, + marker, + markerShape, + icon +} from '../preset'; + +// $ExpectType OverlayGroup, any> +const overlayGroup2 = new AMap.OverlayGroup(); +// $ExpectType OverlayGroup, any> +new AMap.OverlayGroup(marker); +// $ExpectType OverlayGroup, any> +const overlayGroup = new AMap.OverlayGroup([marker]); + +// $ExpectType OverlayGroup, any> +overlayGroup.addOverlay(marker); +// $ExpectType OverlayGroup, any> +overlayGroup.addOverlay([marker]); +// $ExpectError +overlayGroup.addOverlay([circle]); + +// $ExpectType OverlayGroup, any> +overlayGroup.addOverlays(marker); +// $ExpectType OverlayGroup, any> +overlayGroup.addOverlays([marker]); + +// $ExpectType Marker[] +overlayGroup.getOverlays(); + +// $ExpectType boolean +overlayGroup.hasOverlay(marker); +// $ExpectType boolean +overlayGroup.hasOverlay(o => o === marker); + +// $ExpectType OverlayGroup, any> +overlayGroup.removeOverlay(marker); +// $ExpectType OverlayGroup, any> +overlayGroup.removeOverlay([marker]); + +// $ExpectType OverlayGroup, any> +overlayGroup.removeOverlays(marker); +// $ExpectType OverlayGroup, any> +overlayGroup.removeOverlays([marker]); + +// $ExpectType OverlayGroup, any> +overlayGroup.clearOverlays(); + +// $ExpectType OverlayGroup, any> +overlayGroup.eachOverlay(function(overlay, index, overlays) { + // $ExpectType Marker + overlay; + // $ExpectType number + index; + // $ExpectType Marker[] + overlays; + // $ExpectType Marker + this; +}); + +// $ExpectType OverlayGroup, any> +overlayGroup.setMap(null); +// $ExpectType OverlayGroup, any> +overlayGroup.setMap(map); + +// $ExpectType OverlayGroup, any> +overlayGroup2.setOptions({ + test: 1 +}); +// $ExpectType OverlayGroup, any> +overlayGroup.setOptions({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType OverlayGroup, any> +overlayGroup.show(); + +// $ExpectType OverlayGroup, any> +overlayGroup.hide(); + +type ClickEvent = AMap.MapsEvent<'click', AMap.Overlay>; +overlayGroup.on('click', (event: ClickEvent) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); diff --git a/types/amap-js-api/test/overlay/polygon.ts b/types/amap-js-api/test/overlay/polygon.ts new file mode 100644 index 0000000000..d41a597d45 --- /dev/null +++ b/types/amap-js-api/test/overlay/polygon.ts @@ -0,0 +1,123 @@ +import { + map, + lnglat, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} + +const path1 = [lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple]; +const path2 = [lnglat, lnglat, lnglat, lnglat, lnglat]; + +// $ExpectType Polygon +new AMap.Polygon(); +// $ExpectType Polygon +new AMap.Polygon({}); +// $ExpectType Polygon +const polygon = new AMap.Polygon({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.3, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [2, 4], + path: path1 +}); + +// $ExpectType void +polygon.setPath(path1); +// $ExpectType void +polygon.setPath(path2); +// $ExpectType void +polygon.setPath([path1, path2]); + +// $ExpectType LngLat[] | LngLat[][] +polygon.getPath(); + +// $ExpectType void +polygon.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [4, 2], + path: [path2, path1] +}); + +const options = polygon.getOptions(); +// $ExpectType boolean | undefined +options.bubble; +// $ExpectType boolean | undefined +options.clickable; +// $ExpectType {} | ExtraData | undefined +options.extData; +// $ExpectType string | undefined +options.fillColor; +// $ExpectType number | undefined +options.fillOpacity; +// $ExpectType "miter" | "round" | "bevel" | undefined +options.lineJoin; +// $ExpectType Map | undefined +options.map; +// $ExpectType LngLat[] | LngLat[][] | undefined +options.path; +// $ExpectType string | undefined +options.strokeColor; +// $ExpectType number[] | undefined +options.strokeDasharray; +// $ExpectType number | undefined +options.strokeOpacity; +// $ExpectType "dashed" | "solid" | undefined +options.strokeStyle; +// $ExpectType number | undefined +options.strokeWeight; +// $ExpectType string | undefined +options.texture; +// $ExpectType number | undefined +options.zIndex; + +// $ExpectType Bounds | null +polygon.getBounds(); + +// $ExpectType number +polygon.getArea(); + +// $ExpectType void +polygon.setMap(null); +// $ExpectType void +polygon.setMap(map); + +// $ExpectType void +polygon.setExtData({ test: 1 }); + +// $ExpectType {} | ExtraData +polygon.getExtData(); + +// $ExpectType boolean +polygon.contains(lnglat); +// $ExpectType boolean +polygon.contains(lnglatTuple); + +polygon.on('click', (event: AMap.Polygon.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polygon + event.target; +}); diff --git a/types/amap-js-api/test/overlay/polyline.ts b/types/amap-js-api/test/overlay/polyline.ts new file mode 100644 index 0000000000..fc8d52b058 --- /dev/null +++ b/types/amap-js-api/test/overlay/polyline.ts @@ -0,0 +1,139 @@ +import { + map, + lnglat, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} + +// $ExpectType Polyline +new AMap.Polyline(); +// $ExpectType Polyline +new AMap.Polyline({}); +// $ExpectType Polyline +const polyline = new AMap.Polyline({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); +// Polyline + +// $ExpectType void +polyline.setPath([lnglat]); +// $ExpectType void +polyline.setPath([lnglatTuple]); + +// $ExpectType void +polyline.setOptions({}); +// $ExpectType void +polyline.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat, lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); + +const options = polyline.getOptions(); +// $ExpectType number | undefined +options.borderWeight; +// $ExpectType boolean | undefined +options.bubble; +// $ExpectType boolean | undefined +options.clickable; +// $ExpectType string | undefined +options.dirColor; +// $ExpectType string | undefined +options.dirImg; +// $ExpectType {} | ExtraData | undefined +options.extData; +// $ExpectType boolean | undefined +options.geodesic; +// $ExpectType boolean | undefined +options.isOutline; +// $ExpectType "round" | "butt" | "square" | undefined +options.lineCap; +// $ExpectType "miter" | "round" | "bevel" | undefined +options.lineJoin; +// $ExpectType Map | undefined +options.map; +// $ExpectType string | undefined +options.outlineColor; +// $ExpectType LngLat[] | undefined +options.path; +// $ExpectType boolean | undefined +options.showDir; +// $ExpectType string | undefined +options.strokeColor; +// $ExpectType number[] | undefined +options.strokeDasharray; +// $ExpectType number | undefined +options.strokeOpacity; +// $ExpectType "dashed" | "solid" | undefined +options.strokeStyle; +// $ExpectType number | undefined +options.strokeWeight; +// $ExpectType number | undefined +options.zIndex; + +// $ExpectType number +polyline.getLength(); + +// $ExpectType Bounds | null +polyline.getBounds(); + +// $ExpectType void +polyline.hide(); + +// $ExpectType void +polyline.show(); + +// $ExpectType void +polyline.setMap(null); +// $ExpectType void +polyline.setMap(map); + +// $ExpectType void +polyline.setExtData({test: 1}); + +// $ExpectType {} | ExtraData +polyline.getExtData(); + +polyline.on('click', (event: AMap.Polyline.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polyline + event.target; +}); diff --git a/types/amap-js-api/test/overlay/rectangle.ts b/types/amap-js-api/test/overlay/rectangle.ts new file mode 100644 index 0000000000..d2cafa8f09 --- /dev/null +++ b/types/amap-js-api/test/overlay/rectangle.ts @@ -0,0 +1,121 @@ +import { + map, + lnglat, + bounds, + lnglatTuple +} from '../preset'; + +interface ExtraData { + test: number; +} + +// $ExpectType Rectangle +new AMap.Rectangle(); +// $ExpectType Rectangle +new AMap.Rectangle({}); +// $ExpectType Rectangle +const rectangle = new AMap.Rectangle({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType Bounds | undefined +rectangle.getBounds(); + +// $ExpectType void +rectangle.setBounds(bounds); + +// $ExpectType void +rectangle.setOptions({}); +// $ExpectType void +rectangle.setOptions({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +const options = rectangle.getOptions(); +// $ExpectType Bounds | undefined +options.bounds; +// $ExpectType boolean | undefined +options.bubble; +// $ExpectType boolean | undefined +options.clickable; +// $ExpectType {} | ExtraData | undefined +options.extData; +// $ExpectType string | undefined +options.fillColor; +// $ExpectType number | undefined +options.fillOpacity; +// $ExpectType "miter" | "round" | "bevel" | undefined +options.lineJoin; +// $ExpectType Map | undefined +options.map; +// $ExpectType LngLat[] | undefined +options.path; +// $ExpectType string | undefined +options.strokeColor; +// $ExpectType number[] | undefined +options.strokeDasharray; +// $ExpectType number | undefined +options.strokeOpacity; +// $ExpectType "dashed" | "solid" | undefined +options.strokeStyle; +// $ExpectType number | undefined +options.strokeWeight; +// $ExpectType string | undefined +options.texture; +// $ExpectType number | undefined +options.zIndex; + +// $ExpectType void +rectangle.hide(); + +// $ExpectType void +rectangle.show(); + +// $ExpectType void +rectangle.setExtData({test: 2}); + +// $ExpectType {} | ExtraData +rectangle.getExtData(); + +// $ExpectType boolean +rectangle.contains(lnglat); +// $ExpectType boolean +rectangle.contains(lnglatTuple); + +rectangle.on('click', (event: AMap.Rectangle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Rectangle + event.target; +}); + +rectangle.on('setBounds', (event: AMap.Rectangle.EventMap['setBounds']) => { + // $ExpectType "setBounds" + event.type; + // $ExpectError + event.target; +}); diff --git a/types/amap-js-api/test/overlay/text.ts b/types/amap-js-api/test/overlay/text.ts new file mode 100644 index 0000000000..c4d678493c --- /dev/null +++ b/types/amap-js-api/test/overlay/text.ts @@ -0,0 +1,169 @@ +import { + map, + marker, + lnglat, + pixel, + lnglatTuple, + icon +} from '../preset'; + +interface ExtraData { + test: number; +} + +// $ExpectType Text +new AMap.Text(); +// $ExpectType Text +new AMap.Text({}); +// $ExpectType Text +const text = new AMap.Text({ + text: 'content', + textAlign: 'center', + verticalAlign: 'top', + map, + position: lnglat, + offset: pixel, + topWhenClick: true, + bubble: true, + draggable: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 100, + angle: 45, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: 'https://webapi.amap.com/theme/v1.3/markers/0.png', + title: 'title', + clickable: true, + extData: { test: 1 } +}); + +// $ExpectType string +text.getText(); + +// $ExpectType void +text.setText('123'); + +// $ExpectType void +text.setStyle({ + background: 'red', + width: '200px' +}); + +// $ExpectType void +text.markOnAMAP({ + name: '123', + position: lnglatTuple +}); + +// $ExpectType Pixel +text.getOffset(); + +// $ExpectType void +text.setOffset(pixel); + +// $ExpectType void +text.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +text.getAnimation(); + +// $ExpectType void +text.setClickable(true); + +// $ExpectType boolean +text.getClickable(); + +// $ExpectType LngLat | undefined +text.getPosition(); + +// $ExpectType void +text.setAngle(10); + +// $ExpectType number +text.getAngle(); + +// $ExpectType void +text.setzIndex(1); + +// $ExpectType number +text.getzIndex(); + +// $ExpectType void +text.setDraggable(true); + +// $ExpectType boolean +text.getDraggable(); + +// $ExpectType void +text.hide(); + +// $ExpectType void +text.show(); + +// $ExpectType void +text.setCursor('default'); + +// $ExpectType void +text.moveAlong([lnglat], 100); + +// $ExpectType void +text.moveAlong([lnglat], 100); +// $ExpectError +text.moveAlong([[1, 2]], 100); +// $ExpectType void +text.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +text.moveTo(lnglat, 100); +// $ExpectType void +text.moveTo([1, 2], 100); +// $ExpectType void +text.moveTo([1, 2], 100, t => t); + +// $ExpectType void +text.stopMove(); + +// $ExpectType boolean +text.pauseMove(); + +// $ExpectType boolean +text.resumeMove(); + +// $ExpectType void +text.setMap(map); + +// $ExpectType void +text.setTitle('title'); +// $ExpectError +text.setTitle(); + +// $ExpectType string | undefined +text.getTitle(); + +// $ExpectType void +text.setTop(true); + +// $ExpectType boolean +text.getTop(); + +// $ExpectType void +text.setShadow(); +// $ExpectType void +text.setShadow(icon); +// $ExpectType void +text.setShadow('shadow url'); + +// $ExpectType void +text.setExtData({test: 1}); + +// $ExpectType {} | ExtraData +text.getExtData(); + +text.on('click', (event: AMap.Text.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Text + event.target; +}); diff --git a/types/amap-js-api/test/pixel.ts b/types/amap-js-api/test/pixel.ts new file mode 100644 index 0000000000..bcb96e4b77 --- /dev/null +++ b/types/amap-js-api/test/pixel.ts @@ -0,0 +1,42 @@ +import { + pixel +} from './preset'; + +// $ExpectType Pixel +new AMap.Pixel(10, 20); +// $ExpectType Pixel +new AMap.Pixel(10, 20); + +// $ExpectType number +pixel.getX(); + +// $ExpectType number +pixel.getY(); + +// $ExpectType boolean +pixel.equals(pixel); + +// $ExpectType string +pixel.toString(); + +// $ExpectType Pixel +pixel.add({ x: 1, y: 2 }); +// $ExpectType Pixel +pixel.add({ x: 1, y: 2 }, false); + +// $ExpectType Pixel +pixel.round(); + +// $ExpectType Pixel +pixel.floor(); + +// $ExpectType number +pixel.length(); + +// $ExpectType number | null +pixel.direction(); + +// $ExpectType Pixel +pixel.toFixed(); +// $ExpectType Pixel +pixel.toFixed(2); diff --git a/types/amap-js-api/test/preset.ts b/types/amap-js-api/test/preset.ts new file mode 100644 index 0000000000..2c7bb37d59 --- /dev/null +++ b/types/amap-js-api/test/preset.ts @@ -0,0 +1,29 @@ +declare const map: AMap.Map; +declare const lnglat: AMap.LngLat; +declare const size: AMap.Size; +declare const lnglatTuple: [number, number]; +declare const pixel: AMap.Pixel; +declare const marker: AMap.Marker; +declare const circle: AMap.Circle; +declare const markerShape: AMap.MarkerShape; +declare const icon: AMap.Icon; +declare const bounds: AMap.Bounds; +declare const div: HTMLDivElement; +declare const polygon: AMap.Polygon; +declare const lang: AMap.Lang; + +export { + map, + lnglat, + size, + lnglatTuple, + pixel, + marker, + circle, + markerShape, + icon, + bounds, + div, + polygon, + lang +}; diff --git a/types/amap-js-api/test/size.ts b/types/amap-js-api/test/size.ts new file mode 100644 index 0000000000..bdd700f532 --- /dev/null +++ b/types/amap-js-api/test/size.ts @@ -0,0 +1,16 @@ +import { size } from './preset'; + +// $ExpectType Size +new AMap.Size(10, 20); + +// $ExpectType number +size.getHeight(); + +// $ExpectType number +size.getWidth(); + +// $ExpectType string +size.toString(); + +// $ExpectType boolean +size.contains({ x: 10, y: 10 }); diff --git a/types/amap-js-api/test/util.ts b/types/amap-js-api/test/util.ts new file mode 100644 index 0000000000..c238070e21 --- /dev/null +++ b/types/amap-js-api/test/util.ts @@ -0,0 +1,79 @@ +import * as preset from './preset'; + +const util = AMap.Util; + +// $ExpectType string +util.colorNameToHex('colorName'); + +// $ExpectType string +util.rgbHex2Rgba('rgbHex'); + +// $ExpectType string +util.argbHex2Rgba('argbHex'); + +// $ExpectType boolean +util.isEmpty({}); +// $ExpectError +util.isEmpty(1); + +// $ExpectType number[] +util.deleteItemFromArray([1], 1); + +// $ExpectType number[] +util.deleteItemFromArrayByIndex([1], 1); + +// $ExpectType number +util.indexOf([1], 1); +// $ExpectError +util.indexOf([1], '1'); + +// $ExpectType number +util.format(1); +// $ExpectType number +util.format(1, 1); + +declare const value1: number | number[]; +// $ExpectType boolean +util.isArray(value1); +if (util.isArray(value1)) { + // $ExpectType number[] + value1; +} else { + // $ExpectType number + value1; +} + +declare const value2: number | HTMLElement; +// $ExpectType boolean +util.isDOM(value2); +if (util.isDOM(value2)) { + // $ExpectType HTMLElement + value2; +} else { + // $ExpectType number + value2; +} + +// $ExpectType boolean +util.includes([1], 1); +// $ExpectError +util.includes([1], '1'); + +// $ExpectType number +util.requestIdleCallback(() => { }); +// $ExpectType number +const idleCallbackHandle = util.requestIdleCallback(() => { }, { timeout: 1 }); + +// $ExpectType void +util.cancelIdleCallback(idleCallbackHandle); + +// $ExpectType number +util.requestAnimFrame(() => { }); +// $ExpectType number +const animFrameHandle = util.requestAnimFrame(function () { + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +util.cancelAnimFrame(animFrameHandle); diff --git a/types/amap-js-api/test/view2d.ts b/types/amap-js-api/test/view2d.ts new file mode 100644 index 0000000000..2560922a5a --- /dev/null +++ b/types/amap-js-api/test/view2d.ts @@ -0,0 +1,22 @@ +import { lnglat } from './preset'; + +// $ExpectType View2D +new AMap.View2D(); +// $ExpectType View2D +new AMap.View2D({}); + +// $ExpectType View2D +new AMap.View2D({ + center: [1, 2], + rotation: 1, + zoom: 10, + crs: 'EPGS3395' +}); + +// $ExpectType View2D +const view2d = new AMap.View2D({ + center: lnglat +}); + +// $ExpectType View2D +view2d.on('complete', () => { }); diff --git a/types/amap-js-api/tsconfig.json b/types/amap-js-api/tsconfig.json new file mode 100644 index 0000000000..3e8b8b3282 --- /dev/null +++ b/types/amap-js-api/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/amap-js-api/tslint.json b/types/amap-js-api/tslint.json new file mode 100644 index 0000000000..ab1e56673f --- /dev/null +++ b/types/amap-js-api/tslint.json @@ -0,0 +1,10 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "only-arrow-functions": false, + "space-before-function-paren": false, + "no-var-keyword": false, + "no-unnecessary-class": false, + "file-name-casing": false + } +} diff --git a/types/amap-js-api/type-util.d.ts b/types/amap-js-api/type-util.d.ts new file mode 100644 index 0000000000..1ced3d69c1 --- /dev/null +++ b/types/amap-js-api/type-util.d.ts @@ -0,0 +1,12 @@ +type Omit = { + [K in Exclude]: T[K] +}; + +type OptionalKey = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T]; +// type OmitUndefined = Omit; +// type PickUndefined = Omit>; + +type Merge = + { [K in Exclude>]-?: O[K]; } & + { [K in Extract, OptionalKey>]?: O[K]; } & + T; diff --git a/types/amap-js-api/util.d.ts b/types/amap-js-api/util.d.ts new file mode 100644 index 0000000000..70b48c31d1 --- /dev/null +++ b/types/amap-js-api/util.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace Util { + function colorNameToHex(colorName: string): string; + + function rgbHex2Rgba(hex: string): string; + + function argbHex2Rgba(hex: string): string; + + function isEmpty(obj: object): boolean; + + function deleteItemFromArray(array: T[], item: T): T[]; + + function deleteItemFromArrayByIndex(array: T[], index: number): T[]; + + function indexOf(array: T[], item: T): number; + + function format(floatNumber: number, digits?: number): number; + + function isArray(data: any): data is any[]; + + function isDOM(data: any): data is HTMLElement; + + function includes(array: T[], item: T): boolean; + + function requestIdleCallback(callback: (...args: any[]) => any, options?: { timeout?: number }): number; + + function cancelIdleCallback(handle: number): void; + + function requestAnimFrame(callback: (this: C, ...args: any[]) => any, context?: C): number; + + function cancelAnimFrame(handle: number): void; + + function color2RgbaArray(color: string | number[]): [number, number, number, number]; + + function color2Rgba(color: string | number[]): string; + } +} diff --git a/types/amap-js-api/view2D.d.ts b/types/amap-js-api/view2D.d.ts new file mode 100644 index 0000000000..d662b4c50e --- /dev/null +++ b/types/amap-js-api/view2D.d.ts @@ -0,0 +1,13 @@ +declare namespace AMap { + namespace View2D { + interface Options { + center?: LocationValue; + rotation?: number; + zoom?: number; + crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326'; + } + } + class View2D extends EventEmitter { + constructor(options?: View2D.Options); + } +} From ba755ce6a7b8bc72e05301757cb66c2d73ae14e6 Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Mon, 25 Feb 2019 13:31:45 +0800 Subject: [PATCH 017/265] [amap-js-api] list files in tsconfig.json --- types/amap-js-api/tsconfig.json | 89 ++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/types/amap-js-api/tsconfig.json b/types/amap-js-api/tsconfig.json index 3e8b8b3282..8d2306a1a6 100644 --- a/types/amap-js-api/tsconfig.json +++ b/types/amap-js-api/tsconfig.json @@ -16,5 +16,92 @@ ], "types": [], "forceConsistentCasingInFileNames": true - } + }, + "files": [ + "array-bounds.d.ts", + "bounds.d.ts", + "browser.d.ts", + "common.d.ts", + "convert-from.d.ts", + "dom-util.d.ts", + "event.d.ts", + "geometry-util.d.ts", + "index.d.ts", + "layer/building.d.ts", + "layer/flexible.d.ts", + "layer/layer.d.ts", + "layer/layerGroup.d.ts", + "layer/massMarks.d.ts", + "layer/mediaLayer.d.ts", + "layer/tileLayer.d.ts", + "layer/wms.d.ts", + "layer/wmts.d.ts", + "lngLat.d.ts", + "map.d.ts", + "overlay/bezierCurve.d.ts", + "overlay/circle.d.ts", + "overlay/circleMarker.d.ts", + "overlay/contextMenu.d.ts", + "overlay/ellipse.d.ts", + "overlay/geoJSON.d.ts", + "overlay/icon.d.ts", + "overlay/infoWindow.d.ts", + "overlay/marker.d.ts", + "overlay/markerShape.d.ts", + "overlay/overlay.d.ts", + "overlay/overlayGroup.d.ts", + "overlay/pathOverlay.d.ts", + "overlay/polygon.d.ts", + "overlay/polyline.d.ts", + "overlay/rectangle.d.ts", + "overlay/shapeOverlay.d.ts", + "overlay/text.d.ts", + "pixel.d.ts", + "size.d.ts", + "test/arryBounds.ts", + "test/bounds.ts", + "test/browser.ts", + "test/convert-from.ts", + "test/dom-util.ts", + "test/event.ts", + "test/geometry-util.ts", + "test/layer/buildings.ts", + "test/layer/canvasLayer.ts", + "test/layer/flexible.ts", + "test/layer/imageLayer.ts", + "test/layer/layer.ts", + "test/layer/layerGroup.ts", + "test/layer/massMarks.ts", + "test/layer/tileLayer.ts", + "test/layer/videoLayer.ts", + "test/layer/wms.ts", + "test/layer/wmts.ts", + "test/lnglat.ts", + "test/map.ts", + "test/overlay/bezierCurve.ts", + "test/overlay/circle.ts", + "test/overlay/contextMenu.ts", + "test/overlay/ellipse.ts", + "test/overlay/geoJSON.ts", + "test/overlay/icon.ts", + "test/overlay/infoWindow.ts", + "test/overlay/marker.ts", + "test/overlay/markerShape.ts", + "test/overlay/overlay.ts", + "test/overlay/overlayGroup.ts", + "test/overlay/polygon.ts", + "test/overlay/polyline.ts", + "test/overlay/rectangle.ts", + "test/overlay/text.ts", + "test/pixel.ts", + "test/preset.ts", + "test/size.ts", + "test/util.ts", + "test/view2d.ts", + "tsconfig.json", + "tslint.json", + "type-util.d.ts", + "util.d.ts", + "view2D.d.ts" + ] } From 264b33318697a9c2269c0ae1bd690d161995f6d6 Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Mon, 25 Feb 2019 13:44:27 +0800 Subject: [PATCH 018/265] [amap-js-api] remove .json in files in tsconfig.json --- types/amap-js-api/tsconfig.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/amap-js-api/tsconfig.json b/types/amap-js-api/tsconfig.json index 8d2306a1a6..e63a35d326 100644 --- a/types/amap-js-api/tsconfig.json +++ b/types/amap-js-api/tsconfig.json @@ -98,8 +98,6 @@ "test/size.ts", "test/util.ts", "test/view2d.ts", - "tsconfig.json", - "tslint.json", "type-util.d.ts", "util.d.ts", "view2D.d.ts" From b39156db9fb2a4ae5fb9b8a2b4c2aaa706b2e414 Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Mon, 25 Feb 2019 14:49:36 +0800 Subject: [PATCH 019/265] [amap-js-api] no-restricted-globals --- types/amap-js-api/test/event.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/amap-js-api/test/event.ts b/types/amap-js-api/test/event.ts index 8678045158..8061b0d747 100644 --- a/types/amap-js-api/test/event.ts +++ b/types/amap-js-api/test/event.ts @@ -43,7 +43,7 @@ AMap.event.addListener(map, 'click', (event: AMap.Map.EventMap['click']) => { }); // $ExpectType EventListener<1> -AMap.event.addListenerOnce(map, 'hotspotclick', function (event: AMap.Map.EventMap['hotspotclick']) { +const eventListener = AMap.event.addListenerOnce(map, 'hotspotclick', function (event: AMap.Map.EventMap['hotspotclick']) { // $ExpectType "hotspotclick" event.type; // $ExpectType string @@ -54,7 +54,6 @@ AMap.event.addListenerOnce(map, 'hotspotclick', function (event: AMap.Map.EventM this.test; }, { test: 1 }); -declare const eventListener: AMap.event.EventListener<0>; // $ExpectType void AMap.event.removeListener(eventListener); From d055d9a889640fdc839a0b703632bd49ac41067a Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 25 Feb 2019 09:38:10 +0100 Subject: [PATCH 020/265] fix(mongo): change Object in object --- types/mongodb/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index dac421a22a..9fb58dbfc4 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1424,8 +1424,6 @@ export interface FindOneAndDeleteOption { collation?: CollationDocument; } - - /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoHaystackSearch */ export interface GeoHaystackSearchOptions { readPreference?: ReadPreference | string; From 3bd113c6b8af103d53112faa320543b290ec4102 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 25 Feb 2019 09:41:54 +0100 Subject: [PATCH 021/265] fix(mongodb): change Object in object --- types/mongodb/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 9fb58dbfc4..51393a8d25 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1417,8 +1417,8 @@ export interface FindOneAndUpdateOption extends FindOneAndReplaceOption { /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ export interface FindOneAndDeleteOption { - projection?: Object; - sort?: Object; + projection?: object; + sort?: object; maxTimeMS?: number; session?: ClientSession; collation?: CollationDocument; From 825dfd2e0835e35526043462e7e80d7da2057825 Mon Sep 17 00:00:00 2001 From: Sagie Maoz Date: Wed, 27 Feb 2019 17:05:29 -0500 Subject: [PATCH 022/265] fix(@types/select2): Add missing $.fn.select2 typing As per bottom of docs at http://select2.github.io/select2/ --- types/select2/v3/index.d.ts | 8 ++++++++ types/select2/v3/select2-tests.ts | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index f4a0c01efb..a74c294906 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -168,6 +168,14 @@ interface Select2Plugin { (method: 'search'): JQuery; (options: Select2Options): JQuery; + + /** + * Select2 exposes its default options via the $.fn.select2.defaults + * object. Properties changed in this object (same properties configurable + * through the constructor) will take effect for every instance created + * after the change. + */ + defaults: Partial; } interface JQuery { diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 4a0a496e13..af2bdfd583 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -1,3 +1,8 @@ +$.extend($.fn.select2.defaults, { + width: 'copy', + minimumInputLength: 12 +}); + $("#e9").select2(); $("#e2").select2({ placeholder: "Select a State", From ebf272aface38c11047499fc62dffaf77d989f22 Mon Sep 17 00:00:00 2001 From: Borys Kupar Date: Thu, 28 Feb 2019 13:32:55 +0100 Subject: [PATCH 023/265] [moment-timezone] Add support for "moment-timezone/moment-timezone" import --- types/moment-timezone/index.d.ts | 1 + types/moment-timezone/moment-timezone.d.ts | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 types/moment-timezone/moment-timezone.d.ts diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index 95a8621fdd..9d365f01b4 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Michel Salib // Alan Brazil Lins // Agustin Carrasco +// Borys Kupar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import moment = require('moment'); diff --git a/types/moment-timezone/moment-timezone.d.ts b/types/moment-timezone/moment-timezone.d.ts new file mode 100644 index 0000000000..4f06f7e4f1 --- /dev/null +++ b/types/moment-timezone/moment-timezone.d.ts @@ -0,0 +1,3 @@ +import moment = require('moment'); + +export = moment; From e746218ba8915ee395e178e7e30dcbbdda4dfc50 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 28 Feb 2019 13:38:56 +0100 Subject: [PATCH 024/265] [react-router] Add failing test for union props --- types/react-router/test/WithRouter.tsx | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/types/react-router/test/WithRouter.tsx b/types/react-router/test/WithRouter.tsx index 4db65a32bd..5782b08429 100644 --- a/types/react-router/test/WithRouter.tsx +++ b/types/react-router/test/WithRouter.tsx @@ -22,3 +22,31 @@ const WithRouterTestFunction = () => ( ); const WithRouterTestClass = () => ; + +// union props +{ + interface Book { + kind: 'book'; + author: string; + } + + interface Magazine { + kind: 'magazine'; + issue: number; + } + + type SomethingToRead = (Book | Magazine) & RouteComponentProps; + + const Readable: React.SFC = props => { + if (props.kind === 'magazine') { + return
magazine #{props.issue}
; + } + + return
magazine #{props.author}
; + }; + + const RoutedReadable = withRouter(Readable); + + ; + ; // $ExpectError +} From 5b3273643da6ff7cf328b26358aa67fc7d24749d Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 28 Feb 2019 13:39:08 +0100 Subject: [PATCH 025/265] [react-router] Fix withRouter loosing union type --- types/react-router/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 6ed1f19bd0..62c80aef8f 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -20,6 +20,7 @@ // Duong Tran // Ben Smith // Wesley Tsai +// Sebastian Silbermann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -124,8 +125,8 @@ export interface match { url: string; } -// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html -export type Omit = Pick>; +// Omit taken from https://github.com/Microsoft/TypeScript/issues/28339#issuecomment-467220238 +export type Omit = T extends any ? Pick> : never; export function matchPath(pathname: string, props: string | RouteProps, parent?: match | null): match | null; From 527ba73ec799dd660cbecaa74d531d294fde2857 Mon Sep 17 00:00:00 2001 From: Borys Kupar Date: Thu, 28 Feb 2019 14:05:54 +0100 Subject: [PATCH 026/265] Adjust tsconfig --- types/moment-timezone/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/moment-timezone/tsconfig.json b/types/moment-timezone/tsconfig.json index 62cbfb4214..55ec6cf7bb 100644 --- a/types/moment-timezone/tsconfig.json +++ b/types/moment-timezone/tsconfig.json @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", + "moment-timezone.d.ts", "moment-timezone-tests.ts" ] -} \ No newline at end of file +} From a5833836270ddc1d21b29c1d6f8f91ccd5d1e690 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma <14cse031giet@gmail.com> Date: Thu, 28 Feb 2019 18:42:58 +0530 Subject: [PATCH 027/265] Adding html5-History definition --- types/html5-history/html5-history-tests.ts | 10 +++++++++ types/html5-history/index.d.ts | 15 ++++++++++++++ types/html5-history/tsconfig.json | 24 ++++++++++++++++++++++ types/html5-history/tslint.json | 3 +++ 4 files changed, 52 insertions(+) create mode 100644 types/html5-history/html5-history-tests.ts create mode 100644 types/html5-history/index.d.ts create mode 100644 types/html5-history/tsconfig.json create mode 100644 types/html5-history/tslint.json diff --git a/types/html5-history/html5-history-tests.ts b/types/html5-history/html5-history-tests.ts new file mode 100644 index 0000000000..b492e46366 --- /dev/null +++ b/types/html5-history/html5-history-tests.ts @@ -0,0 +1,10 @@ +import * as History from 'html5-history'; + +History.init(); +History.getState(); +History.getCurrentIndex(); +History.getStateByIndex(1); +History.getHash(0); +History.unescapeHash(0); +History.normalizeHash(0); +History.setHash(1, 2); diff --git a/types/html5-history/index.d.ts b/types/html5-history/index.d.ts new file mode 100644 index 0000000000..d729181fdb --- /dev/null +++ b/types/html5-history/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for html5-history 0.1 +// Project: https://github.com/Raynos/html5-history +// Definitions by: Akash Vishwakarma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + + +export function init(options?: any): boolean; +export function getState(friendly?: any,create?: any): any; +export function getCurrentIndex(): number; +export function getStateByIndex(index: number): any; +export function getHash(doc: any): any; +export function unescapeHash(hash: any): any; +export function normalizeHash(hash: any): any; +export function setHash(hash: any, queue: any): boolean; \ No newline at end of file diff --git a/types/html5-history/tsconfig.json b/types/html5-history/tsconfig.json new file mode 100644 index 0000000000..08937c1353 --- /dev/null +++ b/types/html5-history/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "html5-history-tests.ts" + ] +} \ No newline at end of file diff --git a/types/html5-history/tslint.json b/types/html5-history/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/html5-history/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 09b944c9cc0bb2e434d75fba4911adcd7b24ba37 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma <14cse031giet@gmail.com> Date: Thu, 28 Feb 2019 18:52:44 +0530 Subject: [PATCH 028/265] fixing lint error --- types/html5-history/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/html5-history/index.d.ts b/types/html5-history/index.d.ts index d729181fdb..614928f79e 100644 --- a/types/html5-history/index.d.ts +++ b/types/html5-history/index.d.ts @@ -4,12 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 - export function init(options?: any): boolean; -export function getState(friendly?: any,create?: any): any; +export function getState(friendly?: any, create?: any): any; export function getCurrentIndex(): number; export function getStateByIndex(index: number): any; export function getHash(doc: any): any; export function unescapeHash(hash: any): any; export function normalizeHash(hash: any): any; -export function setHash(hash: any, queue: any): boolean; \ No newline at end of file +export function setHash(hash: any, queue: any): boolean; From 68d2c7b85607a7991c7d3e288714cdf48cec532e Mon Sep 17 00:00:00 2001 From: Pierre Vigier Date: Thu, 28 Feb 2019 14:35:25 +0100 Subject: [PATCH 029/265] Fix some types in nodegit --- types/nodegit/commit.d.ts | 2 +- types/nodegit/diff.d.ts | 17 +++++++++-------- types/nodegit/index.d.ts | 4 +++- types/nodegit/reset.d.ts | 7 ++++--- types/nodegit/revert.d.ts | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 57e8c55d87..8152eb8a8d 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -25,7 +25,7 @@ export class Commit { static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise; - amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Promise; + amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree | Oid): Promise; author(): Signature; committer(): Signature; diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 62de0de6c4..2f1abbda62 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -132,17 +132,18 @@ export class Diff { * * */ - static blobToBuffer(oldBlob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + static blobToBuffer(oldBlob: Blob | null, oldAsPath: string | null, + buffer: string | null, bufferAsPath: string | null, opts: DiffOptions | null, fileCb: Function | null, + binaryCb: Function | null, hunkCb: Function | null, lineCb: Function): Promise; static fromBuffer(content: string, contentLen: number): Promise; - static indexToWorkdir(repo: Repository, index: Index, opts?: DiffOptions): Promise; + static indexToWorkdir(repo: Repository, index: Index | null, opts?: DiffOptions): Promise; static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts?: DiffOptions): Promise; - static treeToIndex(repo: Repository, oldTree: Tree, index: Index, opts?: DiffOptions): Promise; - static treeToTree(repo: Repository, oldTree: Tree, new_tree: Tree, opts?: DiffOptions): Promise; - static treeToWorkdir(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; - static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; + static treeToIndex(repo: Repository, oldTree: Tree | null, index: Index | null, opts?: DiffOptions): Promise; + static treeToTree(repo: Repository, oldTree: Tree | null, new_tree: Tree | null, opts?: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, oldTree: Tree | null, opts?: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree | null, opts?: DiffOptions): Promise; - findSimilar(options: DiffFindOptions): Promise; + findSimilar(options?: DiffFindOptions): Promise; getDelta(idx: number): DiffDelta; getPerfdata(): Promise; numDeltas(): number; diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 8f0dd811a0..c0e18853a6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for nodegit 0.24 // Project: https://github.com/nodegit/nodegit, http://nodegit.org -// Definitions by: Dolan Miu , Tobias Nießen +// Definitions by: Dolan Miu , +// Tobias Nießen , +// Pierre Vigier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export { AnnotatedCommit } from './annotated-commit'; diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index 9051fa693b..ca7ff41e86 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -1,8 +1,9 @@ import { AnnotatedCommit } from './annotated-commit'; import { Repository } from './repository'; -import { Object } from './object'; import { Strarray } from './str-array'; import { CheckoutOptions } from './checkout-options'; +import { Commit } from './commit'; +import { Tag } from './tag'; export namespace Reset { const enum TYPE { @@ -16,11 +17,11 @@ export class Reset { /** * Look up a refs's commit. */ - static reset(repo: Repository, target: Object, resetType: number, checkoutOpts: CheckoutOptions): Promise; + static reset(repo: Repository, target: Commit | Tag, resetType: number, checkoutOpts: CheckoutOptions): Promise; /** * Look up a refs's commit. */ - static default(repo: Repository, target: Object, pathspecs: Strarray | string | string[]): Promise; + static default(repo: Repository, target: Commit | Tag, pathspecs: Strarray | string | string[]): Promise; /** * Sets the current head to the specified commit oid and optionally resets the index and working tree to match. * This behaves like reset but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages. diff --git a/types/nodegit/revert.d.ts b/types/nodegit/revert.d.ts index 1f9d4a2677..df804cbb48 100644 --- a/types/nodegit/revert.d.ts +++ b/types/nodegit/revert.d.ts @@ -13,7 +13,7 @@ export interface RevertOptions { } export class Revert { - static revert(repo: Repository, commit: Commit, givenOpts: RevertOptions): Promise; + static revert(repo: Repository, commit: Commit, givenOpts?: RevertOptions): Promise; /** * Reverts the given commit against the given "our" commit, producing an index that reflects the result of the revert. */ From 741a12130dda2a2db8cf4ac5bf284f034383e3cb Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 28 Feb 2019 21:41:17 +0500 Subject: [PATCH 030/265] fix(unsplash-js): some types --- types/unsplash-js/index.d.ts | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts index de2272c422..4fb2fb9175 100644 --- a/types/unsplash-js/index.d.ts +++ b/types/unsplash-js/index.d.ts @@ -6,9 +6,9 @@ export default class Unsplash { public auth: Auth; public categories: CategoriesApi; - public collections: CollectionApi; + public collections: CollectionsApi; public currentUser: CurrentUserApi; - public users: UserApi; + public users: UsersApi; public photos: PhotoApi; public search: SearchApi; public stats: StatsApi; @@ -85,7 +85,7 @@ export class PhotoApi { }): Promise; } -export class CollectionApi { +export class CollectionsApi { public listCollections( page?: number, perPage?: number, @@ -96,10 +96,12 @@ export class CollectionApi { page?: number, perPage?: number ): Promise; + public listFeaturedCollections( page?: number, perPage?: number ): Promise; + public getCollection(id: number): Promise; public getCollectionPhotos( @@ -145,6 +147,8 @@ export class CollectionApi { } export class SearchApi { + public all(keyword: string, page: number, per_page: number): Promise; + public photos( keyword: string, page?: number, @@ -172,18 +176,18 @@ export class CurrentUserApi { public profile(): Promise; public updateProfile(options: { - username: string; - firstName: string; - lastName: string; - email: string; - url: string; - location: string; - bio: string; - instagramUsername: string; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + url?: string; + location?: string; + bio?: string; + instagramUsername?: string; }): Promise; } -export class UserApi { +export class UsersApi { public profile(username: string): Promise; public statistics( @@ -217,7 +221,9 @@ export class UserApi { export class CategoriesApi { public listCategories(): Promise; + public category(id: any): Promise; + public categoryPhotos( id: any, page?: number, @@ -227,6 +233,8 @@ export class CategoriesApi { export class Auth { public getAuthenticationUrl(scopes?: ReadonlyArray): string; - public userAuthentication(code: string): object; + + public userAuthentication(code: string): Promise; + public setBearerToken(accessToken: string): void; } From 3aca920eeba6ab90ad673945cc5209bcf237096b Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Thu, 28 Feb 2019 20:20:00 +0100 Subject: [PATCH 031/265] =?UTF-8?q?feat:=20Add=20`tape=E2=80=91async`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/tape-async/.editorconfig | 3 + types/tape-async/index.d.ts | 74 +++++++++++ types/tape-async/tape-async-tests.ts | 186 +++++++++++++++++++++++++++ types/tape-async/tsconfig.json | 24 ++++ types/tape-async/tslint.json | 83 ++++++++++++ 5 files changed, 370 insertions(+) create mode 100644 types/tape-async/.editorconfig create mode 100644 types/tape-async/index.d.ts create mode 100644 types/tape-async/tape-async-tests.ts create mode 100644 types/tape-async/tsconfig.json create mode 100644 types/tape-async/tslint.json diff --git a/types/tape-async/.editorconfig b/types/tape-async/.editorconfig new file mode 100644 index 0000000000..a0207fa43b --- /dev/null +++ b/types/tape-async/.editorconfig @@ -0,0 +1,3 @@ +# This package uses tabs +[*] +indent_style = tab diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts new file mode 100644 index 0000000000..9b5bfdc1d6 --- /dev/null +++ b/types/tape-async/index.d.ts @@ -0,0 +1,74 @@ +// Type definitions for tape-async v2.3 +// Project: https://github.com/parro-it/tape-async +// Definitions by: ExE Boss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import tapeSync from "tape"; +export = tape; + +declare function tape(name: string, cb: tape.TestCase): void +declare function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; +declare function tape(cb: tape.TestCase): void; +declare function tape(opts: tape.TestOptions, cb: tape.TestCase): void; + +declare namespace tape { + + interface TestCase { + (test: Test): void | Generator | PromiseLike; + } + + /** + * Available opts options for the tape function. + */ + interface TestOptions extends tapeSync.TestOptions { + } + + /** + * Options for the createStream function. + */ + interface StreamOptions extends tapeSync.StreamOptions { + } + + /** + * Generate a new test that will be skipped over. + */ + export function skip(name: string, cb: tape.TestCase): void; + export function skip(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; + export function skip(cb: tape.TestCase): void; + export function skip(opts: tape.TestOptions, cb: tape.TestCase): void; + + /** + * The onFinish hook will get invoked when ALL tape tests have finished right before tape is about to print the test summary. + */ + export function onFinish(cb: () => void): void; + + /** + * Like test(name?, opts?, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. + */ + export function only(name: string, cb: tape.TestCase): void; + export function only(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; + export function only(cb: tape.TestCase): void; + export function only(opts: tape.TestOptions, cb: tape.TestCase): void; + + /** + * Create a new test harness instance, which is a function like test(), but with a new pending stack and test state. + */ + export function createHarness(): typeof tape; + /** + * Create a stream of output, bypassing the default output stream that writes messages to console.log(). + * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. + */ + export function createStream(opts?: tape.StreamOptions): NodeJS.ReadableStream; + + interface Test extends tapeSync.Test { + /** + * Create a subtest with a new test handle st from cb(st) inside the current test. + * cb(st) will only fire when t finishes. + * Additional tests queued up after t will not be run until all subtests finish. + */ + test(name: string, cb: tape.TestCase): void; + test(name: string, opts: TestOptions, cb: tape.TestCase): void; + } +} diff --git a/types/tape-async/tape-async-tests.ts b/types/tape-async/tape-async-tests.ts new file mode 100644 index 0000000000..835661d6d7 --- /dev/null +++ b/types/tape-async/tape-async-tests.ts @@ -0,0 +1,186 @@ +import tape = require("tape-async"); + +var name: string; +var cb: (test: tape.Test) => Promise; +var opts: tape.TestOptions; +var t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, async (test: tape.Test) => { + t = test; +}); + +tape(name, function* (test: tape.Test): IterableIterator { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape.onFinish(() => {}); + + +var sopts: tape.StreamOptions; +var rs: NodeJS.ReadableStream; +rs = tape.createStream(); +rs = tape.createStream(sopts); + + +var htest: typeof tape; +htest = tape.createHarness(); + +class CustomException extends Error { + constructor(message?: string) { + super(message); + } +} + + +tape(name, (test: tape.Test) => { + + var num: number; + var ms: number; + var value: any; + var actual: any; + var expected: any; + var err: any; + var fn = function() {}; + var msg: string; + + var exceptionExpected: RegExp | (() => void); + + test.plan(num); + test.end(); + test.end(err); + + test.fail(msg); + test.pass(msg); + test.timeoutAfter(ms); + test.skip(msg); + + test.ok(value); + test.ok(value, msg); + test.true(value); + test.true(value, msg); + test.assert(value); + test.assert(value, msg); + + test.notOk(value); + test.notOk(value, msg); + test.false(value); + test.false(value, msg); + test.notok(value); + test.notok(value, msg); + + test.error(err, msg); + test.ifError(err, msg); + test.ifErr(err, msg); + test.iferror(err, msg); + + test.equal(actual, expected); + test.equal(actual, expected, msg); + test.equals(actual, expected); + test.equals(actual, expected, msg); + test.isEqual(actual, expected); + test.isEqual(actual, expected, msg); + test.is(actual, expected); + test.is(actual, expected, msg); + test.strictEqual(actual, expected); + test.strictEqual(actual, expected, msg); + test.strictEquals(actual, expected); + test.strictEquals(actual, expected, msg); + + test.notEqual(actual, expected); + test.notEqual(actual, expected, msg); + test.notEquals(actual, expected); + test.notEquals(actual, expected, msg); + test.notStrictEqual(actual, expected); + test.notStrictEqual(actual, expected, msg); + test.notStrictEquals(actual, expected); + test.notStrictEquals(actual, expected, msg); + test.isNotEqual(actual, expected); + test.isNotEqual(actual, expected, msg); + test.isNot(actual, expected); + test.isNot(actual, expected, msg); + test.not(actual, expected); + test.not(actual, expected, msg); + test.doesNotEqual(actual, expected); + test.doesNotEqual(actual, expected, msg); + test.isInequal(actual, expected); + test.isInequal(actual, expected, msg); + + test.deepEqual(actual, expected); + test.deepEqual(actual, expected, msg); + test.deepEquals(actual, expected); + test.deepEquals(actual, expected, msg); + test.isEquivalent(actual, expected); + test.isEquivalent(actual, expected, msg); + test.same(actual, expected); + test.same(actual, expected, msg); + + test.notDeepEqual(actual, expected); + test.notDeepEqual(actual, expected, msg); + test.notEquivalent(actual, expected); + test.notEquivalent(actual, expected, msg); + test.notDeeply(actual, expected); + test.notDeeply(actual, expected, msg); + test.notSame(actual, expected); + test.notSame(actual, expected, msg); + test.isNotDeepEqual(actual, expected); + test.isNotDeepEqual(actual, expected, msg); + test.isNotDeeply(actual, expected); + test.isNotDeeply(actual, expected, msg); + test.isNotEquivalent(actual, expected); + test.isNotEquivalent(actual, expected, msg); + test.isInequivalent(actual, expected); + test.isInequivalent(actual, expected, msg); + + test.deepLooseEqual(actual, expected); + test.deepLooseEqual(actual, expected, msg); + test.looseEqual(actual, expected); + test.looseEqual(actual, expected, msg); + test.looseEquals(actual, expected); + test.looseEquals(actual, expected, msg); + + test.notDeepLooseEqual(actual, expected); + test.notDeepLooseEqual(actual, expected, msg); + test.notLooseEqual(actual, expected); + test.notLooseEqual(actual, expected, msg); + test.notLooseEquals(actual, expected); + test.notLooseEquals(actual, expected, msg); + + test.throws(fn); + test.throws(fn, msg); + test.throws(fn, exceptionExpected); + test.throws(fn, exceptionExpected, msg); + test.throws(fn, CustomException); + test.throws(fn, CustomException, msg); + + test.doesNotThrow(fn); + test.doesNotThrow(fn, msg); + test.doesNotThrow(fn, exceptionExpected); + test.doesNotThrow(fn, exceptionExpected, msg); + test.doesNotThrow(fn, CustomException); + test.doesNotThrow(fn, CustomException, msg); + + test.test(name, async (st) => { + t = st; + }); + + test.test(name, opts, async (st) => { + t = st; + }); + + test.comment(msg); +}); diff --git a/types/tape-async/tsconfig.json b/types/tape-async/tsconfig.json new file mode 100644 index 0000000000..af0ed451a1 --- /dev/null +++ b/types/tape-async/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "tape-async-tests.ts" + ] +} diff --git a/types/tape-async/tslint.json b/types/tape-async/tslint.json new file mode 100644 index 0000000000..b5f5694bcd --- /dev/null +++ b/types/tape-async/tslint.json @@ -0,0 +1,83 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "indent": [ + true, + "tabs" + ], + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 337b83294138ade3e60dfa59a27c649bca89d823 Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Thu, 28 Feb 2019 20:30:00 +0100 Subject: [PATCH 032/265] =?UTF-8?q?fix:=20Use=20`Iterator`=20instead?= =?UTF-8?q?=20of=C2=A0`Generator`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/tape-async/index.d.ts | 4 ++-- types/tape-async/tsconfig.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts index 9b5bfdc1d6..d5b07f37b7 100644 --- a/types/tape-async/index.d.ts +++ b/types/tape-async/index.d.ts @@ -5,7 +5,7 @@ /// -import tapeSync from "tape"; +import tapeSync = require("tape"); export = tape; declare function tape(name: string, cb: tape.TestCase): void @@ -16,7 +16,7 @@ declare function tape(opts: tape.TestOptions, cb: tape.TestCase): void; declare namespace tape { interface TestCase { - (test: Test): void | Generator | PromiseLike; + (test: Test): void | Iterator | PromiseLike; } /** diff --git a/types/tape-async/tsconfig.json b/types/tape-async/tsconfig.json index af0ed451a1..462155b141 100644 --- a/types/tape-async/tsconfig.json +++ b/types/tape-async/tsconfig.json @@ -14,7 +14,6 @@ ], "types": [], "noEmit": true, - "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true }, "files": [ From 1a5a17ff827c7e4acb4cec9eee66a64bc5c2ad22 Mon Sep 17 00:00:00 2001 From: Lloyd Ho Date: Thu, 28 Feb 2019 12:33:09 -0800 Subject: [PATCH 033/265] Add useWorkerScheduler into config for cometd --- types/cometd/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/cometd/index.d.ts b/types/cometd/index.d.ts index d7103f15cd..ff780cfd42 100644 --- a/types/cometd/index.d.ts +++ b/types/cometd/index.d.ts @@ -70,6 +70,15 @@ export interface Configuration { * CometD may fail to remain within the max URI length when encoded in JSON. */ maxURILength?: number; + /** + * Uses the scheduler service available in Web Workers via Worker.setTimeout(fn, delay) rather + * than using that available via Window.setTimeout(fn, delay). Browsers are now throttling the + * Window scheduler in background tabs to save battery in mobile devices, so the Window scheduler + * events are delayed by possibly several seconds, causing CometD sessions to timeout on the + * server. The Worker scheduler is not throttled and guarantees that scheduler events happen + * on time. + */ + useWorkerScheduler?: boolean; } export interface Message { From cbe9422ac4bbf8bcc9addbdc04c8e317dd4b089a Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Fri, 1 Mar 2019 00:00:00 +0100 Subject: [PATCH 034/265] =?UTF-8?q?test(tape=E2=80=91async):=20Extract=20E?= =?UTF-8?q?S2015=C2=A0tests=20into=20separate=C2=A0files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tape-async/test/tape-async.async.test.ts | 37 +++++++++++++++++++ .../test/tape-async.generators.test.ts | 37 +++++++++++++++++++ .../tape-async.test.ts} | 12 ++---- types/tape-async/tsconfig.json | 4 +- 4 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 types/tape-async/test/tape-async.async.test.ts create mode 100644 types/tape-async/test/tape-async.generators.test.ts rename types/tape-async/{tape-async-tests.ts => test/tape-async.test.ts} (94%) diff --git a/types/tape-async/test/tape-async.async.test.ts b/types/tape-async/test/tape-async.async.test.ts new file mode 100644 index 0000000000..bb8e226009 --- /dev/null +++ b/types/tape-async/test/tape-async.async.test.ts @@ -0,0 +1,37 @@ +// TypeScript Version: 2.1 + +import tape = require("tape-async"); + +var name: string; +var cb: (test: tape.Test) => Promise; +var opts: tape.TestOptions; +var t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, async (test: tape.Test) => { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape(name, async (test: tape.Test) => { + test.test(name, async (st) => { + t = st; + }); + + test.test(name, opts, async (st) => { + t = st; + }); +}); diff --git a/types/tape-async/test/tape-async.generators.test.ts b/types/tape-async/test/tape-async.generators.test.ts new file mode 100644 index 0000000000..bf279030ef --- /dev/null +++ b/types/tape-async/test/tape-async.generators.test.ts @@ -0,0 +1,37 @@ +// TypeScript Version: 2.3 + +import tape = require("tape-async"); + +var name: string; +var cb: (test: tape.Test) => IterableIterator; +var opts: tape.TestOptions; +var t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, function* (test: tape.Test): IterableIterator { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape(name, function* (test: tape.Test): IterableIterator { + test.test(name, function* (st: tape.Test): IterableIterator { + t = st; + }); + + test.test(name, opts, function* (st: tape.Test): IterableIterator { + t = st; + }); +}); diff --git a/types/tape-async/tape-async-tests.ts b/types/tape-async/test/tape-async.test.ts similarity index 94% rename from types/tape-async/tape-async-tests.ts rename to types/tape-async/test/tape-async.test.ts index 835661d6d7..060da063be 100644 --- a/types/tape-async/tape-async-tests.ts +++ b/types/tape-async/test/tape-async.test.ts @@ -1,7 +1,7 @@ import tape = require("tape-async"); var name: string; -var cb: (test: tape.Test) => Promise; +var cb: (test: tape.Test) => void; var opts: tape.TestOptions; var t: tape.Test; @@ -10,11 +10,7 @@ tape(name, cb); tape(opts, cb); tape(name, opts, cb); -tape(name, async (test: tape.Test) => { - t = test; -}); - -tape(name, function* (test: tape.Test): IterableIterator { +tape(name, (test: tape.Test) => { t = test; }); @@ -174,11 +170,11 @@ tape(name, (test: tape.Test) => { test.doesNotThrow(fn, CustomException); test.doesNotThrow(fn, CustomException, msg); - test.test(name, async (st) => { + test.test(name, st => { t = st; }); - test.test(name, opts, async (st) => { + test.test(name, opts, st => { t = st; }); diff --git a/types/tape-async/tsconfig.json b/types/tape-async/tsconfig.json index 462155b141..c5b3e90053 100644 --- a/types/tape-async/tsconfig.json +++ b/types/tape-async/tsconfig.json @@ -18,6 +18,8 @@ }, "files": [ "index.d.ts", - "tape-async-tests.ts" + "test/tape-async.async.test.ts", + "test/tape-async.generators.test.ts", + "test/tape-async.test.ts" ] } From ab818540d047bbea8448cac0b4791d4fd81ea480 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Thu, 28 Feb 2019 16:07:50 -0800 Subject: [PATCH 035/265] Add key to react-router-config RouteConfig Routes can have an optional `key`. https://www.npmjs.com/package/react-router-config#route-configuration-shape --- types/react-router-config/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-router-config/index.d.ts b/types/react-router-config/index.d.ts index 0dc1544ca6..bf719c5760 100644 --- a/types/react-router-config/index.d.ts +++ b/types/react-router-config/index.d.ts @@ -15,6 +15,7 @@ export interface RouteConfigComponentProps> | React.ComponentType; path?: string; From b826388e52ab7cb43944b9b9047c8170d9f2fd98 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Fri, 1 Mar 2019 14:21:51 +1100 Subject: [PATCH 036/265] Added type defs for html-truncate --- types/html-truncate/html-truncate-tests.ts | 13 +++++++++++ types/html-truncate/index.d.ts | 20 +++++++++++++++++ types/html-truncate/tsconfig.json | 25 ++++++++++++++++++++++ types/html-truncate/tslint.json | 3 +++ 4 files changed, 61 insertions(+) create mode 100644 types/html-truncate/html-truncate-tests.ts create mode 100644 types/html-truncate/index.d.ts create mode 100644 types/html-truncate/tsconfig.json create mode 100644 types/html-truncate/tslint.json diff --git a/types/html-truncate/html-truncate-tests.ts b/types/html-truncate/html-truncate-tests.ts new file mode 100644 index 0000000000..0c46bf560b --- /dev/null +++ b/types/html-truncate/html-truncate-tests.ts @@ -0,0 +1,13 @@ +import Truncate from "html-truncate"; + +Truncate('hello world', 4); + +Truncate('

hello world

', 4, { + keepImageTag: true, + ellipsis: true +}); + +Truncate('

hello world

', 6, { + keepImageTag: false, + ellipsis: '---' +}); diff --git a/types/html-truncate/index.d.ts b/types/html-truncate/index.d.ts new file mode 100644 index 0000000000..8be4a950a3 --- /dev/null +++ b/types/html-truncate/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for html-truncate 1.2 +// Project: https://github.com/huang47/nodejs-html-truncate +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface TruncateOptions { + /** + * Flag to specify if keep image tag, false by default. + */ + keepImageTag: boolean; + /** + * Omission symbol for truncated string, '...' by default. + */ + ellipsis: boolean|string; +} + +/** + * Truncate HTML text and also keep tag safe. + */ +export default function truncate(input: string, maxLength: number, options?: TruncateOptions): string; diff --git a/types/html-truncate/tsconfig.json b/types/html-truncate/tsconfig.json new file mode 100644 index 0000000000..693d5d17ba --- /dev/null +++ b/types/html-truncate/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "html-truncate-tests.ts" + ] +} diff --git a/types/html-truncate/tslint.json b/types/html-truncate/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/html-truncate/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 64208f26fa7260ec9b49715122d94324caeed548 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Fri, 1 Mar 2019 16:10:22 +1100 Subject: [PATCH 037/265] Added file export type defs --- types/mumath/clamp.d.ts | 6 ++++++ types/mumath/closest.d.ts | 6 ++++++ types/mumath/index.d.ts | 1 - types/mumath/isMultiple.d.ts | 7 +++++++ types/mumath/len.d.ts | 6 ++++++ types/mumath/lerp.d.ts | 6 ++++++ types/mumath/mod.d.ts | 6 ++++++ types/mumath/mumath-tests.ts | 23 +++++++++++++++++++++++ types/mumath/order.d.ts | 6 ++++++ types/mumath/precision.d.ts | 6 ++++++ types/mumath/round.d.ts | 6 ++++++ types/mumath/scale.d.ts | 8 ++++++++ types/mumath/tsconfig.json | 11 +++++++++++ types/mumath/within.d.ts | 6 ++++++ 14 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 types/mumath/clamp.d.ts create mode 100644 types/mumath/closest.d.ts create mode 100644 types/mumath/isMultiple.d.ts create mode 100644 types/mumath/len.d.ts create mode 100644 types/mumath/lerp.d.ts create mode 100644 types/mumath/mod.d.ts create mode 100644 types/mumath/order.d.ts create mode 100644 types/mumath/precision.d.ts create mode 100644 types/mumath/round.d.ts create mode 100644 types/mumath/scale.d.ts create mode 100644 types/mumath/within.d.ts diff --git a/types/mumath/clamp.d.ts b/types/mumath/clamp.d.ts new file mode 100644 index 0000000000..fe08302e37 --- /dev/null +++ b/types/mumath/clamp.d.ts @@ -0,0 +1,6 @@ +/** + * Detects proper clamp min/max. + */ +declare function clamp(value: number, left: number, right: number): number; + +export default clamp; diff --git a/types/mumath/closest.d.ts b/types/mumath/closest.d.ts new file mode 100644 index 0000000000..f2db4ea1ec --- /dev/null +++ b/types/mumath/closest.d.ts @@ -0,0 +1,6 @@ +/** + * Get closest value out of a set. + */ +declare function closest(value: number, list: number[]): number; + +export default closest; diff --git a/types/mumath/index.d.ts b/types/mumath/index.d.ts index 8967bafa4f..3dcfccf565 100644 --- a/types/mumath/index.d.ts +++ b/types/mumath/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/dfcreative/mumath // Definitions by: Adam Zerella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.3 /** * Detects proper clamp min/max. diff --git a/types/mumath/isMultiple.d.ts b/types/mumath/isMultiple.d.ts new file mode 100644 index 0000000000..255d0ece72 --- /dev/null +++ b/types/mumath/isMultiple.d.ts @@ -0,0 +1,7 @@ +/** + * Check if one number is multiple of other + * Same as a % b === 0, but with precision check. + */ +declare function isMultiple(a: number, b: number, eps?: number): boolean; + +export default isMultiple; diff --git a/types/mumath/len.d.ts b/types/mumath/len.d.ts new file mode 100644 index 0000000000..2392cff32f --- /dev/null +++ b/types/mumath/len.d.ts @@ -0,0 +1,6 @@ +/** + * Return quadratic length of a vector. + */ +declare function len(a: number, b: number): number; + +export default len; diff --git a/types/mumath/lerp.d.ts b/types/mumath/lerp.d.ts new file mode 100644 index 0000000000..3ab8639c0c --- /dev/null +++ b/types/mumath/lerp.d.ts @@ -0,0 +1,6 @@ +/** + * Return value interpolated between x and y. + */ +declare function lerp(x: number, y: number, ratio: number): number; + +export default lerp; diff --git a/types/mumath/mod.d.ts b/types/mumath/mod.d.ts new file mode 100644 index 0000000000..6517271e45 --- /dev/null +++ b/types/mumath/mod.d.ts @@ -0,0 +1,6 @@ +/** + * An enhanced mod-loop, like fmod — loops value within a frame. + */ +declare function mod(value: number, max: number, min?: number): number; + +export default mod; diff --git a/types/mumath/mumath-tests.ts b/types/mumath/mumath-tests.ts index c0fed04336..5a8fd6476f 100644 --- a/types/mumath/mumath-tests.ts +++ b/types/mumath/mumath-tests.ts @@ -1,25 +1,48 @@ import * as mumath from "mumath"; +import mumathClamp from "mumath/clamp"; +import mumathClosest from "mumath/closest"; +import mumathIsMultiple from "mumath/isMultiple"; +import mumathLen from "mumath/len"; +import mumathLerp from "mumath/lerp"; +import mumathMod from "mumath/mod"; +import mumathOrder from "mumath/order"; +import mumathPrecision from "mumath/precision"; +import mumathRound from "mumath/round"; +import mumathScale from "mumath/scale"; +import mumathWithin from "mumath/within"; + mumath.clamp(1, 2, 3); +mumathClamp(1, 2, 3); mumath.closest(5, [1, 7, 3, 6, 10]); +mumathClosest(5, [1, 7, 3, 6, 10]); mumath.isMultiple(5, 10, 1.000074); mumath.isMultiple(5, 10); +mumathIsMultiple(5, 10, 1.000074); mumath.len(15, 1.0); +mumathLen(15, 1.0); mumath.lerp(1, 2, 3); +mumathLerp(1, 2, 3); mumath.mod(1, 2, 3); mumath.mod(1, 2); +mumathMod(1, 2, 3); mumath.order(5); +mumathOrder(5); mumath.precision(5.0000001); +mumathPrecision(5.0000001); mumath.round(0.3, 0.5); +mumathRound(0.3, 0.5); mumath.scale(5.93, [1.0, 35, 10, 7.135]); +mumathScale(5.93, [1.0, 35, 10, 7.135]); mumath.within(5, 1, 10); +mumathWithin(5, 1, 10); diff --git a/types/mumath/order.d.ts b/types/mumath/order.d.ts new file mode 100644 index 0000000000..6da624f1d3 --- /dev/null +++ b/types/mumath/order.d.ts @@ -0,0 +1,6 @@ +/** + * Get order of magnitude for a number. + */ +declare function order(value: number): number; + +export default order; diff --git a/types/mumath/precision.d.ts b/types/mumath/precision.d.ts new file mode 100644 index 0000000000..ec94b3a4ed --- /dev/null +++ b/types/mumath/precision.d.ts @@ -0,0 +1,6 @@ +/** + * Get precision from float: + */ +declare function precision(value: number): number; + +export default precision; diff --git a/types/mumath/round.d.ts b/types/mumath/round.d.ts new file mode 100644 index 0000000000..09549f14f1 --- /dev/null +++ b/types/mumath/round.d.ts @@ -0,0 +1,6 @@ +/** + * Rounds value to optional step. + */ +declare function round(value: number, step?: number): number; + +export default round; diff --git a/types/mumath/scale.d.ts b/types/mumath/scale.d.ts new file mode 100644 index 0000000000..2d5487ea10 --- /dev/null +++ b/types/mumath/scale.d.ts @@ -0,0 +1,8 @@ +/** + * Get first scale out of a list of basic scales, aligned to the power. E. g. + * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 + * Similar to closest, but takes all possible powers of scales. + */ +declare function scale(value: number, list: number[]): number; + +export default scale; diff --git a/types/mumath/tsconfig.json b/types/mumath/tsconfig.json index 67aa9c2b29..e96b912780 100644 --- a/types/mumath/tsconfig.json +++ b/types/mumath/tsconfig.json @@ -20,6 +20,17 @@ }, "files": [ "index.d.ts", + "clamp.d.ts", + "closest.d.ts", + "isMultiple.d.ts", + "len.d.ts", + "lerp.d.ts", + "mod.d.ts", + "order.d.ts", + "precision.d.ts", + "round.d.ts", + "scale.d.ts", + "within.d.ts", "mumath-tests.ts" ] } diff --git a/types/mumath/within.d.ts b/types/mumath/within.d.ts new file mode 100644 index 0000000000..47558c73d0 --- /dev/null +++ b/types/mumath/within.d.ts @@ -0,0 +1,6 @@ +/** + * Whether element is between left & right, including. + */ +declare function within(value: number, left: number, right: number): number; + +export default within; From e0cf0c55204ff4d5f4501a57aebb0c302084701d Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 1 Mar 2019 11:00:34 +0500 Subject: [PATCH 038/265] feat(unsplash-js): replace classes with interfaces and update fetch types --- types/unsplash-js/index.d.ts | 160 +++++++++++++++----------------- types/unsplash-js/tsconfig.json | 3 +- 2 files changed, 75 insertions(+), 88 deletions(-) diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts index 4fb2fb9175..e68a854510 100644 --- a/types/unsplash-js/index.d.ts +++ b/types/unsplash-js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for unsplash-js 5.0 // Project: https://github.com/unsplash/unsplash-js#readme -// Definitions by: My Self +// Definitions by: Andrew Malikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export default class Unsplash { @@ -13,7 +13,7 @@ export default class Unsplash { public search: SearchApi; public stats: StatsApi; - constructor(options: { + public constructor(options: { apiUrl: string; apiVersion: string; applicationId: string; @@ -23,48 +23,48 @@ export default class Unsplash { headers?: { [key: string]: string }; }); - private request(requestOptions: { + public request(requestOptions: { url: string; method: string; query: object; headers: object; body: object; oauth: boolean; - }): Promise; + }): Promise; } export function toJson(response: any): any; -export class PhotoApi { - public listPhotos( +export interface PhotoApi { + listPhotos( page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; - public listCuratedPhotos( + listCuratedPhotos( page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; - public searchPhotos( + searchPhotos( query: string, categories: ReadonlyArray, page: number, perPage: number - ): Promise; + ): Promise; - public getPhoto( + getPhoto( id: string, width?: number, height?: number, rectangle?: ReadonlyArray - ): Promise; + ): Promise; - public getPhotoStats(id: string): Promise; + getPhotoStats(id: string): Promise; - public getRandomPhoto(options: { + getRandomPhoto(options: { width?: number; height?: number; query?: string; @@ -72,110 +72,100 @@ export class PhotoApi { featured?: boolean; collections?: ReadonlyArray; count?: number; - }): Promise; + }): Promise; - public uploadPhoto(photo: object): void; + uploadPhoto(photo: object): void; - public likePhoto(id: string): Promise; + likePhoto(id: string): Promise; - public unlikePhoto(id: string): Promise; + unlikePhoto(id: string): Promise; - public downloadPhoto(photo: { + downloadPhoto(photo: { links: { download_location: string }; - }): Promise; + }): Promise; } -export class CollectionsApi { - public listCollections( +export interface CollectionsApi { + listCollections( page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; - public listCuratedCollections( - page?: number, - perPage?: number - ): Promise; + listCuratedCollections(page?: number, perPage?: number): Promise; - public listFeaturedCollections( - page?: number, - perPage?: number - ): Promise; + listFeaturedCollections(page?: number, perPage?: number): Promise; - public getCollection(id: number): Promise; + getCollection(id: number): Promise; - public getCollectionPhotos( + getCollectionPhotos( id: number, page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; - public getCuratedCollectionPhotos( + getCuratedCollectionPhotos( id: number, page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; - public createCollection( + createCollection( title: string, description?: string, private?: boolean - ): Promise; + ): Promise; - public updateCollection( + updateCollection( id: number, title?: string, description?: string, private?: boolean - ): Promise; + ): Promise; - public deleteCollection(id: number): Promise; + deleteCollection(id: number): Promise; - public addPhotoToCollection( + addPhotoToCollection( collectionId: number, photoId: string - ): Promise; + ): Promise; - public removePhotoFromCollection( + removePhotoFromCollection( collectionId: number, photoId: string - ): Promise; + ): Promise; - public listRelatedCollections(collectionId: number): Promise; + listRelatedCollections(collectionId: number): Promise; } -export class SearchApi { - public all(keyword: string, page: number, per_page: number): Promise; +export interface SearchApi { + all(keyword: string, page: number, per_page: number): Promise; - public photos( + photos( keyword: string, page?: number, per_page?: number - ): Promise; + ): Promise; - public users( + users(keyword: string, page?: number, per_page?: number): Promise; + + collections( keyword: string, page?: number, per_page?: number - ): Promise; - - public collections( - keyword: string, - page?: number, - per_page?: number - ): Promise; + ): Promise; } -export class StatsApi { - public total(): Promise; +export interface StatsApi { + total(): Promise; } -export class CurrentUserApi { - public profile(): Promise; +export interface CurrentUserApi { + profile(): Promise; - public updateProfile(options: { + updateProfile(options: { username?: string; firstName?: string; lastName?: string; @@ -184,57 +174,53 @@ export class CurrentUserApi { location?: string; bio?: string; instagramUsername?: string; - }): Promise; + }): Promise; } -export class UsersApi { - public profile(username: string): Promise; +export interface UsersApi { + profile(username: string): Promise; - public statistics( + statistics( username: string, resolution?: string, quantity?: string - ): Promise; + ): Promise; - public photos( + photos( username: string, page?: number, perPage?: number, orderBy?: string, stats?: boolean - ): Promise; + ): Promise; - public likes( + likes( username: string, page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; - public collections( + collections( username: string, page?: number, perPage?: number, orderBy?: string - ): Promise; + ): Promise; } -export class CategoriesApi { - public listCategories(): Promise; +export interface CategoriesApi { + listCategories(): Promise; - public category(id: any): Promise; + category(id: any): Promise; - public categoryPhotos( - id: any, - page?: number, - perPage?: number - ): Promise; + categoryPhotos(id: any, page?: number, perPage?: number): Promise; } -export class Auth { - public getAuthenticationUrl(scopes?: ReadonlyArray): string; +export interface Auth { + getAuthenticationUrl(scopes?: ReadonlyArray): string; - public userAuthentication(code: string): Promise; + userAuthentication(code: string): Promise; - public setBearerToken(accessToken: string): void; + setBearerToken(accessToken: string): void; } diff --git a/types/unsplash-js/tsconfig.json b/types/unsplash-js/tsconfig.json index 79f45318aa..a76632982c 100644 --- a/types/unsplash-js/tsconfig.json +++ b/types/unsplash-js/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From a3770d86923cd891fbc77c67b9e5ee5b3afe1a18 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 1 Mar 2019 11:41:53 +0500 Subject: [PATCH 039/265] feat(unsplash-js): add tests --- types/unsplash-js/index.d.ts | 6 +- types/unsplash-js/unsplash-js-tests.ts | 100 +++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 3 deletions(-) diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts index e68a854510..92a8eceb8b 100644 --- a/types/unsplash-js/index.d.ts +++ b/types/unsplash-js/index.d.ts @@ -14,8 +14,8 @@ export default class Unsplash { public stats: StatsApi; public constructor(options: { - apiUrl: string; - apiVersion: string; + apiUrl?: string; + apiVersion?: string; applicationId: string; secret: string; callbackUrl?: string; @@ -183,7 +183,7 @@ export interface UsersApi { statistics( username: string, resolution?: string, - quantity?: string + quantity?: number ): Promise; photos( diff --git a/types/unsplash-js/unsplash-js-tests.ts b/types/unsplash-js/unsplash-js-tests.ts index e69de29bb2..262d4c5e02 100644 --- a/types/unsplash-js/unsplash-js-tests.ts +++ b/types/unsplash-js/unsplash-js-tests.ts @@ -0,0 +1,100 @@ +import Unsplash, { toJson } from "unsplash-js"; + +const unsplash = new Unsplash({ + applicationId: "{APP_ACCESS_KEY}", + secret: "{APP_SECRET}" +}); + +const authenticationUrl = unsplash.auth.getAuthenticationUrl([ + "public", + "read_user", + "write_user", + "read_photos", + "write_photos" +]); + +unsplash.auth + .userAuthentication("{OAUTH_CODE}") + .then(toJson) + .then(json => { + unsplash.auth.setBearerToken(json.access_token); + }); + +unsplash.currentUser.profile(); + +unsplash.currentUser.updateProfile({ + username: "drizzy", + firstName: "Aubrey", + lastName: "Graham", + email: "drizzy@octobersveryown.com", + url: "http://octobersveryown.com", + location: "Toronto, Ontario, Canada", + bio: "Views from the 6", + instagramUsername: "champagnepapi" +}); + +unsplash.users.profile("naoufal"); + +unsplash.users.statistics("naoufal", "days", 30); + +unsplash.users.photos("naoufal", 1, 10, "popular", false); + +unsplash.users.likes("naoufal", 2, 15, "popular"); + +unsplash.users.collections("naoufal", 2, 15, "updated"); + +unsplash.photos.listPhotos(2, 15, "latest"); + +unsplash.photos.getPhoto("mtNweauBsMQ", 1920, 1080, [0, 0, 1920, 1080]); + +unsplash.photos.getPhotoStats("mtNweauBsMQ"); + +unsplash.photos.getRandomPhoto({ username: "naoufal" }); + +unsplash.photos.likePhoto("mtNweauBsMQ"); + +unsplash.photos.unlikePhoto("mtNweauBsMQ"); + +unsplash.photos + .getPhoto("mtNweauBsMQ") + .then(toJson) + .then(json => { + unsplash.photos.downloadPhoto(json); + }); + +unsplash.collections.listCollections(1, 10, "popular"); + +unsplash.collections.listFeaturedCollections(1, 10); + +unsplash.collections.getCollection(123456); + +unsplash.collections.getCollectionPhotos(123456, 1, 10, "popular"); + +unsplash.collections.createCollection( + "Birds", + "Wild birds from 'round the world", + true +); + +unsplash.collections.updateCollection( + 12345, + "Wild Birds", + "Wild birds from around the world", + false +); + +unsplash.collections.deleteCollection(42); + +unsplash.collections.addPhotoToCollection(88, "abc1234"); + +unsplash.collections.removePhotoFromCollection(88, "abc1234"); + +unsplash.collections.listRelatedCollections(88); + +unsplash.search.photos("dogs", 1); + +unsplash.search.users("steve", 1); + +unsplash.search.collections("dogs", 1); + +unsplash.stats.total(); From f583652711dc5038fa4d3bec0eff75cae7d2f85c Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 1 Mar 2019 12:06:13 +0500 Subject: [PATCH 040/265] feat(unsplash-js): add ts version and remove implicit modificators --- types/unsplash-js/index.d.ts | 21 +++++++++++---------- types/unsplash-js/tsconfig.json | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts index 92a8eceb8b..40971248f6 100644 --- a/types/unsplash-js/index.d.ts +++ b/types/unsplash-js/index.d.ts @@ -2,18 +2,19 @@ // Project: https://github.com/unsplash/unsplash-js#readme // Definitions by: Andrew Malikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export default class Unsplash { - public auth: Auth; - public categories: CategoriesApi; - public collections: CollectionsApi; - public currentUser: CurrentUserApi; - public users: UsersApi; - public photos: PhotoApi; - public search: SearchApi; - public stats: StatsApi; + auth: Auth; + categories: CategoriesApi; + collections: CollectionsApi; + currentUser: CurrentUserApi; + users: UsersApi; + photos: PhotoApi; + search: SearchApi; + stats: StatsApi; - public constructor(options: { + constructor(options: { apiUrl?: string; apiVersion?: string; applicationId: string; @@ -23,7 +24,7 @@ export default class Unsplash { headers?: { [key: string]: string }; }); - public request(requestOptions: { + request(requestOptions: { url: string; method: string; query: object; diff --git a/types/unsplash-js/tsconfig.json b/types/unsplash-js/tsconfig.json index a76632982c..8d04d7480f 100644 --- a/types/unsplash-js/tsconfig.json +++ b/types/unsplash-js/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 1b6ef0e8f0c6a468d2f2caf070791c52447a9fe2 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 1 Mar 2019 12:26:42 +0500 Subject: [PATCH 041/265] feat(unsplash-js): hide internal API --- types/unsplash-js/index.d.ts | 390 ++++++++++++++++++----------------- 1 file changed, 203 insertions(+), 187 deletions(-) diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts index 40971248f6..682eef058b 100644 --- a/types/unsplash-js/index.d.ts +++ b/types/unsplash-js/index.d.ts @@ -5,14 +5,14 @@ // TypeScript Version: 2.2 export default class Unsplash { - auth: Auth; - categories: CategoriesApi; - collections: CollectionsApi; - currentUser: CurrentUserApi; - users: UsersApi; - photos: PhotoApi; - search: SearchApi; - stats: StatsApi; + auth: UnsplashApi.Auth; + categories: UnsplashApi.Categories; + collections: UnsplashApi.Collections; + currentUser: UnsplashApi.CurrentUser; + users: UnsplashApi.Users; + photos: UnsplashApi.Photo; + search: UnsplashApi.Search; + stats: UnsplashApi.Stats; constructor(options: { apiUrl?: string; @@ -36,192 +36,208 @@ export default class Unsplash { export function toJson(response: any): any; -export interface PhotoApi { - listPhotos( - page?: number, - perPage?: number, - orderBy?: string - ): Promise; +declare module UnsplashApi { + interface Photo { + listPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; - listCuratedPhotos( - page?: number, - perPage?: number, - orderBy?: string - ): Promise; + listCuratedPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; - searchPhotos( - query: string, - categories: ReadonlyArray, - page: number, - perPage: number - ): Promise; + searchPhotos( + query: string, + categories: ReadonlyArray, + page: number, + perPage: number + ): Promise; - getPhoto( - id: string, - width?: number, - height?: number, - rectangle?: ReadonlyArray - ): Promise; + getPhoto( + id: string, + width?: number, + height?: number, + rectangle?: ReadonlyArray + ): Promise; - getPhotoStats(id: string): Promise; + getPhotoStats(id: string): Promise; - getRandomPhoto(options: { - width?: number; - height?: number; - query?: string; - username?: string; - featured?: boolean; - collections?: ReadonlyArray; - count?: number; - }): Promise; + getRandomPhoto(options: { + width?: number; + height?: number; + query?: string; + username?: string; + featured?: boolean; + collections?: ReadonlyArray; + count?: number; + }): Promise; - uploadPhoto(photo: object): void; + uploadPhoto(photo: object): void; - likePhoto(id: string): Promise; + likePhoto(id: string): Promise; - unlikePhoto(id: string): Promise; + unlikePhoto(id: string): Promise; - downloadPhoto(photo: { - links: { download_location: string }; - }): Promise; -} - -export interface CollectionsApi { - listCollections( - page?: number, - perPage?: number, - orderBy?: string - ): Promise; - - listCuratedCollections(page?: number, perPage?: number): Promise; - - listFeaturedCollections(page?: number, perPage?: number): Promise; - - getCollection(id: number): Promise; - - getCollectionPhotos( - id: number, - page?: number, - perPage?: number, - orderBy?: string - ): Promise; - - getCuratedCollectionPhotos( - id: number, - page?: number, - perPage?: number, - orderBy?: string - ): Promise; - - createCollection( - title: string, - description?: string, - private?: boolean - ): Promise; - - updateCollection( - id: number, - title?: string, - description?: string, - private?: boolean - ): Promise; - - deleteCollection(id: number): Promise; - - addPhotoToCollection( - collectionId: number, - photoId: string - ): Promise; - - removePhotoFromCollection( - collectionId: number, - photoId: string - ): Promise; - - listRelatedCollections(collectionId: number): Promise; -} - -export interface SearchApi { - all(keyword: string, page: number, per_page: number): Promise; - - photos( - keyword: string, - page?: number, - per_page?: number - ): Promise; - - users(keyword: string, page?: number, per_page?: number): Promise; - - collections( - keyword: string, - page?: number, - per_page?: number - ): Promise; -} - -export interface StatsApi { - total(): Promise; -} - -export interface CurrentUserApi { - profile(): Promise; - - updateProfile(options: { - username?: string; - firstName?: string; - lastName?: string; - email?: string; - url?: string; - location?: string; - bio?: string; - instagramUsername?: string; - }): Promise; -} - -export interface UsersApi { - profile(username: string): Promise; - - statistics( - username: string, - resolution?: string, - quantity?: number - ): Promise; - - photos( - username: string, - page?: number, - perPage?: number, - orderBy?: string, - stats?: boolean - ): Promise; - - likes( - username: string, - page?: number, - perPage?: number, - orderBy?: string - ): Promise; - - collections( - username: string, - page?: number, - perPage?: number, - orderBy?: string - ): Promise; -} - -export interface CategoriesApi { - listCategories(): Promise; - - category(id: any): Promise; - - categoryPhotos(id: any, page?: number, perPage?: number): Promise; -} - -export interface Auth { - getAuthenticationUrl(scopes?: ReadonlyArray): string; - - userAuthentication(code: string): Promise; - - setBearerToken(accessToken: string): void; + downloadPhoto(photo: { + links: { download_location: string }; + }): Promise; + } + + interface Collections { + listCollections( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + listCuratedCollections( + page?: number, + perPage?: number + ): Promise; + + listFeaturedCollections( + page?: number, + perPage?: number + ): Promise; + + getCollection(id: number): Promise; + + getCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + getCuratedCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + createCollection( + title: string, + description?: string, + private?: boolean + ): Promise; + + updateCollection( + id: number, + title?: string, + description?: string, + private?: boolean + ): Promise; + + deleteCollection(id: number): Promise; + + addPhotoToCollection( + collectionId: number, + photoId: string + ): Promise; + + removePhotoFromCollection( + collectionId: number, + photoId: string + ): Promise; + + listRelatedCollections(collectionId: number): Promise; + } + + interface Search { + all(keyword: string, page: number, per_page: number): Promise; + + photos( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + users( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + collections( + keyword: string, + page?: number, + per_page?: number + ): Promise; + } + + interface Stats { + total(): Promise; + } + + interface CurrentUser { + profile(): Promise; + + updateProfile(options: { + username?: string; + firstName?: string; + lastName?: string; + email?: string; + url?: string; + location?: string; + bio?: string; + instagramUsername?: string; + }): Promise; + } + + interface Users { + profile(username: string): Promise; + + statistics( + username: string, + resolution?: string, + quantity?: number + ): Promise; + + photos( + username: string, + page?: number, + perPage?: number, + orderBy?: string, + stats?: boolean + ): Promise; + + likes( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + collections( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + } + + interface Categories { + listCategories(): Promise; + + category(id: any): Promise; + + categoryPhotos( + id: any, + page?: number, + perPage?: number + ): Promise; + } + + interface Auth { + getAuthenticationUrl(scopes?: ReadonlyArray): string; + + userAuthentication(code: string): Promise; + + setBearerToken(accessToken: string): void; + } } From 41ca4ffe36b43a056982cdfac27219a34fd1e385 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 1 Mar 2019 12:38:08 +0500 Subject: [PATCH 042/265] fix(unspash-js): remove deprecated 'module' syntax --- types/unsplash-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts index 682eef058b..8eb6222778 100644 --- a/types/unsplash-js/index.d.ts +++ b/types/unsplash-js/index.d.ts @@ -36,7 +36,7 @@ export default class Unsplash { export function toJson(response: any): any; -declare module UnsplashApi { +export namespace UnsplashApi { interface Photo { listPhotos( page?: number, From 21f65b52987ff81e9bc01c26707ed83bd7b663b8 Mon Sep 17 00:00:00 2001 From: Bryan Huang Date: Fri, 1 Mar 2019 15:57:03 +0800 Subject: [PATCH 043/265] Upgrade to Viewer v6.4 --- types/forge-viewer/index.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/types/forge-viewer/index.d.ts b/types/forge-viewer/index.d.ts index bff0c637a0..878a3926fa 100644 --- a/types/forge-viewer/index.d.ts +++ b/types/forge-viewer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Forge Viewer 6.3 +// Type definitions for Forge Viewer 6.4 // Project: https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d/ // Definitions by: Autodesk Forge Partner Development , Alan Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -238,10 +238,14 @@ declare namespace Autodesk { [key: string]: any; } + const AGGREGATE_FIT_TO_VIEW_EVENT = 'aggregateFitToView'; + const AGGREGATE_ISOLATION_CHANGED_EVENT = 'aggregateIsolation'; const AGGREGATE_SELECTION_CHANGED_EVENT = 'aggregateSelection'; const ANIMATION_READY_EVENT = 'animationReady'; const CAMERA_CHANGE_EVENT = 'cameraChanged'; + const CAMERA_TRANSITION_COMPLETED = 'cameraTransitionCompleted'; const CUTPLANES_CHANGE_EVENT = 'cutplanesChanged'; + const CANCEL_LEAFLET_SCREENSHOT = 'cancelLeafletScreenshot'; const ESCAPE_EVENT = 'escape'; const EXPLODE_CHANGE_EVENT = 'explodeChanged'; const EXTENSION_LOADED_EVENT = 'extensionLoaded'; @@ -251,12 +255,17 @@ declare namespace Autodesk { const FRAGMENTS_LOADED_EVENT = 'fragmentsLoaded'; const FULLSCREEN_MODE_EVENT = 'fullscreenMode'; const GEOMETRY_LOADED_EVENT = 'geometryLoaded'; + const GEOMETRY_DOWNLOAD_COMPLETE_EVENT = 'geometryDownloadComplete'; const HIDE_EVENT = 'hide'; const HYPERLINK_EVENT = 'hyperlink'; const ISOLATE_EVENT = 'isolate'; const LAYER_VISIBILITY_CHANGED_EVENT = 'layerVisibilityChanged'; + const LOAD_GEOMETRY_EVENT = 'loadGeometry'; const LOAD_MISSING_GEOMETRY = 'loadMissingGeometry'; + const MODEL_ADDED_EVENT = 'modelAdded'; const MODEL_ROOT_LOADED_EVENT = 'modelRootLoaded'; + const MODEL_REMOVED_EVENT = 'modelRemoved'; + const MODEL_LAYERS_LOADED_EVENT = 'modelLayersLoaded'; const MODEL_UNLOADED_EVENT = 'modelUnloaded'; const NAVIGATION_MODE_CHANGED_EVENT = 'navigationModeChanged'; const OBJECT_TREE_CREATED_EVENT = 'objectTreeCreated'; @@ -277,6 +286,7 @@ declare namespace Autodesk { const VIEWER_RESIZE_EVENT = 'viewerResize'; const VIEWER_STATE_RESTORED_EVENT = 'viewerStateRestored'; const VIEWER_UNINITIALIZED = 'viewerUninitialized'; + const WEBGL_CONTEXT_LOST_EVENT = 'webGlContextLost'; interface ViewerEventArgs { target?: Viewer3D; @@ -333,6 +343,7 @@ declare namespace Autodesk { setTag(tag: string, value: any): void; traverse(cb: () => void): boolean; urn(searchParent: boolean): string; + useAsDefault(): boolean; } let theExtensionManager: ExtensionManager; @@ -850,11 +861,15 @@ declare namespace Autodesk { hitTestViewport(vpVec: THREE.Vector3, ignoreTransparent: boolean): HitTestResult; initialize(): void; setLightPreset(index: number, force?: boolean): void; + viewportToClient(viewportX: number, viewportY: number): THREE.Vector3; getMaterials(): any; + getScreenShotProgressive(w: number, h: number, onFinished?: () => void, options?: any): any; + getRenderProxy(model: Model, fragId: number): any; sceneUpdated(param: boolean): void; + setViewFromCamera(camera: THREE.Camera, skipTransition?: boolean, useExactCamera?: boolean): void; } class VisibilityManager { From 5941e3481c703daf85efaa1e083a9d8e04af2913 Mon Sep 17 00:00:00 2001 From: Akihiro Uchida Date: Fri, 1 Mar 2019 15:05:09 +0900 Subject: [PATCH 044/265] Add definitions for puppeteer BrowserFetcher --- types/puppeteer/index.d.ts | 28 ++++++++++++++++++++++++++++ types/puppeteer/puppeteer-tests.ts | 8 ++++++++ 2 files changed, 36 insertions(+) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index 1b9428392a..a4bf6e0d73 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -2195,3 +2195,31 @@ export function defaultArgs(options?: ChromeArgOptions): string[]; export function executablePath(): string; /** The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed. */ export function launch(options?: LaunchOptions): Promise; + +/** This methods attaches Puppeteer to an existing Chromium instance. */ +export function createBrowserFetcher(options?: LaunchOptions): BrowserFetcher; + +/** BrowserFetcher can download and manage different versions of Chromium. */ +export interface BrowserFetcher { + /** The method initiates a HEAD request to check if the revision is available. */ + canDownload(revision: string): Promise; + /** The method initiates a GET request to download the revision from the host. */ + download(revision: string, progressCallback?: (downloadBytes: number, totalBytes: number) => any): Promise; + localRevisions(): Promise; + platform(): string; + remove(revision: string): Promise; + revisionInfo(revision: string): RevisionInfo; +} + +export interface RevisionInfo { + /** The revision the info was created from */ + revision: string; + /** Path to the extracted revision folder */ + folderPath: string; + /** Path to the revision executable */ + executablePath: string; + /** URL this revision can be downloaded from */ + url: string; + /** whether the revision is locally available on disk */ + local: boolean; +} diff --git a/types/puppeteer/puppeteer-tests.ts b/types/puppeteer/puppeteer-tests.ts index e5c287b6ee..e62be5b7d5 100644 --- a/types/puppeteer/puppeteer-tests.ts +++ b/types/puppeteer/puppeteer-tests.ts @@ -618,3 +618,11 @@ puppeteer.launch().then(async browser => { ); console.log('there are', numMatchingEls, 'banana paragaphs'); }); + +(async () => { + const rev = '630727'; + const browserFetcher = puppeteer.createBrowserFetcher(); + await browserFetcher.canDownload(rev); + const revisionInfo = await browserFetcher.download(rev); + await browserFetcher.remove(rev); +}); From 4158bbc44beb3cbce3bd584cdc3a28a2d430ec66 Mon Sep 17 00:00:00 2001 From: Bryan Huang Date: Fri, 1 Mar 2019 17:09:43 +0800 Subject: [PATCH 045/265] Merging in contributions from Norconsult --- types/forge-viewer/index.d.ts | 52 +++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/types/forge-viewer/index.d.ts b/types/forge-viewer/index.d.ts index 878a3926fa..8bb90b6d59 100644 --- a/types/forge-viewer/index.d.ts +++ b/types/forge-viewer/index.d.ts @@ -150,6 +150,13 @@ declare namespace Autodesk { interface ViewerConfig { disableBrowserContextMenu?: boolean; + disabledExtensions?: { + bimwalk?: boolean; + hyperlink?: boolean; + measure?: boolean; + scalarisSimulation?: boolean; + section?: boolean; + }; extensions?: string[]; useConsolidation?: boolean; consolidationMemoryLimit?: number; @@ -356,6 +363,7 @@ declare namespace Autodesk { language?: string; accessToken?: string; useADP?: boolean; + useConsolidation?: boolean; [key: string]: any; } @@ -449,16 +457,42 @@ declare namespace Autodesk { } class Model { - getBoundingBox(): THREE.Box3; + fetchTopology(maxSizeMB: number): Promise; getBulkProperties(dbIds: number[], propFilter?: string[], successCallback?: (r: any) => void, errorCallback?: (err: any) => void): void; getData(): any; getFragmentList(): any; getObjectTree(successCallback?: (result: InstanceTree) => void, errorCallback?: (err: any) => void): void; getProperties(dbId: number, successCallback?: (r: PropertyResult) => void, errorCallback?: (err: any) => void): void; + geomPolyCount(): number; + getDefaultCamera(): THREE.Camera; + getDisplayUnit(): string; + getDocumentNode(): object; + getExternalIdMapping(onSuccessCallback: () => void, onErrorCallback: () => void): any; + getFastLoadList(): any; + getFragmentMap(): any; // DbidFragmentMap|InstanceTree; + getLayersRoot(): object; + getMetadata(itemName: string, subitemName?: string, defaultValue?: any): any; + getRoot(): object; + getRootId(): number; + getTopoIndex(fragId: number): number; + getTopology(index: number): object; + getUnitData(unit: string): object; getUnitScale(): number; - getUnitString(): number; - - search(text: string, successCallback: (r: number[]) => void, errorCallback?: (err: any) => void, attributeNames?: string[]): void; + getUnitString(): string; + getUpVector(): any; + hasTopology(): boolean; + instancePolyCount(): number; + is2d(): boolean; + is3d(): boolean; + isAEC(): boolean; + isLoadDone(): boolean; + isObjectTreeCreated(): boolean; + isObjectTreeLoaded(): boolean; + pageToModel(): void; + pointInClip(): void; + search(text: string, onSuccessCallback: () => void, onErrorCallback: () => void, attributeNames?: string[]): void; + setData(data: object): void; + setUUID(urn: string): void; clearThemingColors(): void; getInstanceTree(): InstanceTree; @@ -771,6 +805,13 @@ declare namespace Autodesk { getHitPoint(x: number, y: number): THREE.Vector3; } + namespace Extensions { + class ViewerPropertyPanel extends UI.PropertyPanel { + constructor(viewer: Private.GuiViewer3D); + currentNodeIds: object[]; + } + } + namespace Private { function getHtmlTemplate(url: string, callback: (error: string, content: string) => void): void; @@ -863,7 +904,8 @@ declare namespace Autodesk { setLightPreset(index: number, force?: boolean): void; viewportToClient(viewportX: number, viewportY: number): THREE.Vector3; - + modelqueue(): any; + matman(): any; getMaterials(): any; getScreenShotProgressive(w: number, h: number, onFinished?: () => void, options?: any): any; From d730f94be2975694dca164e13c98fb6f05ad4627 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Fri, 1 Mar 2019 20:12:40 +1100 Subject: [PATCH 046/265] Added type defs for repeat-string --- types/repeat-string/index.d.ts | 9 ++++++++ types/repeat-string/repeat-string-tests.ts | 3 +++ types/repeat-string/tsconfig.json | 25 ++++++++++++++++++++++ types/repeat-string/tslint.json | 3 +++ 4 files changed, 40 insertions(+) create mode 100644 types/repeat-string/index.d.ts create mode 100644 types/repeat-string/repeat-string-tests.ts create mode 100644 types/repeat-string/tsconfig.json create mode 100644 types/repeat-string/tslint.json diff --git a/types/repeat-string/index.d.ts b/types/repeat-string/index.d.ts new file mode 100644 index 0000000000..e593a62b68 --- /dev/null +++ b/types/repeat-string/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for repeat-string 1.6 +// Project: https://github.com/jonschlinkert/repeat-string +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Repeat the given `string` the specified `number` of times. + */ +export default function(str: string, num: number): string; diff --git a/types/repeat-string/repeat-string-tests.ts b/types/repeat-string/repeat-string-tests.ts new file mode 100644 index 0000000000..7095ea672b --- /dev/null +++ b/types/repeat-string/repeat-string-tests.ts @@ -0,0 +1,3 @@ +import Repeat from "repeat-string"; + +Repeat('A', 5); diff --git a/types/repeat-string/tsconfig.json b/types/repeat-string/tsconfig.json new file mode 100644 index 0000000000..a56114d84f --- /dev/null +++ b/types/repeat-string/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "repeat-string-tests.ts" + ] +} diff --git a/types/repeat-string/tslint.json b/types/repeat-string/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/repeat-string/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 017b8bdd70cc40d68698fe948eb8c983cfc90161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Fri, 1 Mar 2019 11:16:20 +0100 Subject: [PATCH 047/265] Fix spelling of a setting The "D" of "Domains" should be written in uppercase according to the docs: https://helmetjs.github.io/docs/hsts/ --- types/helmet/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index b0a50c901e..82ad12929b 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -134,7 +134,7 @@ declare namespace helmet { export interface IHelmetHpkpConfiguration { maxAge: number; sha256s: string[]; - includeSubdomains?: boolean; + includeSubDomains?: boolean; reportUri?: string; reportOnly?: boolean; setIf?: IHelmetSetIfFunction; From f257e0ca0fb86fa449fdb52ad7d5e9961afcf28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Fri, 1 Mar 2019 11:35:26 +0100 Subject: [PATCH 048/265] Add blameable person --- types/helmet/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index 82ad12929b..565dda9ebf 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for helmet // Project: https://github.com/helmetjs/helmet -// Definitions by: Cyril Schumacher , Evan Hahn , Elliot Blackburn +// Definitions by: Cyril Schumacher , Evan Hahn , Elliot Blackburn , Daniel Müller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From ca6acc7eb2a594e5dd70fc203dd34f667789dbc6 Mon Sep 17 00:00:00 2001 From: chdanielmueller Date: Fri, 1 Mar 2019 11:43:05 +0100 Subject: [PATCH 049/265] Fix Tests --- types/helmet/helmet-tests.ts | 6 +++--- types/helmet/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/helmet/helmet-tests.ts b/types/helmet/helmet-tests.ts index 8b4c5634ac..f73095b714 100644 --- a/types/helmet/helmet-tests.ts +++ b/types/helmet/helmet-tests.ts @@ -122,13 +122,13 @@ function hpkpTest() { app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: false + includeSubDomains: false })); app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hpkp({ @@ -164,7 +164,7 @@ function hstsTest() { app.use(helmet.hsts({ maxAge: 7776000000, - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hsts({ diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index 565dda9ebf..573395831b 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -142,7 +142,7 @@ declare namespace helmet { export interface IHelmetHstsConfiguration { maxAge?: number; - includeSubdomains?: boolean; + includeSubDomains?: boolean; preload?: boolean; setIf?: IHelmetSetIfFunction; force?: boolean; From 2203ddb799a7581e69b7f1a0693be7891c810d42 Mon Sep 17 00:00:00 2001 From: chdanielmueller Date: Fri, 1 Mar 2019 11:49:56 +0100 Subject: [PATCH 050/265] Koa Tests --- types/koa-helmet/koa-helmet-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/koa-helmet/koa-helmet-tests.ts b/types/koa-helmet/koa-helmet-tests.ts index 2290ab07fa..34bca1958a 100644 --- a/types/koa-helmet/koa-helmet-tests.ts +++ b/types/koa-helmet/koa-helmet-tests.ts @@ -95,13 +95,13 @@ function hpkpTest() { app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: false + includeSubDomains: false })); app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hpkp({ @@ -137,7 +137,7 @@ function hstsTest() { app.use(helmet.hsts({ maxAge: 7776000000, - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hsts({ From 480b1438e0049ea087e78ff35842e35c0391c9af Mon Sep 17 00:00:00 2001 From: zy410419243 Date: Fri, 1 Mar 2019 19:04:28 +0800 Subject: [PATCH 051/265] fix: Cesium3DTilesetItem --- types/cesium/index.d.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 398d05ad33..7cb7752223 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cesium 1.47 +// Type definitions for cesium 1.54 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls @@ -1393,7 +1393,7 @@ declare namespace Cesium { class ScreenSpaceEventHandler { constructor(element?: HTMLCanvasElement); - setInputAction(action: () => void, type: number, modifier?: number): void; + setInputAction(action: (click: { position: Cartesian2 }) => void, type: number, modifier?: number): void; getInputAction(type: number, modifier?: number): () => void; removeInputAction(type: number, modifier?: number): void; isDestroyed(): boolean; @@ -3134,6 +3134,16 @@ declare namespace Cesium { static clone(hpr: HeadingPitchRange, result?: HeadingPitchRange): HeadingPitchRange; } + class Cesium3DTilesetItem { + url: string; + maximumScreenSpaceError: number; + maximumNumberOfLoadedTiles: number; + } + + class Cesium3DTileset { + constructor (Cesium3DTilesetItem: Cesium3DTilesetItem) + } + class ImageryLayer { alpha: number; brightness: number; From 52748754cf41c58a00a0a4a8311555fbda59253b Mon Sep 17 00:00:00 2001 From: zy410419243 Date: Fri, 1 Mar 2019 19:28:11 +0800 Subject: [PATCH 052/265] pref: disable tslint rule => no-unnecessary-class --- types/cesium/index.d.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 7cb7752223..497c763ebf 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -3134,14 +3134,13 @@ declare namespace Cesium { static clone(hpr: HeadingPitchRange, result?: HeadingPitchRange): HeadingPitchRange; } - class Cesium3DTilesetItem { - url: string; - maximumScreenSpaceError: number; - maximumNumberOfLoadedTiles: number; - } - + // tslint:disable-next-line:no-unnecessary-class class Cesium3DTileset { - constructor (Cesium3DTilesetItem: Cesium3DTilesetItem) + constructor(Cesium3DTilesetItem: { + url: string; + maximumScreenSpaceError: number; + maximumNumberOfLoadedTiles: number; + }) } class ImageryLayer { From 0bcf782f9dc132cba866ffacbdbe6753279c2869 Mon Sep 17 00:00:00 2001 From: Eric Musgrave Date: Fri, 1 Mar 2019 11:14:03 -0500 Subject: [PATCH 053/265] Fix/add more zeromq types --- types/zeromq/index.d.ts | 75 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index d1088aba8f..29bc442723 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -1,3 +1,5 @@ +import { EventEmitter } from "events"; + // Type definitions for zeromq 4.6 // Project: https://github.com/zeromq/zeromq.js // Definitions by: Dave McKeown @@ -58,21 +60,79 @@ export interface SocketOptions { zap_domain: number; } -export class Socket { +/** + * Export all option names at the global level + */ +export const ZMQ_HWM: number; +export const ZMQ_SWAP: number; +export const ZMQ_AFFINITY: number; +export const ZMQ_IDENTITY: number; +export const ZMQ_SUBSCRIBE: number; +export const ZMQ_UNSUBSCRIBE: number; +export const ZMQ_RATE: number; +export const ZMQ_RECOVERY_IVL: number; +export const ZMQ_MCAST_LOOP: number; +export const ZMQ_SNDBUF: number; +export const ZMQ_RCVBUF: number; +export const ZMQ_RCVMORE: number; +export const ZMQ_FD: number; +export const ZMQ_EVENTS: number; +export const ZMQ_TYPE: number; +export const ZMQ_LINGER: number; +export const ZMQ_RECONNECT_IVL: number; +export const ZMQ_BACKLOG: number; +export const ZMQ_RECOVERY_IVL_MSEC: number; +export const ZMQ_RECONNECT_IVL_MAX: number; +export const ZMQ_MAXMSGSIZE: number; +export const ZMQ_SNDHWM: number; +export const ZMQ_RCVHWM: number; +export const ZMQ_MULTICAST_HOPS: number; +export const ZMQ_RCVTIMEO: number; +export const ZMQ_SNDTIMEO: number; +export const ZMQ_IPV4ONLY: number; +export const ZMQ_LAST_ENDPOINT: number; +export const ZMQ_ROUTER_MANDATORY: number; +export const ZMQ_TCP_KEEPALIVE: number; +export const ZMQ_TCP_KEEPALIVE_CNT: number; +export const ZMQ_TCP_KEEPALIVE_IDLE: number; +export const ZMQ_TCP_KEEPALIVE_INTVL: number; +export const ZMQ_TCP_ACCEPT_FILTER: number; +export const ZMQ_DELAY_ATTACH_ON_CONNECT: number; +export const ZMQ_XPUB_VERBOSE: number; +export const ZMQ_ROUTER_RAW: number; +export const ZMQ_IPV6: number; +export const ZMQ_MECHANISM: number; +export const ZMQ_PLAIN_SERVER: number; +export const ZMQ_PLAIN_USERNAME: number; +export const ZMQ_PLAIN_PASSWORD: number; +export const ZMQ_CURVE_SERVER: number; +export const ZMQ_CURVE_PUBLICKEY: number; +export const ZMQ_CURVE_SECRETKEY: number; +export const ZMQ_CURVE_SERVERKEY: number; +export const ZMQ_ZAP_DOMAIN: number; +export const ZMQ_HEARTBEAT_IVL: number; +export const ZMQ_HEARTBEAT_TTL: number; +export const ZMQ_HEARTBEAT_TIMEOUT: number; +export const ZMQ_CONNECT_TIMEOUT: number; +export const ZMQ_IO_THREADS: number; +export const ZMQ_MAX_SOCKETS: number; +export const ZMQ_ROUTER_HANDOVER: number; + +export class Socket extends EventEmitter { /** * Set `opt` to `val`. * * @param opt Option * @param val Value */ - setsocketopt(opt: number|string, val: any): Socket; + setsockopt(opt: number|string, val: any): Socket; /** * Get socket `opt`. * * @param opt Option number */ - getsocketopt(opt: number|string): any; + getsockopt(opt: number|string): any; /** * Async bind. @@ -156,6 +216,15 @@ export class Socket { */ monitor(interval?: number, numOfEvents?: number): Socket; + /** + * Disable monitoring of a Socket release idle handler + * and close the socket + * + * @return {Socket} for chaining + * @api public + */ + unmonitor(): Socket; + /** * Close the socket. * From 1a3a185d97a1ed0edf2d84684f75c63f7a6be043 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 1 Mar 2019 12:35:56 -0500 Subject: [PATCH 054/265] Remove `on` definition --- types/zeromq/index.d.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index 29bc442723..7f9573555e 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -231,11 +231,6 @@ export class Socket extends EventEmitter { */ close(): Socket; - /** - * Socket event - 'message' - */ - on(eventName: string, callback: (...buffer: Buffer[]) => void): void; - pause(): void; resume(): void; From 9623d61290fb9ded402ecd6f3de40fac17b2c60c Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 1 Mar 2019 19:13:17 +0100 Subject: [PATCH 055/265] Add offscreencanvas types --- types/offscreencanvas/index.d.ts | 50 +++++++++++++++++++ .../offscreencanvas/offscreencanvas-tests.ts | 29 +++++++++++ types/offscreencanvas/tsconfig.json | 23 +++++++++ types/offscreencanvas/tslint.json | 1 + 4 files changed, 103 insertions(+) create mode 100644 types/offscreencanvas/index.d.ts create mode 100644 types/offscreencanvas/offscreencanvas-tests.ts create mode 100644 types/offscreencanvas/tsconfig.json create mode 100644 types/offscreencanvas/tslint.json diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts new file mode 100644 index 0000000000..395af42f16 --- /dev/null +++ b/types/offscreencanvas/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for the W3C OffscreenCanvas +// Project: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare global { + // https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage + interface CanvasDrawImage { + drawImage(image: OffscreenCanvas, dx: number, dy: number): void; + drawImage(image: OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, + dx: number, dy: number, dw: number, dh: number): void; + } + + // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen + interface HTMLCanvasElement extends HTMLElement { + transferControlToOffscreen(): OffscreenCanvas; + } + + // https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvasrenderingcontext2d + interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, + CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, + CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, + CanvasTextDrawingStyles, CanvasPath { + readonly canvas: OffscreenCanvas; + } + var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new (): OffscreenCanvasRenderingContext2D; + } + + // https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface + interface OffscreenCanvas extends EventTarget { + width: number; + height: number; + getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings): + OffscreenCanvasRenderingContext2D | null; + getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): OffscreenCanvasRenderingContext2D + | WebGLRenderingContext | null; + transferToImageBitmap(): ImageBitmap; + convertToBlob(options?: { type?: string, quality?: number }): Promise; + } + var OffscreenCanvas: { + prototype: OffscreenCanvas; + new (width: number, height: number): OffscreenCanvas; + } +} + +export { }; diff --git a/types/offscreencanvas/offscreencanvas-tests.ts b/types/offscreencanvas/offscreencanvas-tests.ts new file mode 100644 index 0000000000..f74690ad9a --- /dev/null +++ b/types/offscreencanvas/offscreencanvas-tests.ts @@ -0,0 +1,29 @@ +// Test constructor +const offscreenCanvas: OffscreenCanvas = new OffscreenCanvas(20, 10); + +// Test OffscreenCanvas properties +let width: number = offscreenCanvas.width; +let height: number = offscreenCanvas.height; + +// Test OffscreenCanvas methods +const context2D: OffscreenCanvasRenderingContext2D | null = offscreenCanvas.getContext("2d"); +const webglContext: WebGLRenderingContext | null = offscreenCanvas.getContext("webgl"); +const otherContext: OffscreenCanvasRenderingContext2D | WebGLRenderingContext | null = + offscreenCanvas.getContext("foobar"); +const imageBitmap: ImageBitmap = offscreenCanvas.transferToImageBitmap(); +const blob1: Promise = offscreenCanvas.convertToBlob(); +const blob2: Promise = offscreenCanvas.convertToBlob({ type: "image/jpeg" }); +const blob3: Promise = offscreenCanvas.convertToBlob({ type: "image/jpeg", quality: 0.92 }); + +// Test OffscreenCanvasRenderingContext2D properties +const canvasRef: OffscreenCanvas = context2D!.canvas; + +// Test HTMLCanvasElement methods +const canvas: HTMLCanvasElement = document.createElement("canvas"); +const transferredCanvas: OffscreenCanvas = canvas.transferControlToOffscreen(); + +// Test CanvasRenderingContext2D methods +const ctx = canvas.getContext("2d")!; +ctx.drawImage(offscreenCanvas, 0, 0); +ctx.drawImage(offscreenCanvas, 0, 0, 20, 10); +ctx.drawImage(offscreenCanvas, 0, 0, 20, 10, 0, 0, 20, 10); diff --git a/types/offscreencanvas/tsconfig.json b/types/offscreencanvas/tsconfig.json new file mode 100644 index 0000000000..3bb1ca90b4 --- /dev/null +++ b/types/offscreencanvas/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "offscreencanvas-tests.ts" + ] +} diff --git a/types/offscreencanvas/tslint.json b/types/offscreencanvas/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/offscreencanvas/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 749f6eaf2e2164380eeb9e5db8fd68ed103dd487 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 1 Mar 2019 19:46:08 +0100 Subject: [PATCH 056/265] Fix createImageBitmap and drawImage --- types/offscreencanvas/index.d.ts | 11 ++++++++--- types/offscreencanvas/offscreencanvas-tests.ts | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts index 395af42f16..810ba7a5f5 100644 --- a/types/offscreencanvas/index.d.ts +++ b/types/offscreencanvas/index.d.ts @@ -6,12 +6,17 @@ declare global { // https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage interface CanvasDrawImage { - drawImage(image: OffscreenCanvas, dx: number, dy: number): void; - drawImage(image: OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; - drawImage(image: OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void; } + // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap + function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise; + function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas, sx: number, sy: number, + sw: number, sh: number): Promise; + // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen interface HTMLCanvasElement extends HTMLElement { transferControlToOffscreen(): OffscreenCanvas; diff --git a/types/offscreencanvas/offscreencanvas-tests.ts b/types/offscreencanvas/offscreencanvas-tests.ts index f74690ad9a..9f89e374b3 100644 --- a/types/offscreencanvas/offscreencanvas-tests.ts +++ b/types/offscreencanvas/offscreencanvas-tests.ts @@ -27,3 +27,7 @@ const ctx = canvas.getContext("2d")!; ctx.drawImage(offscreenCanvas, 0, 0); ctx.drawImage(offscreenCanvas, 0, 0, 20, 10); ctx.drawImage(offscreenCanvas, 0, 0, 20, 10, 0, 0, 20, 10); + +// Test createImageBitmap function with offscreen canvas +const imageBitmap1 = createImageBitmap(offscreenCanvas); +const imageBitmap2 = createImageBitmap(offscreenCanvas, 1, 2, 3, 4); From cb32368e03397703ce9741a8b064b6616b7b0700 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 1 Mar 2019 19:46:21 +0100 Subject: [PATCH 057/265] Add strictFunctionTypes option --- types/offscreencanvas/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/offscreencanvas/tsconfig.json b/types/offscreencanvas/tsconfig.json index 3bb1ca90b4..12d786084f 100644 --- a/types/offscreencanvas/tsconfig.json +++ b/types/offscreencanvas/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 5c448bba7fe3a96e0f472f1e32ecb8c568e74174 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 1 Mar 2019 13:48:11 -0500 Subject: [PATCH 058/265] Use NodeJS.EventEmitter instead of importing event --- types/zeromq/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index 7f9573555e..cb21200253 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -1,5 +1,3 @@ -import { EventEmitter } from "events"; - // Type definitions for zeromq 4.6 // Project: https://github.com/zeromq/zeromq.js // Definitions by: Dave McKeown @@ -118,7 +116,7 @@ export const ZMQ_IO_THREADS: number; export const ZMQ_MAX_SOCKETS: number; export const ZMQ_ROUTER_HANDOVER: number; -export class Socket extends EventEmitter { +export class Socket extends NodeJS.EventEmitter { /** * Set `opt` to `val`. * From dd14243978af5beb48a230d93f94932d9c821e5e Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 1 Mar 2019 19:52:52 +0100 Subject: [PATCH 059/265] Fix header format --- types/offscreencanvas/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts index 810ba7a5f5..a5940042d8 100644 --- a/types/offscreencanvas/index.d.ts +++ b/types/offscreencanvas/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for the W3C OffscreenCanvas +// Type definitions for non-npm package offscreencanvas-browser // Project: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface // Definitions by: Klaus Reimer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 3764aa01952e399c9c4e876df4c9fd47e2fefae1 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 1 Mar 2019 20:00:41 +0100 Subject: [PATCH 060/265] Fix liniting errors --- types/offscreencanvas/index.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts index a5940042d8..de3b3a7fe3 100644 --- a/types/offscreencanvas/index.d.ts +++ b/types/offscreencanvas/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for non-npm package offscreencanvas-browser +// Type definitions for non-npm package offscreencanvas-browser 2019.3 // Project: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface // Definitions by: Klaus Reimer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + declare global { // https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage interface CanvasDrawImage { @@ -32,7 +34,7 @@ declare global { var OffscreenCanvasRenderingContext2D: { prototype: OffscreenCanvasRenderingContext2D; new (): OffscreenCanvasRenderingContext2D; - } + }; // https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface interface OffscreenCanvas extends EventTarget { @@ -49,7 +51,7 @@ declare global { var OffscreenCanvas: { prototype: OffscreenCanvas; new (width: number, height: number): OffscreenCanvas; - } + }; } export { }; From 465aea12e4ecf7692d8d4e6e4f77bc7a032945f6 Mon Sep 17 00:00:00 2001 From: simonihmig Date: Mon, 11 Feb 2019 20:40:23 +0100 Subject: [PATCH 061/265] [ember] Fix wrongly deprecated Ember.assign --- types/ember/index.d.ts | 1 - types/ember/v2/index.d.ts | 3 +-- types/ember__polyfills/index.d.ts | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index d0f9896eb9..d7aaa35b36 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -498,7 +498,6 @@ export namespace Ember { // TODO: replace with an es6 reexport when declare module 'ember' is removed /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ const assign: typeof EmberPolyfillsNs.assign; /** diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index 54b6d2e4a9..1734ee6a14 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -3131,7 +3131,7 @@ declare module 'ember' { function isPresent(obj: any): boolean; /** * Merge the contents of two objects together into the first object. - * @deprecated Use Object.assign + * @deprecated Use Ember.assign */ function merge(original: T, updates: U): T & U; /** @@ -3284,7 +3284,6 @@ declare module 'ember' { function typeOf(item: any): string; /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ function assign(target: T, source: U): T & U; function assign(target: T, source1: U, source2: V): T & U & V; diff --git a/types/ember__polyfills/index.d.ts b/types/ember__polyfills/index.d.ts index e5ace0fe2e..01820351e5 100644 --- a/types/ember__polyfills/index.d.ts +++ b/types/ember__polyfills/index.d.ts @@ -8,7 +8,6 @@ import { Mix, Mix3, Mix4 } from './types'; /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ export function assign(target: T, source: U): Mix; export function assign(target: T, source1: U, source2: V): Mix3; @@ -17,6 +16,6 @@ export function assign(target: object, ...sources: object[]): any; /** * Merge the contents of two objects together into the first object. - * @deprecated Use Object.assign + * @deprecated Use Ember.assign */ export function merge(original: T, updates: U): Mix; From 4245ec91060834381448443e347f7bb751e74855 Mon Sep 17 00:00:00 2001 From: Mike North Date: Fri, 1 Mar 2019 11:57:56 -0800 Subject: [PATCH 062/265] [ember/v2] remove dependency on handlebars types --- types/ember/v2/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index 1734ee6a14..cfc95ed691 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -12,7 +12,6 @@ // TypeScript Version: 2.4 /// -/// declare module 'ember' { // Capitalization is intentional: this makes it much easier to re-export RSVP on From 9ecdc820da5e79c24a6d9abcf6336ff459e05a0b Mon Sep 17 00:00:00 2001 From: Mike North Date: Fri, 1 Mar 2019 12:00:16 -0800 Subject: [PATCH 063/265] [ember/v2] add limited handlebars types to old ember types --- types/ember/v2/index.d.ts | 1 + types/ember/v2/test/ember-tests.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index cfc95ed691..b414a6f79b 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -2414,6 +2414,7 @@ declare module 'ember' { function print(ast: any): void; const logger: typeof Ember.Logger; function log(level: string, str: string): void; + function registerHelper(name: string, helper: any): void; } namespace String { function camelize(str: string): string; diff --git a/types/ember/v2/test/ember-tests.ts b/types/ember/v2/test/ember-tests.ts index c049512eb0..892c9ed9a8 100755 --- a/types/ember/v2/test/ember-tests.ts +++ b/types/ember/v2/test/ember-tests.ts @@ -92,10 +92,10 @@ App.userController = Ember.Object.create({ }), }); -Handlebars.registerHelper( +Ember.Handlebars.registerHelper( 'highlight', (property: string, options: any) => - new Handlebars.SafeString('' + 'some value' + '') + new Ember.Handlebars.SafeString('' + 'some value' + '') ); const coolView = App.CoolView.create(); From 12c7576fedcdd83e51fde9561f5c7b71cbe3de78 Mon Sep 17 00:00:00 2001 From: Jonathan Viney Date: Tue, 5 Feb 2019 17:41:32 +1300 Subject: [PATCH 064/265] [@ember/object]: Make ObjectProxy content generic. Add type checks for EmberObject getters. --- types/ember__object/proxy.d.ts | 24 +++++++++++++++++-- types/ember__object/test/proxy.ts | 38 +++++++++++++++++++++++++++++++ types/ember__object/tsconfig.json | 1 + 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 types/ember__object/test/proxy.ts diff --git a/types/ember__object/proxy.d.ts b/types/ember__object/proxy.d.ts index 841b211e49..38c690fe72 100644 --- a/types/ember__object/proxy.d.ts +++ b/types/ember__object/proxy.d.ts @@ -1,12 +1,32 @@ import EmberObject from "@ember/object"; +import { + UnwrapComputedPropertyGetter, + UnwrapComputedPropertyGetters +} from "@ember/object/-private/types"; /** * `Ember.ObjectProxy` forwards all properties not defined by the proxy itself * to a proxied `content` object. */ -export default class ObjectProxy extends EmberObject { +export default class ObjectProxy extends EmberObject { /** * The object whose properties will be forwarded. */ - content: object; + content: T | undefined; + + get(key: K): UnwrapComputedPropertyGetter; + get(key: K): UnwrapComputedPropertyGetter | undefined; + + getProperties( + list: K[] + ): Pick, K>; + getProperties( + ...list: K[] + ): Pick, K>; + getProperties( + list: K[] + ): Pick>, K>; + getProperties( + ...list: K[] + ): Pick>, K>; } diff --git a/types/ember__object/test/proxy.ts b/types/ember__object/test/proxy.ts new file mode 100644 index 0000000000..bacfd013f1 --- /dev/null +++ b/types/ember__object/test/proxy.ts @@ -0,0 +1,38 @@ +import ObjectProxy from "@ember/object/proxy"; + +interface Book { + title: string; + subtitle: string; + chapters: Array<{ title: string }>; +} + +class DefaultProxy extends ObjectProxy {} +DefaultProxy.create().content; // $ExpectType object | undefined + +class BookProxy extends ObjectProxy { + private readonly baz = 'baz'; + + getTitle() { + return this.get('title'); + } + + getPropertiesTitleSubtitle() { + return this.getProperties('title', 'subtitle'); + } +} + +const book = BookProxy.create(); +book.content; // $ExpectType Book | undefined + +book.get("unknownProperty"); // $ExpectError +book.get("title"); // $ExpectType string | undefined +book.getTitle(); // $ExpectType string | undefined + +book.getProperties("title", "unknownProperty"); // $ExpectError +book.getProperties("title", "subtitle"); // $ExpectType Pick>, "title" | "subtitle"> +book.getPropertiesTitleSubtitle(); // $ExpectType Pick>, "title" | "subtitle"> + +book.getProperties(["subtitle", "chapters"]); // $ExpectType Pick>, "subtitle" | "chapters"> +book.getProperties(["title", "unknownProperty"]); // $ExpectError + +book.get("baz"); // $ExpectError diff --git a/types/ember__object/tsconfig.json b/types/ember__object/tsconfig.json index 5ed61a24d3..deeb128e7b 100644 --- a/types/ember__object/tsconfig.json +++ b/types/ember__object/tsconfig.json @@ -49,6 +49,7 @@ "test/extend.ts", "test/object.ts", "test/observable.ts", + "test/proxy.ts", "test/reopen.ts" ] } From e065fec3902500ac044320b984b44bea07a54980 Mon Sep 17 00:00:00 2001 From: simonihmig Date: Sun, 27 Jan 2019 20:42:18 +0100 Subject: [PATCH 065/265] Add url property to deprecation options See https://github.com/emberjs/ember.js/blob/56d60eac537933e20ef66e735299b81dba9a1788/packages/%40ember/debug/lib/deprecate.ts#L16 --- types/ember/v2/index.d.ts | 16 +++++++++++----- types/ember/v2/test/utils.ts | 8 ++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index 54b6d2e4a9..bdea9c24f8 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -274,6 +274,12 @@ declare module 'ember' { triggerAction(opts: TriggerActionOptions): boolean; } + interface DeprecationOptions { + id: string; + until: string; + url?: string; + } + export namespace Ember { interface FunctionPrototypeExtensions { /** @@ -2574,14 +2580,14 @@ declare module 'ember' { */ deprecatingAlias( dependentKey: string, - options: { id: string; until: string } + options: DeprecationOptions ): ComputedProperty; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ deprecatingAlias( dependentKey: string, - options?: { id?: string; until?: string } + options?: Partial ): ComputedProperty; /** * A computed property that returns the sum of the values @@ -2977,7 +2983,7 @@ declare module 'ember' { function deprecate( message: string, test: boolean, - options: { id: string; until: string } + options: DeprecationOptions ): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options @@ -2985,7 +2991,7 @@ declare module 'ember' { function deprecate( message: string, test: boolean, - options?: { id?: string; until?: string } + options?: Partial ): any; /** * Define an assertion that will throw an exception if the condition is not met. @@ -3012,7 +3018,7 @@ declare module 'ember' { */ function deprecateFunc any)>( message: string, - options: { id: string; until: string }, + options: DeprecationOptions, func: Func ): Func; /** diff --git a/types/ember/v2/test/utils.ts b/types/ember/v2/test/utils.ts index d729d472b8..72d55184ab 100755 --- a/types/ember/v2/test/utils.ts +++ b/types/ember/v2/test/utils.ts @@ -50,6 +50,14 @@ function testDeprecateFunc() { assertType(oldMethod('first', 123)); } +function testDeprecate() { + Ember.deprecate('This has been deprecated', false, { + id: 'some.id', + until: '1.0.0', + url: 'http://www.emberjs.com' + }); +} + function testDefineProperty() { const contact = {}; From 8cfa0ed3349d02128424dbe9dd112c8f85e11ff8 Mon Sep 17 00:00:00 2001 From: simonihmig Date: Fri, 1 Feb 2019 14:17:49 +0100 Subject: [PATCH 066/265] Add url property to deprecation options in ember/application/deprecations --- types/ember__application/deprecations.d.ts | 11 +++++++++-- types/ember__application/test/deprecations.ts | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/types/ember__application/deprecations.d.ts b/types/ember__application/deprecations.d.ts index 8509e2f69d..ddc5af5019 100644 --- a/types/ember__application/deprecations.d.ts +++ b/types/ember__application/deprecations.d.ts @@ -1,3 +1,10 @@ +// tslint:disable-next-line:strict-export-declare-modifiers +interface DeprecationOptions { + id: string; + until: string; + url?: string; +} + /** * Display a deprecation warning with the provided message and a stack trace * (Chrome and Firefox only). @@ -5,7 +12,7 @@ export function deprecate( message: string, test: boolean, - options: { id: string; until: string } + options: DeprecationOptions ): any; /** @@ -13,6 +20,6 @@ export function deprecate( */ export function deprecateFunc any)>( message: string, - options: { id: string; until: string }, + options: DeprecationOptions, func: Func ): Func; diff --git a/types/ember__application/test/deprecations.ts b/types/ember__application/test/deprecations.ts index 30d1e8a075..c5db468535 100644 --- a/types/ember__application/test/deprecations.ts +++ b/types/ember__application/test/deprecations.ts @@ -1,8 +1,13 @@ import { deprecate, deprecateFunc } from '@ember/application/deprecations'; +deprecate('this is no longer advised', false, { + id: 'no-longer-advised', + until: 'v4.0' +}); deprecate('this is no longer advised', false, { id: 'no-longer-advised', - until: 'v4.0' + until: 'v4.0', + url: 'https://emberjs.com' }); deprecate('this is no longer advised', false); // $ExpectError From 3bf06f2894dd547e71ddd817a55d1f6802982d01 Mon Sep 17 00:00:00 2001 From: Mike North Date: Fri, 1 Mar 2019 12:00:16 -0800 Subject: [PATCH 067/265] [ember/v2] add limited handlebars types to old ember types --- types/ember/v2/index.d.ts | 2 +- types/ember/v2/test/ember-tests.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index bdea9c24f8..1875f23eca 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -12,7 +12,6 @@ // TypeScript Version: 2.4 /// -/// declare module 'ember' { // Capitalization is intentional: this makes it much easier to re-export RSVP on @@ -2421,6 +2420,7 @@ declare module 'ember' { function print(ast: any): void; const logger: typeof Ember.Logger; function log(level: string, str: string): void; + function registerHelper(name: string, helper: any): void; } namespace String { function camelize(str: string): string; diff --git a/types/ember/v2/test/ember-tests.ts b/types/ember/v2/test/ember-tests.ts index c049512eb0..892c9ed9a8 100755 --- a/types/ember/v2/test/ember-tests.ts +++ b/types/ember/v2/test/ember-tests.ts @@ -92,10 +92,10 @@ App.userController = Ember.Object.create({ }), }); -Handlebars.registerHelper( +Ember.Handlebars.registerHelper( 'highlight', (property: string, options: any) => - new Handlebars.SafeString('' + 'some value' + '') + new Ember.Handlebars.SafeString('' + 'some value' + '') ); const coolView = App.CoolView.create(); From bdad98eff86a701b05256c1f8720ff631ebdd5c8 Mon Sep 17 00:00:00 2001 From: Ron Newcomb Date: Fri, 1 Mar 2019 13:19:06 -0800 Subject: [PATCH 068/265] VictoryVoronoiContainer for tooltips on Line chart VictoryVoronoiContainer for tooltips on Line chart --- types/victory/index.d.ts | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index f5c67995da..f70e8f7bf9 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -420,6 +420,81 @@ declare module "victory" { export class VictoryBrushContainer extends React.Component {} + export interface VictoryVoronoiContainerProps extends VictoryContainerProps { + /** + * When the activateData prop is set to true, the active prop will be set to true on all + * data components within a voronoi area. When this prop is set to false, the onActivated + * and onDeactivated callbacks will still fire, but no mutations to data components will + * occur via Victory’s event system. + */ + activateData?: boolean; + /** + * When the activateLabels prop is set to true, the active prop will be set to true on all + * labels corresponding to points within a voronoi area. When this prop is set to false, + * the onActivated and onDeactivated callbacks will still fire, but no mutations to label + * components will occur via Victory’s event system. Labels defined directly on + * VictoryVoronoiContainer via the labels prop will still appear when this prop is set to false. + */ + activateLabels?: boolean; + /** + * When the disable prop is set to true, VictoryVoronoiContainer events will not fire. + */ + disable?: boolean; + /** + * When a labels prop is provided to VictoryVoronoiContainer it will render a label component + * rather than activating labels on the child components it renders. This is useful for + * creating multi- point tooltips. This prop should be given as a function which will be called + * once for each active point. The labels function will be called with the arguments point, + * index, and points, where point refers to a single active point, index refers to the position + * of that point in the array of active points, and points is an array of all active points. + */ + labels?: (point: any, index: number, points: any[]) => string; + /** + * The labelComponent prop specified the component that will be rendered when labels are defined + * on VictoryVoronoiContainer. If the labels prop is omitted, no label component will be rendered. + */ + labelComponent?: React.ReactElement; + /** + * The onActivated prop accepts a function to be called whenever new data points are activated. + * The function is called with the parameters points (an array of active data objects) and props + * (the props used by VictoryVoronoiContainer). + */ + onActivated?: (points: any[], props: VictoryVoronoiContainerProps) => void; + /** + * The onDeactivated prop accepts a function to be called whenever points are deactivated. The + * function is called with the parameters points (an array of the newly-deactivated data objects) + * and props (the props used by VictoryVoronoiContainer). + */ + onDeactivated?: (points: any[], props: VictoryVoronoiContainerProps) => void; + /** + * When the radius prop is set, the voronoi areas associated with each data point will be no larger + * than the given radius. This prop should be given as a number. + */ + radius?: number; + /** + * The voronoiBlacklist prop is used to specify a list of components to ignore when calculating a + * shared voronoi diagram. Components with a name prop matching an element in the voronoiBlacklist + * array will be ignored by VictoryVoronoiContainer. Ignored components will never be flagged as + * active, and will not contribute date to shared tooltips or labels. + */ + voronoiBlacklist?: string[]; + /** + *When the voronoiDimension prop is set, voronoi selection will only take the given dimension into + * account. For example, when dimension is set to “x”, all data points matching a particular x mouse + * position will be activated regardless of y value. When this prop is not given, voronoi selection + * is determined by both x any y values. + */ + voronoiDimension?: "x" | "y"; + /** + * When the voronoiPadding prop is given, the area of the chart that will trigger voronoi events is + * reduced by the given padding on every side. By default, no padding is applied, and the entire range + * of a given chart may trigger voronoi events. This prop should be given as a number. + */ + voronoiPadding?: number; + } + + export class VictoryVoronoiContainer extends React.Component { } + export interface VictoryZoomContainerProps extends VictoryContainerProps { /** * The optional allowPan prop accepts a boolean that enables the panning From 9ea4c0ba6048ceb5435345b2598fdee6652d70d4 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 1 Mar 2019 16:35:43 -0500 Subject: [PATCH 069/265] Remove JSDoc type annotation --- types/zeromq/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index cb21200253..e40e5cc3aa 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -218,8 +218,7 @@ export class Socket extends NodeJS.EventEmitter { * Disable monitoring of a Socket release idle handler * and close the socket * - * @return {Socket} for chaining - * @api public + * @return for chaining */ unmonitor(): Socket; From 1717bac2515339ca81bbed35ba1a588bfa3bc7c1 Mon Sep 17 00:00:00 2001 From: Ron Newcomb Date: Fri, 1 Mar 2019 14:47:33 -0800 Subject: [PATCH 070/265] VictoryVoronoiContainer for tooltips on Line chart --- types/victory/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index f70e8f7bf9..e6443c37d8 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -423,7 +423,7 @@ declare module "victory" { export interface VictoryVoronoiContainerProps extends VictoryContainerProps { /** * When the activateData prop is set to true, the active prop will be set to true on all - * data components within a voronoi area. When this prop is set to false, the onActivated + * data components within a voronoi area. When this prop is set to false, the onActivated * and onDeactivated callbacks will still fire, but no mutations to data components will * occur via Victory’s event system. */ @@ -431,8 +431,8 @@ declare module "victory" { /** * When the activateLabels prop is set to true, the active prop will be set to true on all * labels corresponding to points within a voronoi area. When this prop is set to false, - * the onActivated and onDeactivated callbacks will still fire, but no mutations to label - * components will occur via Victory’s event system. Labels defined directly on + * the onActivated and onDeactivated callbacks will still fire, but no mutations to label + * components will occur via Victory’s event system. Labels defined directly on * VictoryVoronoiContainer via the labels prop will still appear when this prop is set to false. */ activateLabels?: boolean; @@ -441,8 +441,8 @@ declare module "victory" { */ disable?: boolean; /** - * When a labels prop is provided to VictoryVoronoiContainer it will render a label component - * rather than activating labels on the child components it renders. This is useful for + * When a labels prop is provided to VictoryVoronoiContainer it will render a label component + * rather than activating labels on the child components it renders. This is useful for * creating multi- point tooltips. This prop should be given as a function which will be called * once for each active point. The labels function will be called with the arguments point, * index, and points, where point refers to a single active point, index refers to the position @@ -455,7 +455,7 @@ declare module "victory" { */ labelComponent?: React.ReactElement; /** - * The onActivated prop accepts a function to be called whenever new data points are activated. + * The onActivated prop accepts a function to be called whenever new data points are activated. * The function is called with the parameters points (an array of active data objects) and props * (the props used by VictoryVoronoiContainer). */ @@ -474,14 +474,14 @@ declare module "victory" { /** * The voronoiBlacklist prop is used to specify a list of components to ignore when calculating a * shared voronoi diagram. Components with a name prop matching an element in the voronoiBlacklist - * array will be ignored by VictoryVoronoiContainer. Ignored components will never be flagged as + * array will be ignored by VictoryVoronoiContainer. Ignored components will never be flagged as * active, and will not contribute date to shared tooltips or labels. */ voronoiBlacklist?: string[]; /** - *When the voronoiDimension prop is set, voronoi selection will only take the given dimension into + * When the voronoiDimension prop is set, voronoi selection will only take the given dimension into * account. For example, when dimension is set to “x”, all data points matching a particular x mouse - * position will be activated regardless of y value. When this prop is not given, voronoi selection + * position will be activated regardless of y value. When this prop is not given, voronoi selection * is determined by both x any y values. */ voronoiDimension?: "x" | "y"; From 328c85b59a52f21ba75ff3f001b9799af3490dc3 Mon Sep 17 00:00:00 2001 From: Jordan Abreu Date: Fri, 1 Mar 2019 15:13:04 -0800 Subject: [PATCH 071/265] Add missing property boolean `followRedirects` Add missing boolean property `followRedirects ` to ServerOptions interface --- types/http-proxy/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index 2560b0a38d..535c12ab8a 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -207,6 +207,8 @@ declare namespace Server { headers?: {[header: string]: string}; /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */ proxyTimeout?: number; + /** Specify whether you want to follow redirects. Default: false */ + followRedirects?: boolean; /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */ selfHandleResponse?: boolean; } From 46c8b18ad68ffc0f4a973f4339b9e4bee060ff4f Mon Sep 17 00:00:00 2001 From: Jordan Abreu Date: Fri, 1 Mar 2019 15:42:41 -0800 Subject: [PATCH 072/265] Updates ServerOptions interface Bumps version Adds timeout and cookiePathRewite to ServerOptions interface reorders ServerOptions interface to reflect order in http-proxy readme --- types/http-proxy/index.d.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index 535c12ab8a..80e09de68f 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for node-http-proxy 1.16 +// Type definitions for node-http-proxy 1.17 // Project: https://github.com/nodejitsu/node-http-proxy // Definitions by: Maxime LUCE // Florian Oellerich // Daniel Schmidt +// Jordan Abreu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -165,8 +166,6 @@ declare class Server extends events.EventEmitter { declare namespace Server { interface ServerOptions { - /** Buffer */ - buffer?: stream.Stream; /** URL string to be parsed with the url module. */ target?: ProxyTargetUrl; /** URL string to be parsed with the url module. */ @@ -203,14 +202,20 @@ declare namespace Server { protocolRewrite?: string; /** rewrites domain of set-cookie headers. */ cookieDomainRewrite?: false | string | {[oldDomain: string]: string}; + /** rewrites path of set-cookie headers. Default: false */ + cookiePathRewrite?: false | string | {[oldPath: string]: string}; /** object with extra headers to be added to target requests. */ headers?: {[header: string]: string}; /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */ proxyTimeout?: number; + /** Timeout (in milliseconds) for incoming requests */ + timeout?: number; /** Specify whether you want to follow redirects. Default: false */ followRedirects?: boolean; /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */ selfHandleResponse?: boolean; + /** Buffer */ + buffer?: stream.Stream; } } From e5f8ae32346b7574f264ecc366914c8459fe4751 Mon Sep 17 00:00:00 2001 From: Ori Livni Date: Wed, 27 Feb 2019 10:21:44 +0200 Subject: [PATCH 073/265] electron-store - Fix `onDidChange` return value --- types/electron-store/electron-store-tests.ts | 4 ++++ types/electron-store/index.d.ts | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/types/electron-store/electron-store-tests.ts b/types/electron-store/electron-store-tests.ts index f27cd6aca3..318af19f5c 100644 --- a/types/electron-store/electron-store-tests.ts +++ b/types/electron-store/electron-store-tests.ts @@ -52,3 +52,7 @@ typedElectronStore.set({ enabled: true, interval: 10000, }); + +const offDidChange = typedElectronStore.onDidChange("enabled", (n: boolean | undefined, p: boolean | undefined) => {}); + +offDidChange(); diff --git a/types/electron-store/index.d.ts b/types/electron-store/index.d.ts index 66e579b392..721386de2f 100644 --- a/types/electron-store/index.d.ts +++ b/types/electron-store/index.d.ts @@ -8,6 +8,8 @@ /// +import EventEmitter = require("events"); + type JSONValue = string | number | boolean | JSONObject | JSONArray; interface JSONObject { @@ -79,12 +81,12 @@ declare class ElectronStore implements Iterable<[string, JSONValue]> { */ onDidChange( key: K, - callback: (newValue: T[K], oldValue: T[K]) => void - ): void; + callback: (newValue: T[K] | undefined, oldValue: T[K] | undefined) => void + ): () => EventEmitter; onDidChange( key: string, - callback: (newValue: JSONValue, oldValue: JSONValue) => void - ): void; + callback: (newValue: JSONValue | undefined, oldValue: JSONValue | undefined) => void + ): () => EventEmitter; /** * Get the item count. From 558d043fd0f9b3e247839d2a09a16accf4e21e09 Mon Sep 17 00:00:00 2001 From: Akihiro Uchida Date: Sat, 2 Mar 2019 14:24:36 +0900 Subject: [PATCH 074/265] put options to createBrowserFetcher test --- types/puppeteer/puppeteer-tests.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/puppeteer/puppeteer-tests.ts b/types/puppeteer/puppeteer-tests.ts index e62be5b7d5..81c23e5b5e 100644 --- a/types/puppeteer/puppeteer-tests.ts +++ b/types/puppeteer/puppeteer-tests.ts @@ -621,7 +621,11 @@ puppeteer.launch().then(async browser => { (async () => { const rev = '630727'; - const browserFetcher = puppeteer.createBrowserFetcher(); + const browserFetcher = puppeteer.createBrowserFetcher({ + host: 'https://storage.googleapis.com', + path: '/tmp/.local-chromium', + platform: 'linux', + }); await browserFetcher.canDownload(rev); const revisionInfo = await browserFetcher.download(rev); await browserFetcher.remove(rev); From efaf421de15617c280593b8a45168874896c391f Mon Sep 17 00:00:00 2001 From: Akihiro Uchida Date: Sat, 2 Mar 2019 14:24:47 +0900 Subject: [PATCH 075/265] fixes due to the review comments --- types/puppeteer/index.d.ts | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index a4bf6e0d73..aacd54a9d0 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -31,6 +31,8 @@ export interface JSONObject { } export type SerializableOrJSHandle = Serializable | JSHandle; +export type Platform = "mac" | "win32" | "win64" | "linux"; + /** Defines `$eval` and `$$eval` for Page, Frame and ElementHandle. */ export interface Evalable { /** @@ -2187,26 +2189,14 @@ export interface CoverageEntry { ranges: Array<{start: number, end: number}>; } -/** Attaches Puppeteer to an existing Chromium instance */ -export function connect(options?: ConnectOptions): Promise; -/** The default flags that Chromium will be launched with */ -export function defaultArgs(options?: ChromeArgOptions): string[]; -/** Path where Puppeteer expects to find bundled Chromium */ -export function executablePath(): string; -/** The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed. */ -export function launch(options?: LaunchOptions): Promise; - -/** This methods attaches Puppeteer to an existing Chromium instance. */ -export function createBrowserFetcher(options?: LaunchOptions): BrowserFetcher; - /** BrowserFetcher can download and manage different versions of Chromium. */ export interface BrowserFetcher { /** The method initiates a HEAD request to check if the revision is available. */ canDownload(revision: string): Promise; /** The method initiates a GET request to download the revision from the host. */ - download(revision: string, progressCallback?: (downloadBytes: number, totalBytes: number) => any): Promise; + download(revision: string, progressCallback?: (downloadBytes: number, totalBytes: number) => void): Promise; localRevisions(): Promise; - platform(): string; + platform(): Platform; remove(revision: string): Promise; revisionInfo(revision: string): RevisionInfo; } @@ -2223,3 +2213,23 @@ export interface RevisionInfo { /** whether the revision is locally available on disk */ local: boolean; } + +export interface FetcherOptions { + /** A download host to be used. Defaults to `https://storage.googleapis.com`. */ + host: string; + /** A path for the downloads folder. Defaults to `/.local-chromium`, where `` is puppeteer's package root. */ + path: string; + /** Possible values are: `mac`, `win32`, `win64`, `linux`. Defaults to the current platform. */ + platform: Platform; +} + +/** Attaches Puppeteer to an existing Chromium instance */ +export function connect(options?: ConnectOptions): Promise; +/** The default flags that Chromium will be launched with */ +export function defaultArgs(options?: ChromeArgOptions): string[]; +/** Path where Puppeteer expects to find bundled Chromium */ +export function executablePath(): string; +/** The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed. */ +export function launch(options?: LaunchOptions): Promise; +/** This methods attaches Puppeteer to an existing Chromium instance. */ +export function createBrowserFetcher(options?: FetcherOptions): BrowserFetcher; From 8057cda1792524316a88ff73ca9054dd97b2888d Mon Sep 17 00:00:00 2001 From: Akihiro Uchida Date: Sat, 2 Mar 2019 17:07:47 +0900 Subject: [PATCH 076/265] make optional properties in FetcherOptions --- types/puppeteer/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index aacd54a9d0..e043587e16 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -2216,11 +2216,11 @@ export interface RevisionInfo { export interface FetcherOptions { /** A download host to be used. Defaults to `https://storage.googleapis.com`. */ - host: string; + host?: string; /** A path for the downloads folder. Defaults to `/.local-chromium`, where `` is puppeteer's package root. */ - path: string; + path?: string; /** Possible values are: `mac`, `win32`, `win64`, `linux`. Defaults to the current platform. */ - platform: Platform; + platform?: Platform; } /** Attaches Puppeteer to an existing Chromium instance */ From 4b389b4092cb2a915f75767823fdbad1947469fc Mon Sep 17 00:00:00 2001 From: Akihiro Uchida Date: Sat, 2 Mar 2019 17:13:58 +0900 Subject: [PATCH 077/265] add some tests to cover methods and properties --- types/puppeteer/puppeteer-tests.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/types/puppeteer/puppeteer-tests.ts b/types/puppeteer/puppeteer-tests.ts index 81c23e5b5e..90006c77d4 100644 --- a/types/puppeteer/puppeteer-tests.ts +++ b/types/puppeteer/puppeteer-tests.ts @@ -621,12 +621,25 @@ puppeteer.launch().then(async browser => { (async () => { const rev = '630727'; - const browserFetcher = puppeteer.createBrowserFetcher({ + const defaultFetcher = puppeteer.createBrowserFetcher(); + const options: puppeteer.FetcherOptions = { host: 'https://storage.googleapis.com', path: '/tmp/.local-chromium', platform: 'linux', - }); - await browserFetcher.canDownload(rev); - const revisionInfo = await browserFetcher.download(rev); - await browserFetcher.remove(rev); + }; + const browserFetcher = puppeteer.createBrowserFetcher(options); + const canDownload = await browserFetcher.canDownload(rev); + if (canDownload) { + const revisionInfo = await browserFetcher.download(rev); + const localRevisions = await browserFetcher.localRevisions(); + const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath}); + browser.close(); + if (localRevisions.includes(rev)) { + await browserFetcher.remove(rev); + } + await browserFetcher.download(rev, (download, total) => { + console.log('downloadBytes:', download, 'totalBytes:', total); + }); + await browserFetcher.remove(rev); + } }); From dc452cdb4d335ee6690480cbc6e3f557f51908bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 20:24:35 +0800 Subject: [PATCH 078/265] Create index.d.ts retinajs --- retinajs/index.d.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 retinajs/index.d.ts diff --git a/retinajs/index.d.ts b/retinajs/index.d.ts new file mode 100644 index 0000000000..58b3e3b653 --- /dev/null +++ b/retinajs/index.d.ts @@ -0,0 +1,42 @@ +export = retinajs.retina; + +export as namespace retinajs; + +declare namespace retinajs { + var hasWindow: boolean; + + var environment: number; + + var srcReplace: RegExp; + + var inlineReplace: RegExp; + + var selector: string; + + var processedAttr: string; + + var processedAttr: string; + + function arrayify(object: any): HTMLImageElement[]; + + function chooseCap(cap: number | string): number; + + function forceOriginalDimensions(image: HTMLImageElement): HTMLImageElement; + + function setSourceIfAvailable( + image: HTMLImageElement, + retinaURL: string + ): void; + + function dynamicSwapImage(image: HTMLImageElement, src: string): void; + + function manualSwapImage(image: HTMLImageElement, hdsrc: string): void; + + function getImages(images: HTMLImageElement[] | null): HTMLImageElement[]; + + function cleanBgImg(img: HTMLImageElement): HTMLImageElement; + + function retina(): void; + + function retina(images: any): void; +} From ecc222e7529c73a95b95fcac93c990d5040e7a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 20:47:59 +0800 Subject: [PATCH 079/265] create --- retinajs/package.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 retinajs/package.json diff --git a/retinajs/package.json b/retinajs/package.json new file mode 100644 index 0000000000..2c3081334e --- /dev/null +++ b/retinajs/package.json @@ -0,0 +1,28 @@ +{ + "name": "@types/retinajs", + "version": "2.1.3", + "description": "TypeScript definitions for retinajs", + "license": "MIT", + "contributors": [ + "senjyouhara (https://github.com/senjyouhara)" + ], + "main": "", + "types": "index", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "4BCEA62CB241C5EA821904599800CBA7A5695E03776CAE7E46CC1FDE98B73069", + "typeScriptVersion": ">= 3.2", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "keywords": [ + "retinajs", + "retina" + ], + "author": "senjyouhara" +} From 63a3de36cea6484083cc6ce613d3fa95aefee9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 20:48:43 +0800 Subject: [PATCH 080/265] create --- types/retinajs/package.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 types/retinajs/package.json diff --git a/types/retinajs/package.json b/types/retinajs/package.json new file mode 100644 index 0000000000..2c3081334e --- /dev/null +++ b/types/retinajs/package.json @@ -0,0 +1,28 @@ +{ + "name": "@types/retinajs", + "version": "2.1.3", + "description": "TypeScript definitions for retinajs", + "license": "MIT", + "contributors": [ + "senjyouhara (https://github.com/senjyouhara)" + ], + "main": "", + "types": "index", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "4BCEA62CB241C5EA821904599800CBA7A5695E03776CAE7E46CC1FDE98B73069", + "typeScriptVersion": ">= 3.2", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "keywords": [ + "retinajs", + "retina" + ], + "author": "senjyouhara" +} From 0c8a03cc88985a2ee00cc8cf829263260870535a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 20:49:11 +0800 Subject: [PATCH 081/265] create --- types/retinajs/index.d.ts | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 types/retinajs/index.d.ts diff --git a/types/retinajs/index.d.ts b/types/retinajs/index.d.ts new file mode 100644 index 0000000000..58b3e3b653 --- /dev/null +++ b/types/retinajs/index.d.ts @@ -0,0 +1,42 @@ +export = retinajs.retina; + +export as namespace retinajs; + +declare namespace retinajs { + var hasWindow: boolean; + + var environment: number; + + var srcReplace: RegExp; + + var inlineReplace: RegExp; + + var selector: string; + + var processedAttr: string; + + var processedAttr: string; + + function arrayify(object: any): HTMLImageElement[]; + + function chooseCap(cap: number | string): number; + + function forceOriginalDimensions(image: HTMLImageElement): HTMLImageElement; + + function setSourceIfAvailable( + image: HTMLImageElement, + retinaURL: string + ): void; + + function dynamicSwapImage(image: HTMLImageElement, src: string): void; + + function manualSwapImage(image: HTMLImageElement, hdsrc: string): void; + + function getImages(images: HTMLImageElement[] | null): HTMLImageElement[]; + + function cleanBgImg(img: HTMLImageElement): HTMLImageElement; + + function retina(): void; + + function retina(images: any): void; +} From 8bd09c0fb42a8508d222aa500ba9a2758f148ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 20:49:33 +0800 Subject: [PATCH 082/265] create --- types/retinajs/LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 types/retinajs/LICENSE diff --git a/types/retinajs/LICENSE b/types/retinajs/LICENSE new file mode 100644 index 0000000000..21071075c2 --- /dev/null +++ b/types/retinajs/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE From 83f39442eb2dcbb9d1c830f8c827b8cdc5dfa856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 20:49:57 +0800 Subject: [PATCH 083/265] create --- types/retinajs/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 types/retinajs/README.md diff --git a/types/retinajs/README.md b/types/retinajs/README.md new file mode 100644 index 0000000000..d28dcdd483 --- /dev/null +++ b/types/retinajs/README.md @@ -0,0 +1,14 @@ +# Installation + +> `npm install --save @types/retinajs` + +# Summary + +This package contains type definitions for retinajs ( https://github.com/strues/retinajs ). + +# Details + +Additional Details + +- Last updated: Sat Mar 02 2019 15:07:39 GMT+0800 +- Dependencies: none From 96f97bd1ab84dcaaf4e8d1ca9380efd15409a2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 21:03:24 +0800 Subject: [PATCH 084/265] Delete package.json --- retinajs/package.json | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 retinajs/package.json diff --git a/retinajs/package.json b/retinajs/package.json deleted file mode 100644 index 2c3081334e..0000000000 --- a/retinajs/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@types/retinajs", - "version": "2.1.3", - "description": "TypeScript definitions for retinajs", - "license": "MIT", - "contributors": [ - "senjyouhara (https://github.com/senjyouhara)" - ], - "main": "", - "types": "index", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "4BCEA62CB241C5EA821904599800CBA7A5695E03776CAE7E46CC1FDE98B73069", - "typeScriptVersion": ">= 3.2", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "keywords": [ - "retinajs", - "retina" - ], - "author": "senjyouhara" -} From eed28b1a47cc7ca700d945e196db57e2e8ba736d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 21:17:55 +0800 Subject: [PATCH 085/265] Create index.d.ts --- types/retinajs/index.d.ts | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 types/retinajs/index.d.ts diff --git a/types/retinajs/index.d.ts b/types/retinajs/index.d.ts new file mode 100644 index 0000000000..58b3e3b653 --- /dev/null +++ b/types/retinajs/index.d.ts @@ -0,0 +1,42 @@ +export = retinajs.retina; + +export as namespace retinajs; + +declare namespace retinajs { + var hasWindow: boolean; + + var environment: number; + + var srcReplace: RegExp; + + var inlineReplace: RegExp; + + var selector: string; + + var processedAttr: string; + + var processedAttr: string; + + function arrayify(object: any): HTMLImageElement[]; + + function chooseCap(cap: number | string): number; + + function forceOriginalDimensions(image: HTMLImageElement): HTMLImageElement; + + function setSourceIfAvailable( + image: HTMLImageElement, + retinaURL: string + ): void; + + function dynamicSwapImage(image: HTMLImageElement, src: string): void; + + function manualSwapImage(image: HTMLImageElement, hdsrc: string): void; + + function getImages(images: HTMLImageElement[] | null): HTMLImageElement[]; + + function cleanBgImg(img: HTMLImageElement): HTMLImageElement; + + function retina(): void; + + function retina(images: any): void; +} From 074c39b139ffa668ce24c1dfbc34ad8f3680c998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 21:18:28 +0800 Subject: [PATCH 086/265] create --- types/retinajs/package.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 types/retinajs/package.json diff --git a/types/retinajs/package.json b/types/retinajs/package.json new file mode 100644 index 0000000000..2c3081334e --- /dev/null +++ b/types/retinajs/package.json @@ -0,0 +1,28 @@ +{ + "name": "@types/retinajs", + "version": "2.1.3", + "description": "TypeScript definitions for retinajs", + "license": "MIT", + "contributors": [ + "senjyouhara (https://github.com/senjyouhara)" + ], + "main": "", + "types": "index", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "4BCEA62CB241C5EA821904599800CBA7A5695E03776CAE7E46CC1FDE98B73069", + "typeScriptVersion": ">= 3.2", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "keywords": [ + "retinajs", + "retina" + ], + "author": "senjyouhara" +} From 0f9be7571c6a0ed2c0f7443c215f0956ebbec12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 21:18:46 +0800 Subject: [PATCH 087/265] create --- types/retinajs/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 types/retinajs/README.md diff --git a/types/retinajs/README.md b/types/retinajs/README.md new file mode 100644 index 0000000000..d28dcdd483 --- /dev/null +++ b/types/retinajs/README.md @@ -0,0 +1,14 @@ +# Installation + +> `npm install --save @types/retinajs` + +# Summary + +This package contains type definitions for retinajs ( https://github.com/strues/retinajs ). + +# Details + +Additional Details + +- Last updated: Sat Mar 02 2019 15:07:39 GMT+0800 +- Dependencies: none From 4668a6dedf8eb5d411d4ce67394de71d53a88366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=BD=E5=B7=9D=E7=BF=BC?= <48148944+senjyouhara@users.noreply.github.com> Date: Sat, 2 Mar 2019 21:19:06 +0800 Subject: [PATCH 088/265] create --- types/retinajs/LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 types/retinajs/LICENSE diff --git a/types/retinajs/LICENSE b/types/retinajs/LICENSE new file mode 100644 index 0000000000..21071075c2 --- /dev/null +++ b/types/retinajs/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE From 26fe0ed1615538292deb11cbbb7a691dac2fbb46 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sat, 2 Mar 2019 21:18:09 +0100 Subject: [PATCH 089/265] [pkg-conf] Remove types --- notNeededPackages.json | 6 ++++++ types/pkg-conf/index.d.ts | 34 -------------------------------- types/pkg-conf/pkg-conf-tests.ts | 6 ------ types/pkg-conf/tsconfig.json | 23 --------------------- types/pkg-conf/tslint.json | 1 - 5 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 types/pkg-conf/index.d.ts delete mode 100644 types/pkg-conf/pkg-conf-tests.ts delete mode 100644 types/pkg-conf/tsconfig.json delete mode 100644 types/pkg-conf/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4289393363..6b24197054 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1230,6 +1230,12 @@ "sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js", "asOfVersion": "1.0.4" }, + { + "libraryName": "pkg-conf", + "typingsPackageName": "pkg-conf", + "sourceRepoURL": "https://github.com/sindresorhus/pkg-conf", + "asOfVersion": "3.0.0" + }, { "libraryName": "plottable", "typingsPackageName": "plottable", diff --git a/types/pkg-conf/index.d.ts b/types/pkg-conf/index.d.ts deleted file mode 100644 index 6a783c1891..0000000000 --- a/types/pkg-conf/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for pkg-conf 2.1 -// Project: https://github.com/sindresorhus/pkg-conf#readme -// Definitions by: Jorge Gonzalez -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -declare namespace pkgConf { - type AnyJson = boolean | number | string | null | JsonArray | JsonMap; - interface JsonArray extends Array { } - interface JsonMap { - [key: string]: AnyJson; - } - - interface Options { - // Directory to start looking up for a package.json file. - // Default: process.cwd() - cwd?: string; - // Default config. - defaults?: object; - // Skip package.json files that have the namespaced config explicitly set to false. - skipOnFalse?: boolean; - } - - // Returns the config. - function sync(namespace: string, options?: Options): JsonMap; - // Pass in the config returned from any of the above methods. - // Returns the filepath to the package.json file or null when not found. - function filepath(config: JsonMap): string | null; -} - -// Returns a Promise for the config. -declare function pkgConf(namespace: string, options?: pkgConf.Options): Promise; - -export = pkgConf; diff --git a/types/pkg-conf/pkg-conf-tests.ts b/types/pkg-conf/pkg-conf-tests.ts deleted file mode 100644 index bf2dee1e2f..0000000000 --- a/types/pkg-conf/pkg-conf-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import pkgConf = require('pkg-conf'); - -pkgConf('name'); // $ExpectType Promise -const config = pkgConf.sync('bugs'); // $ExpectType JsonMap -pkgConf.filepath(config); // $ExpectType string | null -config.url; // $ExpectType AnyJson diff --git a/types/pkg-conf/tsconfig.json b/types/pkg-conf/tsconfig.json deleted file mode 100644 index 449922d19e..0000000000 --- a/types/pkg-conf/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "pkg-conf-tests.ts" - ] -} diff --git a/types/pkg-conf/tslint.json b/types/pkg-conf/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/pkg-conf/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From ab4aa16e85e13003fdf5f369525ff81e4c1ec8ed Mon Sep 17 00:00:00 2001 From: alreadyExisted Date: Sat, 2 Mar 2019 22:43:58 +0200 Subject: [PATCH 090/265] #30562 Updated VictoryLegendProps --- types/victory/index.d.ts | 2008 ++++++++++++++++--------------- types/victory/victory-tests.tsx | 28 +- 2 files changed, 1036 insertions(+), 1000 deletions(-) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index f5c67995da..b34b192a65 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Alexey Svetliakov // snerks // Krzysztof Cebula -// Vitaliy Polyanskiy +// Vitaliy Polyanskiy // James Lismore // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -16,7 +16,7 @@ declare module "victory" { /** * Single animation object to interpolate */ - export type AnimationStyle = { [key: string ]: string | number }; + export type AnimationStyle = { [key: string]: string | number }; /** * Animation styles to interpolate @@ -32,6 +32,20 @@ declare module "victory" { "expIn" | "expOut" | "expInOut" | "poly" | "polyIn" | "polyOut" | "polyInOut" | "quad" | "quadIn" | "quadOut" | "quadInOut" | "sin" | "sinIn" | "sinOut" | "sinInOut"; + /** + * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html + */ + type Omit = Pick>; + + type BlockProps = { + top?: number; + bottom?: number; + left?: number; + right?: number; + }; + + type PaddingProps = number | BlockProps; + // Many victory components accept string or number or callback which returns string or number type StringOrNumberOrCallback = | string @@ -44,9 +58,9 @@ declare module "victory" { * Style interface used in components/themeing */ export interface VictoryStyleInterface { - parent?: VictoryStyleObject; - data?: VictoryStyleObject; - labels?: VictoryStyleObject; + parent?: VictoryStyleObject; + data?: VictoryStyleObject; + labels?: VictoryStyleObject; } export interface VictoryAnimationProps { @@ -774,8 +788,10 @@ declare module "victory" { */ eventHandlers: { [key: string]: { - (event: React.SyntheticEvent): EventCallbackInterface } | - { (event: React.SyntheticEvent): EventCallbackInterface[] + (event: React.SyntheticEvent): EventCallbackInterface + } | + { + (event: React.SyntheticEvent): EventCallbackInterface[] } }; } @@ -791,8 +807,8 @@ declare module "victory" { * Domain padding */ type DomainPaddingPropType = number | { - x?: number | [ number, number]; - y?: number | [ number, number]; + x?: number | [number, number]; + y?: number | [number, number]; }; /** @@ -858,12 +874,7 @@ declare module "victory" { * and right. * @default 50 */ - padding?: number | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; + padding?: PaddingProps; /** * The scale prop determines which scales your chart should use. This prop can be * given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), @@ -1030,66 +1041,66 @@ declare module "victory" { } export interface VictoryAreaProps - extends VictoryCommonProps, - VictoryDatableProps, - VictorySingleLabableProps { - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryArea events. - * Since VictoryArea only renders a single element, the eventKey property is not used. - * The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. an area), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @example - * events={[ - * { - * target: "data", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; - /** - * The interpolation prop determines how data points should be connected when plotting a line - * @default "linear" - */ - interpolation?: InterpolationPropType; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - * @default 50 - */ - samples?: number; - /** - * The style prop specifies styles for your VictoryArea. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. - * @example {data: {fill: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; + extends VictoryCommonProps, + VictoryDatableProps, + VictorySingleLabableProps { + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryArea events. + * Since VictoryArea only renders a single element, the eventKey property is not used. + * The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. an area), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @example + * events={[ + * { + * target: "data", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; + /** + * The interpolation prop determines how data points should be connected when plotting a line + * @default "linear" + */ + interpolation?: InterpolationPropType; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + * @default 50 + */ + samples?: number; + /** + * The style prop specifies styles for your VictoryArea. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. + * @example {data: {fill: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; } /** @@ -1341,13 +1352,13 @@ declare module "victory" { */ cornerRadius?: NumberOrCallback | { - top?: number | (NumberOrCallback), - topLeft?: number | (NumberOrCallback), - topRight?: number | (NumberOrCallback), - bottom?: number | (NumberOrCallback), - bottomLeft?: number | (NumberOrCallback), - bottomRight?: number | (NumberOrCallback) - }; + top?: number | (NumberOrCallback), + topLeft?: number | (NumberOrCallback), + topRight?: number | (NumberOrCallback), + bottom?: number | (NumberOrCallback), + bottomLeft?: number | (NumberOrCallback), + bottomRight?: number | (NumberOrCallback) + }; /** * The event prop take an array of event objects. Event objects are composed of * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace @@ -1418,917 +1429,924 @@ declare module "victory" { */ export class VictoryBar extends React.Component {} - export interface VictoryBoxPlotStyleInterface - extends VictoryStyleInterface { - max?: VictoryStyleObject; - maxLabels?: VictoryStyleObject; - min?: VictoryStyleObject; - minLabels?: VictoryStyleObject; - median?: VictoryStyleObject; - medianLabels?: VictoryStyleObject; - q1?: VictoryStyleObject; - q1Labels?: VictoryStyleObject; - q3?: VictoryStyleObject; - q3Labels?: VictoryStyleObject; - } - - export interface VictoryBoxPlotProps - extends VictoryCommonProps, - VictoryDatableProps { - /** - * The boxWidth prop specifies how wide each box should be. If the whiskerWidth - * prop is not set, this prop will also determine the width of the whisker crosshair. - */ - boxWidth?: number; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryChart, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The labelOrientation prop determines where labels are placed relative to their - * corresponding data. If this prop is not set, it will be set to “top” for - * horizontal charts, and “right” for vertical charts. - */ - labelOrientation?: "top" | "bottom" | "left" | "right"; - /** - * When the boolean labels prop is set to true, the values for min, max, median, - * q1, and q3 will be displayed for each box. For more granular label control, use - * the individual minLabels, maxLabels, medianLabels, q1Labels, and q3Labels props. - */ - labels?: boolean; - /** - * Use the max data accessor prop to define the max value of a box plot. - */ - max?: StringOrNumberOrCallback; - /** - * Use the median data accessor prop to define the median value of a box plot. - */ - median?: StringOrNumberOrCallback; - /** - * Use the min data accessor prop to define the min value of a box plot. - */ - min?: StringOrNumberOrCallback; - /** - * Use the q1 data accessor prop to define the q1 value of a box plot. - */ - q1?: StringOrNumberOrCallback; - /** - * Use the q3 data accessor prop to define the q1 value of a box plot. - */ - q3?: StringOrNumberOrCallback; - /** - * The style prop defines the style of the component. The style prop - * should be given as an object with styles defined for parent, max, - * maxLabels, min, minLabels,median, medianLabels,q1, q1Labels,q3, - * q3Labels. Any valid svg styles are supported, but width, height, a - * nd padding should be specified via props as they determine relative - * layout for components in VictoryChart. Functional styles may be - * defined for style properties, and they will be evaluated with each datum. - */ - style?: VictoryBoxPlotStyleInterface; - /** - * The whiskerWidth prop specifies how wide each whisker crosshair should be. If the - * whiskerWidth prop is not set, the width of the whisker crosshair will match - * the width of the box. - */ - whiskerWidth?: number; - } - - /** - * VictoryBoxPlot renders a box plot to describe the distribution of a set of data. Data for - * VictoryBoxPlot may be given with summary statistics pre-calculated (min, median, max, q1, q3), - * or as an array of raw data. VictoryBoxPlot can be composed with VictoryChart to create box plot charts. - */ - export class VictoryBoxPlot extends React.Component< - VictoryBoxPlotProps, - any - > {} - - export interface VictoryChartProps extends VictoryCommonProps { - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryChart, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The style prop specifies styles for your chart. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. - * @example {border: "1px solid #ccc", margin: "2%", maxWidth: "40%"} - */ - style?: Pick; - } - - /** - * A flexible charting component for React. - * VictoryChart composes other Victory components into reusable charts. - * Acting as a coordinator rather than a stand-alone component, VictoryChart reconciles props such as domain and scale for child components, - * and provides a set of sensible defaults. This component works with: - * - VictoryAxis - * - VictoryLine - * - VictoryScatter - * - VictoryBar - */ - export class VictoryChart extends React.Component {} - - export interface VictoryGroupProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The categories prop specifies how categorical data for a chart should be ordered. - * This prop should be given as an array of string values, or an object with - * these values for x and y. When categories are not given as an object - * When this prop is set on a wrapper component, it will dictate the categories of - * its the children. If this prop is not set, any categories on child component - * or categorical data, will be merged to create a shared set of categories. - * @example ["dogs", "cats", "mice"] - */ - categories?: CategoryPropType; - /** - * The colorScale prop is an optional prop that defines the color scale the chart's bars - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryBar will automatically assign - * values from this color scale to the bars unless colors are explicitly provided in the - * `dataAttributes` prop. - */ - colorScale?: ColorScalePropType; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @examples: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryGroup, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The offset prop determines the number of pixels each element in a group should - * be offset from its original position of the on the independent axis. In the - * case of groups of bars, this number should be equal to the width of the bar - * plus the desired spacing between bars. - */ - offset?: number; - /** - * The style prop specifies styles for your grouped chart. These styles will be - * applied to all grouped children - */ - style?: VictoryStyleInterface; - } - - export class VictoryGroup extends React.Component {} - - export interface VictoryLineProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryLine events. - * Since VictoryLine only renders a single element, the eventKey property is not used. - * The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a line), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * mutation: (props) => { - * return {style: merge({}, props.style, {stroke: "orange"})}; - * } - * }, { - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; - /** - * The interpolation prop determines how data points should be connected - * when plotting a line - */ - interpolation?: InterpolationPropType; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - */ - samples?: number; - /** - * The labels prop defines the labels that will appear above each point. - * This prop should be given as an array or as a function of data. - */ - labels?: string[]|number[]|Function; - /** - * Use the sortKey prop to indicate how data should be sorted. This prop - * is given directly to the lodash sortBy function to be executed on the - * final dataset. - */ - sortKey?: string|string[]|Function; - /** - * The style prop specifies styles for your VictoryLine. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. in addition to normal style properties, angle and verticalAnchor - * may also be specified via the labels object, and they will be passed as props to - * VictoryLabel, or any custom labelComponent. - * @examples{data: {stroke: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; - } - - /** - * VictoryLine creates a line based on data. VictoryLine is a composable component, so it does not include an axis. - * Check out VictoryChart for easy to use line charts and more. - */ - export class VictoryLine extends React.Component {} - - export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { - /** - * The colorScale prop defines a color scale to be applied to each data - * symbol in VictoryLegend. This prop should be given as an array of CSS - * colors, or as a string corresponding to one of the built in color - * scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", - * "green", "blue". VictoryLegend will assign a color to each symbol by - * index, unless they are explicitly specified in the data object. - * Colors will repeat when there are more symbols than colors in the - * provided colorScale. - */ - colorScale?: ColorScalePropType; - /** - * The style prop defines the style of the VictoryLegend component. - * The style prop should be given as an object with styles defined for data, labels and - * parent. Any valid svg styles are supported, but width, height, and - * padding should be specified via props as they determine relative - * layout for components in VictoryLegend. - */ - style?: VictoryStyleInterface; - /** - * The containerComponent prop takes a component instance which will be - * used to create a container element for standalone legends. The new - * element created from the passed containerComponent will be provided - * with the following props: height, width, children (the legend itself) - * and style. If a containerComponent is not provided, the default - * VictoryContainer component will be used. VictoryContainer supports - * title and desc props, which are intended to add accessibility to - * Victory components. The more descriptive these props are, the more - * accessible your data will be for people using screen readers. These - * props may be set by passing them directly to the supplied component. - * By default, VictoryContainer renders a responsive svg using the - * viewBox attribute. To render a static container, set - * responsive={false} directly on the instance of VictoryContainer - * supplied via the containerComponent prop. VictoryContainer also - * renders a Portal element that may be used in conjunction with - * VictoryPortal to force components to render above other children. - * @default - */ - containerComponent?: React.ReactElement; - /** - * Specify data via the data prop. VictoryLegend expects data as an - * array of objects with name (required), symbol, and labels properties. - * The data prop must be given as an array. - */ - data?: Array<{ - name?: string; - symbol?: { - fill?: string; - type?: string; - }; - }>; - /** - * The itemsPerRow prop determines how many items to render in each row - * of a horizontal legend, or in each column of a vertical legend. This - * prop should be given as an integer. When this prop is not given, - * legend items will be rendered in a single row or column. - */ - itemsPerRow?: number; - /** - * The dataComponent prop takes a component instance which will be - * responsible for rendering a data element used to associate a symbol - * or color with each data series. The new element created from the - * passed dataComponent will be provided with the following properties - * calculated by VictoryLegend: x, y, size, style, and symbol. Any of - * these props may be overridden by passing in props to the supplied - * component, or modified or ignored within the custom component itself. - * If a dataComponent is not provided, VictoryLegend will use its - * default Point component. - */ - dataComponent?: React.ReactElement; - /** - * The groupComponent prop takes an entire component which will be used to - * create group elements for use within container elements. This prop defaults - * to a tag on web, and a react-native-svg tag on mobile - * @default - */ - groupComponent?: React.ReactElement; - /** - * The gutter prop defines the number of pixels between legend rows or - * columns, depending on orientation. When orientation is horizontal, - * gutters are between columns. When orientation is vertical, gutters - * are the space between rows. - */ - gutter?: number; - /** - * The labelComponent prop takes a component instance which will be used - * to render each legend label. The new element created from the passed - * labelComponent will be supplied with the following properties: x, y, - * style, and text. Any of these props may be overridden by passing in - * props to the supplied component, or modified or ignored within the - * custom component itself. If labelComponent is omitted, a new - * VictoryLabel will be created with the props described above. - */ - labelComponent?: React.ReactElement; - /** - * The orientation prop takes a string that defines whether legend data - * are displayed in a row or column. When orientation is "horizontal", - * legend items will be displayed in a single row. When orientation is - * "vertical", legend items will be displayed in a single column. Line - * and text-wrapping is not currently supported, so "vertical" - * orientation is both the default setting and recommended for - * displaying many series of data. - * @default 'vertical' - */ - orientation?: 'horizontal'|'vertical'; - /** - * The padding prop specifies the amount of padding in pixels between - * the edge of the legend and any rendered child components. This prop - * can be given as a number or as an object with padding specified for - * top, bottom, left and right. As with width and height, the absolute - * padding will depend on whether the component is rendered in a - * responsive container. When a component is nested within - * VictoryLegend, setting padding on the child component will have no - * effect. - */ - padding?: number | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; - /** - * The standalone props specifies whether the component should be - * rendered in an independent element or in a tag. This prop - * defaults to true, and renders an svg. - */ - standalone?: boolean; - /** - * The symbolSpacer prop defines the number of pixels between data - * components and label components. - */ - symbolSpacer?: number; - /** - * The width and height props define the width and height of the legend. - * These props may be given as positive numbers or functions of data. If - * these props are not set, width and height will be determined based on - * an approximate text size calculated from the text and style props - * provided to VictoryLegend. - */ - width?: number; - height?: number; - /** - * The x and y props define the base position of the legend element. - */ - x?: number; - y?: number; - } - - /** - * VictoryLegend renders a chart legend component. - */ - export class VictoryLegend extends React.Component {} - - type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp"; - - export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps { - /** - * The bubbleProperty prop indicates which property of the data object should be used - * to scale data points in a bubble chart - */ - bubbleProperty?: string; - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryScatter - * events. The eventKey may optionally be used to select a single element by index rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventKey: "thisOne", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * eventKey: "theOtherOne", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * eventKey: "theOtherOne", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The maxBubbleSize prop sets an upper limit for scaling data points in a bubble chart - */ - maxBubbleSize?: number; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - */ - samples?: number; - /** - * The size prop determines how to scale each data point - */ - size?: number | { (data: any): number }; - /** - * The style prop specifies styles for your VictoryScatter. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. In addition to normal style properties, angle and verticalAnchor - * may also be specified via the labels object, and they will be passed as props to - * VictoryLabel, or any custom labelComponent. - * @example {data: {fill: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; - /** - * The symbol prop determines which symbol should be drawn to represent data points. - */ - symbol?: ScatterSymbolType | { (data: any): ScatterSymbolType }; - } - - /** - * VictoryScatter creates a scatter of points from data. VictoryScatter is a composable component, so it does not include an axis. - * Check out VictoryChart for easy to use scatter plots and more. - */ - export class VictoryScatter extends React.Component {} - - export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The categories prop specifies how categorical data for a chart should be ordered. - * This prop should be given as an array of string values, or an object with - * these values for x and y. When categories are not given as an object - * When this prop is set on a wrapper component, it will dictate the categories of - * its the children. If this prop is not set, any categories on child component - * or catigorical data, will be merged to create a shared set of categories. - * @example ["dogs", "cats", "mice"] - */ - categories?: CategoryPropType; - /** - * The colorScale prop is an optional prop that defines the color scale the chart's bars - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryBar will automatically assign - * values from this color scale to the bars unless colors are explicitly provided in the - * `dataAttributes` prop. - */ - colorScale?: ColorScalePropType; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryStack, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The style prop specifies styles for your grouped chart. These styles will be - * applied to all grouped children - */ - style?: VictoryStyleInterface; - /** - * The xOffset prop is used for grouping stacks of bars. This prop will be set - * by the VictoryGroup component wrapper, or can be set manually. - */ - xOffset?: number; - } - - export class VictoryStack extends React.Component {} - - export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The colorScale prop is an optional prop that defines the color scale the pie - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryPie will automatically assign - * values from this color scale to the pie slices unless colors are explicitly provided in the - * data object - */ - colorScale?: ColorScalePropType; - /** - * The data prop specifies the data to be plotted, - * where data X-value is the slice label (string or number), - * and Y-value is the corresponding number value represented by the slice - * Data should be in the form of an array of data points. - * Each data point may be any format you wish (depending on the `x` and `y` accessor props), - * but by default, an object with x and y properties is expected. - * @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], - * [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]] - */ - data?: any[]; - /** - * The dataComponent prop takes an entire, HTML-complete data component which will be used to - * create slices for each datum in the pie chart. The new element created from the passed - * dataComponent will have the property datum set by the pie chart for the point it renders; - * properties style and pathFunction calculated by VictoryPie; an index property set - * corresponding to the location of the datum in the data provided to the pie; events bound to - * the VictoryPie; and the d3 compatible slice object. - * If a dataComponent is not provided, VictoryPie's Slice component will be used. - */ - dataComponent?: React.ReactElement; - /** - * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. - * If this prop is not set, the label radius will default to the radius of the pie + label padding. - */ - labelRadius?: number; - /** - * The overall end angle of the pie in degrees. This prop is used in conjunction with - * startAngle to create a pie that spans only a segment of a circle. - */ - endAngle?: number; - /** - * The event prop takes an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryPie - * events. The eventKey may optionally be used to select a single element by index rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventKey: 1, - * eventHandlers: { - * onClick: () => { - * return [ - * { - * eventKey: 2, - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * eventKey: 2, - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * Specifies the radius of the chart. If this property is not provided it is computed - * from width, height, and padding props - * - */ - radius?: number; - /** - * When creating a donut chart, this prop determines the number of pixels between - * the center of the chart and the inner edge of a donut. When this prop is set to zero - * a regular pie chart is rendered. - */ - innerRadius?: number; - /** - * Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie - */ - cornerRadius?: number; - /** - * The padAngle prop determines the amount of separation between adjacent data slices - * in number of degrees - */ - padAngle?: number; - /** - * The overall start angle of the pie in degrees. This prop is used in conjunction with - * endAngle to create a pie that spans only a segment of a circle. - */ - startAngle?: number; - /** - * The style prop specifies styles for your pie. VictoryPie relies on Radium, - * so valid Radium style objects should work for this prop. Height, width, and - * padding should be specified via the height, width, and padding props. - * @example {data: {stroke: "black"}, label: {fontSize: 10}} - */ - style?: VictoryStyleInterface; - /** - * The x prop specifies how to access the X value of each data point. - * If given as a function, it will be run on each data point, and returned value will be used. - * If given as an integer, it will be used as an array index for array-type data points. - * If given as a string, it will be used as a property key for object-type data points. - * If given as an array of strings, or a string containing dots or brackets, - * it will be used as a nested object property path (for details see Lodash docs for _.get). - * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). - * @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d) - */ - x?: DataGetterPropType; - /** - * The y prop specifies how to access the Y value of each data point. - * If given as a function, it will be run on each data point, and returned value will be used. - * If given as an integer, it will be used as an array index for array-type data points. - * If given as a string, it will be used as a property key for object-type data points. - * If given as an array of strings, or a string containing dots or brackets, - * it will be used as a nested object property path (for details see Lodash docs for _.get). - * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). - * @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d) - */ - y?: DataGetterPropType; - } - - /** - * victory-pie draws an SVG pie or donut chart with React. - * Styles and data can be customized by passing in your own values as properties to the component. - * Data changes are animated with VictoryAnimation. - */ - export class VictoryPie extends React.Component {} + export interface VictoryBoxPlotStyleInterface extends VictoryStyleInterface { + max?: VictoryStyleObject; + maxLabels?: VictoryStyleObject; + min?: VictoryStyleObject; + minLabels?: VictoryStyleObject; + median?: VictoryStyleObject; + medianLabels?: VictoryStyleObject; + q1?: VictoryStyleObject; + q1Labels?: VictoryStyleObject; + q3?: VictoryStyleObject; + q3Labels?: VictoryStyleObject; } + + export interface VictoryBoxPlotProps extends VictoryCommonProps, VictoryDatableProps { + /** + * The boxWidth prop specifies how wide each box should be. If the whiskerWidth + * prop is not set, this prop will also determine the width of the whisker crosshair. + */ + boxWidth?: number; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryChart, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The labelOrientation prop determines where labels are placed relative to their + * corresponding data. If this prop is not set, it will be set to “top” for + * horizontal charts, and “right” for vertical charts. + */ + labelOrientation?: "top" | "bottom" | "left" | "right"; + /** + * When the boolean labels prop is set to true, the values for min, max, median, + * q1, and q3 will be displayed for each box. For more granular label control, use + * the individual minLabels, maxLabels, medianLabels, q1Labels, and q3Labels props. + */ + labels?: boolean; + /** + * Use the max data accessor prop to define the max value of a box plot. + */ + max?: StringOrNumberOrCallback; + /** + * Use the median data accessor prop to define the median value of a box plot. + */ + median?: StringOrNumberOrCallback; + /** + * Use the min data accessor prop to define the min value of a box plot. + */ + min?: StringOrNumberOrCallback; + /** + * Use the q1 data accessor prop to define the q1 value of a box plot. + */ + q1?: StringOrNumberOrCallback; + /** + * Use the q3 data accessor prop to define the q1 value of a box plot. + */ + q3?: StringOrNumberOrCallback; + /** + * The style prop defines the style of the component. The style prop + * should be given as an object with styles defined for parent, max, + * maxLabels, min, minLabels,median, medianLabels,q1, q1Labels,q3, + * q3Labels. Any valid svg styles are supported, but width, height, a + * nd padding should be specified via props as they determine relative + * layout for components in VictoryChart. Functional styles may be + * defined for style properties, and they will be evaluated with each datum. + */ + style?: VictoryBoxPlotStyleInterface; + /** + * The whiskerWidth prop specifies how wide each whisker crosshair should be. If the + * whiskerWidth prop is not set, the width of the whisker crosshair will match + * the width of the box. + */ + whiskerWidth?: number; + } + + /** + * VictoryBoxPlot renders a box plot to describe the distribution of a set of data. Data for + * VictoryBoxPlot may be given with summary statistics pre-calculated (min, median, max, q1, q3), + * or as an array of raw data. VictoryBoxPlot can be composed with VictoryChart to create box plot charts. + */ + export class VictoryBoxPlot extends React.Component< + VictoryBoxPlotProps, + any + > {} + + export interface VictoryChartProps extends VictoryCommonProps { + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryChart, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The style prop specifies styles for your chart. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. + * @example {border: "1px solid #ccc", margin: "2%", maxWidth: "40%"} + */ + style?: Pick; + } + + /** + * A flexible charting component for React. + * VictoryChart composes other Victory components into reusable charts. + * Acting as a coordinator rather than a stand-alone component, VictoryChart reconciles props such as domain and scale for child components, + * and provides a set of sensible defaults. This component works with: + * - VictoryAxis + * - VictoryLine + * - VictoryScatter + * - VictoryBar + */ + export class VictoryChart extends React.Component {} + + export interface VictoryGroupProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The categories prop specifies how categorical data for a chart should be ordered. + * This prop should be given as an array of string values, or an object with + * these values for x and y. When categories are not given as an object + * When this prop is set on a wrapper component, it will dictate the categories of + * its the children. If this prop is not set, any categories on child component + * or categorical data, will be merged to create a shared set of categories. + * @example ["dogs", "cats", "mice"] + */ + categories?: CategoryPropType; + /** + * The colorScale prop is an optional prop that defines the color scale the chart's bars + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryBar will automatically assign + * values from this color scale to the bars unless colors are explicitly provided in the + * `dataAttributes` prop. + */ + colorScale?: ColorScalePropType; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @examples: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryGroup, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The offset prop determines the number of pixels each element in a group should + * be offset from its original position of the on the independent axis. In the + * case of groups of bars, this number should be equal to the width of the bar + * plus the desired spacing between bars. + */ + offset?: number; + /** + * The style prop specifies styles for your grouped chart. These styles will be + * applied to all grouped children + */ + style?: VictoryStyleInterface; + } + + export class VictoryGroup extends React.Component {} + + export interface VictoryLineProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryLine events. + * Since VictoryLine only renders a single element, the eventKey property is not used. + * The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a line), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * mutation: (props) => { + * return {style: merge({}, props.style, {stroke: "orange"})}; + * } + * }, { + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; + /** + * The interpolation prop determines how data points should be connected + * when plotting a line + */ + interpolation?: InterpolationPropType; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + */ + samples?: number; + /** + * The labels prop defines the labels that will appear above each point. + * This prop should be given as an array or as a function of data. + */ + labels?: string[] | number[] | Function; + /** + * Use the sortKey prop to indicate how data should be sorted. This prop + * is given directly to the lodash sortBy function to be executed on the + * final dataset. + */ + sortKey?: string | string[] | Function; + /** + * The style prop specifies styles for your VictoryLine. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. in addition to normal style properties, angle and verticalAnchor + * may also be specified via the labels object, and they will be passed as props to + * VictoryLabel, or any custom labelComponent. + * @examples{data: {stroke: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; + } + + /** + * VictoryLine creates a line based on data. VictoryLine is a composable component, so it does not include an axis. + * Check out VictoryChart for easy to use line charts and more. + */ + export class VictoryLine extends React.Component {} + + export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { + /** + * The borderComponent prop takes a component instance which will be responsible + * for rendering a border around the legend. The new element created from the passed + * borderComponent will be provided with the following properties calculated by + * VictoryLegend: x, y, width, height, and style. Any of these props may be + * overridden by passing in props to the supplied component, or modified or ignored + * within the custom component itself. If a borderComponent + * is not provided, VictoryLegend will use its default Border component. + * Please note that the default width and height calculated + * for the border component is based on approximated + * text measurements, and may need to be adjusted. + * @default + */ + borderComponent?: React.ReactElement; + /** + * The borderPadding specifies the amount of padding that should + * be added between the legend items and the border. This prop may be given as + * a number, or asanobject with values specified for top, bottom, left, and right. + * Please note that the default width and height calculated for the border + * component is based on approximated text measurements, so padding may need to be adjusted. + */ + borderPadding?: PaddingProps; + /** + * The centerTitle boolean prop specifies whether a legend title should be centered. + */ + centerTitle?: boolean; + /** + * The colorScale prop defines a color scale to be applied to each data + * symbol in VictoryLegend. This prop should be given as an array of CSS + * colors, or as a string corresponding to one of the built in color + * scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", + * "green", "blue". VictoryLegend will assign a color to each symbol by + * index, unless they are explicitly specified in the data object. + * Colors will repeat when there are more symbols than colors in the + * provided colorScale. + */ + colorScale?: ColorScalePropType; + /** + * Specify data via the data prop. VictoryLegend expects data as an + * array of objects with name (required), symbol, and labels properties. + * The data prop must be given as an array. + */ + data?: Array<{ + name?: string; + symbol?: { + fill?: string; + type?: string; + }; + }>; + /** + * The dataComponent prop takes a component instance which will be + * responsible for rendering a data element used to associate a symbol + * or color with each data series. The new element created from the + * passed dataComponent will be provided with the following properties + * calculated by VictoryLegend: x, y, size, style, and symbol. Any of + * these props may be overridden by passing in props to the supplied + * component, or modified or ignored within the custom component itself. + * If a dataComponent is not provided, VictoryLegend will use its + * default Point component. + */ + dataComponent?: React.ReactElement; + /** + * VictoryLegend uses the standard eventKey prop to specify how event targets + * are addressed. This prop is not commonly used. + */ + eventKey?: StringOrNumberOrCallback | string[]; + /** + * VictoryLegend uses the standard events prop. + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * VictoryLegend uses the standard externalEventMutations prop. + */ + externalEventMutations?: any[]; + /** + * The gutter prop defines the number of pixels between legend rows or + * columns, depending on orientation. When orientation is horizontal, + * gutters are between columns. When orientation is vertical, gutters + * are the space between rows. + */ + gutter?: number; + /** + * The itemsPerRow prop determines how many items to render in each row + * of a horizontal legend, or in each column of a vertical legend. This + * prop should be given as an integer. When this prop is not given, + * legend items will be rendered in a single row or column. + */ + itemsPerRow?: number; + /** + * The labelComponent prop takes a component instance which will be used + * to render each legend label. The new element created from the passed + * labelComponent will be supplied with the following properties: x, y, + * style, and text. Any of these props may be overridden by passing in + * props to the supplied component, or modified or ignored within the + * custom component itself. If labelComponent is omitted, a new + * VictoryLabel will be created with the props described above. + */ + labelComponent?: React.ReactElement; + /** + * The orientation prop takes a string that defines whether legend data + * are displayed in a row or column. When orientation is "horizontal", + * legend items will be displayed in a single row. When orientation is + * "vertical", legend items will be displayed in a single column. Line + * and text-wrapping is not currently supported, so "vertical" + * orientation is both the default setting and recommended for + * displaying many series of data. + * @default 'vertical' + */ + orientation?: 'horizontal' | 'vertical'; + /** + * The rowGutter prop defines the number of pixels between legend rows. + * This prop may be given as a number, or as an object with values + * specified for “top” and “bottom” gutters. To set spacing between columns, + * use the gutter prop. + */ + rowGutter?: number | Omit; + /** + * The style prop defines the style of the VictoryLegend component. + * The style prop should be given as an object with styles defined for data, labels and + * parent. Any valid svg styles are supported, but width, height, and + * padding should be specified via props as they determine relative + * layout for components in VictoryLegend. + */ + style?: VictoryStyleInterface; + /** + * The symbolSpacer prop defines the number of pixels between data + * components and label components. + */ + symbolSpacer?: number; + /** + * The title prop specifies a title to render with the legend. + * This prop should be given as a string, or an array of strings for multi-line titles. + */ + title?: string | string[]; + /** + * The titleComponent prop takes a component instance which will be used to render + * a title for the component. The new element created from the passed + * labelComponent will be supplied with the following properties: x, y, index, data, + * datum, verticalAnchor, textAnchor, style, text, and events. Any of these props + * may be overridden by passing in props to the supplied component, or modified + * or ignored within the custom component itself. If labelComponent is omitted, + * a new VictoryLabel will be created with the props described above. + */ + titleComponent?: React.ReactElement; + /** + * The titleOrientation prop specifies where the a title should be rendered + * in relation to the rest of the legend. Possible values + * for this prop are “top”, “bottom”, “left”, and “right”. + * @default (provided by default theme): titleOrientation="top" + */ + titleOrientation?: OrientationTypes; + /** + * The x and y props define the base position of the legend element. + */ + x?: number; + y?: number; + } + + /** + * VictoryLegend renders a chart legend component. + */ + export class VictoryLegend extends React.Component {} + + type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp"; + + export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps { + /** + * The bubbleProperty prop indicates which property of the data object should be used + * to scale data points in a bubble chart + */ + bubbleProperty?: string; + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryScatter + * events. The eventKey may optionally be used to select a single element by index rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventKey: "thisOne", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * eventKey: "theOtherOne", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * eventKey: "theOtherOne", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The maxBubbleSize prop sets an upper limit for scaling data points in a bubble chart + */ + maxBubbleSize?: number; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + */ + samples?: number; + /** + * The size prop determines how to scale each data point + */ + size?: number | { (data: any): number }; + /** + * The style prop specifies styles for your VictoryScatter. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. In addition to normal style properties, angle and verticalAnchor + * may also be specified via the labels object, and they will be passed as props to + * VictoryLabel, or any custom labelComponent. + * @example {data: {fill: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; + /** + * The symbol prop determines which symbol should be drawn to represent data points. + */ + symbol?: ScatterSymbolType | { (data: any): ScatterSymbolType }; + } + + /** + * VictoryScatter creates a scatter of points from data. VictoryScatter is a composable component, so it does not include an axis. + * Check out VictoryChart for easy to use scatter plots and more. + */ + export class VictoryScatter extends React.Component {} + + export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The categories prop specifies how categorical data for a chart should be ordered. + * This prop should be given as an array of string values, or an object with + * these values for x and y. When categories are not given as an object + * When this prop is set on a wrapper component, it will dictate the categories of + * its the children. If this prop is not set, any categories on child component + * or catigorical data, will be merged to create a shared set of categories. + * @example ["dogs", "cats", "mice"] + */ + categories?: CategoryPropType; + /** + * The colorScale prop is an optional prop that defines the color scale the chart's bars + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryBar will automatically assign + * values from this color scale to the bars unless colors are explicitly provided in the + * `dataAttributes` prop. + */ + colorScale?: ColorScalePropType; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryStack, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The style prop specifies styles for your grouped chart. These styles will be + * applied to all grouped children + */ + style?: VictoryStyleInterface; + /** + * The xOffset prop is used for grouping stacks of bars. This prop will be set + * by the VictoryGroup component wrapper, or can be set manually. + */ + xOffset?: number; + } + + export class VictoryStack extends React.Component {} + + export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The colorScale prop is an optional prop that defines the color scale the pie + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryPie will automatically assign + * values from this color scale to the pie slices unless colors are explicitly provided in the + * data object + */ + colorScale?: ColorScalePropType; + /** + * The data prop specifies the data to be plotted, + * where data X-value is the slice label (string or number), + * and Y-value is the corresponding number value represented by the slice + * Data should be in the form of an array of data points. + * Each data point may be any format you wish (depending on the `x` and `y` accessor props), + * but by default, an object with x and y properties is expected. + * @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], + * [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]] + */ + data?: any[]; + /** + * The dataComponent prop takes an entire, HTML-complete data component which will be used to + * create slices for each datum in the pie chart. The new element created from the passed + * dataComponent will have the property datum set by the pie chart for the point it renders; + * properties style and pathFunction calculated by VictoryPie; an index property set + * corresponding to the location of the datum in the data provided to the pie; events bound to + * the VictoryPie; and the d3 compatible slice object. + * If a dataComponent is not provided, VictoryPie's Slice component will be used. + */ + dataComponent?: React.ReactElement; + /** + * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. + * If this prop is not set, the label radius will default to the radius of the pie + label padding. + */ + labelRadius?: number; + /** + * The overall end angle of the pie in degrees. This prop is used in conjunction with + * startAngle to create a pie that spans only a segment of a circle. + */ + endAngle?: number; + /** + * The event prop takes an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryPie + * events. The eventKey may optionally be used to select a single element by index rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventKey: 1, + * eventHandlers: { + * onClick: () => { + * return [ + * { + * eventKey: 2, + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * eventKey: 2, + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * Specifies the radius of the chart. If this property is not provided it is computed + * from width, height, and padding props + * + */ + radius?: number; + /** + * When creating a donut chart, this prop determines the number of pixels between + * the center of the chart and the inner edge of a donut. When this prop is set to zero + * a regular pie chart is rendered. + */ + innerRadius?: number; + /** + * Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie + */ + cornerRadius?: number; + /** + * The padAngle prop determines the amount of separation between adjacent data slices + * in number of degrees + */ + padAngle?: number; + /** + * The overall start angle of the pie in degrees. This prop is used in conjunction with + * endAngle to create a pie that spans only a segment of a circle. + */ + startAngle?: number; + /** + * The style prop specifies styles for your pie. VictoryPie relies on Radium, + * so valid Radium style objects should work for this prop. Height, width, and + * padding should be specified via the height, width, and padding props. + * @example {data: {stroke: "black"}, label: {fontSize: 10}} + */ + style?: VictoryStyleInterface; + /** + * The x prop specifies how to access the X value of each data point. + * If given as a function, it will be run on each data point, and returned value will be used. + * If given as an integer, it will be used as an array index for array-type data points. + * If given as a string, it will be used as a property key for object-type data points. + * If given as an array of strings, or a string containing dots or brackets, + * it will be used as a nested object property path (for details see Lodash docs for _.get). + * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). + * @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d) + */ + x?: DataGetterPropType; + /** + * The y prop specifies how to access the Y value of each data point. + * If given as a function, it will be run on each data point, and returned value will be used. + * If given as an integer, it will be used as an array index for array-type data points. + * If given as a string, it will be used as a property key for object-type data points. + * If given as an array of strings, or a string containing dots or brackets, + * it will be used as a nested object property path (for details see Lodash docs for _.get). + * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). + * @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d) + */ + y?: DataGetterPropType; + } + + /** + * victory-pie draws an SVG pie or donut chart with React. + * Styles and data can be customized by passing in your own values as properties to the component. + * Data changes are animated with VictoryAnimation. + */ + export class VictoryPie extends React.Component {} +} diff --git a/types/victory/victory-tests.tsx b/types/victory/victory-tests.tsx index fcd18571e3..682b8c30d8 100644 --- a/types/victory/victory-tests.tsx +++ b/types/victory/victory-tests.tsx @@ -197,9 +197,9 @@ test = ( tick.x }, - ticks: { stroke: tick => tick.color }, - tickLabels: { fontSize: tick => tick.y }, + grid: { strokeWidth: (tick: any) => tick.x }, + ticks: { stroke: (tick: any) => tick.color }, + tickLabels: { fontSize: (tick: any) => tick.y }, }} tickValues={[ new Date(1980, 1, 1), @@ -611,8 +611,8 @@ test = ( ]} style={{ data: { - fill: d => d.x, - stroke: (datum, active) => active ? datum.x : datum.y, + fill: (d: any) => d.x, + stroke: (datum: any, active: boolean) => active ? datum.x : datum.y, strokeWidth: 3 } }} @@ -757,6 +757,7 @@ test = ( ]} gutter={10} orientation="horizontal" + title="Title" symbolSpacer={8} width={100} height={50} @@ -771,5 +772,22 @@ test = ( standalone padding={{ top: 20, right: 40, bottom: 60, left: 20 }} colorScale="heatmap" + events={[{ + target: "data", + eventKey: "thisOne", + eventHandlers: { + onClick: () => ([ + { + eventKey: "theOtherOne", + mutation: props => ({ style: { ...props.style, fill: "orange" } }) + }, + { + eventKey: "theOtherOne", + target: "labels", + mutation: () => ({ text: "hey" }) + } + ]) + } + }]} /> ); From fdf8237ec0d49c60f3da62cfc53b911f07ee5224 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Fri, 1 Mar 2019 23:53:00 +0100 Subject: [PATCH 091/265] fix(node): add `Map` forward declare --- types/node/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 41bfd02671..1e9121044a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -63,6 +63,7 @@ interface WeakMapConstructor { } interface SetConstructor { } interface WeakSetConstructor { } interface Set {} +interface Map {} interface ReadonlySet {} interface IteratorResult { } interface Iterable { } From cfb29cc2d2f9525e6b5706eb5b3fa73510e204eb Mon Sep 17 00:00:00 2001 From: Joel Spadin Date: Sat, 2 Mar 2019 20:16:38 -0600 Subject: [PATCH 092/265] Add types for plurals-cldr --- types/plurals-cldr/index.d.ts | 53 ++++++++++++++++++++++++ types/plurals-cldr/plurals-cldr-tests.ts | 15 +++++++ types/plurals-cldr/tsconfig.json | 23 ++++++++++ types/plurals-cldr/tslint.json | 1 + 4 files changed, 92 insertions(+) create mode 100644 types/plurals-cldr/index.d.ts create mode 100644 types/plurals-cldr/plurals-cldr-tests.ts create mode 100644 types/plurals-cldr/tsconfig.json create mode 100644 types/plurals-cldr/tslint.json diff --git a/types/plurals-cldr/index.d.ts b/types/plurals-cldr/index.d.ts new file mode 100644 index 0000000000..0d7277b52a --- /dev/null +++ b/types/plurals-cldr/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for plurals-cldr 1.0 +// Project: https://github.com/nodeca/plurals-cldr +// Definitions by: Joel Spadin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type Form = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; + +interface Plural { + /** + * Returns the form name for a given number. If the locale is not + * supported, returns `null`. + * + * @param locale The locale code. + * @param number The number to check. May be passed as a string to keep + * trailing zeroes. + */ + (locale: string, number: number | string): Form | null; + + /** + * Returns an array of available forms for the given locale. If the + * locale is not supported, returns `null`. + * + * @param locale The locale code. + */ + forms(locale: string): Form[] | null; + + /** + * Returns the index of the form for a given number. If the locale is + * not supported, returns `-1`. + * + * This is convenient for implementing a lookup from a compact, ordered + * list. The order of forms for all locales is `zero`, `one`, `two`, + * `few`, `many`, `other`. Remove the forms not used by a locale to get + * the indices of each. + * + * @param locale The locale code. + * @param number The number to check. May be passed as a string to keep + * trailing zeroes. + */ + indexOf(locale: string, number: number | string): number; +} + +/** + * Gets the CLDR cardinal plural forms for numbers in different locales. + */ +declare const plural: Plural & { + /** + * Gets the CLDR ordinal plural forms for numbers in different locales. + */ + ordinal: Plural; +}; + +export default plural; diff --git a/types/plurals-cldr/plurals-cldr-tests.ts b/types/plurals-cldr/plurals-cldr-tests.ts new file mode 100644 index 0000000000..f5aacbd30c --- /dev/null +++ b/types/plurals-cldr/plurals-cldr-tests.ts @@ -0,0 +1,15 @@ +import plural from 'plurals-cldr'; + +plural('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null +plural('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null + +plural.forms('en'); // $ExpectType Form[] | null +plural.indexOf('en', 0); // $ExpectType number +plural.indexOf('en', ''); // $ExpectType number + +plural.ordinal('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null +plural.ordinal('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null + +plural.ordinal.forms('en'); // $ExpectType Form[] | null +plural.ordinal.indexOf('en', 0); // $ExpectType number +plural.ordinal.indexOf('en', ''); // $ExpectType number diff --git a/types/plurals-cldr/tsconfig.json b/types/plurals-cldr/tsconfig.json new file mode 100644 index 0000000000..593fbd1545 --- /dev/null +++ b/types/plurals-cldr/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "plurals-cldr-tests.ts" + ] +} diff --git a/types/plurals-cldr/tslint.json b/types/plurals-cldr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/plurals-cldr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 967d0226707f2e69dc83e61ffc89f48a3f835794 Mon Sep 17 00:00:00 2001 From: loli Date: Sun, 3 Mar 2019 10:37:13 +0800 Subject: [PATCH 093/265] file update --- retinajs/index.d.ts | 42 --------------------------------- types/retinajs/LICENSE | 21 ----------------- types/retinajs/README.md | 14 ----------- types/retinajs/package.json | 28 ---------------------- types/retinajs/retinajs-test.ts | 3 +++ types/retinajs/tsconfig.json | 23 ++++++++++++++++++ types/retinajs/tslint.json | 1 + 7 files changed, 27 insertions(+), 105 deletions(-) delete mode 100644 retinajs/index.d.ts delete mode 100644 types/retinajs/LICENSE delete mode 100644 types/retinajs/README.md delete mode 100644 types/retinajs/package.json create mode 100644 types/retinajs/retinajs-test.ts create mode 100644 types/retinajs/tsconfig.json create mode 100644 types/retinajs/tslint.json diff --git a/retinajs/index.d.ts b/retinajs/index.d.ts deleted file mode 100644 index 58b3e3b653..0000000000 --- a/retinajs/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export = retinajs.retina; - -export as namespace retinajs; - -declare namespace retinajs { - var hasWindow: boolean; - - var environment: number; - - var srcReplace: RegExp; - - var inlineReplace: RegExp; - - var selector: string; - - var processedAttr: string; - - var processedAttr: string; - - function arrayify(object: any): HTMLImageElement[]; - - function chooseCap(cap: number | string): number; - - function forceOriginalDimensions(image: HTMLImageElement): HTMLImageElement; - - function setSourceIfAvailable( - image: HTMLImageElement, - retinaURL: string - ): void; - - function dynamicSwapImage(image: HTMLImageElement, src: string): void; - - function manualSwapImage(image: HTMLImageElement, hdsrc: string): void; - - function getImages(images: HTMLImageElement[] | null): HTMLImageElement[]; - - function cleanBgImg(img: HTMLImageElement): HTMLImageElement; - - function retina(): void; - - function retina(images: any): void; -} diff --git a/types/retinajs/LICENSE b/types/retinajs/LICENSE deleted file mode 100644 index 21071075c2..0000000000 --- a/types/retinajs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/types/retinajs/README.md b/types/retinajs/README.md deleted file mode 100644 index d28dcdd483..0000000000 --- a/types/retinajs/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Installation - -> `npm install --save @types/retinajs` - -# Summary - -This package contains type definitions for retinajs ( https://github.com/strues/retinajs ). - -# Details - -Additional Details - -- Last updated: Sat Mar 02 2019 15:07:39 GMT+0800 -- Dependencies: none diff --git a/types/retinajs/package.json b/types/retinajs/package.json deleted file mode 100644 index 2c3081334e..0000000000 --- a/types/retinajs/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@types/retinajs", - "version": "2.1.3", - "description": "TypeScript definitions for retinajs", - "license": "MIT", - "contributors": [ - "senjyouhara (https://github.com/senjyouhara)" - ], - "main": "", - "types": "index", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "4BCEA62CB241C5EA821904599800CBA7A5695E03776CAE7E46CC1FDE98B73069", - "typeScriptVersion": ">= 3.2", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "keywords": [ - "retinajs", - "retina" - ], - "author": "senjyouhara" -} diff --git a/types/retinajs/retinajs-test.ts b/types/retinajs/retinajs-test.ts new file mode 100644 index 0000000000..9795d8922e --- /dev/null +++ b/types/retinajs/retinajs-test.ts @@ -0,0 +1,3 @@ +const retinajs = require("retinajs"); + +window.addEventListener("load", retinajs); diff --git a/types/retinajs/tsconfig.json b/types/retinajs/tsconfig.json new file mode 100644 index 0000000000..a137453eb4 --- /dev/null +++ b/types/retinajs/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "retinajs-test.ts" + ] +} diff --git a/types/retinajs/tslint.json b/types/retinajs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/retinajs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f802af39041b1b02d5d00d20c8cf4333f38e369c Mon Sep 17 00:00:00 2001 From: loli Date: Sun, 3 Mar 2019 12:03:23 +0800 Subject: [PATCH 094/265] file update --- types/retinajs/index.d.ts | 42 ++++++++++++++++---------------- types/retinajs/retinajs-test.ts | 3 --- types/retinajs/retinajs-tests.ts | 3 +++ types/retinajs/tsconfig.json | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 types/retinajs/retinajs-test.ts create mode 100644 types/retinajs/retinajs-tests.ts diff --git a/types/retinajs/index.d.ts b/types/retinajs/index.d.ts index 58b3e3b653..7d02ebc90b 100644 --- a/types/retinajs/index.d.ts +++ b/types/retinajs/index.d.ts @@ -1,42 +1,42 @@ +// Type definitions for retinajs 2.1 +// Project: https://github.com/strues/retinajs +// Definitions by: senjyouhara +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + export = retinajs.retina; export as namespace retinajs; declare namespace retinajs { - var hasWindow: boolean; + // var hasWindow: boolean; - var environment: number; + // var environment: number; - var srcReplace: RegExp; + // var srcReplace: RegExp; - var inlineReplace: RegExp; + // var inlineReplace: RegExp; - var selector: string; + // var selector: string; - var processedAttr: string; + // var processedAttr: string; - var processedAttr: string; + // var processedAttr: string; - function arrayify(object: any): HTMLImageElement[]; + // function arrayify(object: any): any[]; - function chooseCap(cap: number | string): number; + // function chooseCap(cap: number | string): number; - function forceOriginalDimensions(image: HTMLImageElement): HTMLImageElement; + // function forceOriginalDimensions(image: any): any; - function setSourceIfAvailable( - image: HTMLImageElement, - retinaURL: string - ): void; + // function setSourceIfAvailable(image: any, retinaURL: string): void; - function dynamicSwapImage(image: HTMLImageElement, src: string): void; + // function dynamicSwapImage(image: any, src: string): void; - function manualSwapImage(image: HTMLImageElement, hdsrc: string): void; + // function manualSwapImage(image: any, hdsrc: string): void; - function getImages(images: HTMLImageElement[] | null): HTMLImageElement[]; + // function getImages(images: any[] | null): any[]; - function cleanBgImg(img: HTMLImageElement): HTMLImageElement; + // function cleanBgImg(img: any): any; - function retina(): void; - - function retina(images: any): void; + function retina(images?: any): void; } diff --git a/types/retinajs/retinajs-test.ts b/types/retinajs/retinajs-test.ts deleted file mode 100644 index 9795d8922e..0000000000 --- a/types/retinajs/retinajs-test.ts +++ /dev/null @@ -1,3 +0,0 @@ -const retinajs = require("retinajs"); - -window.addEventListener("load", retinajs); diff --git a/types/retinajs/retinajs-tests.ts b/types/retinajs/retinajs-tests.ts new file mode 100644 index 0000000000..382f843e60 --- /dev/null +++ b/types/retinajs/retinajs-tests.ts @@ -0,0 +1,3 @@ +import retina = require("retinajs"); + +retina(); diff --git a/types/retinajs/tsconfig.json b/types/retinajs/tsconfig.json index a137453eb4..c022eaf6cc 100644 --- a/types/retinajs/tsconfig.json +++ b/types/retinajs/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "retinajs-test.ts" + "retinajs-tests.ts" ] } From 232ae8a9252d5499d82e74d23ef64d1ae9e22a59 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Sun, 3 Mar 2019 05:34:01 +0000 Subject: [PATCH 095/265] webpack-env: Make module.hot.accept callback optional --- types/webpack-env/index.d.ts | 4 ++-- types/webpack-env/webpack-env-tests.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 705e776c1e..3677523927 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -122,13 +122,13 @@ declare namespace __WebpackModuleApi { * @param dependencies * @param callback */ - accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void; + accept(dependencies: string[], callback?: (updatedDependencies: ModuleId[]) => void): void; /** * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. * @param dependency * @param callback */ - accept(dependency: string, callback: () => void): void; + accept(dependency: string, callback?: () => void): void; /** * Accept code updates for this module without notification of parents. * This should only be used if the module doesn’t export anything. diff --git a/types/webpack-env/webpack-env-tests.ts b/types/webpack-env/webpack-env-tests.ts index 61fb3f6c55..b07a3b632a 100644 --- a/types/webpack-env/webpack-env-tests.ts +++ b/types/webpack-env/webpack-env-tests.ts @@ -19,6 +19,9 @@ require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: // check if HMR is enabled if(module.hot) { + // accept update of dependency without a callback + module.hot.accept("./handler.js"); + // accept update of dependency module.hot.accept("./handler.js", function() { //... From 2d91880e13bf25f568bb4ac990e401afafa82122 Mon Sep 17 00:00:00 2001 From: Himenon <6715229+Himenon@users.noreply.github.com> Date: Sun, 3 Mar 2019 17:57:23 +0900 Subject: [PATCH 096/265] webpack-dev-server: add server argument --- types/webpack-dev-server/index.d.ts | 6 +++--- types/webpack-dev-server/webpack-dev-server-tests.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index 30fd2482e7..602d23ce13 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -52,11 +52,11 @@ declare namespace WebpackDevServer { interface Configuration { /** Provides the ability to execute custom middleware after all other middleware internally within the server. */ - after?: (app: express.Application) => void; + after?: (app: express.Application, server: WebpackDevServer) => void; /** This option allows you to whitelist services that are allowed to access the dev server. */ allowedHosts?: string[]; /** Provides the ability to execute custom middleware prior to all other middleware internally within the server. */ - before?: (app: express.Application) => void; + before?: (app: express.Application, server: WebpackDevServer) => void; /** This option broadcasts the server via ZeroConf networking on start. */ bonjour?: boolean; /** @@ -150,7 +150,7 @@ declare namespace WebpackDevServer { */ quiet?: boolean; /** @deprecated Here you can access the Express app object and add your own custom middleware to it. */ - setup?: (app: express.Application) => void; + setup?: (app: express.Application, server: WebpackDevServer) => void; /** The Unix socket to listen to (instead of a host). */ socket?: string; /** It is possible to configure advanced options for serving static files from contentBase. */ diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index 755245b035..dc59d75736 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -46,7 +46,7 @@ const config: WebpackDevServer.Configuration = { "**": "http://localhost:9090" }, - setup: (app: Application) => { + setup: (app: Application, server: WebpackDevServer) => { // Here you can access the Express app object and add your own custom middleware to it. // For example, to define custom handlers for some paths: app.get('/some/path', (req, res) => { From 46096ba4f75f6c76d1ea20c02f93e9829508c77b Mon Sep 17 00:00:00 2001 From: Dmitrii Sorin Date: Sun, 3 Mar 2019 19:38:04 +1100 Subject: [PATCH 097/265] Change pdfjs-dist typings to reflect the newest major version --- types/pdfjs-dist/index.d.ts | 710 +++++++++++++-------------- types/pdfjs-dist/pdfjs-dist-tests.ts | 10 +- 2 files changed, 352 insertions(+), 368 deletions(-) diff --git a/types/pdfjs-dist/index.d.ts b/types/pdfjs-dist/index.d.ts index 81de4624f9..84d40e926a 100644 --- a/types/pdfjs-dist/index.d.ts +++ b/types/pdfjs-dist/index.d.ts @@ -1,487 +1,471 @@ -// Type definitions for PDF.js v0.1.0 +// Type definitions for PDF.js v2.0 // Project: https://github.com/mozilla/pdf.js -// Definitions by: Josh Baldwin +// Definitions by: Josh Baldwin , Dmitrii Sorin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 -/* -Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/pdf.d.ts - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ +/// interface PDFPromise { - isResolved(): boolean; - isRejected(): boolean; - resolve(value: T): void; - reject(reason: string): void; - then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; + isResolved(): boolean; + isRejected(): boolean; + resolve(value: T): void; + reject(reason: string): void; + then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; } interface PDFTreeNode { - title: string; - bold: boolean; - italic: boolean; - color: number[]; // [r,g,b] - dest: any; - items: PDFTreeNode[]; + title: string; + bold: boolean; + italic: boolean; + color: number[]; // [r,g,b] + dest: any; + items: PDFTreeNode[]; } interface PDFInfo { - PDFFormatVersion: string; - IsAcroFormPresent: boolean; - IsXFAPresent: boolean; - [key: string]: any; // return type is string, typescript chokes + PDFFormatVersion: string; + IsAcroFormPresent: boolean; + IsXFAPresent: boolean; + [key: string]: any; // return type is string, typescript chokes } interface PDFMetadata { - parse(): void; - get(name: string): string; - has(name: string): boolean; + parse(): void; + get(name: string): string; + has(name: string): boolean; } interface PDFSource { - url?: string; - data?: Uint8Array; - httpHeaders?: any; - password?: string; + url?: string; + data?: Uint8Array; + httpHeaders?: any; + password?: string; } interface PDFProgressData { - loaded: number; - total: number; + loaded: number; + total: number; } interface PDFDocumentProxy { - /** - * Total number of pages the PDF contains. - **/ - numPages: number; + /** + * Total number of pages the PDF contains. + **/ + numPages: number; - /** - * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] - **/ - fingerprint: string; + /** + * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] + **/ + fingerprint: string; - /** - * True if embedded document fonts are in use. Will be set during rendering of the pages. - **/ - embeddedFontsUsed(): boolean; + /** + * True if embedded document fonts are in use. Will be set during rendering of the pages. + **/ + embeddedFontsUsed(): boolean; - /** - * @param number The page number to get. The first page is 1. - * @return A promise that is resolved with a PDFPageProxy. - **/ - getPage(number: number): PDFPromise; + /** + * @param number The page number to get. The first page is 1. + * @return A promise that is resolved with a PDFPageProxy. + **/ + getPage(number: number): PDFPromise; - /** - * TODO: return type of Promise - * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. - **/ - getDestinations(): PDFPromise; + /** + * TODO: return type of Promise + * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. + **/ + getDestinations(): PDFPromise; - /** - * A promise that is resolved with an array of all the JavaScript strings in the name tree. - **/ - getJavaScript(): PDFPromise; + /** + * A promise that is resolved with an array of all the JavaScript strings in the name tree. + **/ + getJavaScript(): PDFPromise; - /** - * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode - **/ - getOutline(): PDFPromise; + /** + * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode + **/ + getOutline(): PDFPromise; - /** - * A promise that is resolved with the info and metadata of the PDF. - **/ - getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; + /** + * A promise that is resolved with the info and metadata of the PDF. + **/ + getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; - /** - * Is the PDF encrypted? - **/ - isEncrypted(): PDFPromise; + /** + * Is the PDF encrypted? + **/ + isEncrypted(): PDFPromise; - /** - * A promise that is resolved with Uint8Array that has the raw PDF data. - **/ - getData(): PDFPromise; + /** + * A promise that is resolved with Uint8Array that has the raw PDF data. + **/ + getData(): PDFPromise; - /** - * TODO: return type of Promise - * A promise that is resolved when the document's data is loaded. - **/ - dataLoaded(): PDFPromise; + /** + * TODO: return type of Promise + * A promise that is resolved when the document's data is loaded. + **/ + dataLoaded(): PDFPromise; - /** - * - **/ - destroy(): void; + /** + * + **/ + destroy(): void; } interface PDFRef { - num: number; - gen: any; // todo + num: number; + gen: any; // todo } interface PDFPageViewportOptions { - viewBox: any; - scale: number; - rotation: number; - offsetX: number; - offsetY: number; - dontFlip: boolean; + viewBox: any; + scale: number; + rotation: number; + offsetX: number; + offsetY: number; + dontFlip: boolean; } interface PDFPageViewport { - width: number; - height: number; - fontScale: number; - transforms: number[]; + width: number; + height: number; + fontScale: number; + transforms: number[]; - clone(options: PDFPageViewportOptions): PDFPageViewport; - convertToViewportPoint(x: number, y: number): number[]; // [x, y] - convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] - convertToPdfPoint(x: number, y: number): number[]; // [x, y] + clone(options: PDFPageViewportOptions): PDFPageViewport; + convertToViewportPoint(x: number, y: number): number[]; // [x, y] + convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] + convertToPdfPoint(x: number, y: number): number[]; // [x, y] } interface PDFAnnotationData { - subtype: string; - rect: number[]; // [x1, y1, x2, y2] - annotationFlags: any; // todo - color: number[]; // [r,g,b] - borderWidth: number; - hasAppearance: boolean; + subtype: string; + rect: number[]; // [x1, y1, x2, y2] + annotationFlags: any; // todo + color: number[]; // [r,g,b] + borderWidth: number; + hasAppearance: boolean; } interface PDFAnnotations { - getData(): PDFAnnotationData; - hasHtml(): boolean; // always false - getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() - getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated - isViewable(): boolean; - loadResources(keys: any): PDFPromise; - getOperatorList(evaluator: any): PDFPromise; - // ... todo + getData(): PDFAnnotationData; + hasHtml(): boolean; // always false + getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() + getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated + isViewable(): boolean; + loadResources(keys: any): PDFPromise; + getOperatorList(evaluator: any): PDFPromise; + // ... todo } interface PDFRenderTextLayer { - beginLayout(): void; - endLayout(): void; - appendText(): void; + beginLayout(): void; + endLayout(): void; + appendText(): void; } interface PDFRenderImageLayer { - beginLayout(): void; - endLayout(): void; - appendImage(): void; + beginLayout(): void; + endLayout(): void; + appendImage(): void; } interface PDFRenderParams { - canvasContext: CanvasRenderingContext2D; - viewport?: PDFPageViewport; - textLayer?: PDFRenderTextLayer; - imageLayer?: PDFRenderImageLayer; - continueCallback?: (_continue: () => void) => void; + canvasContext: CanvasRenderingContext2D; + viewport?: PDFPageViewport; + textLayer?: PDFRenderTextLayer; + imageLayer?: PDFRenderImageLayer; + continueCallback?: (_continue: () => void) => void; } interface PDFViewerParams { - container: HTMLElement; - viewer?: HTMLElement; + container: HTMLElement; + viewer?: HTMLElement; } /** * RenderTask is basically a promise but adds a cancel function to termiate it. **/ -interface PDFRenderTask extends PDFPromise { +interface PDFRenderTask extends PDFLoadingTask { - /** - * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. - **/ - cancel(): void; + /** + * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. + **/ + cancel(): void; } interface PDFPageProxy { - /** - * Page number of the page. First page is 1. - **/ - pageNumber: number; + /** + * Page number of the page. First page is 1. + **/ + pageNumber: number; - /** - * The number of degrees the page is rotated clockwise. - **/ - rotate: number; + /** + * The number of degrees the page is rotated clockwise. + **/ + rotate: number; - /** - * The reference that points to this page. - **/ - ref: PDFRef; + /** + * The reference that points to this page. + **/ + ref: PDFRef; - /** - * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. - **/ - view: number[]; + /** + * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. + **/ + view: number[]; - /** - * @param scale The desired scale of the viewport. - * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. - * @return - **/ - getViewport(scale: number, rotate?: number): PDFPageViewport; + /** + * @param scale The desired scale of the viewport. + * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. + * @param dontFlip + * @return + **/ + getViewport(scale: number, rotate?: number, dontFlip?: boolean): PDFPageViewport; - /** - * A promise that is resolved with an array of the annotation objects. - **/ - getAnnotations(): PDFPromise; + /** + * A promise that is resolved with an array of the annotation objects. + **/ + getAnnotations(): PDFPromise; - /** - * Begins the process of rendering a page to the desired context. - * @param params Rendering options. - * @return An extended promise that is resolved when the page finishes rendering. - **/ - render(params: PDFRenderParams): PDFRenderTask; + /** + * Begins the process of rendering a page to the desired context. + * @param params Rendering options. + * @return An extended promise that is resolved when the page finishes rendering. + **/ + render(params: PDFRenderParams): PDFRenderTask; - /** - * A promise that is resolved with the string that is the text content frm the page. - **/ - getTextContent(): PDFPromise; + /** + * A promise that is resolved with the string that is the text content frm the page. + **/ + getTextContent(): PDFPromise; - /** - * marked as future feature - **/ - //getOperationList(): PDFPromise<>; + /** + * marked as future feature + **/ + //getOperationList(): PDFPromise<>; - /** - * Destroyes resources allocated by the page. - **/ - destroy(): void; + /** + * Destroyes resources allocated by the page. + **/ + destroy(): void; } interface TextContentItem { - str: string; - transform: number[]; // [0..5] 4=x, 5=y - width: number; - height: number; - dir: string; // Left-to-right (ltr), etc - fontName: string; // A lookup into the styles map of the owning TextContent + str: string; + transform: number[]; // [0..5] 4=x, 5=y + width: number; + height: number; + dir: string; // Left-to-right (ltr), etc + fontName: string; // A lookup into the styles map of the owning TextContent } interface TextContent { - items: TextContentItem[]; - styles: any; + items: TextContentItem[]; + styles: any; } /** * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. **/ interface PDFObjects { - get(objId: number, callback?: any): any; - resolve(objId: number, data: any): any; - isResolved(objId: number): boolean; - hasData(objId: number): boolean; - getData(objId: number): any; - clear(): void; + get(objId: number, callback?: any): any; + resolve(objId: number, data: any): any; + isResolved(objId: number): boolean; + hasData(objId: number): boolean; + getData(objId: number): any; + clear(): void; } interface PDFJSUtilStatic { - /** - * Normalize rectangle so that (x1,y1) < (x2,y2) - * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] - * - * For coordinate systems whose origin lies in the bottom-left, this - * means normalization to (BL,TR) ordering. For systems with origin in the - * top-left, this means (TL,BR) ordering. - **/ - normalizeRect(rect:number[]): number[]; + /** + * Normalize rectangle so that (x1,y1) < (x2,y2) + * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] + * + * For coordinate systems whose origin lies in the bottom-left, this + * means normalization to (BL,TR) ordering. For systems with origin in the + * top-left, this means (TL,BR) ordering. + **/ + normalizeRect(rect:number[]): number[]; } export const PDFJS: PDFJSStatic; interface PDFJSStatic { - /** - * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. - **/ - maxImageSize: number; + /** + * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. + **/ + maxImageSize: number; - /** - * The url of where the predefined Adobe CMaps are located. Include trailing - * slash. - */ - cMapUrl: string; + /** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + */ + cMapUrl: string; - /** - * Specifies if CMaps are binary packed. - */ - cMapPacked: boolean; + /** + * Specifies if CMaps are binary packed. + */ + cMapPacked: boolean; - /** - * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. - **/ - disableFontFace: boolean; + /** + * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. + **/ + disableFontFace: boolean; - /** - * Path for image resources, mainly for annotation icons. Include trailing - * slash. - */ - imageResourcesPath: string; + /** + * Path for image resources, mainly for annotation icons. Include trailing + * slash. + */ + imageResourcesPath: string; - /** - * Disable the web worker and run all code on the main thread. This will happen - * automatically if the browser doesn't support workers or sending typed arrays - * to workers. - */ - disableWorker: boolean; + /** + * Disable the web worker and run all code on the main thread. This will happen + * automatically if the browser doesn't support workers or sending typed arrays + * to workers. + */ + disableWorker: boolean; - /** - * Path and filename of the worker file. Required when the worker is enabled in - * development mode. If unspecified in the production build, the worker will be - * loaded based on the location of the pdf.js file. - */ - workerSrc: string; + /** + * Path and filename of the worker file. Required when the worker is enabled in + * development mode. If unspecified in the production build, the worker will be + * loaded based on the location of the pdf.js file. + */ + workerSrc: string; - /** - * Disable range request loading of PDF files. When enabled and if the server - * supports partial content requests then the PDF will be fetched in chunks. - * Enabled (false) by default. - */ - disableRange: boolean; + /** + * Disable range request loading of PDF files. When enabled and if the server + * supports partial content requests then the PDF will be fetched in chunks. + * Enabled (false) by default. + */ + disableRange: boolean; - /** - * Disable streaming of PDF file data. By default PDF.js attempts to load PDF - * in chunks. This default behavior can be disabled. - */ - disableStream: boolean; + /** + * Disable streaming of PDF file data. By default PDF.js attempts to load PDF + * in chunks. This default behavior can be disabled. + */ + disableStream: boolean; - /** - * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js - * will automatically keep fetching more data even if it isn't needed to display - * the current page. This default behavior can be disabled. - * - * NOTE: It is also necessary to disable streaming, see above, - * in order for disabling of pre-fetching to work correctly. - */ - disableAutoFetch: boolean; + /** + * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js + * will automatically keep fetching more data even if it isn't needed to display + * the current page. This default behavior can be disabled. + * + * NOTE: It is also necessary to disable streaming, see above, + * in order for disabling of pre-fetching to work correctly. + */ + disableAutoFetch: boolean; - /** - * Enables special hooks for debugging PDF.js. - */ - pdfBug: boolean; + /** + * Enables special hooks for debugging PDF.js. + */ + pdfBug: boolean; - /** - * Enables transfer usage in postMessage for ArrayBuffers. - */ - postMessageTransfers: boolean; + /** + * Enables transfer usage in postMessage for ArrayBuffers. + */ + postMessageTransfers: boolean; - /** - * Disables URL.createObjectURL usage. - */ - disableCreateObjectURL: boolean; + /** + * Disables URL.createObjectURL usage. + */ + disableCreateObjectURL: boolean; - /** - * Disables WebGL usage. - */ - disableWebGL: boolean; + /** + * Disables WebGL usage. + */ + disableWebGL: boolean; - /** - * Disables fullscreen support, and by extension Presentation Mode, - * in browsers which support the fullscreen API. - */ - disableFullscreen: boolean; + /** + * Disables fullscreen support, and by extension Presentation Mode, + * in browsers which support the fullscreen API. + */ + disableFullscreen: boolean; - /** - * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements - * - */ - disableTextLayer: boolean; + /** + * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements + * + */ + disableTextLayer: boolean; - /** - * Enables CSS only zooming. - */ - useOnlyCssZoom: boolean; + /** + * Enables CSS only zooming. + */ + useOnlyCssZoom: boolean; - /** - * Controls the logging level. - * The constants from PDFJS.VERBOSITY_LEVELS should be used: - * - errors - * - warnings [default] - * - infos - */ - verbosity: number; + /** + * Controls the logging level. + * The constants from PDFJS.VERBOSITY_LEVELS should be used: + * - errors + * - warnings [default] + * - infos + */ + verbosity: number; - /** - * The maximum supported canvas size in total pixels e.g. width * height. - * The default value is 4096 * 4096. Use -1 for no limit. - */ - maxCanvasPixels: number; + /** + * The maximum supported canvas size in total pixels e.g. width * height. + * The default value is 4096 * 4096. Use -1 for no limit. + */ + maxCanvasPixels: number; - /** - * Opens external links in a new window if enabled. The default behavior opens - * external links in the PDF.js window. - */ - openExternalLinksInNewWindow: boolean; + /** + * Opens external links in a new window if enabled. The default behavior opens + * external links in the PDF.js window. + */ + openExternalLinksInNewWindow: boolean; - /** - * Determines if we can eval strings as JS. Primarily used to improve - * performance for font rendering. - */ - isEvalSupported: boolean; + /** + * Determines if we can eval strings as JS. Primarily used to improve + * performance for font rendering. + */ + isEvalSupported: boolean; - Util: PDFJSUtilStatic; - - /** - * This is the main entry point for loading a PDF and interacting with it. - * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) - * is used, which means it must follow the same origin rules that any XHR does - * e.g. No corss domain requests without CORS. - * @param source - * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. - * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. - * @param progressCallback Progress callback. - * @return A promise that is resolved with PDFDocumentProxy object. - **/ - getDocument( - source: string, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: Uint8Array, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: PDFSource, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - PDFViewer(params: PDFViewerParams): void; - /** - * yet another viewer, this will render only one page at the time, reducing rendering time - * very important for mobile development - * @params {PDFViewerParams} - */ - PDFSinglePageViewer(params: PDFViewerParams): void; + PDFViewer(params: PDFViewerParams): void; + /** + * yet another viewer, this will render only one page at the time, reducing rendering time + * very important for mobile development + * @params {PDFViewerParams} + */ + PDFSinglePageViewer(params: PDFViewerParams): void; } + +interface PDFLoadingTask { + promise: PDFPromise; +} + +declare const Util: PDFJSUtilStatic; + +/** + * This is the main entry point for loading a PDF and interacting with it. + * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) + * is used, which means it must follow the same origin rules that any XHR does + * e.g. No corss domain requests without CORS. + * @param source + * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. + * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. + * @param progressCallback Progress callback. + * @return A promise that is resolved with PDFDocumentProxy object. + **/ +declare function getDocument( + source: string, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; + +declare function getDocument( + source: Uint8Array, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; + +declare function getDocument( + source: PDFSource, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; diff --git a/types/pdfjs-dist/pdfjs-dist-tests.ts b/types/pdfjs-dist/pdfjs-dist-tests.ts index ef569b2fda..cb7be752af 100644 --- a/types/pdfjs-dist/pdfjs-dist-tests.ts +++ b/types/pdfjs-dist/pdfjs-dist-tests.ts @@ -1,4 +1,4 @@ -import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; +import { getDocument, PDFDocumentProxy, PDFPromise, Util } from 'pdfjs-dist'; // // Fetch the PDF document from the URL using promises @@ -6,7 +6,7 @@ import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; var pdfDoc: PDFDocumentProxy; var pageNum: number; -PDFJS.getDocument('helloworld.pdf').then(function (pdf) { +getDocument('helloworld.pdf').promise.then(function (pdf) { // Using promise to fetch the page pdfDoc = pdf; pageNum = 1; @@ -32,7 +32,7 @@ function renderPage(pageNum: number) { // https://github.com/mozilla/pdf.js/blob/master/examples/acroforms/forms.js // const rect = viewport.convertToViewportRectangle([100,100,0,0]); - const normalizedRect = PDFJS.Util.normalizeRect(rect); + const normalizedRect = Util.normalizeRect(rect); const point = viewport.convertToViewportPoint(100, 100); const pdfPoint = viewport.convertToPdfPoint(100, 100); @@ -57,6 +57,6 @@ function goNext() { // // Test PDFPromise allows return value mutation // -var promise: PDFPromise = PDFJS.getDocument('helloworld.pdf').then(pdf => { +var promise: PDFPromise = getDocument('helloworld.pdf').promise.then(pdf => { return "arbitrary string"; -}); \ No newline at end of file +}); From 1ccfa15c9a34fa05b08e8515280b8ca22acd013f Mon Sep 17 00:00:00 2001 From: Pierre Vigier Date: Sun, 3 Mar 2019 16:16:21 +0100 Subject: [PATCH 098/265] Replace nullable by optional --- types/nodegit/diff.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 2f1abbda62..3a02577b98 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -132,16 +132,16 @@ export class Diff { * * */ - static blobToBuffer(oldBlob: Blob | null, oldAsPath: string | null, - buffer: string | null, bufferAsPath: string | null, opts: DiffOptions | null, fileCb: Function | null, - binaryCb: Function | null, hunkCb: Function | null, lineCb: Function): Promise; + static blobToBuffer(oldBlob?: Blob, oldAsPath?: string, + buffer?: string, bufferAsPath?: string, opts?: DiffOptions, fileCb?: Function, + binaryCb?: Function, hunkCb?: Function, lineCb?: Function): Promise; static fromBuffer(content: string, contentLen: number): Promise; - static indexToWorkdir(repo: Repository, index: Index | null, opts?: DiffOptions): Promise; + static indexToWorkdir(repo: Repository, index?: Index, opts?: DiffOptions): Promise; static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts?: DiffOptions): Promise; - static treeToIndex(repo: Repository, oldTree: Tree | null, index: Index | null, opts?: DiffOptions): Promise; - static treeToTree(repo: Repository, oldTree: Tree | null, new_tree: Tree | null, opts?: DiffOptions): Promise; - static treeToWorkdir(repo: Repository, oldTree: Tree | null, opts?: DiffOptions): Promise; - static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree | null, opts?: DiffOptions): Promise; + static treeToIndex(repo: Repository, oldTree?: Tree, index?: Index, opts?: DiffOptions): Promise; + static treeToTree(repo: Repository, oldTree?: Tree, new_tree?: Tree, opts?: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, oldTree?: Tree, opts?: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, oldTree?: Tree, opts?: DiffOptions): Promise; findSimilar(options?: DiffFindOptions): Promise; getDelta(idx: number): DiffDelta; From aac82565fe94b969a0dd32cf842846cbb73ca297 Mon Sep 17 00:00:00 2001 From: Pierre Vigier Date: Sun, 3 Mar 2019 16:20:35 +0100 Subject: [PATCH 099/265] Fix types in Time --- types/nodegit/time.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/nodegit/time.d.ts b/types/nodegit/time.d.ts index 575c005781..cb42ea6838 100644 --- a/types/nodegit/time.d.ts +++ b/types/nodegit/time.d.ts @@ -1,4 +1,4 @@ export class Time { - time: number; - offset: number; + time(): number; + offset(): number; } From 5ea320d9b787f01bd9f2696172a7c9c4bf5f126c Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 3 Mar 2019 11:22:50 -0600 Subject: [PATCH 100/265] Added locale option to filesize --- types/filesize/filesize-tests.ts | 1 + types/filesize/index.d.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/types/filesize/filesize-tests.ts b/types/filesize/filesize-tests.ts index 6980ac892d..aadc0542fa 100644 --- a/types/filesize/filesize-tests.ts +++ b/types/filesize/filesize-tests.ts @@ -15,6 +15,7 @@ filesize(265318, {standard: "iec"}); // "259.1 KiB" filesize(265318, {standard: "iec", fullform: true}); // "259.1 kibibytes" filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов" filesize(265318, {separator: ","}); // "259,1 KB" +filesize(265318, {locale: 'de-DE'}); // "259,1 KB" const size = filesize.partial({standard: "iec"}); size(265318); diff --git a/types/filesize/index.d.ts b/types/filesize/index.d.ts index 33d04b66ff..d53fba8641 100644 --- a/types/filesize/index.d.ts +++ b/types/filesize/index.d.ts @@ -57,6 +57,10 @@ declare namespace Filesize { * Array of full form overrides, default is [] */ fullforms?: string[]; + /** + * BCP 47 language tag to specify a locale, or true to use default locale, default is "" + */ + locale?: string | boolean; /** * Output of function (array, exponent, object, or string), default is string */ From f5b66cb1740ee4f7afb2d399525a82aace1706bd Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 3 Mar 2019 11:28:17 -0600 Subject: [PATCH 101/265] Modified file header --- types/filesize/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/filesize/index.d.ts b/types/filesize/index.d.ts index d53fba8641..cdc9031f22 100644 --- a/types/filesize/index.d.ts +++ b/types/filesize/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for filesize 4.0 +// Type definitions for filesize 4.1.2 // Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com // Definitions by: Giedrius Grabauskas // Renaud Chaput // Roman Nuritdinov +// Sam Hulick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var fileSize: Filesize.Filesize; From 3c211fe01dc2c08a41ba77888265180340992c16 Mon Sep 17 00:00:00 2001 From: kouros51 Date: Sun, 3 Mar 2019 16:45:17 -0500 Subject: [PATCH 102/265] Add enter and exist for a context so we set and get values and keys for certain context --- types/cls-hooked/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/cls-hooked/index.d.ts b/types/cls-hooked/index.d.ts index 57e6b79c60..c81966970c 100644 --- a/types/cls-hooked/index.d.ts +++ b/types/cls-hooked/index.d.ts @@ -12,6 +12,8 @@ export interface Namespace { set(key: string, value: T): T; get(key: string): any; + enter(context: any): void; + exit(context: any): void; run(fn: (...args: any[]) => void): void; runAndReturn(fn: (...args: any[]) => T): T; runPromise(fn: (...args: any[]) => Promise): Promise; From dc27067ac0e57e4609ffcaa8f4af841cd56f404a Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 3 Mar 2019 15:46:09 -0600 Subject: [PATCH 103/265] Removed patch part from version --- types/filesize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/filesize/index.d.ts b/types/filesize/index.d.ts index cdc9031f22..958a5e3973 100644 --- a/types/filesize/index.d.ts +++ b/types/filesize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for filesize 4.1.2 +// Type definitions for filesize 4.1 // Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com // Definitions by: Giedrius Grabauskas // Renaud Chaput From 1c43f86f73ca178bdc96fbd98e8e8c3b6b8219d9 Mon Sep 17 00:00:00 2001 From: kouros51 Date: Sun, 3 Mar 2019 17:32:17 -0500 Subject: [PATCH 104/265] Add in the test a use case explaining the need to expose those too new functions --- types/cls-hooked/cls-hooked-tests.ts | 21 +++++++++++++++++++++ types/cls-hooked/index.d.ts | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/types/cls-hooked/cls-hooked-tests.ts b/types/cls-hooked/cls-hooked-tests.ts index affaa6c54a..04c0789e71 100644 --- a/types/cls-hooked/cls-hooked-tests.ts +++ b/types/cls-hooked/cls-hooked-tests.ts @@ -21,3 +21,24 @@ bindLater((x: number) => { const session2 = cls.getNamespace('my session'); session2.get('user'); + +const appNamespace = cls.createNamespace('applicationNameSpace'); +const context = appNamespace.createContext(); + +function bindWithMiddleware(middlewareFn: () => void) { + return session.bind(middlewareFn, context); +} + +bindWithMiddleware(()=>{ + // Some middleware that doing something in the application +}); + +// In some place in application, we want to set value to be used elsewhere +appNamespace.enter(context); +appNamespace.set('requestId','someId'); +appNamespace.exit(context); + +// Retrieve that value set before without losing the context when chaining several middleware +appNamespace.enter(context); +appNamespace.get('requestId'); +appNamespace.exit(context); diff --git a/types/cls-hooked/index.d.ts b/types/cls-hooked/index.d.ts index c81966970c..4fa385c52f 100644 --- a/types/cls-hooked/index.d.ts +++ b/types/cls-hooked/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cls-hooked 4.2 +// Type definitions for cls-hooked 4.3 // Project: https://github.com/jeff-lewis/cls-hooked // Definitions by: Leo Liang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,14 +12,14 @@ export interface Namespace { set(key: string, value: T): T; get(key: string): any; - enter(context: any): void; - exit(context: any): void; run(fn: (...args: any[]) => void): void; runAndReturn(fn: (...args: any[]) => T): T; runPromise(fn: (...args: any[]) => Promise): Promise; bind(fn: F, context?: any): F; // tslint:disable-line: ban-types bindEmitter(emitter: EventEmitter): void; createContext(): any; + enter(context: any): void; + exit(context: any): void; } export function createNamespace(name: string): Namespace; From 405f9855ed3194061579b15253f5a616f52310b2 Mon Sep 17 00:00:00 2001 From: kouros51 Date: Sun, 3 Mar 2019 17:39:15 -0500 Subject: [PATCH 105/265] Adding missing whitespaces --- types/cls-hooked/cls-hooked-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cls-hooked/cls-hooked-tests.ts b/types/cls-hooked/cls-hooked-tests.ts index 04c0789e71..e1552c16e2 100644 --- a/types/cls-hooked/cls-hooked-tests.ts +++ b/types/cls-hooked/cls-hooked-tests.ts @@ -29,7 +29,7 @@ function bindWithMiddleware(middlewareFn: () => void) { return session.bind(middlewareFn, context); } -bindWithMiddleware(()=>{ +bindWithMiddleware(() => { // Some middleware that doing something in the application }); From 047237d00c412b2b5b64b92938645f8ad8dfc4a0 Mon Sep 17 00:00:00 2001 From: kouros51 Date: Sun, 3 Mar 2019 17:41:08 -0500 Subject: [PATCH 106/265] Adding missing whitespaces --- types/cls-hooked/cls-hooked-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cls-hooked/cls-hooked-tests.ts b/types/cls-hooked/cls-hooked-tests.ts index e1552c16e2..9d9e14af1b 100644 --- a/types/cls-hooked/cls-hooked-tests.ts +++ b/types/cls-hooked/cls-hooked-tests.ts @@ -35,7 +35,7 @@ bindWithMiddleware(() => { // In some place in application, we want to set value to be used elsewhere appNamespace.enter(context); -appNamespace.set('requestId','someId'); +appNamespace.set('requestId', 'someId'); appNamespace.exit(context); // Retrieve that value set before without losing the context when chaining several middleware From 1c05fef87ebbaa0fba845af52e0ac5771a130a71 Mon Sep 17 00:00:00 2001 From: kouros51 Date: Sun, 3 Mar 2019 17:43:23 -0500 Subject: [PATCH 107/265] Fixing typo in comment --- types/cls-hooked/cls-hooked-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cls-hooked/cls-hooked-tests.ts b/types/cls-hooked/cls-hooked-tests.ts index 9d9e14af1b..60931e1253 100644 --- a/types/cls-hooked/cls-hooked-tests.ts +++ b/types/cls-hooked/cls-hooked-tests.ts @@ -33,7 +33,7 @@ bindWithMiddleware(() => { // Some middleware that doing something in the application }); -// In some place in application, we want to set value to be used elsewhere +// In some place in the application, we want to set a value to a given key to be used elsewhere appNamespace.enter(context); appNamespace.set('requestId', 'someId'); appNamespace.exit(context); From 6233e51f07941c6ac47ee86513f8c592fab56f98 Mon Sep 17 00:00:00 2001 From: Joel Spadin Date: Sun, 3 Mar 2019 20:50:48 -0600 Subject: [PATCH 108/265] Change export default to export = --- types/plurals-cldr/index.d.ts | 4 ++-- types/plurals-cldr/plurals-cldr-tests.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/plurals-cldr/index.d.ts b/types/plurals-cldr/index.d.ts index 0d7277b52a..a65fc4e2c8 100644 --- a/types/plurals-cldr/index.d.ts +++ b/types/plurals-cldr/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Joel Spadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export type Form = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; +type Form = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; interface Plural { /** @@ -50,4 +50,4 @@ declare const plural: Plural & { ordinal: Plural; }; -export default plural; +export = plural; diff --git a/types/plurals-cldr/plurals-cldr-tests.ts b/types/plurals-cldr/plurals-cldr-tests.ts index f5aacbd30c..7927afe761 100644 --- a/types/plurals-cldr/plurals-cldr-tests.ts +++ b/types/plurals-cldr/plurals-cldr-tests.ts @@ -1,4 +1,4 @@ -import plural from 'plurals-cldr'; +import plural = require('plurals-cldr'); plural('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null plural('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null From ec26d5ee1235cbfd2e77b17dcbacfd304fc287f5 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma <14cse031giet@gmail.com> Date: Mon, 4 Mar 2019 10:40:34 +0530 Subject: [PATCH 109/265] Update tsconfig.json --- types/html5-history/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/html5-history/tsconfig.json b/types/html5-history/tsconfig.json index 08937c1353..b4bc53cbb5 100644 --- a/types/html5-history/tsconfig.json +++ b/types/html5-history/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "html5-history-tests.ts" ] -} \ No newline at end of file +} From 8fdbc6ef465f678ae4847cd2adc7db8ecc33b290 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 4 Mar 2019 16:03:11 +1100 Subject: [PATCH 110/265] Add regtest network constant Added to the library with bitcoinjs/bitcoinjs-lib#1261 --- types/bitcoinjs-lib/bitcoinjs-lib-tests.ts | 4 ++++ types/bitcoinjs-lib/index.d.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts index cc24c6573b..a2db324e39 100644 --- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts +++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts @@ -20,6 +20,10 @@ keyPair3.toWIF(); bitcoin.payments.p2pkh({ pubkey: keyPair3.publicKey }); const network = keyPair3.network; +const keyPair4 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.regtest, rng}); +keyPair4.toWIF(); +bitcoin.payments.p2pkh({ pubkey: keyPair4.publicKey }); + // Test TransactionBuilder and Transaction const txb = new bitcoin.TransactionBuilder(); txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0); diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 4fb1bb16a7..7cedbc822a 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -191,6 +191,7 @@ export class TransactionBuilder { export const networks: { bitcoin: Network; testnet: Network; + regtest: Network; }; export const opcodes: { From c01da43b4223ce947278a719e1ff232e291db3d9 Mon Sep 17 00:00:00 2001 From: taoqf Date: Mon, 4 Mar 2019 17:14:53 +0800 Subject: [PATCH 111/265] add type for dv --- types/dv/dv-tests.ts | 18 ++ types/dv/index.d.ts | 446 +++++++++++++++++++++++++++++++++++++++++ types/dv/tsconfig.json | 23 +++ types/dv/tslint.json | 1 + 4 files changed, 488 insertions(+) create mode 100644 types/dv/dv-tests.ts create mode 100644 types/dv/index.d.ts create mode 100644 types/dv/tsconfig.json create mode 100644 types/dv/tslint.json diff --git a/types/dv/dv-tests.ts b/types/dv/dv-tests.ts new file mode 100644 index 0000000000..f49a7ef683 --- /dev/null +++ b/types/dv/dv-tests.ts @@ -0,0 +1,18 @@ +import dv = require('dv'); +import fs = require('fs'); + +const image = new dv.Image('png', fs.readFileSync('textpage300.png')); +const tesseract = new dv.Tesseract('eng', image); +console.log(tesseract.findText('plain')); + +const barcodes = new dv.Image('png', fs.readFileSync('form2.png')); +const open = barcodes.thin('bg', 8, 5).dilate(3, 3); +const openMap = open.distanceFunction(8); +const openMask = openMap.threshold(10).erode(22, 22); +const boxes = openMask.invert().connectedComponents(8); +for (const i in boxes) { + const boxImage = barcodes.crop( + boxes[i].x, boxes[i].y, + boxes[i].width, boxes[i].height); + // Do something useful with our image. +} diff --git a/types/dv/index.d.ts b/types/dv/index.d.ts new file mode 100644 index 0000000000..6aec428e5e --- /dev/null +++ b/types/dv/index.d.ts @@ -0,0 +1,446 @@ +// Type definitions for dv 2.1 +// Project: https://github.com/creatale/node-dv +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export interface Box { + x: number; + y: number; + width: number; + height: number; +} + +export interface Point { + x: number; + y: number; +} + +export interface Segment { + p1: Point; + p2: Point; + error: number; +} + + +export interface Skew { + angle: number; + confidence: number; +} + +export interface Component { + x: number; + y: number; + width: number; + height: number; +} + +export class Image { + /** + * Creates a copy of otherImage. + */ + constructor(otherImage: Image); + /** + * Creates a 32 bit imagen from three 8 bit images, where each image represents one channel of RGB or HSV. + */ + constructor(image1: Image, image2: Image, image3: Image); + /** + * Creates an empty image with the specified dimensions (!!! note: this constructor is experimental and likely to change). + */ + constructor(width: number, height: number, depth: number); + /** + * Creates an image from a Buffer object, that contains the PNG/JPG encoded image. + */ + constructor(type: 'png' | 'jpg', buffer: Buffer); + constructor(type: 'rgba' | 'rgb' | 'gray', buffer: Buffer, width: number, height: number); + + public readonly width: number; + public readonly height: number; + /** + * The depth of the image in bits per pixel, i.e. one of 32 (color), 8 (grayscale) or 1 (monochrome). + */ + public readonly depth: number; + + /** + * Returns the (boolean) inverse of this image. + */ + public invert(): Image; + /** + * Returns the (boolean) union of two images with equal depth, aligning them to the upper left corner. + */ + public or(otherImage: Image): Image; + /** + * Returns the (boolean) difference of two images with equal depth, aligning them to the upper left corner. + */ + public and(otherImage: Image): Image; + /** + * Returns the (boolean) exclusive disjunction of two images with equal depth, aligning them to the upper left corner. + */ + public xor(otherImage: Image): Image; + /** + * If the images are monochrome, dispatches to Leptonica's pixOr. Otherwise, returns the channelwise addition of b to a, clipped at 255. + */ + public add(otherImage: Image): Image; + /** If the images are monochrome, dispatches to Leptonica's pixSubtract and is equivalent to a.and(b.invert()). For grayscale images, returns the pixelwise subtraction of b from a, clipped at zero. For color, the entire RGB value is subtracted instead of doing channelwise subtraction (ask Leptonica why). + * @example: + * redness = colorImage.toGray(1, 0, 0).subtract(colorImage.toGray(0, 0.5, 0.5)) + */ + public subtract(otherImage: Image): Image; + /** + * Applies a convoltuion kernel with the specified dimensions. Image convolution is an operation where each destination pixel is computed based on a weighted sum of a set of nearby source pixels. + */ + public convolve(halfWidth: number, halfHeight: number): Image; + + /** + * Unsharp Masking creates an unsharp mask using halfWidth. The fraction determines how much of the edge is added back into image. The resulting image appears clearer, but it is generally less accurate. + */ + public unsharp(halfWidth: number, fraction: number): Image; + /** + * Rotates the image around its center by the specified angle in degrees. + */ + public rotate(angle: number): Image; + /** + * Scales an image proportionally by scale (1.0 = 100%). + */ + public scale(scale: number): Image; + + /** + * Scales an image by scaleX and scaleY (1.0 = 100%). + */ + public scale(scaleX: number, scaleY: number): Image; + + /** + * Crops an image from this image by the specified rectangle and returns the resulting image. + */ + public crop(box: Box): Image; + public crop(x: number, y: number, width: number, height: number): Image; + /** + * Creates a mask by testing if pixels (RGB, HSV, ...) are between lower and upper. Formally speaking: + * lower1 ≤ pixel1 ≤ upper1 + * ∧ lower2 ≤ pixel2 ≤ upper2 + * ∧ lower3 ≤ pixel3 ≤ upper3 + */ + public inRange(lower1: number, lower2: number, lower3: number, upper1: number, upper2: number, upper3: number): Image; + /** + * Only available for grayscale images. Returns the histogram in an array of length 256, where each entry represents the fraction (0.0 to 1.0) of that color in the image. + * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be counted. + */ + public histogram(mask?: Image): Image; + /** + * Computes the horizontal or vertical projection of an 1bpp or 8bpp image. + */ + public projection(mode: 'horizontal' | 'vertical'): number[]; + /** + * Sets the specified value to each pixel set in the mask. + */ + public setMasked(mask: Image, value: number): Image; + /** + * Available for grayscale and color images. Channelwise maps each pixel of image using mapping, which must be an array of length 256 with integer values between 0 and 255. + * !!! !!! Note: this function actually changes the image! + * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be modified. + */ + public applyCurve(mapping: number[], mask?: Image): this; + /** + * Applies a rank (0.0 ... 1.0) filter of the specified width and height (think of it as radius) to this image and returns the result. If you set rank to 0.5 you'll get a Median Filter. Note that this type of filter works best with odd sizes like 3 or 5. + */ + public rankFilter(width: number, height: number, rank: number): Image; + /** + * Color image quantization using an octree based algorithm. colors must be between 2 and 256. Note that support for the resulting palette image is highly experimental at this point; only toGray() and toBuffer('png') are guaranteed to work. + */ + public octreeColorQuant(colors: number): Image; + /** + * Color image quantization using median cut algorithm. colors must be between 2 and 256. Note that support for the resulting palette image is highly experimental at this point; only toGray() and toBuffer('png') are guaranteed to work. + */ + public medianCutQuant(colors: number): Image; + /** + * Converts a grayscale image to monochrome using a global threshold. value must be between 0 and 255. + */ + public threshold(value: number): Image; + /** + * Converts an image to grayscale using default settings. Can be used to convert monochrome images back to grayscale. + */ + public toGray(): Image; + /** + * Converts an RGB image to grayscale using the specified widths for each channel. + */ + public toGray(redWeight: number, greenWeight: number, blueWeight: number): Image; + /** + * Converts an RGB image to grayscale by selecting either the 'min' or 'max' channel. This can act as a simple color filter: 'max' maps colored pixels towards white, while 'min' maps colored pixels towards black. + */ + public toGray(selector: 'min' | 'max'): Image; + /** + * Converts a grayscale image to a color image. + */ + public toColor(): Image; + /** + * Converts from RGB to HSV color space. HSV has the following ranges: + * Hue: [0 .. 239] + * Saturation: [0 .. 255] + * Value: [0 .. 255] + */ + public toHSV(): Image; + /** + * Converts from HSV to RGB color space. + */ + public toRGB(): Image; + /** + * Applies an Erode Filter and returns the result. + */ + public erode(width: number, height: number): Image; + /** + * Applies a Dilate Filter and returns the result. + */ + public dilate(width: number, height: number): Image; + /** + * Applies an Open Filter and returns the result. + */ + public open(width: number, height: number): Image; + /** + * Applies a Close Filter and returns the result. + */ + public close(width: number, height: number): Image; + /** + * Applies morphological thinning of type (fg or bg) with the specified connectivitiy (4 or 8) and maxIterations (0 to iterate until complete). + */ + public thin(type: 'fg' | 'bg', connectivity: number, maxIterations: number): Image; + /** + * Scales an 8bpp image for maximum dynamic range. scale must be either log or linear. + */ + public maxDynamicRange(scale: 'log' | 'linear'): Image; + /** + * Applies Otsu's Method for computing the threshold of a grayscale image. It computes a threshold for each tile of the specified size and performs the threshold operation, resulting in a binary image for each tile. These are stitched into the final result. + * The smooth size controls the a convolution kernel applied to threshold array (use 0 for no smoothing). The score factor controls the fraction of the max. Otsu score (typically 0.1; use 0.0 for standard Otsu). + */ + public otsuAdaptiveThreshold(tileWidth: number, tileHeight: number, smoothWidth: number, smoothHeight: number, scoreFactor: number): Image; + /** + * Detects Line Segments with the specified accuracy (3 is a good start). The number of found line segments can be limited using maxLineSegments (0 is unlimited). + */ + public lineSegments(accuracy: number, maxLineSegments: number, useWeightedMeanShift: boolean): Segment[]; + /** + * Only available for monochrome images. Tries to find the skew of this image. The resulting angle is in degree. The confidence is between 0.0 and 1.0. + */ + public findSkew(): Skew; + /** + * Only available for monochrome images. Tries to extract connected components (think of flood fill). The connectivity can be specified as 4 or 8 directions. + */ + public connectedComponents(connectivity: 4 | 8): Component[]; + /** + * The Distance Function works on 1bpp images. It labels each pixel with the largest distance between this and any other pixel in its connected component. The connectivity is either 4 or 8. + */ + public distanceFunction(connectivity: 4 | 8): Image; + /** + * !!! Note: this function actually changes the image! + * Fills a specified rectangle with white. + */ + public clearBox(box: Box): this; + public clearBox(x: number, y: number, width: number, height: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a filled rectangle to this image with the specified value. Works for 8bpp and 1bpp images. + */ + public fillBox(box: Box, value: number): this; + public fillBox(x: number, y: number, width: number, height: number, value: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a filled rectangle to this image in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + public fillBox(box: Box, r: number, g: number, b: number, fraction?: number): this; + public fillBox(x: number, y: number, width: number, height: number, r: number, g: number, b: number, fraction?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a rectangle to this image with the specified border. The possible pixel manipulating operations are set, clear and flip. + */ + public drawBox(box: Box, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + public drawBox(x: number, y: number, width: number, height: number, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + /** + * !!! Note: this function actually changes the image! + * Draws a rectangle to this image with the specified border in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + public drawBox(box: Box, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + public drawBox(x: number, y: number, width: number, height: number, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a line between p1 and p2 to this image with the specified line width. The possible pixel manipulating operations are set, clear and flip. + */ + public drawLine(p1: Point, p2: Point, width: number, operation: 'set' | 'clear' | 'flip'): this; + /** + * !!! Note: this function actually changes the image! + * Draws a line between p1 and p2 to this image with the specified line width in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + public drawLine(p1: Point, p2: Point, width: number, red: number, green: number, blue: number, frac?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws an image to this image with the specified destination box. + */ + public drawImage(image: Image, box: Box): this; + public drawImage(image: Image, x: number, y: number, width: number, height: number): this; + /** + * Converts the Image in the specified format to a buffer. + * Specifying raw returns the raw image data as buffer. For color images, the result contains three bytes per pixel in the order R, G, B; for grayscale and monochrome images, it contains one byte per pixel. + * Specifying png returns a PNG encoded image as buffer. + * Specifying jpg returns a JPG encoded image as buffer. + */ + public toBuffer(format?: 'raw' | 'png' | 'jpg'): Buffer; +} + +export interface Rect { + // todo +} + +export interface Region { + box: Box; + text: string, + confidence: number; +} + +export type Paragaph = Region; + +export interface Textline { + box: Box; +} + +export type Word = Region; + +export interface Choice { + text: string, + confidence: number; +} + +export interface Symbol extends Region { + choices: Choice[]; +} + +export type Text = Choice; + +/** + * A Tesseract object represents an optical character recognition engine, that reads text using Tesseract from an image. Tesseract supports many langauges and fonts (see Tesseract/Downloads). New language files have to be installed in node-dv/tessdata. + */ +export class Tesseract { + /** + * Creates a Tesseract engine with language set to english. + */ + constructor(); + constructor(datapath: string); + /** + * Creates a Tesseract engine with the specified language. + */ + constructor(datapath: string, lang: string); + /** + * Creates a Tesseract engine with the specified language and image. + */ + constructor(datapath: string, lang: string, image: Image); + + /** + * Accessor for the input image. + */ + public image: Image; + /** + * Accessor for the rectangle that specifies a "visible" area on the image. + */ + public rectangle: Rect; + /** + * Accessor for the page segmentation mode. Valid values are: osd_only, auto_osd, auto_only, auto, single_column, single_block_vert_text, single_block, single_line, single_word, circle_word, single_char, sparse_text, sparse_text_osd. + */ + public pageSegMode: 'osd_only' | 'auto_osd' | 'auto_only' | 'auto' | 'single_column' | 'single_block_vert_text' | 'single_block' | 'single_line' | 'single_word' | 'circle_word' | 'single_char' | 'sparse_text' | 'sparse_text_osd' + [key: string]: unknown; + + /** + * Clears the tesseract image and its last results. + */ + public clear(): void; + /** + * Clears all adaptive classifiers (use this when results vary during scanning). + */ + public clearAdaptiveClassifier(): void; + /** + * Returns the binarized image Tesseract uses for its recognition. + */ + public thresholdImage(): Image; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + public findRegions(recognize: boolean): Region[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + public findParagraphs(recognize: boolean): Paragaph[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + public findTextLines(recognize: boolean): Textline[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + public findWords(recognize: boolean): Word[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + public findSymbols(recognize: boolean): Symbol[]; + /** + * Returns text in the specified format. Valid formats are: plain, unlv. + */ + public findText(format: 'plain' | 'unlv', withConfidence?: boolean): string; + public findText(format: 'hocr' | 'box', pageNumber: number): string; +} + +export interface Barcodeformat { + QR_CODE: boolean; + DATA_MATRIX: boolean; + PDF_417: boolean; + UPC_E: boolean; + UPC_A: boolean; + EAN_8: boolean; + EAN_13: boolean; + CODE_128: boolean; + CODE_39: boolean; + ITF: boolean; + AZTEC: boolean; +} + +export interface BarCode { + type: string; + data: string; + buffer: Buffer; + points: Point[]; +} + +/** + * A ZXing object represents a barcode reader. By default it attempts to decode all barcode formats that ZXing supports. + */ +export class ZXing { + constructor(image?: Image); + + /** + * Accessor for the input image this barcode reader operates on. + */ + public image: Image; + /** + * List of barcodes the reader tries to find. It's specified as an object and missing properties account as false + */ + public formats: Barcodeformat; + /** + * If try harder is enabled, the barcode reader spends more time trying to find a barcode (optimize for accuracy, not speed). + */ + public tryHarder: boolean; + /** + * Returns the first barcode found as an object with the following format: + */ + public findCode(): BarCode; + /** + * enotes the barcodes type. + */ + public readonly type: 'None' | 'QR_CODE' | 'DATA_MATRIX' | 'PDF_417' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'ITF' | 'AZTEC'; + /** + * denotes the stringified data read from the barcode. + */ + public readonly data: string; + /** + * denotes the decoded binary data of the barcode before conversion into another character encoding. + */ + public readonly buffer: Buffer; + /** + * denotes the points in pixels which were used by the barcode reader to detect the barcode. + */ + public readonly points: Point[]; +} diff --git a/types/dv/tsconfig.json b/types/dv/tsconfig.json new file mode 100644 index 0000000000..ad0aaa212b --- /dev/null +++ b/types/dv/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dv-tests.ts" + ] +} \ No newline at end of file diff --git a/types/dv/tslint.json b/types/dv/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dv/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bd701363922cc3c1bdaa9d19e98a2f2faab9b6d7 Mon Sep 17 00:00:00 2001 From: minijus <3633549+minijus@users.noreply.github.com> Date: Mon, 4 Mar 2019 13:33:04 +0200 Subject: [PATCH 112/265] [webpack-dev-server] Add httpProxyMiddleware.Filter support to context property of ProxyConfigArrayItem webpack-dev-server [proxy documentation](https://webpack.js.org/configuration/dev-server/#devserverproxy) gives an example of using Filter function for context property and in reality dev-server supports it. However, it was missing on `@types/webpack-dev-server`. --- types/webpack-dev-server/index.d.ts | 2 +- types/webpack-dev-server/webpack-dev-server-tests.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index 30fd2482e7..02b22e7817 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -28,7 +28,7 @@ declare namespace WebpackDevServer { type ProxyConfigArrayItem = { path?: string | string[]; - context?: string | string[] + context?: string | string[] | httpProxyMiddleware.Filter } & httpProxyMiddleware.Config; type ProxyConfigArray = ProxyConfigArrayItem[]; diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index 755245b035..dc8a1dbdc1 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -87,6 +87,9 @@ const c3: WebpackDevServer.Configuration = { const c4: WebpackDevServer.Configuration = { writeToDisk: (filePath: string) => true, }; +const c5: WebpackDevServer.Configuration = { + proxy: [{context: (pathname: string) => true}] +}; // API example server = new WebpackDevServer(compiler, config); From 51a727e81317ef19933e96b099ccadb874fd1c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20H=C3=BCbelbauer?= Date: Mon, 4 Mar 2019 13:42:34 +0100 Subject: [PATCH 113/265] Document the timeGutterHeader component --- types/react-big-calendar/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index 7a6bebe1c2..85914eda10 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -120,6 +120,7 @@ export interface Components { dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; dateCellWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; timeSlotWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + timeGutterHeader?: React.SFC | React.Component | React.ComponentClass | JSX.Element; timeGutterWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; toolbar?: React.ComponentType; agenda?: { From 65a3fe8ce4c08ca1c866c67595c1b08a28f9b105 Mon Sep 17 00:00:00 2001 From: Kenneth Kidmose Johnsen Date: Mon, 4 Mar 2019 15:23:05 +0100 Subject: [PATCH 114/265] Fixed so that getFromUniqueIdentifier return ResumableFile instead of just void --- types/resumablejs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/resumablejs/index.d.ts b/types/resumablejs/index.d.ts index c87d669a07..48d3f578d8 100644 --- a/types/resumablejs/index.d.ts +++ b/types/resumablejs/index.d.ts @@ -213,7 +213,7 @@ declare namespace Resumable { /** * Look up a ResumableFile object by its unique identifier. **/ - getFromUniqueIdentifier(uniqueIdentifier: string): void; + getFromUniqueIdentifier(uniqueIdentifier: string): ResumableFile; /** * Returns the total size of the upload in bytes. **/ From aad8e76a58b28168ceb10a16a75019d41e48b6ca Mon Sep 17 00:00:00 2001 From: Kenneth Kidmose Johnsen Date: Mon, 4 Mar 2019 15:29:14 +0100 Subject: [PATCH 115/265] added definition credits for proper notifications about issues --- types/resumablejs/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/resumablejs/index.d.ts b/types/resumablejs/index.d.ts index 48d3f578d8..45047b7cf7 100644 --- a/types/resumablejs/index.d.ts +++ b/types/resumablejs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Resumable.js v1.0.2 // Project: https://github.com/23/resumable.js // Definitions by: Daniel McAssey +// Kenneth Kidmose Johnsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Resumable { From 3cf473bd75fe65923d19cc058fdd0c3405413ba3 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 4 Mar 2019 15:23:24 +0000 Subject: [PATCH 116/265] Adds collectionsjs type. --- types/collectionsjs/collectionsjs-tests.ts | 57 ++++++++++++++++++++++ types/collectionsjs/index.d.ts | 45 +++++++++++++++++ types/collectionsjs/tsconfig.json | 23 +++++++++ types/collectionsjs/tslint.json | 1 + 4 files changed, 126 insertions(+) create mode 100644 types/collectionsjs/collectionsjs-tests.ts create mode 100644 types/collectionsjs/index.d.ts create mode 100644 types/collectionsjs/tsconfig.json create mode 100644 types/collectionsjs/tslint.json diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts new file mode 100644 index 0000000000..2b7a3d5fb0 --- /dev/null +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -0,0 +1,57 @@ +import Collection from 'collectionsjs'; + +const collectable = [ + { name: 'Arya Stark', age: 9 }, + { name: 'Bran Stark', age: 7 }, + { name: 'Jon Snow', age: 14 } +]; + +const collection = new Collection(collectable); + +const item = { 6: 7 }; + +collection.add(item); +collection.all(); +collection.average('age'); +collection.chunk(2).all(); +collection.collect(collectable); + +const characters = [ + { name: 'Ned Stark', age: 40}, + { name: 'Catelyn Stark', age: 35} +]; + +const array = ['a', 'b', 'c']; + +collection.concat(characters); +collection.contains(stark => stark.name === 'John Snow'); +collection.count(); +collection.each(t => t = 3); +collection.filter(stark => stark.age === 14); +collection.find('bran'); +collection.first(item => item.age > 7); +collection.flatten(true); +collection.get(2); +collection.has({ name: 'Bran Stark', age: 7 }); +collection.join(); +collection.keys(); +collection.last(); +collection.map(stark => stark.name); +collection.pluck('name'); +collection.push({name: 'Robb Stark', age: 17}); +collection.reduce((previous, current) => previous + current, 0); +collection.reject(stark => stark.age < 14); +collection.remove({name: 'Robb Stark', age: 17}); +collection.skip(2); +collection.slice(1, 3); +collection.sort(); +collection.sortBy('name'); +collection.stringify(); +collection.sum('age'); +collection.take(2); +collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); +collection.unique(s => s.grade); +collection.values(); +collection.where('age', 14); +collection.where(stark => stark.age === 14); +collection.zip(array); diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts new file mode 100644 index 0000000000..ca64acaff8 --- /dev/null +++ b/types/collectionsjs/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for collectionsjs 0.3 +// Project: https://github.com/logaretm/collectionsjs#readme +// Definitions by: Jaymeh +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +export default class Collection { + constructor(items?: any); + add(item: any): Collection; + all(): Collection; + average(property?: string | ((property?: number) => number)): number; + chunk(size: number): Collection; + collect(collectable: any[]|string): Collection; + concat(collection: any[]|Collection): Collection; + contains(closure: ((item: any) => boolean)): boolean; + count(): number; + each(callback: (item: any) => void): Collection; + filter(callback: (item: any) => any): Collection; + find(item: any): number; + first(callback?: ((item: any) => any)|null): any; + flatten(deep?: boolean): Collection; + get(index: number): any; + has(item: any): boolean; + join(separator?: string): string; + keys(): Collection; + last(callback?: ((item: any) => any)|null): any; + map(callback: (item: any) => any): Collection; + pluck(property: string): Collection; + push(item: any): Collection; + reduce(callback: (previous: any, current: any) => any, initial: any): any; + reject(callback: (item: any) => any): Collection; + remove(item: any): boolean; + skip(count: number): Collection; + slice(start: number, end?: number): Collection; + sort(compare?: () => any): Collection; + sortBy(property: string, order?: string): Collection; + stringify(): string; + sum(property?: string|null): any; + take(count: number): Collection; + macro(name: string, callback: (...args: any) => any): any; + unique(callback?: string|null|((item: any) => any)): Collection; + values(): Collection; + where(callback: ((item: any) => any)|string, value?: any): Collection; + zip(array: any[]|Collection): Collection; +} diff --git a/types/collectionsjs/tsconfig.json b/types/collectionsjs/tsconfig.json new file mode 100644 index 0000000000..6ec4a9edc3 --- /dev/null +++ b/types/collectionsjs/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "collectionsjs-tests.ts" + ] +} diff --git a/types/collectionsjs/tslint.json b/types/collectionsjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/collectionsjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b37b33f17c898dce5d01fd4d9628d82e67df4352 Mon Sep 17 00:00:00 2001 From: helloworld111gh Date: Mon, 4 Mar 2019 08:56:50 -0800 Subject: [PATCH 117/265] fix version for lolex --- types/lolex/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 35c4880a5b..3f7031f266 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lolex 3 +// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman // Josh Goldberg From 31e96442b240412208a07ad4fdba3444fa750736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Holhjem?= Date: Mon, 4 Mar 2019 18:00:01 +0100 Subject: [PATCH 118/265] Added allowNew function From documentation: https://github.com/ericgio/react-bootstrap-typeahead/blob/master/docs/Props.md --- types/react-bootstrap-typeahead/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 93fa2c9c6a..18311bccb5 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -126,7 +126,7 @@ export interface TypeaheadProps { but not the list of original options unless handled as such by Typeahead's parent. The newly added item will always be returned as an object even if the other options are simply strings, so be sure your onChange callback can handle this. */ - allowNew?: boolean; + allowNew?: boolean | ((results: T[], props: TypeaheadProps) => boolean); /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; From 2761cb1b444ba0550f31d16e857e77fc60bfab20 Mon Sep 17 00:00:00 2001 From: helloworld111gh Date: Mon, 4 Mar 2019 08:56:50 -0800 Subject: [PATCH 119/265] fix version for lolex --- types/lolex/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 35c4880a5b..3f7031f266 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lolex 3 +// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman // Josh Goldberg From b6c52a90ddbf5e08a7d3c47cf0cdf4cbf4947489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjell=20Die=C3=9Fel?= Date: Mon, 4 Mar 2019 18:07:57 +0100 Subject: [PATCH 120/265] Update jsonwebtoken index.d.ts --- types/jsonwebtoken/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index d1c3aeee5f..71a098cb8f 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -17,9 +17,9 @@ export class JsonWebTokenError extends Error { } export class TokenExpiredError extends JsonWebTokenError { - expiredAt: number; + expiredAt: Date; - constructor(message: string, expiredAt: number); + constructor(message: string, expiredAt: Date); } export class NotBeforeError extends JsonWebTokenError { From 6f9e0fddedb7ec27aa6885cd382a8f7bdeb18c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjell=20Die=C3=9Fel?= Date: Mon, 4 Mar 2019 18:15:30 +0100 Subject: [PATCH 121/265] Update jsonwebtoken index.d.ts --- types/jsonwebtoken/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index 71a098cb8f..079fd254dd 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -4,7 +4,8 @@ // Daniel Heim , // Brice BERNARD , // Veli-Pekka Kestilä , -// Daniel Parker +// Daniel Parker , +// Kjell Dießel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 91ad301fb00a5ed1da136b4f129ee1b57a9858df Mon Sep 17 00:00:00 2001 From: helloworld111gh Date: Mon, 4 Mar 2019 09:54:14 -0800 Subject: [PATCH 122/265] update lolex to 3.1 --- types/lolex/index.d.ts | 18 +++++++++++++++++- types/lolex/lolex-tests.ts | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 3f7031f266..052c9c45dc 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -9,7 +9,7 @@ /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). @@ -126,6 +126,22 @@ export interface LolexClock extends GlobalTimers void; + /** + * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. + * + * @param callback Callback to be fired. + * @param timeout The maximum number of ticks before the callback must be fired. + * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. + */ + requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; + + /** + * Clears a timer, as long as it was created using requestIdleCallback. + * + * @param id Timer ID or object. + */ + cancelIdleCallback: (id: TTimerId) => void; + /** * Get the number of waiting timers. * diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 2a01dd5916..d09cfcc042 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -59,10 +59,14 @@ const browserTimeout: number = browserClock.setTimeout(() => {}, 7); const browserInterval: number = browserClock.setInterval(() => {}, 7); const browserImmediate: number = browserClock.setImmediate(() => {}); const browserAnimationFrame: number = browserClock.requestAnimationFrame(() => {}); +const browserIdleCallback: number = browserClock.requestIdleCallback(() => {}); +const browserIdleCallbackWithTimeout: number = browserClock.requestIdleCallback(() => {}, 7); const nodeTimeout: lolex.NodeTimer = nodeClock.setTimeout(() => {}, 7); const nodeInterval: lolex.NodeTimer = nodeClock.setInterval(() => {}, 7); const nodeImmediate: lolex.NodeTimer = nodeClock.setImmediate(() => {}); const nodeAnimationFrame: lolex.NodeTimer = nodeClock.requestAnimationFrame(() => {}); +const nodeIdleCallback: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}); +const nodeIdleCallbackWithTimeout: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}, 7); nodeTimeout.ref(); nodeTimeout.unref(); @@ -71,11 +75,15 @@ browserClock.clearTimeout(browserTimeout); browserClock.clearInterval(browserInterval); browserClock.clearImmediate(browserImmediate); browserClock.cancelAnimationFrame(browserAnimationFrame); +browserClock.cancelIdleCallback(browserIdleCallback); +browserClock.cancelIdleCallback(browserIdleCallbackWithTimeout); nodeClock.clearTimeout(nodeTimeout); nodeClock.clearInterval(nodeInterval); nodeClock.clearImmediate(nodeImmediate); nodeClock.cancelAnimationFrame(nodeAnimationFrame); +nodeClock.cancelIdleCallback(nodeIdleCallback); +nodeClock.cancelIdleCallback(nodeIdleCallbackWithTimeout); browserClock.tick(7); browserClock.tick("08"); From ecef3eeb3e698404be0a256d0c754fcd7f8b3cf9 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 4 Mar 2019 20:46:43 +0000 Subject: [PATCH 123/265] Adds missing reverse function. --- types/collectionsjs/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts index ca64acaff8..9252953ea3 100644 --- a/types/collectionsjs/index.d.ts +++ b/types/collectionsjs/index.d.ts @@ -30,6 +30,7 @@ export default class Collection { reduce(callback: (previous: any, current: any) => any, initial: any): any; reject(callback: (item: any) => any): Collection; remove(item: any): boolean; + reverse(): Collection; skip(count: number): Collection; slice(start: number, end?: number): Collection; sort(compare?: () => any): Collection; From 07de538eef13e1df3baeff9e752afb978addd13f Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 4 Mar 2019 20:47:04 +0000 Subject: [PATCH 124/265] Adds $ExpectsType to each of the tests. --- types/collectionsjs/collectionsjs-tests.ts | 84 +++++++++++----------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index 2b7a3d5fb0..b415502d67 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -6,52 +6,52 @@ const collectable = [ { name: 'Jon Snow', age: 14 } ]; -const collection = new Collection(collectable); - -const item = { 6: 7 }; - -collection.add(item); -collection.all(); -collection.average('age'); -collection.chunk(2).all(); -collection.collect(collectable); - const characters = [ { name: 'Ned Stark', age: 40}, { name: 'Catelyn Stark', age: 35} ]; +const item = { 6: 7 }; + const array = ['a', 'b', 'c']; -collection.concat(characters); -collection.contains(stark => stark.name === 'John Snow'); -collection.count(); -collection.each(t => t = 3); -collection.filter(stark => stark.age === 14); -collection.find('bran'); -collection.first(item => item.age > 7); -collection.flatten(true); -collection.get(2); -collection.has({ name: 'Bran Stark', age: 7 }); -collection.join(); -collection.keys(); -collection.last(); -collection.map(stark => stark.name); -collection.pluck('name'); -collection.push({name: 'Robb Stark', age: 17}); -collection.reduce((previous, current) => previous + current, 0); -collection.reject(stark => stark.age < 14); -collection.remove({name: 'Robb Stark', age: 17}); -collection.skip(2); -collection.slice(1, 3); -collection.sort(); -collection.sortBy('name'); -collection.stringify(); -collection.sum('age'); -collection.take(2); -collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); -collection.unique(s => s.grade); -collection.values(); -collection.where('age', 14); -collection.where(stark => stark.age === 14); -collection.zip(array); +const collection = new Collection(collectable); // $ExpectType Collection + +collection.add(item); // $ExpectType Collection +collection.all(); // $ExpectType Collection +collection.average('age'); // $ExpectType number +collection.chunk(2).all(); // $ExpectType Collection +collection.collect(collectable); // $ExpectType Collection +collection.concat(characters); // $ExpectType Collection +collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean +collection.count(); // $ExpectType number +collection.each(t => t = 3); // $ExpectType Collection +collection.filter(stark => stark.age === 14); // $ExpectType Collection +collection.find('bran'); // $ExpectType number +collection.first(item => item.age > 7); // $ExpectType any +collection.flatten(true); // $ExpectType Collection +collection.get(2); // $ExpectType any +collection.has({ name: 'Bran Stark', age: 7 }); // $ExpectType boolean +collection.join(); // $ExpectType string +collection.keys(); // $ExpectType Collection +collection.last(); // $ExpectType any +collection.map(stark => stark.name); // $ExpectType Collection +collection.pluck('name'); // $ExpectType Collection +collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection +collection.reduce((previous, current) => previous + current, 0); // $ExpectType any +collection.reject(stark => stark.age < 14); // $ExpectType Collection +collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean +collection.reverse(); // $ExpectType Collection +collection.skip(2); // $ExpectType Collection +collection.slice(1, 3); // $ExpectType Collection +collection.sort(); // $ExpectType Collection +collection.sortBy('name'); // $ExpectType Collection +collection.stringify(); // $ExpectType string +collection.sum('age'); // $ExpectType any +collection.take(2); // $ExpectType Collection +collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); // $ExpectType any +collection.unique(s => s.grade); // $ExpectType Collection +collection.values(); // $ExpectType Collection +collection.where('age', 14); // $ExpectType Collection +collection.where(stark => stark.age === 14); // $ExpectType Collection +collection.zip(array); // $ExpectType Collection From af9058995f6df0e81288249277d69f879360946e Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Mon, 4 Mar 2019 23:00:00 +0100 Subject: [PATCH 125/265] =?UTF-8?q?chore(tape=E2=80=91async):=20Require=20?= =?UTF-8?q?TypeScript=C2=A02.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> --- types/tape-async/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts index d5b07f37b7..be104ec2b4 100644 --- a/types/tape-async/index.d.ts +++ b/types/tape-async/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/parro-it/tape-async // Definitions by: ExE Boss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// From 56bcf7fd2418407623b3e95e8320779340bff866 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 4 Mar 2019 22:01:49 +0000 Subject: [PATCH 126/265] Make use of Generic's and ensure tests are up to date. --- types/collectionsjs/collectionsjs-tests.ts | 65 +++++++++++----------- types/collectionsjs/index.d.ts | 62 ++++++++++----------- 2 files changed, 65 insertions(+), 62 deletions(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index b415502d67..1c3b8a5813 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -11,47 +11,50 @@ const characters = [ { name: 'Catelyn Stark', age: 35} ]; -const item = { 6: 7 }; +const item = { name: 'Sansa Stark', age: 13 }; -const array = ['a', 'b', 'c']; +const array = [ + { name: 'Robert Baratheon', age: 40 }, + { name: 'Joffrey Baratheon', age: 13 } +]; -const collection = new Collection(collectable); // $ExpectType Collection +const collection = new Collection(collectable); // $ExpectType Collection<{ name: string; age: number; }> -collection.add(item); // $ExpectType Collection -collection.all(); // $ExpectType Collection +collection.add(item); // $ExpectType Collection<{ name: string; age: number; }> +collection.all(); // $ExpectType Collection<{ name: string; age: number; }> collection.average('age'); // $ExpectType number -collection.chunk(2).all(); // $ExpectType Collection -collection.collect(collectable); // $ExpectType Collection -collection.concat(characters); // $ExpectType Collection +collection.chunk(2).all(); // $ExpectType Collection<{ name: string; age: number; }> +collection.collect(collectable); // $ExpectType Collection<{ name: string; age: number; }> +collection.concat(characters); // $ExpectType Collection<{ name: string; age: number; }> collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean collection.count(); // $ExpectType number -collection.each(t => t = 3); // $ExpectType Collection -collection.filter(stark => stark.age === 14); // $ExpectType Collection +collection.each(stark => stark.age = 3); // $ExpectType Collection<{ name: string; age: number; }> +collection.filter(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> collection.find('bran'); // $ExpectType number -collection.first(item => item.age > 7); // $ExpectType any -collection.flatten(true); // $ExpectType Collection -collection.get(2); // $ExpectType any +collection.first(item => item.age > 7); // $ExpectType { name: string; age: number; } +collection.flatten(true); // $ExpectType Collection<{ name: string; age: number; }> +collection.get(2); // $ExpectType { name: string; age: number; } collection.has({ name: 'Bran Stark', age: 7 }); // $ExpectType boolean collection.join(); // $ExpectType string -collection.keys(); // $ExpectType Collection -collection.last(); // $ExpectType any -collection.map(stark => stark.name); // $ExpectType Collection -collection.pluck('name'); // $ExpectType Collection -collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection -collection.reduce((previous, current) => previous + current, 0); // $ExpectType any -collection.reject(stark => stark.age < 14); // $ExpectType Collection +collection.keys(); // $ExpectType Collection<{ name: string; age: number; }> +collection.last(); // $ExpectType { name: string; age: number; } +collection.map(stark => stark.name); // $ExpectType Collection<{ name: string; age: number; }> +collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }> +collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }> +collection.reduce((previous, current) => previous.age + current.age, 0); // $ExpectType any +collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }> collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean -collection.reverse(); // $ExpectType Collection -collection.skip(2); // $ExpectType Collection -collection.slice(1, 3); // $ExpectType Collection -collection.sort(); // $ExpectType Collection -collection.sortBy('name'); // $ExpectType Collection +collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }> +collection.skip(2); // $ExpectType Collection<{ name: string; age: number; }> +collection.slice(1, 3); // $ExpectType Collection<{ name: string; age: number; }> +collection.sort(); // $ExpectType Collection<{ name: string; age: number; }> +collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number; }> collection.stringify(); // $ExpectType string collection.sum('age'); // $ExpectType any -collection.take(2); // $ExpectType Collection +collection.take(2); // $ExpectType Collection<{ name: string; age: number; }> collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); // $ExpectType any -collection.unique(s => s.grade); // $ExpectType Collection -collection.values(); // $ExpectType Collection -collection.where('age', 14); // $ExpectType Collection -collection.where(stark => stark.age === 14); // $ExpectType Collection -collection.zip(array); // $ExpectType Collection +collection.unique(stark => stark.age); // $ExpectType Collection<{ name: string; age: number; }> +collection.values(); // $ExpectType Collection<{ name: string; age: number; }> +collection.where('age', 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.where(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.zip(array); // $ExpectType Collection<{ name: string; age: number; }> diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts index 9252953ea3..40c616fcdb 100644 --- a/types/collectionsjs/index.d.ts +++ b/types/collectionsjs/index.d.ts @@ -4,43 +4,43 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.1 -export default class Collection { - constructor(items?: any); - add(item: any): Collection; - all(): Collection; +export default class Collection { + constructor(items?: T[]); + add(item: T): Collection; + all(): Collection; average(property?: string | ((property?: number) => number)): number; - chunk(size: number): Collection; - collect(collectable: any[]|string): Collection; - concat(collection: any[]|Collection): Collection; - contains(closure: ((item: any) => boolean)): boolean; + chunk(size: number): Collection; + collect(collectable: T[]): Collection; + concat(collection: T[]|Collection): Collection; + contains(closure: ((item: T) => boolean)): boolean; count(): number; - each(callback: (item: any) => void): Collection; - filter(callback: (item: any) => any): Collection; + each(callback: (item: T) => void): Collection; + filter(callback: (item: T) => boolean): Collection; find(item: any): number; - first(callback?: ((item: any) => any)|null): any; - flatten(deep?: boolean): Collection; - get(index: number): any; - has(item: any): boolean; + first(callback?: ((item: T) => boolean)|null): T; + flatten(deep?: boolean): Collection; + get(index: number): T; + has(item: T): boolean; join(separator?: string): string; - keys(): Collection; - last(callback?: ((item: any) => any)|null): any; - map(callback: (item: any) => any): Collection; - pluck(property: string): Collection; - push(item: any): Collection; - reduce(callback: (previous: any, current: any) => any, initial: any): any; - reject(callback: (item: any) => any): Collection; + keys(): Collection; + last(callback?: ((item: T) => boolean)|null): T; + map(callback: (item: T) => any): Collection; + pluck(property: string): Collection; + push(item: T): Collection; + reduce(callback: (previous: T, current: T) => any, initial: any): any; + reject(callback: (item: T) => boolean): Collection; remove(item: any): boolean; - reverse(): Collection; - skip(count: number): Collection; - slice(start: number, end?: number): Collection; - sort(compare?: () => any): Collection; - sortBy(property: string, order?: string): Collection; + reverse(): Collection; + skip(count: number): Collection; + slice(start: number, end?: number): Collection; + sort(compare?: () => boolean): Collection; + sortBy(property: string, order?: string): Collection; stringify(): string; sum(property?: string|null): any; - take(count: number): Collection; + take(count: number): Collection; macro(name: string, callback: (...args: any) => any): any; - unique(callback?: string|null|((item: any) => any)): Collection; - values(): Collection; - where(callback: ((item: any) => any)|string, value?: any): Collection; - zip(array: any[]|Collection): Collection; + unique(callback?: string|null|((item: T) => any)): Collection; + values(): Collection; + where(callback: ((item: T) => boolean)|string, value?: any): Collection; + zip(array: T[]|Collection): Collection; } From bb1d194eaec37289f4474bb25cab14a3a8c79b92 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Fri, 2 Nov 2018 12:16:46 -0700 Subject: [PATCH 127/265] add typings for cassanknex --- types/cassanknex/cassanknex-tests.ts | 74 ++++++++++ types/cassanknex/index.d.ts | 204 +++++++++++++++++++++++++++ types/cassanknex/tsconfig.json | 24 ++++ types/cassanknex/tslint.json | 14 ++ 4 files changed, 316 insertions(+) create mode 100644 types/cassanknex/cassanknex-tests.ts create mode 100644 types/cassanknex/index.d.ts create mode 100644 types/cassanknex/tsconfig.json create mode 100644 types/cassanknex/tslint.json diff --git a/types/cassanknex/cassanknex-tests.ts b/types/cassanknex/cassanknex-tests.ts new file mode 100644 index 0000000000..45e4ba3261 --- /dev/null +++ b/types/cassanknex/cassanknex-tests.ts @@ -0,0 +1,74 @@ +import * as cassanknex from "cassanknex"; + +const knex = cassanknex({ + connection: { + contactPoints: ['127.0.0.1'] + } +}); + +knex.on('ready', (err) => { +}); + +interface BirdRow { + type: string; + canFly: boolean; +} + +const qb = knex("animals") + .insert({ + type: 'Stork', + canFly: true + }) + .into('birds'); + +qb.exec((err, res) => { +}); + +qb.eachRow((n, row) => { +}, (err) => { +}); + +interface FooRow { + id: string; + foo: string; + bar: number; + baz: string[]; +} + +const query2 = knex("keyspace") + .select("id", "foo", "bar", "baz") + .ttl('foo') + .where("id", "=", "1") + .orWhere("id", "in", ["2", "3"]) + .orWhere("baz", "=", ["bar"]) + .andWhere("foo", "IN", ["baz", "bar"]) + .limit(10) + .from("table"); + +query2.stream({ + readable () { + const row = this.read(); + }, + end () {}, + error () {} +}); + +const values = { + id: "foo", + bar: 13, + baz: ["foo", "bar"] +}; + +const query3 = knex("cassanKnexy") + .insert(values) + .usingTimestamp(250000) + .usingTTL(50000) + .into("columnFamily"); + +const [cql, params] = [query3.cql(), query3.bindings()]; + +const query4 = knex("cassanKnexy") + .update("columnFamily") + .add("bar", { foo: "baz" }) // "bar" is a map + .remove("foo", ["bar"]) // "foo" is a set + .where("id", "=", 1); diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts new file mode 100644 index 0000000000..5f5dc72b8c --- /dev/null +++ b/types/cassanknex/index.d.ts @@ -0,0 +1,204 @@ +// Type definitions for cassanknex 1.19 +// Project: https://github.com/azuqua/cassanknex +// Definitions by: Daniel Chao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +import { EventEmitter } from "events"; +import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver"; +import * as Long from "long"; +import { Readable } from "stream"; + +declare function CassanKnex (options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex; + +export = CassanKnex; + +/** + * Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`. + */ +type TypeMatchedValue = T[K] extends Type ? This : never; + +type MappedDict = { + [key: string]: B +}; + +type InRestriction = 'in' | 'IN'; + +type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>='; + +declare namespace CassanKnex { + interface DriverOptions { + debug?: boolean; + connection?: Client | ClientOptions; + } + + interface CassanKnex extends EventEmitter { + (keyspace?: string): QueryBuilderRoot; + } + + type SelectAsClause = { + [P in keyof T]: string; + }; + + interface StreamParams { + readable: (this: Readable) => any; + end: (this: Readable) => any; + error: (err: Error) => any; + } + + interface QueryBuilderRoot { + insert (values: Partial | T): InsertQueryBuilder; + select (...columns: Array): SelectQueryBuilder; + select (values: SelectAsClause): SelectQueryBuilder; + update (table: string): UpdateQueryBuilder; + delete (): DeleteQueryBuilder; + alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; + createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; + createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; + createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; + createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; + createType (typeName: string): CreateTypeQueryBuilder; + createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; + dropColumnFamily (columnFamily: string): QueryBuilder; + dropColumnFamilyIfExists (columnFamily: string): QueryBuilder; + dropType (): QueryBuilder; + dropTypeIfExists (): QueryBuilder; + truncate (columnFamily: string): QueryBuilder; + alterKeyspace (keyspace: string): KeyspaceQueryBuilder; + createKeyspace (keyspace: string): KeyspaceQueryBuilder; + createKeyspaceIfNotExists (keyspace: string): KeyspaceQueryBuilder; + dropKeyspace (): QueryBuilder; + dropKeyspaceIfExists (): QueryBuilder; + } + + interface QueryBuilder { + cql (): string; + bindings (): any[]; + exec (cb: ResultCallback): undefined; + eachRow (onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined; + stream (params: StreamParams): undefined; + } + + interface FieldValueQueryBuilder { + decimal (columnName: K): TypeMatchedValue; + boolean (columnName: K): TypeMatchedValue; + blob (columnName: K): TypeMatchedValue; + timestamp (columnName: K): TypeMatchedValue; + date (columnName: K): TypeMatchedValue; + inet (columnName: K): TypeMatchedValue; + bigint (columnName: K): TypeMatchedValue; + counter (columnName: K): TypeMatchedValue; + double (columnName: K): TypeMatchedValue; + int (columnName: K): TypeMatchedValue; + float (columnName: K): TypeMatchedValue; + map (columnName: K, a: A, b: B): TypeMatchedValue, this>; + ascii (columnName: K): TypeMatchedValue; + text (columnName: K): TypeMatchedValue; + timeuuid (columnName: K): TypeMatchedValue; + uuid (columnName: K): TypeMatchedValue; + varchar (columnName: K): TypeMatchedValue; + list (columnName: K, typeName: string): TypeMatchedValue; + primary (primaryKey: string): this; + set (columnName: K, a: A): TypeMatchedValue, this>; + } + + interface CreateableColumnFamilyBuilder { + withCaching (): this; + withCompression (): this; + withCompaction (): this; + withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; + } + + interface CreateableIndexBuilder { + withOptions (opts: MappedDict): this; + } + + interface KeyspaceableQueryBuilder { + withNetworkTopologyStrategy (strategy: MappedDict): this; + withSimpleStrategy (replicas: number): this; + withDurableWrites (durableWrites: boolean): this; + } + + interface InsertableQueryBuilder { + into (table: string): this; + ifNotExists (): this; + } + + interface TtlableQueryBuilder { + usingTimestamp (timestamp: number): this; + usingTTL (ttl: number): this; + } + + interface WhereableQueryBuilder { + where (lhs: K, comparison: InRestriction, rhs: Array): this; + where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + ttl (columnName: K): this; + } + + interface IfableQueryBuilder { + if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; + } + + interface LimitableQueryBuilder { + limit (limit: number): this; + limitPerPartition (limit: number): this; + } + + interface FromableQueryBuilder { + from (table: string): this; + } + + interface UpdateableQueryBuilder { + set (key: K, value: T[K]): this; + set (object: Partial): this; + add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; + add (key: K, value: Array): TypeMatchedValue, this>; + add (object: Partial): this; + remove (key: K, value: Array): this; + remove (object: Partial): this; + increment (column: keyof T, amount: number): this; + increment (object: Partial): this; + decrement (column: keyof T, amount: number): this; + decrement (object: Partial): this; + } + + interface AlterableQueryBuilder { + drop (...columns: K[]): this; + rename (column: K, newColumn: K): this; + alter (column: K, newType: string): this; + } + + type InsertQueryBuilder = QueryBuilder + & InsertableQueryBuilder + & TtlableQueryBuilder; + type SelectQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & LimitableQueryBuilder + & FromableQueryBuilder; + type UpdateQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & UpdateableQueryBuilder + & IfableQueryBuilder + & TtlableQueryBuilder; + type DeleteQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & FromableQueryBuilder; + type CreateColumnFamilyQueryBuilder = QueryBuilder + & FieldValueQueryBuilder + & CreateableColumnFamilyBuilder; + type KeyspaceQueryBuilder = QueryBuilder + & KeyspaceableQueryBuilder; + type CreateTypeQueryBuilder = QueryBuilder + & FieldValueQueryBuilder; + type AlterColumnFamilyQueryBuilder = QueryBuilder + & AlterableQueryBuilder + & FieldValueQueryBuilder; +} diff --git a/types/cassanknex/tsconfig.json b/types/cassanknex/tsconfig.json new file mode 100644 index 0000000000..d77cbaca70 --- /dev/null +++ b/types/cassanknex/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cassanknex-tests.ts" + ] +} \ No newline at end of file diff --git a/types/cassanknex/tslint.json b/types/cassanknex/tslint.json new file mode 100644 index 0000000000..8bd9293b77 --- /dev/null +++ b/types/cassanknex/tslint.json @@ -0,0 +1,14 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "space-before-function-paren": [true, "always"], + "no-unnecessary-generics": false, + "strict-export-declare-modifiers": false, + "prefer-readonly": false, + "await-promise": false, + "no-for-in-array": false, + "no-void-expression": false, + "expect": false, + "no-declare-current-package": false + } +} \ No newline at end of file From b2d972b0ae8649d0651d8128f935f3de09452bec Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Fri, 2 Nov 2018 13:57:08 -0700 Subject: [PATCH 128/265] expect: true --- types/cassanknex/tslint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cassanknex/tslint.json b/types/cassanknex/tslint.json index 8bd9293b77..978a6cf2fc 100644 --- a/types/cassanknex/tslint.json +++ b/types/cassanknex/tslint.json @@ -8,7 +8,7 @@ "await-promise": false, "no-for-in-array": false, "no-void-expression": false, - "expect": false, + "expect": true, "no-declare-current-package": false } } \ No newline at end of file From 08544665c8862d3637605b9390dca5b2bc583187 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Fri, 2 Nov 2018 13:58:44 -0700 Subject: [PATCH 129/265] fix linting errors --- types/cassanknex/index.d.ts | 102 ++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts index 5f5dc72b8c..0de4ac8ebc 100644 --- a/types/cassanknex/index.d.ts +++ b/types/cassanknex/index.d.ts @@ -20,9 +20,9 @@ export = CassanKnex; */ type TypeMatchedValue = T[K] extends Type ? This : never; -type MappedDict = { +interface MappedDict { [key: string]: B -}; +} type InRestriction = 'in' | 'IN'; @@ -49,18 +49,18 @@ declare namespace CassanKnex { } interface QueryBuilderRoot { - insert (values: Partial | T): InsertQueryBuilder; - select (...columns: Array): SelectQueryBuilder; - select (values: SelectAsClause): SelectQueryBuilder; - update (table: string): UpdateQueryBuilder; - delete (): DeleteQueryBuilder; - alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; - createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; - createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; - createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; - createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; - createType (typeName: string): CreateTypeQueryBuilder; - createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; + insert (values: Partial | T): InsertQueryBuilder; + select (...columns: Array): SelectQueryBuilder; + select (values: SelectAsClause): SelectQueryBuilder; + update (table: string): UpdateQueryBuilder; + delete (): DeleteQueryBuilder; + alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; + createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; + createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; + createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; + createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; + createType (typeName: string): CreateTypeQueryBuilder; + createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; dropColumnFamily (columnFamily: string): QueryBuilder; dropColumnFamilyIfExists (columnFamily: string): QueryBuilder; dropType (): QueryBuilder; @@ -82,33 +82,33 @@ declare namespace CassanKnex { } interface FieldValueQueryBuilder { - decimal (columnName: K): TypeMatchedValue; - boolean (columnName: K): TypeMatchedValue; - blob (columnName: K): TypeMatchedValue; - timestamp (columnName: K): TypeMatchedValue; - date (columnName: K): TypeMatchedValue; - inet (columnName: K): TypeMatchedValue; - bigint (columnName: K): TypeMatchedValue; - counter (columnName: K): TypeMatchedValue; - double (columnName: K): TypeMatchedValue; - int (columnName: K): TypeMatchedValue; - float (columnName: K): TypeMatchedValue; - map (columnName: K, a: A, b: B): TypeMatchedValue, this>; - ascii (columnName: K): TypeMatchedValue; - text (columnName: K): TypeMatchedValue; - timeuuid (columnName: K): TypeMatchedValue; - uuid (columnName: K): TypeMatchedValue; - varchar (columnName: K): TypeMatchedValue; - list (columnName: K, typeName: string): TypeMatchedValue; + decimal (columnName: K): TypeMatchedValue; + boolean (columnName: K): TypeMatchedValue; + blob (columnName: K): TypeMatchedValue; + timestamp (columnName: K): TypeMatchedValue; + date (columnName: K): TypeMatchedValue; + inet (columnName: K): TypeMatchedValue; + bigint (columnName: K): TypeMatchedValue; + counter (columnName: K): TypeMatchedValue; + double (columnName: K): TypeMatchedValue; + int (columnName: K): TypeMatchedValue; + float (columnName: K): TypeMatchedValue; + map (columnName: K, a: A, b: B): TypeMatchedValue, this>; + ascii (columnName: K): TypeMatchedValue; + text (columnName: K): TypeMatchedValue; + timeuuid (columnName: K): TypeMatchedValue; + uuid (columnName: K): TypeMatchedValue; + varchar (columnName: K): TypeMatchedValue; + list (columnName: K, typeName: string): TypeMatchedValue; primary (primaryKey: string): this; - set (columnName: K, a: A): TypeMatchedValue, this>; + set (columnName: K, a: A): TypeMatchedValue, this>; } interface CreateableColumnFamilyBuilder { withCaching (): this; withCompression (): this; withCompaction (): this; - withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; + withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; } interface CreateableIndexBuilder { @@ -132,19 +132,19 @@ declare namespace CassanKnex { } interface WhereableQueryBuilder { - where (lhs: K, comparison: InRestriction, rhs: Array): this; - where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; - orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; - andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; - tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - ttl (columnName: K): this; + where (lhs: K, comparison: InRestriction, rhs: Array): this; + where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + ttl (columnName: K): this; } interface IfableQueryBuilder { - if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; + if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; } interface LimitableQueryBuilder { @@ -157,12 +157,12 @@ declare namespace CassanKnex { } interface UpdateableQueryBuilder { - set (key: K, value: T[K]): this; + set (key: K, value: T[K]): this; set (object: Partial): this; - add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; - add (key: K, value: Array): TypeMatchedValue, this>; + add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; + add (key: K, value: Array): TypeMatchedValue, this>; add (object: Partial): this; - remove (key: K, value: Array): this; + remove (key: K, value: Array): this; remove (object: Partial): this; increment (column: keyof T, amount: number): this; increment (object: Partial): this; @@ -171,9 +171,9 @@ declare namespace CassanKnex { } interface AlterableQueryBuilder { - drop (...columns: K[]): this; - rename (column: K, newColumn: K): this; - alter (column: K, newType: string): this; + drop (...columns: K[]): this; + rename (column: K, newColumn: K): this; + alter (column: K, newType: string): this; } type InsertQueryBuilder = QueryBuilder From f681ca576b3cbbe8c7785858f542f415e9191344 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Fri, 2 Nov 2018 14:00:02 -0700 Subject: [PATCH 130/265] semicolon --- types/cassanknex/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts index 0de4ac8ebc..bd85325b4b 100644 --- a/types/cassanknex/index.d.ts +++ b/types/cassanknex/index.d.ts @@ -21,7 +21,7 @@ export = CassanKnex; type TypeMatchedValue = T[K] extends Type ? This : never; interface MappedDict { - [key: string]: B + [key: string]: B; } type InRestriction = 'in' | 'IN'; From 4ee3aa7569fb9a21baaef713529de9328d4658e3 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Fri, 2 Nov 2018 14:43:57 -0700 Subject: [PATCH 131/265] move all type aliases to within the namespace --- types/cassanknex/index.d.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts index bd85325b4b..b9b75e92e6 100644 --- a/types/cassanknex/index.d.ts +++ b/types/cassanknex/index.d.ts @@ -15,33 +15,33 @@ declare function CassanKnex (options?: CassanKnex.DriverOptions): CassanKnex.Cas export = CassanKnex; -/** - * Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`. - */ -type TypeMatchedValue = T[K] extends Type ? This : never; - -interface MappedDict { - [key: string]: B; -} - -type InRestriction = 'in' | 'IN'; - -type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>='; - declare namespace CassanKnex { interface DriverOptions { debug?: boolean; connection?: Client | ClientOptions; } + /** + * Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`. + */ + type TypeMatchedValue = T[K] extends Type ? This : never; + + interface MappedDict { + [key: string]: B; + } + + type InRestriction = 'in' | 'IN'; + + type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>='; + + type SelectAsClause = { + [P in keyof T]: string; + }; + interface CassanKnex extends EventEmitter { (keyspace?: string): QueryBuilderRoot; } - type SelectAsClause = { - [P in keyof T]: string; - }; - interface StreamParams { readable: (this: Readable) => any; end: (this: Readable) => any; From 51f148ad836c791c8b947f86a2d366a1d714dfc4 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Mon, 5 Nov 2018 17:37:33 -0800 Subject: [PATCH 132/265] use import = require syntax per PR feedback --- types/cassanknex/cassanknex-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cassanknex/cassanknex-tests.ts b/types/cassanknex/cassanknex-tests.ts index 45e4ba3261..550fe141aa 100644 --- a/types/cassanknex/cassanknex-tests.ts +++ b/types/cassanknex/cassanknex-tests.ts @@ -1,4 +1,4 @@ -import * as cassanknex from "cassanknex"; +import cassanknex = require('cassanknex'); const knex = cassanknex({ connection: { From 4ec7a6b59bf208fa631398ef5f7cb9924a3740e4 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Sun, 2 Dec 2018 13:04:25 -0800 Subject: [PATCH 133/265] re-emable most dts-lint errors --- types/cassanknex/index.d.ts | 176 +++++++++++++++++------------------ types/cassanknex/tslint.json | 15 +-- 2 files changed, 92 insertions(+), 99 deletions(-) diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts index b9b75e92e6..fd7f9c53f4 100644 --- a/types/cassanknex/index.d.ts +++ b/types/cassanknex/index.d.ts @@ -11,7 +11,7 @@ import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver"; import * as Long from "long"; import { Readable } from "stream"; -declare function CassanKnex (options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex; +declare function CassanKnex(options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex; export = CassanKnex; @@ -49,134 +49,134 @@ declare namespace CassanKnex { } interface QueryBuilderRoot { - insert (values: Partial | T): InsertQueryBuilder; - select (...columns: Array): SelectQueryBuilder; - select (values: SelectAsClause): SelectQueryBuilder; - update (table: string): UpdateQueryBuilder; - delete (): DeleteQueryBuilder; - alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; - createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; - createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; - createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; - createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; - createType (typeName: string): CreateTypeQueryBuilder; - createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; - dropColumnFamily (columnFamily: string): QueryBuilder; - dropColumnFamilyIfExists (columnFamily: string): QueryBuilder; - dropType (): QueryBuilder; - dropTypeIfExists (): QueryBuilder; - truncate (columnFamily: string): QueryBuilder; - alterKeyspace (keyspace: string): KeyspaceQueryBuilder; - createKeyspace (keyspace: string): KeyspaceQueryBuilder; - createKeyspaceIfNotExists (keyspace: string): KeyspaceQueryBuilder; - dropKeyspace (): QueryBuilder; - dropKeyspaceIfExists (): QueryBuilder; + insert (values: Partial | T): InsertQueryBuilder; + select (...columns: Array): SelectQueryBuilder; + select (values: SelectAsClause): SelectQueryBuilder; + update (table: string): UpdateQueryBuilder; + delete (): DeleteQueryBuilder; + alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; + createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; + createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; + createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; + createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; + createType (typeName: string): CreateTypeQueryBuilder; + createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; + dropColumnFamily(columnFamily: string): QueryBuilder; + dropColumnFamilyIfExists(columnFamily: string): QueryBuilder; + dropType(): QueryBuilder; + dropTypeIfExists(): QueryBuilder; + truncate(columnFamily: string): QueryBuilder; + alterKeyspace(keyspace: string): KeyspaceQueryBuilder; + createKeyspace(keyspace: string): KeyspaceQueryBuilder; + createKeyspaceIfNotExists(keyspace: string): KeyspaceQueryBuilder; + dropKeyspace(): QueryBuilder; + dropKeyspaceIfExists(): QueryBuilder; } interface QueryBuilder { - cql (): string; - bindings (): any[]; - exec (cb: ResultCallback): undefined; - eachRow (onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined; - stream (params: StreamParams): undefined; + cql(): string; + bindings(): any[]; + exec(cb: ResultCallback): undefined; + eachRow(onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined; + stream(params: StreamParams): undefined; } interface FieldValueQueryBuilder { - decimal (columnName: K): TypeMatchedValue; - boolean (columnName: K): TypeMatchedValue; - blob (columnName: K): TypeMatchedValue; - timestamp (columnName: K): TypeMatchedValue; - date (columnName: K): TypeMatchedValue; - inet (columnName: K): TypeMatchedValue; - bigint (columnName: K): TypeMatchedValue; - counter (columnName: K): TypeMatchedValue; - double (columnName: K): TypeMatchedValue; - int (columnName: K): TypeMatchedValue; - float (columnName: K): TypeMatchedValue; - map (columnName: K, a: A, b: B): TypeMatchedValue, this>; - ascii (columnName: K): TypeMatchedValue; - text (columnName: K): TypeMatchedValue; - timeuuid (columnName: K): TypeMatchedValue; - uuid (columnName: K): TypeMatchedValue; - varchar (columnName: K): TypeMatchedValue; - list (columnName: K, typeName: string): TypeMatchedValue; - primary (primaryKey: string): this; - set (columnName: K, a: A): TypeMatchedValue, this>; + decimal (columnName: K): TypeMatchedValue; + boolean (columnName: K): TypeMatchedValue; + blob (columnName: K): TypeMatchedValue; + timestamp (columnName: K): TypeMatchedValue; + date (columnName: K): TypeMatchedValue; + inet (columnName: K): TypeMatchedValue; + bigint (columnName: K): TypeMatchedValue; + counter (columnName: K): TypeMatchedValue; + double (columnName: K): TypeMatchedValue; + int (columnName: K): TypeMatchedValue; + float (columnName: K): TypeMatchedValue; + map (columnName: K, a: A, b: B): TypeMatchedValue, this>; + ascii (columnName: K): TypeMatchedValue; + text (columnName: K): TypeMatchedValue; + timeuuid (columnName: K): TypeMatchedValue; + uuid (columnName: K): TypeMatchedValue; + varchar (columnName: K): TypeMatchedValue; + list (columnName: K, typeName: string): TypeMatchedValue; + primary(primaryKey: string): this; + set (columnName: K, a: A): TypeMatchedValue, this>; } interface CreateableColumnFamilyBuilder { - withCaching (): this; - withCompression (): this; - withCompaction (): this; - withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; + withCaching(): this; + withCompression(): this; + withCompaction(): this; + withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; } interface CreateableIndexBuilder { - withOptions (opts: MappedDict): this; + withOptions(opts: MappedDict): this; } interface KeyspaceableQueryBuilder { - withNetworkTopologyStrategy (strategy: MappedDict): this; - withSimpleStrategy (replicas: number): this; - withDurableWrites (durableWrites: boolean): this; + withNetworkTopologyStrategy(strategy: MappedDict): this; + withSimpleStrategy(replicas: number): this; + withDurableWrites(durableWrites: boolean): this; } interface InsertableQueryBuilder { - into (table: string): this; - ifNotExists (): this; + into(table: string): this; + ifNotExists(): this; } interface TtlableQueryBuilder { - usingTimestamp (timestamp: number): this; - usingTTL (ttl: number): this; + usingTimestamp(timestamp: number): this; + usingTTL(ttl: number): this; } interface WhereableQueryBuilder { - where (lhs: K, comparison: InRestriction, rhs: Array): this; - where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; - orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; - andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; - tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; - ttl (columnName: K): this; + where (lhs: K, comparison: InRestriction, rhs: Array): this; + where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + ttl (columnName: K): this; } interface IfableQueryBuilder { - if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; + if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; } interface LimitableQueryBuilder { - limit (limit: number): this; - limitPerPartition (limit: number): this; + limit(limit: number): this; + limitPerPartition(limit: number): this; } interface FromableQueryBuilder { - from (table: string): this; + from(table: string): this; } interface UpdateableQueryBuilder { - set (key: K, value: T[K]): this; - set (object: Partial): this; - add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; - add (key: K, value: Array): TypeMatchedValue, this>; - add (object: Partial): this; - remove (key: K, value: Array): this; - remove (object: Partial): this; - increment (column: keyof T, amount: number): this; - increment (object: Partial): this; - decrement (column: keyof T, amount: number): this; - decrement (object: Partial): this; + set (key: K, value: T[K]): this; + set(object: Partial): this; + add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; + add (key: K, value: Array): TypeMatchedValue, this>; + add(object: Partial): this; + remove (key: K, value: Array): this; + remove(object: Partial): this; + increment(column: keyof T, amount: number): this; + increment(object: Partial): this; + decrement(column: keyof T, amount: number): this; + decrement(object: Partial): this; } interface AlterableQueryBuilder { - drop (...columns: K[]): this; - rename (column: K, newColumn: K): this; - alter (column: K, newType: string): this; + drop (...columns: K[]): this; + rename (column: K, newColumn: K): this; + alter (column: K, newType: string): this; } - type InsertQueryBuilder = QueryBuilder + type InsertQueryBuilder = QueryBuilder & InsertableQueryBuilder & TtlableQueryBuilder; type SelectQueryBuilder = QueryBuilder diff --git a/types/cassanknex/tslint.json b/types/cassanknex/tslint.json index 978a6cf2fc..4074d3cece 100644 --- a/types/cassanknex/tslint.json +++ b/types/cassanknex/tslint.json @@ -1,14 +1,7 @@ { "extends": "dtslint/dt.json", - "rules": { - "space-before-function-paren": [true, "always"], - "no-unnecessary-generics": false, - "strict-export-declare-modifiers": false, - "prefer-readonly": false, - "await-promise": false, - "no-for-in-array": false, - "no-void-expression": false, - "expect": true, - "no-declare-current-package": false - } + "rules": { + "no-unnecessary-generics": false, + "strict-export-declare-modifiers": false + } } \ No newline at end of file From 9a5fd17efc249b0085813aad11c5589e03425ab9 Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Sun, 2 Dec 2018 13:10:33 -0800 Subject: [PATCH 134/265] fix more linting errors --- types/cassanknex/cassanknex-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/cassanknex/cassanknex-tests.ts b/types/cassanknex/cassanknex-tests.ts index 550fe141aa..b874d2a784 100644 --- a/types/cassanknex/cassanknex-tests.ts +++ b/types/cassanknex/cassanknex-tests.ts @@ -46,11 +46,11 @@ const query2 = knex("keyspace") .from("table"); query2.stream({ - readable () { + readable() { const row = this.read(); }, - end () {}, - error () {} + end() {}, + error() {} }); const values = { From 0edcd42252db8dd2350a5d73351e503f61d3ebcd Mon Sep 17 00:00:00 2001 From: taoqf Date: Tue, 5 Mar 2019 10:15:47 +0800 Subject: [PATCH 135/265] fix: tslint --- types/dv/dv-tests.ts | 10 +- types/dv/index.d.ts | 219 ++++++++++++++++++++++++------------------- types/dv/tslint.json | 7 +- 3 files changed, 136 insertions(+), 100 deletions(-) diff --git a/types/dv/dv-tests.ts b/types/dv/dv-tests.ts index f49a7ef683..4dd9f0e88e 100644 --- a/types/dv/dv-tests.ts +++ b/types/dv/dv-tests.ts @@ -10,9 +10,9 @@ const open = barcodes.thin('bg', 8, 5).dilate(3, 3); const openMap = open.distanceFunction(8); const openMask = openMap.threshold(10).erode(22, 22); const boxes = openMask.invert().connectedComponents(8); -for (const i in boxes) { +boxes.forEach((box) => { const boxImage = barcodes.crop( - boxes[i].x, boxes[i].y, - boxes[i].width, boxes[i].height); - // Do something useful with our image. -} + // Do something useful with our image. + box.x, box.y, + box.width, box.height); +}); diff --git a/types/dv/index.d.ts b/types/dv/index.d.ts index 6aec428e5e..5a0447966a 100644 --- a/types/dv/index.d.ts +++ b/types/dv/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/creatale/node-dv // Definitions by: taoqf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// @@ -23,7 +24,6 @@ export interface Segment { error: number; } - export interface Skew { angle: number; confidence: number; @@ -55,242 +55,268 @@ export class Image { constructor(type: 'png' | 'jpg', buffer: Buffer); constructor(type: 'rgba' | 'rgb' | 'gray', buffer: Buffer, width: number, height: number); - public readonly width: number; - public readonly height: number; + readonly width: number; + readonly height: number; /** * The depth of the image in bits per pixel, i.e. one of 32 (color), 8 (grayscale) or 1 (monochrome). */ - public readonly depth: number; + readonly depth: number; /** * Returns the (boolean) inverse of this image. */ - public invert(): Image; + invert(): Image; /** * Returns the (boolean) union of two images with equal depth, aligning them to the upper left corner. */ - public or(otherImage: Image): Image; + or(otherImage: Image): Image; /** * Returns the (boolean) difference of two images with equal depth, aligning them to the upper left corner. */ - public and(otherImage: Image): Image; + and(otherImage: Image): Image; /** * Returns the (boolean) exclusive disjunction of two images with equal depth, aligning them to the upper left corner. */ - public xor(otherImage: Image): Image; + xor(otherImage: Image): Image; /** * If the images are monochrome, dispatches to Leptonica's pixOr. Otherwise, returns the channelwise addition of b to a, clipped at 255. */ - public add(otherImage: Image): Image; - /** If the images are monochrome, dispatches to Leptonica's pixSubtract and is equivalent to a.and(b.invert()). For grayscale images, returns the pixelwise subtraction of b from a, clipped at zero. For color, the entire RGB value is subtracted instead of doing channelwise subtraction (ask Leptonica why). + add(otherImage: Image): Image; + + /** + * If the images are monochrome, dispatches to Leptonica's pixSubtract and is equivalent to a.and(b.invert()). + * For grayscale images, returns the pixelwise subtraction of b from a, clipped at zero. + * For color, the entire RGB value is subtracted instead of doing channelwise subtraction (ask Leptonica why). * @example: * redness = colorImage.toGray(1, 0, 0).subtract(colorImage.toGray(0, 0.5, 0.5)) */ - public subtract(otherImage: Image): Image; + subtract(otherImage: Image): Image; /** * Applies a convoltuion kernel with the specified dimensions. Image convolution is an operation where each destination pixel is computed based on a weighted sum of a set of nearby source pixels. */ - public convolve(halfWidth: number, halfHeight: number): Image; + convolve(halfWidth: number, halfHeight: number): Image; /** - * Unsharp Masking creates an unsharp mask using halfWidth. The fraction determines how much of the edge is added back into image. The resulting image appears clearer, but it is generally less accurate. + * Unsharp Masking creates an unsharp mask using halfWidth. + * The fraction determines how much of the edge is added back into image. + * The resulting image appears clearer, but it is generally less accurate. */ - public unsharp(halfWidth: number, fraction: number): Image; + unsharp(halfWidth: number, fraction: number): Image; /** * Rotates the image around its center by the specified angle in degrees. */ - public rotate(angle: number): Image; + rotate(angle: number): Image; /** * Scales an image proportionally by scale (1.0 = 100%). */ - public scale(scale: number): Image; + scale(scale: number): Image; /** * Scales an image by scaleX and scaleY (1.0 = 100%). */ - public scale(scaleX: number, scaleY: number): Image; + scale(scaleX: number, scaleY: number): Image; /** * Crops an image from this image by the specified rectangle and returns the resulting image. */ - public crop(box: Box): Image; - public crop(x: number, y: number, width: number, height: number): Image; + crop(box: Box): Image; + crop(x: number, y: number, width: number, height: number): Image; /** * Creates a mask by testing if pixels (RGB, HSV, ...) are between lower and upper. Formally speaking: * lower1 ≤ pixel1 ≤ upper1 * ∧ lower2 ≤ pixel2 ≤ upper2 * ∧ lower3 ≤ pixel3 ≤ upper3 */ - public inRange(lower1: number, lower2: number, lower3: number, upper1: number, upper2: number, upper3: number): Image; + inRange(lower1: number, lower2: number, lower3: number, upper1: number, upper2: number, upper3: number): Image; /** * Only available for grayscale images. Returns the histogram in an array of length 256, where each entry represents the fraction (0.0 to 1.0) of that color in the image. * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be counted. */ - public histogram(mask?: Image): Image; + histogram(mask?: Image): Image; /** * Computes the horizontal or vertical projection of an 1bpp or 8bpp image. */ - public projection(mode: 'horizontal' | 'vertical'): number[]; + projection(mode: 'horizontal' | 'vertical'): number[]; /** * Sets the specified value to each pixel set in the mask. */ - public setMasked(mask: Image, value: number): Image; + setMasked(mask: Image, value: number): Image; /** * Available for grayscale and color images. Channelwise maps each pixel of image using mapping, which must be an array of length 256 with integer values between 0 and 255. * !!! !!! Note: this function actually changes the image! * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be modified. */ - public applyCurve(mapping: number[], mask?: Image): this; + applyCurve(mapping: number[], mask?: Image): this; /** - * Applies a rank (0.0 ... 1.0) filter of the specified width and height (think of it as radius) to this image and returns the result. If you set rank to 0.5 you'll get a Median Filter. Note that this type of filter works best with odd sizes like 3 or 5. + * Applies a rank (0.0 ... 1.0) filter of the specified width + * and height (think of it as radius) to this image + * and returns the result. + * If you set rank to 0.5 you'll get a Median Filter. + * Note that this type of filter works best with odd sizes like 3 or 5. */ - public rankFilter(width: number, height: number, rank: number): Image; + rankFilter(width: number, height: number, rank: number): Image; /** - * Color image quantization using an octree based algorithm. colors must be between 2 and 256. Note that support for the resulting palette image is highly experimental at this point; only toGray() and toBuffer('png') are guaranteed to work. + * Color image quantization using an octree based algorithm. + * colors must be between 2 and 256. + * Note that support for the resulting palette image is highly experimental at this point; + * only toGray() and toBuffer('png') are guaranteed to work. */ - public octreeColorQuant(colors: number): Image; + octreeColorQuant(colors: number): Image; /** - * Color image quantization using median cut algorithm. colors must be between 2 and 256. Note that support for the resulting palette image is highly experimental at this point; only toGray() and toBuffer('png') are guaranteed to work. + * Color image quantization using median cut algorithm. + * colors must be between 2 and 256. + * Note that support for the resulting palette image is highly experimental at this point; + * only toGray() and toBuffer('png') are guaranteed to work. */ - public medianCutQuant(colors: number): Image; + medianCutQuant(colors: number): Image; /** * Converts a grayscale image to monochrome using a global threshold. value must be between 0 and 255. */ - public threshold(value: number): Image; + threshold(value: number): Image; /** * Converts an image to grayscale using default settings. Can be used to convert monochrome images back to grayscale. */ - public toGray(): Image; + toGray(): Image; /** * Converts an RGB image to grayscale using the specified widths for each channel. */ - public toGray(redWeight: number, greenWeight: number, blueWeight: number): Image; + toGray(redWeight: number, greenWeight: number, blueWeight: number): Image; /** - * Converts an RGB image to grayscale by selecting either the 'min' or 'max' channel. This can act as a simple color filter: 'max' maps colored pixels towards white, while 'min' maps colored pixels towards black. + * Converts an RGB image to grayscale by selecting either the 'min' or 'max' channel. + * This can act as a simple color filter: 'max' maps colored pixels towards white, + * while 'min' maps colored pixels towards black. */ - public toGray(selector: 'min' | 'max'): Image; + toGray(selector: 'min' | 'max'): Image; /** * Converts a grayscale image to a color image. */ - public toColor(): Image; + toColor(): Image; /** * Converts from RGB to HSV color space. HSV has the following ranges: * Hue: [0 .. 239] * Saturation: [0 .. 255] * Value: [0 .. 255] */ - public toHSV(): Image; + toHSV(): Image; /** * Converts from HSV to RGB color space. */ - public toRGB(): Image; + toRGB(): Image; /** * Applies an Erode Filter and returns the result. */ - public erode(width: number, height: number): Image; + erode(width: number, height: number): Image; /** * Applies a Dilate Filter and returns the result. */ - public dilate(width: number, height: number): Image; + dilate(width: number, height: number): Image; /** * Applies an Open Filter and returns the result. */ - public open(width: number, height: number): Image; + open(width: number, height: number): Image; /** * Applies a Close Filter and returns the result. */ - public close(width: number, height: number): Image; + close(width: number, height: number): Image; /** * Applies morphological thinning of type (fg or bg) with the specified connectivitiy (4 or 8) and maxIterations (0 to iterate until complete). */ - public thin(type: 'fg' | 'bg', connectivity: number, maxIterations: number): Image; + thin(type: 'fg' | 'bg', connectivity: number, maxIterations: number): Image; /** * Scales an 8bpp image for maximum dynamic range. scale must be either log or linear. */ - public maxDynamicRange(scale: 'log' | 'linear'): Image; + maxDynamicRange(scale: 'log' | 'linear'): Image; /** - * Applies Otsu's Method for computing the threshold of a grayscale image. It computes a threshold for each tile of the specified size and performs the threshold operation, resulting in a binary image for each tile. These are stitched into the final result. - * The smooth size controls the a convolution kernel applied to threshold array (use 0 for no smoothing). The score factor controls the fraction of the max. Otsu score (typically 0.1; use 0.0 for standard Otsu). + * Applies Otsu's Method for computing the threshold of a grayscale image. + * It computes a threshold for each tile of the specified size and performs the threshold operation, + * resulting in a binary image for each tile. These are stitched into the final result. + * The smooth size controls the a convolution kernel applied to threshold array (use 0 for no smoothing). + * The score factor controls the fraction of the max. Otsu score (typically 0.1; use 0.0 for standard Otsu). */ - public otsuAdaptiveThreshold(tileWidth: number, tileHeight: number, smoothWidth: number, smoothHeight: number, scoreFactor: number): Image; + otsuAdaptiveThreshold(tileWidth: number, tileHeight: number, smoothWidth: number, smoothHeight: number, scoreFactor: number): Image; /** * Detects Line Segments with the specified accuracy (3 is a good start). The number of found line segments can be limited using maxLineSegments (0 is unlimited). */ - public lineSegments(accuracy: number, maxLineSegments: number, useWeightedMeanShift: boolean): Segment[]; + lineSegments(accuracy: number, maxLineSegments: number, useWeightedMeanShift: boolean): Segment[]; /** * Only available for monochrome images. Tries to find the skew of this image. The resulting angle is in degree. The confidence is between 0.0 and 1.0. */ - public findSkew(): Skew; + findSkew(): Skew; /** * Only available for monochrome images. Tries to extract connected components (think of flood fill). The connectivity can be specified as 4 or 8 directions. */ - public connectedComponents(connectivity: 4 | 8): Component[]; + connectedComponents(connectivity: 4 | 8): Component[]; /** * The Distance Function works on 1bpp images. It labels each pixel with the largest distance between this and any other pixel in its connected component. The connectivity is either 4 or 8. */ - public distanceFunction(connectivity: 4 | 8): Image; + distanceFunction(connectivity: 4 | 8): Image; /** * !!! Note: this function actually changes the image! * Fills a specified rectangle with white. */ - public clearBox(box: Box): this; - public clearBox(x: number, y: number, width: number, height: number): this; + clearBox(box: Box): this; + clearBox(x: number, y: number, width: number, height: number): this; /** * !!! Note: this function actually changes the image! * Draws a filled rectangle to this image with the specified value. Works for 8bpp and 1bpp images. */ - public fillBox(box: Box, value: number): this; - public fillBox(x: number, y: number, width: number, height: number, value: number): this; + fillBox(box: Box, value: number): this; + fillBox(x: number, y: number, width: number, height: number, value: number): this; /** * !!! Note: this function actually changes the image! * Draws a filled rectangle to this image in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). */ - public fillBox(box: Box, r: number, g: number, b: number, fraction?: number): this; - public fillBox(x: number, y: number, width: number, height: number, r: number, g: number, b: number, fraction?: number): this; + fillBox(box: Box, r: number, g: number, b: number, fraction?: number): this; + fillBox(x: number, y: number, width: number, height: number, r: number, g: number, b: number, fraction?: number): this; /** * !!! Note: this function actually changes the image! * Draws a rectangle to this image with the specified border. The possible pixel manipulating operations are set, clear and flip. */ - public drawBox(box: Box, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; - public drawBox(x: number, y: number, width: number, height: number, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + drawBox(box: Box, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + drawBox(x: number, y: number, width: number, height: number, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; /** * !!! Note: this function actually changes the image! * Draws a rectangle to this image with the specified border in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). */ - public drawBox(box: Box, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; - public drawBox(x: number, y: number, width: number, height: number, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + drawBox(box: Box, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + drawBox(x: number, y: number, width: number, height: number, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; /** * !!! Note: this function actually changes the image! * Draws a line between p1 and p2 to this image with the specified line width. The possible pixel manipulating operations are set, clear and flip. */ - public drawLine(p1: Point, p2: Point, width: number, operation: 'set' | 'clear' | 'flip'): this; + drawLine(p1: Point, p2: Point, width: number, operation: 'set' | 'clear' | 'flip'): this; /** * !!! Note: this function actually changes the image! * Draws a line between p1 and p2 to this image with the specified line width in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). */ - public drawLine(p1: Point, p2: Point, width: number, red: number, green: number, blue: number, frac?: number): this; + drawLine(p1: Point, p2: Point, width: number, red: number, green: number, blue: number, frac?: number): this; /** * !!! Note: this function actually changes the image! * Draws an image to this image with the specified destination box. */ - public drawImage(image: Image, box: Box): this; - public drawImage(image: Image, x: number, y: number, width: number, height: number): this; + drawImage(image: Image, box: Box): this; + drawImage(image: Image, x: number, y: number, width: number, height: number): this; /** * Converts the Image in the specified format to a buffer. - * Specifying raw returns the raw image data as buffer. For color images, the result contains three bytes per pixel in the order R, G, B; for grayscale and monochrome images, it contains one byte per pixel. + * Specifying raw returns the raw image data as buffer. + * For color images, the result contains three bytes per pixel in the order R, G, B; + * for grayscale and monochrome images, it contains one byte per pixel. * Specifying png returns a PNG encoded image as buffer. * Specifying jpg returns a JPG encoded image as buffer. */ - public toBuffer(format?: 'raw' | 'png' | 'jpg'): Buffer; + toBuffer(format?: 'raw' | 'png' | 'jpg'): Buffer; } export interface Rect { - // todo + x: number; + y: number; + width: number; + height: number; } export interface Region { box: Box; - text: string, + text: string; confidence: number; } @@ -303,7 +329,7 @@ export interface Textline { export type Word = Region; export interface Choice { - text: string, + text: string; confidence: number; } @@ -314,7 +340,9 @@ export interface Symbol extends Region { export type Text = Choice; /** - * A Tesseract object represents an optical character recognition engine, that reads text using Tesseract from an image. Tesseract supports many langauges and fonts (see Tesseract/Downloads). New language files have to be installed in node-dv/tessdata. + * A Tesseract object represents an optical character recognition engine, that reads text using Tesseract from an image. + * Tesseract supports many langauges and fonts (see Tesseract/Downloads). + * New language files have to be installed in node-dv/tessdata. */ export class Tesseract { /** @@ -325,7 +353,7 @@ export class Tesseract { /** * Creates a Tesseract engine with the specified language. */ - constructor(datapath: string, lang: string); + constructor(lang: string, image: Image); /** * Creates a Tesseract engine with the specified language and image. */ @@ -334,54 +362,57 @@ export class Tesseract { /** * Accessor for the input image. */ - public image: Image; + image: Image; /** * Accessor for the rectangle that specifies a "visible" area on the image. */ - public rectangle: Rect; + rectangle: Rect; /** - * Accessor for the page segmentation mode. Valid values are: osd_only, auto_osd, auto_only, auto, single_column, single_block_vert_text, single_block, single_line, single_word, circle_word, single_char, sparse_text, sparse_text_osd. + * Accessor for the page segmentation mode. */ - public pageSegMode: 'osd_only' | 'auto_osd' | 'auto_only' | 'auto' | 'single_column' | 'single_block_vert_text' | 'single_block' | 'single_line' | 'single_word' | 'circle_word' | 'single_char' | 'sparse_text' | 'sparse_text_osd' + pageSegMode: 'osd_only' | 'auto_osd' | 'auto_only' | 'auto' + | 'single_column' | 'single_block_vert_text' | 'single_block' + | 'single_line' | 'single_word' | 'circle_word' | 'single_char' + | 'sparse_text' | 'sparse_text_osd'; [key: string]: unknown; /** * Clears the tesseract image and its last results. */ - public clear(): void; + clear(): void; /** * Clears all adaptive classifiers (use this when results vary during scanning). */ - public clearAdaptiveClassifier(): void; + clearAdaptiveClassifier(): void; /** * Returns the binarized image Tesseract uses for its recognition. */ - public thresholdImage(): Image; + thresholdImage(): Image; /** * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. */ - public findRegions(recognize: boolean): Region[]; + findRegions(recognize: boolean): Region[]; /** * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. */ - public findParagraphs(recognize: boolean): Paragaph[]; + findParagraphs(recognize: boolean): Paragaph[]; /** * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. */ - public findTextLines(recognize: boolean): Textline[]; + findTextLines(recognize: boolean): Textline[]; /** * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. */ - public findWords(recognize: boolean): Word[]; + findWords(recognize: boolean): Word[]; /** * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. */ - public findSymbols(recognize: boolean): Symbol[]; + findSymbols(recognize: boolean): symbol[]; /** * Returns text in the specified format. Valid formats are: plain, unlv. */ - public findText(format: 'plain' | 'unlv', withConfidence?: boolean): string; - public findText(format: 'hocr' | 'box', pageNumber: number): string; + findText(format: 'plain' | 'unlv', withConfidence?: boolean): string; + findText(format: 'hocr' | 'box', pageNumber: number): string; } export interface Barcodeformat { @@ -414,33 +445,33 @@ export class ZXing { /** * Accessor for the input image this barcode reader operates on. */ - public image: Image; + image: Image; /** * List of barcodes the reader tries to find. It's specified as an object and missing properties account as false */ - public formats: Barcodeformat; + formats: Barcodeformat; /** * If try harder is enabled, the barcode reader spends more time trying to find a barcode (optimize for accuracy, not speed). */ - public tryHarder: boolean; + tryHarder: boolean; /** * Returns the first barcode found as an object with the following format: */ - public findCode(): BarCode; + findCode(): BarCode; /** * enotes the barcodes type. */ - public readonly type: 'None' | 'QR_CODE' | 'DATA_MATRIX' | 'PDF_417' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'ITF' | 'AZTEC'; + readonly type: 'None' | 'QR_CODE' | 'DATA_MATRIX' | 'PDF_417' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'ITF' | 'AZTEC'; /** * denotes the stringified data read from the barcode. */ - public readonly data: string; + readonly data: string; /** * denotes the decoded binary data of the barcode before conversion into another character encoding. */ - public readonly buffer: Buffer; + readonly buffer: Buffer; /** * denotes the points in pixels which were used by the barcode reader to detect the barcode. */ - public readonly points: Point[]; + readonly points: Point[]; } diff --git a/types/dv/tslint.json b/types/dv/tslint.json index 3db14f85ea..8765f2428f 100644 --- a/types/dv/tslint.json +++ b/types/dv/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} \ No newline at end of file From 5887c8669381c6c8d8ead32c72d23d147a1b8a10 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Tue, 5 Mar 2019 14:19:18 +1100 Subject: [PATCH 136/265] Updated function default export to function --- types/mumath/clamp.d.ts | 2 +- types/mumath/closest.d.ts | 2 +- types/mumath/index.d.ts | 68 +++++++----------------------------- types/mumath/isMultiple.d.ts | 2 +- types/mumath/len.d.ts | 2 +- types/mumath/lerp.d.ts | 2 +- types/mumath/mod.d.ts | 2 +- types/mumath/mumath-tests.ts | 24 ++++++------- types/mumath/order.d.ts | 2 +- types/mumath/precision.d.ts | 2 +- types/mumath/round.d.ts | 2 +- types/mumath/scale.d.ts | 2 +- types/mumath/within.d.ts | 2 +- 13 files changed, 35 insertions(+), 79 deletions(-) diff --git a/types/mumath/clamp.d.ts b/types/mumath/clamp.d.ts index fe08302e37..9d674a9620 100644 --- a/types/mumath/clamp.d.ts +++ b/types/mumath/clamp.d.ts @@ -3,4 +3,4 @@ */ declare function clamp(value: number, left: number, right: number): number; -export default clamp; +export = clamp; diff --git a/types/mumath/closest.d.ts b/types/mumath/closest.d.ts index f2db4ea1ec..762bcb6548 100644 --- a/types/mumath/closest.d.ts +++ b/types/mumath/closest.d.ts @@ -3,4 +3,4 @@ */ declare function closest(value: number, list: number[]): number; -export default closest; +export = closest; diff --git a/types/mumath/index.d.ts b/types/mumath/index.d.ts index 3dcfccf565..ee0f0ff6c6 100644 --- a/types/mumath/index.d.ts +++ b/types/mumath/index.d.ts @@ -3,60 +3,16 @@ // Definitions by: Adam Zerella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Detects proper clamp min/max. - */ -export function clamp(value: number, left: number, right: number): number; +import clamp = require('./clamp'); +import closest = require('./closest'); +import isMultiple = require('./isMultiple'); +import len = require('./len'); +import lerp = require('./lerp'); +import mod = require('./mod'); +import order = require('./order'); +import precision = require('./precision'); +import round = require('./round'); +import scale = require('./scale'); +import within = require('./within'); -/** - * Get closest value out of a set. - */ -export function closest(value: number, list: number[]): number; - -/** - * Check if one number is multiple of other - * Same as a % b === 0, but with precision check. - */ -export function isMultiple(a: number, b: number, eps?: number): boolean; - -/** - * Return quadratic length of a vector. - */ -export function len(a: number, b: number): number; - -/** - * Return value interpolated between x and y. - */ -export function lerp(x: number, y: number, ratio: number): number; - -/** - * An enhanced mod-loop, like fmod — loops value within a frame. - */ -export function mod(value: number, max: number, min?: number): number; - -/** - * Get order of magnitude for a number. - */ -export function order(value: number): number; - -/** - * Get precision from float: - */ -export function precision(value: number): number; - -/** - * Rounds value to optional step. - */ -export function round(value: number, step?: number): number; - -/** - * Get first scale out of a list of basic scales, aligned to the power. E. g. - * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 - * Similar to closest, but takes all possible powers of scales. - */ -export function scale(value: number, list: number[]): number; - -/** - * Whether element is between left & right, including. - */ -export function within(value: number, left: number, right: number): number; +export { clamp, closest, isMultiple, len, lerp, mod, order, precision, round, scale, within }; diff --git a/types/mumath/isMultiple.d.ts b/types/mumath/isMultiple.d.ts index 255d0ece72..31c7a09b08 100644 --- a/types/mumath/isMultiple.d.ts +++ b/types/mumath/isMultiple.d.ts @@ -4,4 +4,4 @@ */ declare function isMultiple(a: number, b: number, eps?: number): boolean; -export default isMultiple; +export = isMultiple; diff --git a/types/mumath/len.d.ts b/types/mumath/len.d.ts index 2392cff32f..b2fae8a8e5 100644 --- a/types/mumath/len.d.ts +++ b/types/mumath/len.d.ts @@ -3,4 +3,4 @@ */ declare function len(a: number, b: number): number; -export default len; +export = len; diff --git a/types/mumath/lerp.d.ts b/types/mumath/lerp.d.ts index 3ab8639c0c..5e09370be2 100644 --- a/types/mumath/lerp.d.ts +++ b/types/mumath/lerp.d.ts @@ -3,4 +3,4 @@ */ declare function lerp(x: number, y: number, ratio: number): number; -export default lerp; +export = lerp; diff --git a/types/mumath/mod.d.ts b/types/mumath/mod.d.ts index 6517271e45..ac1784fe06 100644 --- a/types/mumath/mod.d.ts +++ b/types/mumath/mod.d.ts @@ -3,4 +3,4 @@ */ declare function mod(value: number, max: number, min?: number): number; -export default mod; +export = mod; diff --git a/types/mumath/mumath-tests.ts b/types/mumath/mumath-tests.ts index 5a8fd6476f..a5b339b2fe 100644 --- a/types/mumath/mumath-tests.ts +++ b/types/mumath/mumath-tests.ts @@ -1,16 +1,16 @@ -import * as mumath from "mumath"; +import mumath = require("mumath"); -import mumathClamp from "mumath/clamp"; -import mumathClosest from "mumath/closest"; -import mumathIsMultiple from "mumath/isMultiple"; -import mumathLen from "mumath/len"; -import mumathLerp from "mumath/lerp"; -import mumathMod from "mumath/mod"; -import mumathOrder from "mumath/order"; -import mumathPrecision from "mumath/precision"; -import mumathRound from "mumath/round"; -import mumathScale from "mumath/scale"; -import mumathWithin from "mumath/within"; +import mumathClamp = require("mumath/clamp"); +import mumathClosest = require("mumath/closest"); +import mumathIsMultiple = require("mumath/isMultiple"); +import mumathLen = require("mumath/len"); +import mumathLerp = require("mumath/lerp"); +import mumathMod = require("mumath/mod"); +import mumathOrder = require("mumath/order"); +import mumathPrecision = require("mumath/precision"); +import mumathRound = require("mumath/round"); +import mumathScale = require("mumath/scale"); +import mumathWithin = require("mumath/within"); mumath.clamp(1, 2, 3); mumathClamp(1, 2, 3); diff --git a/types/mumath/order.d.ts b/types/mumath/order.d.ts index 6da624f1d3..8ce4c396fa 100644 --- a/types/mumath/order.d.ts +++ b/types/mumath/order.d.ts @@ -3,4 +3,4 @@ */ declare function order(value: number): number; -export default order; +export = order; diff --git a/types/mumath/precision.d.ts b/types/mumath/precision.d.ts index ec94b3a4ed..1b1a7290cc 100644 --- a/types/mumath/precision.d.ts +++ b/types/mumath/precision.d.ts @@ -3,4 +3,4 @@ */ declare function precision(value: number): number; -export default precision; +export = precision; diff --git a/types/mumath/round.d.ts b/types/mumath/round.d.ts index 09549f14f1..8966dc6068 100644 --- a/types/mumath/round.d.ts +++ b/types/mumath/round.d.ts @@ -3,4 +3,4 @@ */ declare function round(value: number, step?: number): number; -export default round; +export = round; diff --git a/types/mumath/scale.d.ts b/types/mumath/scale.d.ts index 2d5487ea10..2cb97bcb4f 100644 --- a/types/mumath/scale.d.ts +++ b/types/mumath/scale.d.ts @@ -5,4 +5,4 @@ */ declare function scale(value: number, list: number[]): number; -export default scale; +export = scale; diff --git a/types/mumath/within.d.ts b/types/mumath/within.d.ts index 47558c73d0..f1d7e56cbd 100644 --- a/types/mumath/within.d.ts +++ b/types/mumath/within.d.ts @@ -3,4 +3,4 @@ */ declare function within(value: number, left: number, right: number): number; -export default within; +export = within; From b0c0de0a559025254302cafaaf7032a258cb77c2 Mon Sep 17 00:00:00 2001 From: tkow Date: Tue, 5 Mar 2019 13:00:57 +0900 Subject: [PATCH 137/265] remove deprecated methods --- types/react-navigation/index.d.ts | 23 ------------------- .../react-navigation-tests.tsx | 15 ------------ 2 files changed, 38 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index f2b0b968fb..9b2aee84e2 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -872,10 +872,6 @@ export interface StackNavigatorConfig } // Return createNavigationContainer -export function StackNavigator( - routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig -): NavigationContainer; export function createStackNavigator( routeConfigMap: NavigationRouteConfigMap, @@ -892,11 +888,6 @@ export interface SwitchNavigatorConfig { // Return createNavigationContainer export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; -export function SwitchNavigator( - routeConfigMap: NavigationRouteConfigMap, - switchConfig?: SwitchNavigatorConfig -): NavigationContainer; - export function createSwitchNavigator( routeConfigMap: NavigationRouteConfigMap, switchConfig?: SwitchNavigatorConfig @@ -962,11 +953,6 @@ export interface DrawerNavigatorConfig drawerLockMode?: DrawerLockMode; } -export function DrawerNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawerConfig?: DrawerNavigatorConfig -): NavigationContainer; - export function createDrawerNavigator( routeConfigMap: NavigationRouteConfigMap, drawerConfig?: DrawerNavigatorConfig @@ -1021,15 +1007,6 @@ export interface BottomTabNavigatorConfig } // From navigators/TabNavigator.js -export function TabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; - -export function createTabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; export function createBottomTabNavigator( routeConfigMap: NavigationRouteConfigMap, diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 777a8fa9f3..cf933d43ba 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -36,7 +36,6 @@ import { createSwitchNavigator, SwitchNavigatorConfig, TabBarTop, - createTabNavigator, TabNavigatorConfig, Transitioner, HeaderBackButton, @@ -245,20 +244,6 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = { }, }; -const BasicTabNavigator = createTabNavigator( - routeConfigMap, - tabNavigatorConfig, -); - -function renderBasicTabNavigator(): JSX.Element { - return ( - { }} - style={[viewStyle, undefined]} // Test that we are using StyleProp - /> - ); -} - /** * Stack navigator. */ From 78260dbf4c74d308b5e189cd8adcc4a587040502 Mon Sep 17 00:00:00 2001 From: Aaron Beall Date: Mon, 4 Mar 2019 23:01:41 -0500 Subject: [PATCH 138/265] Added pendo-io-agent definitions --- pendo-io-agent/index.d.ts | 166 +++++++++++++++++++ pendo-io-agent/pendo-io-agent-tests.ts | 78 +++++++++ pendo-io-agent/tsconfig.json | 23 +++ pendo-io-agent/tslint.json | 1 + types/pendo-io-agent/index.d.ts | 63 +++++++ types/pendo-io-agent/pendo-io-agent-tests.ts | 0 types/pendo-io-agent/tsconfig.json | 22 +++ types/pendo-io-agent/tslint.json | 1 + 8 files changed, 354 insertions(+) create mode 100644 pendo-io-agent/index.d.ts create mode 100644 pendo-io-agent/pendo-io-agent-tests.ts create mode 100644 pendo-io-agent/tsconfig.json create mode 100644 pendo-io-agent/tslint.json create mode 100644 types/pendo-io-agent/index.d.ts create mode 100644 types/pendo-io-agent/pendo-io-agent-tests.ts create mode 100644 types/pendo-io-agent/tsconfig.json create mode 100644 types/pendo-io-agent/tslint.json diff --git a/pendo-io-agent/index.d.ts b/pendo-io-agent/index.d.ts new file mode 100644 index 0000000000..6429f3b95b --- /dev/null +++ b/pendo-io-agent/index.d.ts @@ -0,0 +1,166 @@ +// Type definitions for Pendo.io Agent 2.16 +// Project: https://www.pendo.io/ +// Definitions by: Aaron Beall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace pendo { + interface Identity { + visitor: Visitor; + account?: Account; + } + + type Metadata = Record; + + interface Visitor extends Metadata { + id: string; + } + + interface Account extends Metadata { + id?: string; + } + + interface InitOptions extends Identity { + apiKey?: string; + excludeAllText?: boolean; + excludeTitle?: boolean; + disablePersistence?: boolean; + guides?: { + delay?: boolean; + disable?: boolean; + timeout?: number; + tooltip?: { + arrowSize?: number; + } + }; + events?: EventCallbacks; + } + + interface EventCallbacks { + ready?(): void; + guidesLoaded?(): void; + guidesFailed?(): void; + } + + interface Pendo { + // Initialization and Identification + initialize(options: InitOptions): void; + identify(visitorId: string, accountId?: string): void; + identify(identity: Identity): void; + isReady(): boolean; + flushNow(): Promise; + updateOptions(visitorMetadata: Metadata): void; + getVersion(): string; + getVisitorId(): string; + getAccountId(): string; + getCurrentUrl(): string; + + // Guides and Guide Center + findGuideByName(name: string): Guide | void; + findGuideById(id: string): Guide | void; + showGuideByName(name: string): void; + showGuideById(id: string): void; + toggleLauncher(): void; + removeLauncher(): void; + + // Troubleshooting + loadGuides(): void; + startGuides(): void; + stopGuides(): void; + + // Debugging + enableDebugging(): void; + disableDebugging(): void; + isDebuggingEnabled(coerce?: false): "Yes" | "No"; + isDebuggingEnabled(coerce: true): boolean; + debugging: Debugging; + + // Events + events: Events; + track(trackType: string, metadata?: Metadata): void; + + // Guide Events + onGuideAdvanced(step?: GuideStep): void; + onGuideAdvanced(steps: { steps: number }): void; + onGuidePrevious(step?: GuideStep): void; + onGuideDismissed(step?: GuideStep): void; + onGuideDismissed(until: { until: "reload" }): void; + + // Other + validateInstall(): void; + dom(input: any): HTMLElement; // TODO + } + + interface Debugging { + getEventCache(): any[]; // TODO + getAllGuides(): Guide[]; + getAutoGuides(): { auto: Guide[]; override: Guide[] }; + getBadgeGuides(): Guide[]; + getLauncherGuides(): Guide[]; + } + + type Events = { + [K in keyof EventCallbacks]-?: (callback: EventCallbacks[K]) => Events; + }; + + interface Guide { + createdByUser: User; + createdAt: number; + lastUpdatedByUser: User; + lastUpdatedAt: number; + kind: string; + rootVersionId: string; + stableVersionId: string; + id: string; + name: string; + state: "published" | "staged" | "draft" | "disabled"; + launchMethod: "api" | "automatic" | "badge" | "dom" | "launcher"; + isMultiStep: boolean; + steps: GuideStep[]; + attributes: { + type: string; + device: { desktop: boolean; mobile: boolean; type: "desktop" | "mobile" }; + badge: any; + priority: number; + launcher: { keywords: string[] }; + }; + audience: any[]; // TODO + audienceUiHint: { filters: any[] }; // TODO + resetAt: number; + publishedAt: number; + } + + interface User { + id: string; + username: string; + first: string; + last: string; + role: number; + userType: string; + } + + interface GuideStep { + id: string; + guideId: string; + type: string; + elementPathRule: string; + contentType: string; + contentUrl?: string; + contentUrlCss?: string; + contentUrlJs?: string; + rank: number; + advanceMethod: "button" | "programatic" /* sic */ | "element"; + thumbnailUrls?: string; + attributes: { + height: number; + width: number; + autoHeight: boolean; + position: string; + css: string; + variables: any; + }; + lastUpdatedAt: number; + resetAt: number; + } +} + +declare const pendo: pendo.Pendo; diff --git a/pendo-io-agent/pendo-io-agent-tests.ts b/pendo-io-agent/pendo-io-agent-tests.ts new file mode 100644 index 0000000000..575b039686 --- /dev/null +++ b/pendo-io-agent/pendo-io-agent-tests.ts @@ -0,0 +1,78 @@ +// Examples from: https://developers.pendo.io/docs/?bash#agent-api + +pendo.initialize({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.identify( + "PUT_VISITOR_ID_HERE", + "PUT_ACCOUNT_ID_HERE" +); + +pendo.identify({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.debugging.getEventCache(); + +pendo.events + .ready(function () { + // Do something once `pendo.isReady()` would return `true` + }) + .guidesLoaded(function () { + // Do something when Guides load + }) + .guidesFailed(function () { + // Do something when Guides fail to load + }); + +pendo.initialize({ + apiKey: 'YOUR_API_KEY', + visitor: { id: "" }, + account: { id: "" }, + events: { + ready: function () { + // Do something when pendo is initialized + } + } +}); + +pendo.track("User Registered", { + userId: "user.id", + plan: "user.plan", + accountType: "Facebook" +}); + +try { + throw new Error(); +} +catch (error) { + pendo.track("JIRA-12345--error-tripped", { + message: error.message, + stack: error.stack + }); +} + +pendo.dom("").closest('._pendo-guide-next_') + +pendo.onGuideAdvanced(); +pendo.onGuideAdvanced({ steps: 2 }); +pendo.onGuideDismissed(); diff --git a/pendo-io-agent/tsconfig.json b/pendo-io-agent/tsconfig.json new file mode 100644 index 0000000000..4ee19675e0 --- /dev/null +++ b/pendo-io-agent/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pendo-io-agent-tests.ts" + ] +} diff --git a/pendo-io-agent/tslint.json b/pendo-io-agent/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/pendo-io-agent/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pendo-io-agent/index.d.ts b/types/pendo-io-agent/index.d.ts new file mode 100644 index 0000000000..edd35a96fd --- /dev/null +++ b/types/pendo-io-agent/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for pendo-io-agent x.x +// Project: https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.) +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ If this library is callable (e.g. can be invoked as myLib(3)), + *~ include those call signatures here. + *~ Otherwise, delete this section. + */ +declare function myLib(a: string): string; +declare function myLib(a: number): number; + +/*~ If you want the name of this library to be a valid type name, + *~ you can do so here. + *~ + *~ For example, this allows us to write 'var x: myLib'; + *~ Be sure this actually makes sense! If it doesn't, just + *~ delete this declaration and add types inside the namespace below. + */ +interface myLib { + name: string; + length: number; + extras?: string[]; +} + +/*~ If your library has properties exposed on a global variable, + *~ place them here. + *~ You should also place types (interfaces and type alias) here. + */ +declare namespace myLib { + //~ We can write 'myLib.timeout = 50;' + let timeout: number; + + //~ We can access 'myLib.version', but not change it + const version: string; + + //~ There's some class we can create via 'let c = new myLib.Cat(42)' + //~ Or reference e.g. 'function f(c: myLib.Cat) { ... } + class Cat { + constructor(n: number); + + //~ We can read 'c.age' from a 'Cat' instance + readonly age: number; + + //~ We can invoke 'c.purr()' from a 'Cat' instance + purr(): void; + } + + //~ We can declare a variable as + //~ 'var s: myLib.CatSettings = { weight: 5, name: "Maru" };' + interface CatSettings { + weight: number; + name: string; + tailLength?: number; + } + + //~ We can write 'const v: myLib.VetID = 42;' + //~ or 'const v: myLib.VetID = "bob";' + type VetID = string | number; + + //~ We can invoke 'myLib.checkCat(c)' or 'myLib.checkCat(c, v);' + function checkCat(c: Cat, s?: VetID); +} diff --git a/types/pendo-io-agent/pendo-io-agent-tests.ts b/types/pendo-io-agent/pendo-io-agent-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/pendo-io-agent/tsconfig.json b/types/pendo-io-agent/tsconfig.json new file mode 100644 index 0000000000..35695dd90c --- /dev/null +++ b/types/pendo-io-agent/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pendo-io-agent-tests.ts" + ] +} diff --git a/types/pendo-io-agent/tslint.json b/types/pendo-io-agent/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pendo-io-agent/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c018882991198c685b6c38741242bab5435839dc Mon Sep 17 00:00:00 2001 From: tkow Date: Tue, 5 Mar 2019 13:02:16 +0900 Subject: [PATCH 139/265] add createMaterialTopTabNavigator test --- types/react-navigation/react-navigation-tests.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index cf933d43ba..2f7c65f9cd 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -36,6 +36,7 @@ import { createSwitchNavigator, SwitchNavigatorConfig, TabBarTop, + createMaterialTopTabNavigator, TabNavigatorConfig, Transitioner, HeaderBackButton, @@ -244,6 +245,20 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = { }, }; +const BasicTabNavigator = createMaterialTopTabNavigator( + routeConfigMap, + tabNavigatorConfig, +); + +function renderBasicTabNavigator(): JSX.Element { + return ( + { }} + style={[viewStyle, undefined]} // Test that we are using StyleProp + /> + ); +} + /** * Stack navigator. */ From 3f04dbeed99039d96b22dedd04bb456765b466a4 Mon Sep 17 00:00:00 2001 From: Aaron Beall Date: Mon, 4 Mar 2019 23:07:34 -0500 Subject: [PATCH 140/265] Moved dir to /types --- pendo-io-agent/index.d.ts | 166 --------------- pendo-io-agent/pendo-io-agent-tests.ts | 78 ------- pendo-io-agent/tsconfig.json | 23 -- pendo-io-agent/tslint.json | 1 - types/pendo-io-agent/index.d.ts | 211 ++++++++++++++----- types/pendo-io-agent/pendo-io-agent-tests.ts | 78 +++++++ types/pendo-io-agent/tsconfig.json | 5 +- 7 files changed, 238 insertions(+), 324 deletions(-) delete mode 100644 pendo-io-agent/index.d.ts delete mode 100644 pendo-io-agent/pendo-io-agent-tests.ts delete mode 100644 pendo-io-agent/tsconfig.json delete mode 100644 pendo-io-agent/tslint.json diff --git a/pendo-io-agent/index.d.ts b/pendo-io-agent/index.d.ts deleted file mode 100644 index 6429f3b95b..0000000000 --- a/pendo-io-agent/index.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -// Type definitions for Pendo.io Agent 2.16 -// Project: https://www.pendo.io/ -// Definitions by: Aaron Beall -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace pendo { - interface Identity { - visitor: Visitor; - account?: Account; - } - - type Metadata = Record; - - interface Visitor extends Metadata { - id: string; - } - - interface Account extends Metadata { - id?: string; - } - - interface InitOptions extends Identity { - apiKey?: string; - excludeAllText?: boolean; - excludeTitle?: boolean; - disablePersistence?: boolean; - guides?: { - delay?: boolean; - disable?: boolean; - timeout?: number; - tooltip?: { - arrowSize?: number; - } - }; - events?: EventCallbacks; - } - - interface EventCallbacks { - ready?(): void; - guidesLoaded?(): void; - guidesFailed?(): void; - } - - interface Pendo { - // Initialization and Identification - initialize(options: InitOptions): void; - identify(visitorId: string, accountId?: string): void; - identify(identity: Identity): void; - isReady(): boolean; - flushNow(): Promise; - updateOptions(visitorMetadata: Metadata): void; - getVersion(): string; - getVisitorId(): string; - getAccountId(): string; - getCurrentUrl(): string; - - // Guides and Guide Center - findGuideByName(name: string): Guide | void; - findGuideById(id: string): Guide | void; - showGuideByName(name: string): void; - showGuideById(id: string): void; - toggleLauncher(): void; - removeLauncher(): void; - - // Troubleshooting - loadGuides(): void; - startGuides(): void; - stopGuides(): void; - - // Debugging - enableDebugging(): void; - disableDebugging(): void; - isDebuggingEnabled(coerce?: false): "Yes" | "No"; - isDebuggingEnabled(coerce: true): boolean; - debugging: Debugging; - - // Events - events: Events; - track(trackType: string, metadata?: Metadata): void; - - // Guide Events - onGuideAdvanced(step?: GuideStep): void; - onGuideAdvanced(steps: { steps: number }): void; - onGuidePrevious(step?: GuideStep): void; - onGuideDismissed(step?: GuideStep): void; - onGuideDismissed(until: { until: "reload" }): void; - - // Other - validateInstall(): void; - dom(input: any): HTMLElement; // TODO - } - - interface Debugging { - getEventCache(): any[]; // TODO - getAllGuides(): Guide[]; - getAutoGuides(): { auto: Guide[]; override: Guide[] }; - getBadgeGuides(): Guide[]; - getLauncherGuides(): Guide[]; - } - - type Events = { - [K in keyof EventCallbacks]-?: (callback: EventCallbacks[K]) => Events; - }; - - interface Guide { - createdByUser: User; - createdAt: number; - lastUpdatedByUser: User; - lastUpdatedAt: number; - kind: string; - rootVersionId: string; - stableVersionId: string; - id: string; - name: string; - state: "published" | "staged" | "draft" | "disabled"; - launchMethod: "api" | "automatic" | "badge" | "dom" | "launcher"; - isMultiStep: boolean; - steps: GuideStep[]; - attributes: { - type: string; - device: { desktop: boolean; mobile: boolean; type: "desktop" | "mobile" }; - badge: any; - priority: number; - launcher: { keywords: string[] }; - }; - audience: any[]; // TODO - audienceUiHint: { filters: any[] }; // TODO - resetAt: number; - publishedAt: number; - } - - interface User { - id: string; - username: string; - first: string; - last: string; - role: number; - userType: string; - } - - interface GuideStep { - id: string; - guideId: string; - type: string; - elementPathRule: string; - contentType: string; - contentUrl?: string; - contentUrlCss?: string; - contentUrlJs?: string; - rank: number; - advanceMethod: "button" | "programatic" /* sic */ | "element"; - thumbnailUrls?: string; - attributes: { - height: number; - width: number; - autoHeight: boolean; - position: string; - css: string; - variables: any; - }; - lastUpdatedAt: number; - resetAt: number; - } -} - -declare const pendo: pendo.Pendo; diff --git a/pendo-io-agent/pendo-io-agent-tests.ts b/pendo-io-agent/pendo-io-agent-tests.ts deleted file mode 100644 index 575b039686..0000000000 --- a/pendo-io-agent/pendo-io-agent-tests.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Examples from: https://developers.pendo.io/docs/?bash#agent-api - -pendo.initialize({ - visitor: { - id: "PUT_VISITOR_ID_HERE", - name: "Neo", - email: "neo@thematrix.io", - role: "godlike" - }, - account: { - id: "PUT_ACCOUNT_ID_HERE", - name: "CorpSchmorp" - } -}); - -pendo.identify( - "PUT_VISITOR_ID_HERE", - "PUT_ACCOUNT_ID_HERE" -); - -pendo.identify({ - visitor: { - id: "PUT_VISITOR_ID_HERE", - name: "Neo", - email: "neo@thematrix.io", - role: "godlike" - }, - account: { - id: "PUT_ACCOUNT_ID_HERE", - name: "CorpSchmorp" - } -}); - -pendo.debugging.getEventCache(); - -pendo.events - .ready(function () { - // Do something once `pendo.isReady()` would return `true` - }) - .guidesLoaded(function () { - // Do something when Guides load - }) - .guidesFailed(function () { - // Do something when Guides fail to load - }); - -pendo.initialize({ - apiKey: 'YOUR_API_KEY', - visitor: { id: "" }, - account: { id: "" }, - events: { - ready: function () { - // Do something when pendo is initialized - } - } -}); - -pendo.track("User Registered", { - userId: "user.id", - plan: "user.plan", - accountType: "Facebook" -}); - -try { - throw new Error(); -} -catch (error) { - pendo.track("JIRA-12345--error-tripped", { - message: error.message, - stack: error.stack - }); -} - -pendo.dom("").closest('._pendo-guide-next_') - -pendo.onGuideAdvanced(); -pendo.onGuideAdvanced({ steps: 2 }); -pendo.onGuideDismissed(); diff --git a/pendo-io-agent/tsconfig.json b/pendo-io-agent/tsconfig.json deleted file mode 100644 index 4ee19675e0..0000000000 --- a/pendo-io-agent/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "pendo-io-agent-tests.ts" - ] -} diff --git a/pendo-io-agent/tslint.json b/pendo-io-agent/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/pendo-io-agent/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/pendo-io-agent/index.d.ts b/types/pendo-io-agent/index.d.ts index edd35a96fd..6429f3b95b 100644 --- a/types/pendo-io-agent/index.d.ts +++ b/types/pendo-io-agent/index.d.ts @@ -1,63 +1,166 @@ -// Type definitions for pendo-io-agent x.x -// Project: https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.) -// Definitions by: My Self +// Type definitions for Pendo.io Agent 2.16 +// Project: https://www.pendo.io/ +// Definitions by: Aaron Beall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/*~ If this library is callable (e.g. can be invoked as myLib(3)), - *~ include those call signatures here. - *~ Otherwise, delete this section. - */ -declare function myLib(a: string): string; -declare function myLib(a: number): number; - -/*~ If you want the name of this library to be a valid type name, - *~ you can do so here. - *~ - *~ For example, this allows us to write 'var x: myLib'; - *~ Be sure this actually makes sense! If it doesn't, just - *~ delete this declaration and add types inside the namespace below. - */ -interface myLib { - name: string; - length: number; - extras?: string[]; -} - -/*~ If your library has properties exposed on a global variable, - *~ place them here. - *~ You should also place types (interfaces and type alias) here. - */ -declare namespace myLib { - //~ We can write 'myLib.timeout = 50;' - let timeout: number; - - //~ We can access 'myLib.version', but not change it - const version: string; - - //~ There's some class we can create via 'let c = new myLib.Cat(42)' - //~ Or reference e.g. 'function f(c: myLib.Cat) { ... } - class Cat { - constructor(n: number); - - //~ We can read 'c.age' from a 'Cat' instance - readonly age: number; - - //~ We can invoke 'c.purr()' from a 'Cat' instance - purr(): void; +declare namespace pendo { + interface Identity { + visitor: Visitor; + account?: Account; } - //~ We can declare a variable as - //~ 'var s: myLib.CatSettings = { weight: 5, name: "Maru" };' - interface CatSettings { - weight: number; + type Metadata = Record; + + interface Visitor extends Metadata { + id: string; + } + + interface Account extends Metadata { + id?: string; + } + + interface InitOptions extends Identity { + apiKey?: string; + excludeAllText?: boolean; + excludeTitle?: boolean; + disablePersistence?: boolean; + guides?: { + delay?: boolean; + disable?: boolean; + timeout?: number; + tooltip?: { + arrowSize?: number; + } + }; + events?: EventCallbacks; + } + + interface EventCallbacks { + ready?(): void; + guidesLoaded?(): void; + guidesFailed?(): void; + } + + interface Pendo { + // Initialization and Identification + initialize(options: InitOptions): void; + identify(visitorId: string, accountId?: string): void; + identify(identity: Identity): void; + isReady(): boolean; + flushNow(): Promise; + updateOptions(visitorMetadata: Metadata): void; + getVersion(): string; + getVisitorId(): string; + getAccountId(): string; + getCurrentUrl(): string; + + // Guides and Guide Center + findGuideByName(name: string): Guide | void; + findGuideById(id: string): Guide | void; + showGuideByName(name: string): void; + showGuideById(id: string): void; + toggleLauncher(): void; + removeLauncher(): void; + + // Troubleshooting + loadGuides(): void; + startGuides(): void; + stopGuides(): void; + + // Debugging + enableDebugging(): void; + disableDebugging(): void; + isDebuggingEnabled(coerce?: false): "Yes" | "No"; + isDebuggingEnabled(coerce: true): boolean; + debugging: Debugging; + + // Events + events: Events; + track(trackType: string, metadata?: Metadata): void; + + // Guide Events + onGuideAdvanced(step?: GuideStep): void; + onGuideAdvanced(steps: { steps: number }): void; + onGuidePrevious(step?: GuideStep): void; + onGuideDismissed(step?: GuideStep): void; + onGuideDismissed(until: { until: "reload" }): void; + + // Other + validateInstall(): void; + dom(input: any): HTMLElement; // TODO + } + + interface Debugging { + getEventCache(): any[]; // TODO + getAllGuides(): Guide[]; + getAutoGuides(): { auto: Guide[]; override: Guide[] }; + getBadgeGuides(): Guide[]; + getLauncherGuides(): Guide[]; + } + + type Events = { + [K in keyof EventCallbacks]-?: (callback: EventCallbacks[K]) => Events; + }; + + interface Guide { + createdByUser: User; + createdAt: number; + lastUpdatedByUser: User; + lastUpdatedAt: number; + kind: string; + rootVersionId: string; + stableVersionId: string; + id: string; name: string; - tailLength?: number; + state: "published" | "staged" | "draft" | "disabled"; + launchMethod: "api" | "automatic" | "badge" | "dom" | "launcher"; + isMultiStep: boolean; + steps: GuideStep[]; + attributes: { + type: string; + device: { desktop: boolean; mobile: boolean; type: "desktop" | "mobile" }; + badge: any; + priority: number; + launcher: { keywords: string[] }; + }; + audience: any[]; // TODO + audienceUiHint: { filters: any[] }; // TODO + resetAt: number; + publishedAt: number; } - //~ We can write 'const v: myLib.VetID = 42;' - //~ or 'const v: myLib.VetID = "bob";' - type VetID = string | number; + interface User { + id: string; + username: string; + first: string; + last: string; + role: number; + userType: string; + } - //~ We can invoke 'myLib.checkCat(c)' or 'myLib.checkCat(c, v);' - function checkCat(c: Cat, s?: VetID); + interface GuideStep { + id: string; + guideId: string; + type: string; + elementPathRule: string; + contentType: string; + contentUrl?: string; + contentUrlCss?: string; + contentUrlJs?: string; + rank: number; + advanceMethod: "button" | "programatic" /* sic */ | "element"; + thumbnailUrls?: string; + attributes: { + height: number; + width: number; + autoHeight: boolean; + position: string; + css: string; + variables: any; + }; + lastUpdatedAt: number; + resetAt: number; + } } + +declare const pendo: pendo.Pendo; diff --git a/types/pendo-io-agent/pendo-io-agent-tests.ts b/types/pendo-io-agent/pendo-io-agent-tests.ts index e69de29bb2..575b039686 100644 --- a/types/pendo-io-agent/pendo-io-agent-tests.ts +++ b/types/pendo-io-agent/pendo-io-agent-tests.ts @@ -0,0 +1,78 @@ +// Examples from: https://developers.pendo.io/docs/?bash#agent-api + +pendo.initialize({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.identify( + "PUT_VISITOR_ID_HERE", + "PUT_ACCOUNT_ID_HERE" +); + +pendo.identify({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.debugging.getEventCache(); + +pendo.events + .ready(function () { + // Do something once `pendo.isReady()` would return `true` + }) + .guidesLoaded(function () { + // Do something when Guides load + }) + .guidesFailed(function () { + // Do something when Guides fail to load + }); + +pendo.initialize({ + apiKey: 'YOUR_API_KEY', + visitor: { id: "" }, + account: { id: "" }, + events: { + ready: function () { + // Do something when pendo is initialized + } + } +}); + +pendo.track("User Registered", { + userId: "user.id", + plan: "user.plan", + accountType: "Facebook" +}); + +try { + throw new Error(); +} +catch (error) { + pendo.track("JIRA-12345--error-tripped", { + message: error.message, + stack: error.stack + }); +} + +pendo.dom("").closest('._pendo-guide-next_') + +pendo.onGuideAdvanced(); +pendo.onGuideAdvanced({ steps: 2 }); +pendo.onGuideDismissed(); diff --git a/types/pendo-io-agent/tsconfig.json b/types/pendo-io-agent/tsconfig.json index 35695dd90c..4ee19675e0 100644 --- a/types/pendo-io-agent/tsconfig.json +++ b/types/pendo-io-agent/tsconfig.json @@ -1,12 +1,13 @@ { "compilerOptions": { - "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From ef25a112620ddf8e21f902efa98432ef8f6325ed Mon Sep 17 00:00:00 2001 From: Aaron Beall Date: Mon, 4 Mar 2019 23:31:51 -0500 Subject: [PATCH 141/265] Renamed to pendo-io-browser per tslint, other lint fixes --- .../{pendo-io-agent => pendo-io-browser}/index.d.ts | 3 ++- .../pendo-io-browser-tests.ts} | 13 ++++++------- .../tsconfig.json | 3 ++- .../tslint.json | 0 4 files changed, 10 insertions(+), 9 deletions(-) rename types/{pendo-io-agent => pendo-io-browser}/index.d.ts (98%) rename types/{pendo-io-agent/pendo-io-agent-tests.ts => pendo-io-browser/pendo-io-browser-tests.ts} (88%) rename types/{pendo-io-agent => pendo-io-browser}/tsconfig.json (87%) rename types/{pendo-io-agent => pendo-io-browser}/tslint.json (100%) diff --git a/types/pendo-io-agent/index.d.ts b/types/pendo-io-browser/index.d.ts similarity index 98% rename from types/pendo-io-agent/index.d.ts rename to types/pendo-io-browser/index.d.ts index 6429f3b95b..dfc04e25d4 100644 --- a/types/pendo-io-agent/index.d.ts +++ b/types/pendo-io-browser/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Pendo.io Agent 2.16 +// Type definitions for non-npm package Pendo.io Agent 2.16 // Project: https://www.pendo.io/ // Definitions by: Aaron Beall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 declare namespace pendo { interface Identity { diff --git a/types/pendo-io-agent/pendo-io-agent-tests.ts b/types/pendo-io-browser/pendo-io-browser-tests.ts similarity index 88% rename from types/pendo-io-agent/pendo-io-agent-tests.ts rename to types/pendo-io-browser/pendo-io-browser-tests.ts index 575b039686..16db208cda 100644 --- a/types/pendo-io-agent/pendo-io-agent-tests.ts +++ b/types/pendo-io-browser/pendo-io-browser-tests.ts @@ -34,13 +34,13 @@ pendo.identify({ pendo.debugging.getEventCache(); pendo.events - .ready(function () { + .ready(() => { // Do something once `pendo.isReady()` would return `true` }) - .guidesLoaded(function () { + .guidesLoaded(() => { // Do something when Guides load }) - .guidesFailed(function () { + .guidesFailed(() => { // Do something when Guides fail to load }); @@ -49,7 +49,7 @@ pendo.initialize({ visitor: { id: "" }, account: { id: "" }, events: { - ready: function () { + ready() { // Do something when pendo is initialized } } @@ -63,15 +63,14 @@ pendo.track("User Registered", { try { throw new Error(); -} -catch (error) { +} catch (error) { pendo.track("JIRA-12345--error-tripped", { message: error.message, stack: error.stack }); } -pendo.dom("").closest('._pendo-guide-next_') +pendo.dom("").closest('._pendo-guide-next_'); pendo.onGuideAdvanced(); pendo.onGuideAdvanced({ steps: 2 }); diff --git a/types/pendo-io-agent/tsconfig.json b/types/pendo-io-browser/tsconfig.json similarity index 87% rename from types/pendo-io-agent/tsconfig.json rename to types/pendo-io-browser/tsconfig.json index 4ee19675e0..e5b8fc4c3f 100644 --- a/types/pendo-io-agent/tsconfig.json +++ b/types/pendo-io-browser/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "module": "commonjs", "lib": [ "es6", "dom" @@ -18,6 +19,6 @@ }, "files": [ "index.d.ts", - "pendo-io-agent-tests.ts" + "pendo-io-browser-tests.ts" ] } diff --git a/types/pendo-io-agent/tslint.json b/types/pendo-io-browser/tslint.json similarity index 100% rename from types/pendo-io-agent/tslint.json rename to types/pendo-io-browser/tslint.json From d6bdcea216db4fb7c546bb72e51cee1b1753ae92 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Tue, 5 Mar 2019 17:15:20 +1100 Subject: [PATCH 142/265] Added type defs for gl-vec2 --- types/gl-vec2/add.d.ts | 6 ++ types/gl-vec2/clone.d.ts | 6 ++ types/gl-vec2/copy.d.ts | 6 ++ types/gl-vec2/create.d.ts | 6 ++ types/gl-vec2/cross.d.ts | 6 ++ types/gl-vec2/dist.d.ts | 6 ++ types/gl-vec2/div.d.ts | 6 ++ types/gl-vec2/dot.d.ts | 6 ++ types/gl-vec2/equals.d.ts | 6 ++ types/gl-vec2/exactEquals.d.ts | 6 ++ types/gl-vec2/floor.d.ts | 6 ++ types/gl-vec2/forEach.d.ts | 6 ++ types/gl-vec2/fromValues.d.ts | 6 ++ types/gl-vec2/gl-vec2-tests.ts | 134 ++++++++++++++++++++++++++++++ types/gl-vec2/index.d.ts | 75 +++++++++++++++++ types/gl-vec2/inverse.d.ts | 6 ++ types/gl-vec2/len.d.ts | 6 ++ types/gl-vec2/lerp.d.ts | 6 ++ types/gl-vec2/limit.d.ts | 6 ++ types/gl-vec2/max.d.ts | 6 ++ types/gl-vec2/min.d.ts | 6 ++ types/gl-vec2/mul.d.ts | 6 ++ types/gl-vec2/negate.d.ts | 6 ++ types/gl-vec2/normalize.d.ts | 6 ++ types/gl-vec2/random.d.ts | 6 ++ types/gl-vec2/scale.d.ts | 6 ++ types/gl-vec2/scaleAndAdd.d.ts | 6 ++ types/gl-vec2/set.d.ts | 6 ++ types/gl-vec2/sqrDist.d.ts | 6 ++ types/gl-vec2/sqrLen.d.ts | 6 ++ types/gl-vec2/sub.d.ts | 6 ++ types/gl-vec2/transformMat2.d.ts | 6 ++ types/gl-vec2/transformMat2d.d.ts | 6 ++ types/gl-vec2/transformMat3.d.ts | 6 ++ types/gl-vec2/transformMat4.d.ts | 6 ++ types/gl-vec2/tsconfig.json | 58 +++++++++++++ types/gl-vec2/tslint.json | 3 + 37 files changed, 468 insertions(+) create mode 100644 types/gl-vec2/add.d.ts create mode 100644 types/gl-vec2/clone.d.ts create mode 100644 types/gl-vec2/copy.d.ts create mode 100644 types/gl-vec2/create.d.ts create mode 100644 types/gl-vec2/cross.d.ts create mode 100644 types/gl-vec2/dist.d.ts create mode 100644 types/gl-vec2/div.d.ts create mode 100644 types/gl-vec2/dot.d.ts create mode 100644 types/gl-vec2/equals.d.ts create mode 100644 types/gl-vec2/exactEquals.d.ts create mode 100644 types/gl-vec2/floor.d.ts create mode 100644 types/gl-vec2/forEach.d.ts create mode 100644 types/gl-vec2/fromValues.d.ts create mode 100644 types/gl-vec2/gl-vec2-tests.ts create mode 100644 types/gl-vec2/index.d.ts create mode 100644 types/gl-vec2/inverse.d.ts create mode 100644 types/gl-vec2/len.d.ts create mode 100644 types/gl-vec2/lerp.d.ts create mode 100644 types/gl-vec2/limit.d.ts create mode 100644 types/gl-vec2/max.d.ts create mode 100644 types/gl-vec2/min.d.ts create mode 100644 types/gl-vec2/mul.d.ts create mode 100644 types/gl-vec2/negate.d.ts create mode 100644 types/gl-vec2/normalize.d.ts create mode 100644 types/gl-vec2/random.d.ts create mode 100644 types/gl-vec2/scale.d.ts create mode 100644 types/gl-vec2/scaleAndAdd.d.ts create mode 100644 types/gl-vec2/set.d.ts create mode 100644 types/gl-vec2/sqrDist.d.ts create mode 100644 types/gl-vec2/sqrLen.d.ts create mode 100644 types/gl-vec2/sub.d.ts create mode 100644 types/gl-vec2/transformMat2.d.ts create mode 100644 types/gl-vec2/transformMat2d.d.ts create mode 100644 types/gl-vec2/transformMat3.d.ts create mode 100644 types/gl-vec2/transformMat4.d.ts create mode 100644 types/gl-vec2/tsconfig.json create mode 100644 types/gl-vec2/tslint.json diff --git a/types/gl-vec2/add.d.ts b/types/gl-vec2/add.d.ts new file mode 100644 index 0000000000..f19025387f --- /dev/null +++ b/types/gl-vec2/add.d.ts @@ -0,0 +1,6 @@ +/** + * Adds two vec2's + */ +declare function add(out: number[], a: number[], b: number[]): number[]; + +export = add; diff --git a/types/gl-vec2/clone.d.ts b/types/gl-vec2/clone.d.ts new file mode 100644 index 0000000000..53f4fd9aea --- /dev/null +++ b/types/gl-vec2/clone.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new vec2 initialized with values from an existing vector + */ +declare function clone(a: number[]): number[]; + +export = clone; diff --git a/types/gl-vec2/copy.d.ts b/types/gl-vec2/copy.d.ts new file mode 100644 index 0000000000..8236100308 --- /dev/null +++ b/types/gl-vec2/copy.d.ts @@ -0,0 +1,6 @@ +/** + * Copy the values from one vec2 to another. + */ +declare function copy(out: number[], a: number[]): number[]; + +export = copy; diff --git a/types/gl-vec2/create.d.ts b/types/gl-vec2/create.d.ts new file mode 100644 index 0000000000..26b76eee80 --- /dev/null +++ b/types/gl-vec2/create.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new, empty vec2. + */ +declare function create(): number[]; + +export = create; diff --git a/types/gl-vec2/cross.d.ts b/types/gl-vec2/cross.d.ts new file mode 100644 index 0000000000..6ce6cab5f4 --- /dev/null +++ b/types/gl-vec2/cross.d.ts @@ -0,0 +1,6 @@ +/** + * Computes the cross product of two vec2's Note that the cross product must by definition produce a 3D vector. + */ +declare function cross(out: number[], a: number[], b: number[]): number[]; + +export = cross; diff --git a/types/gl-vec2/dist.d.ts b/types/gl-vec2/dist.d.ts new file mode 100644 index 0000000000..d83a49e3fb --- /dev/null +++ b/types/gl-vec2/dist.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the euclidian distance between two vec2's. Aliased as dist. + */ +declare function dist(a: number[], b: number[]): number; + +export = dist; diff --git a/types/gl-vec2/div.d.ts b/types/gl-vec2/div.d.ts new file mode 100644 index 0000000000..7999d6f3e9 --- /dev/null +++ b/types/gl-vec2/div.d.ts @@ -0,0 +1,6 @@ +/** + * Divides two vec2's. Aliased as div. + */ +declare function div(out: number[], a: number[], b: number[]): number[]; + +export = div; diff --git a/types/gl-vec2/dot.d.ts b/types/gl-vec2/dot.d.ts new file mode 100644 index 0000000000..60a7c484dc --- /dev/null +++ b/types/gl-vec2/dot.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the dot product of two vec2's. + */ +declare function dot(a: number[], b: number[]): number; + +export = dot; diff --git a/types/gl-vec2/equals.d.ts b/types/gl-vec2/equals.d.ts new file mode 100644 index 0000000000..3892372e7e --- /dev/null +++ b/types/gl-vec2/equals.d.ts @@ -0,0 +1,6 @@ +/** + * Returns whether or not the vectors have approximately the same elements in the same position. + */ +declare function equals(a: number[], b: number[]): boolean; + +export = equals; diff --git a/types/gl-vec2/exactEquals.d.ts b/types/gl-vec2/exactEquals.d.ts new file mode 100644 index 0000000000..ce8772b5fc --- /dev/null +++ b/types/gl-vec2/exactEquals.d.ts @@ -0,0 +1,6 @@ +/** + * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===). + */ +declare function exactEquals(a: number[], b: number[]): boolean; + +export = exactEquals; diff --git a/types/gl-vec2/floor.d.ts b/types/gl-vec2/floor.d.ts new file mode 100644 index 0000000000..7909d20a23 --- /dev/null +++ b/types/gl-vec2/floor.d.ts @@ -0,0 +1,6 @@ +/** + * Math.floor the components of a vec2. + */ +declare function floor(out: number[], a: number[]): number[]; + +export = floor; diff --git a/types/gl-vec2/forEach.d.ts b/types/gl-vec2/forEach.d.ts new file mode 100644 index 0000000000..7da060f549 --- /dev/null +++ b/types/gl-vec2/forEach.d.ts @@ -0,0 +1,6 @@ +/** + * Perform some operation over an array of vec2s. + */ +declare function forEach(a: number[], stride: number, offset: number, count: number, fn: (a: number[], b: number[], arg: object) => number[], arg: object): number[]; + +export = forEach; diff --git a/types/gl-vec2/fromValues.d.ts b/types/gl-vec2/fromValues.d.ts new file mode 100644 index 0000000000..7a3f7928e9 --- /dev/null +++ b/types/gl-vec2/fromValues.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new vec2 initialized with the given values. + */ +declare function fromValues(x: number, y: number): number[]; + +export = fromValues; diff --git a/types/gl-vec2/gl-vec2-tests.ts b/types/gl-vec2/gl-vec2-tests.ts new file mode 100644 index 0000000000..6db61462ac --- /dev/null +++ b/types/gl-vec2/gl-vec2-tests.ts @@ -0,0 +1,134 @@ +import GlVec2 = require("gl-vec2"); + +import GlVec2Add = require("gl-vec2/add"); +import GlVec2Clone = require("gl-vec2/clone"); +import GlVec2Copy = require("gl-vec2/copy"); +import GlVec2Create = require("gl-vec2/create"); +import GlVec2Cross = require("gl-vec2/cross"); +import GlVec2Dist = require("gl-vec2/dist"); +import GlVec2Div = require("gl-vec2/div"); +import GlVec2Dot = require("gl-vec2/dot"); +import GlVec2Equals = require("gl-vec2/equals"); +import GlVec2exactEquals = require("gl-vec2/exactEquals"); +import GlVec2forEach = require("gl-vec2/forEach"); +import GlVec2fromValues = require("gl-vec2/fromValues"); +import GlVec2Floor = require("gl-vec2/floor"); +import GlVec2Inverse = require("gl-vec2/inverse"); +import GlVec2Len = require("gl-vec2/len"); +import GlVec2Lerp = require("gl-vec2/lerp"); +import GlVec2Limit = require("gl-vec2/limit"); +import GlVec2Max = require("gl-vec2/max"); +import GlVec2Min = require("gl-vec2/min"); +import GlVec2Mul = require("gl-vec2/mul"); +import GlVec2Negate = require("gl-vec2/negate"); +import GlVec2Normalize = require("gl-vec2/normalize"); +import GlVec2Random = require("gl-vec2/random"); +import GlVec2Scale = require("gl-vec2/scale"); +import GlVec2ScaleAndAdd = require("gl-vec2/scaleAndAdd"); +import GlVec2Set = require("gl-vec2/set"); +import GlVec2SqrDist = require("gl-vec2/sqrDist"); +import GlVec2SqrLen = require("gl-vec2/sqrLen"); +import GlVec2Sub = require("gl-vec2/sub"); +import GlVec2TransformMat2 = require("gl-vec2/transformMat2"); +import GlVec2TransformMat2d = require("gl-vec2/transformMat2d"); +import GlVec2TransformMat3 = require("gl-vec2/transformMat3"); +import GlVec2TransformMat4 = require("gl-vec2/transformMat4"); + +GlVec2.add([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Add([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.clone([1, 2, 3]); +GlVec2Clone([1, 2, 3]); + +GlVec2.copy([1, 2, 3], [1, 2, 3]); +GlVec2Copy([1, 2, 3], [1, 2, 3]); + +GlVec2.create(); +GlVec2Create(); + +GlVec2.cross([1, 2], [1, 2], [1, 2]); +GlVec2Cross([1, 2], [1, 2], [1, 2]); + +GlVec2.dist([1, 2, 3], [1, 2, 3]); +GlVec2Dist([1, 2, 3], [1, 2, 3]); + +GlVec2.div([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Div([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.dot([1, 2, 3], [1, 2, 3]); +GlVec2Dot([1, 2, 3], [1, 2, 3]); + +GlVec2.forEach([1, 2, 3], 5, 6, 1, () => [3], {}); +GlVec2forEach([1, 2, 3], 5, 6, 1, () => [3], {}); + +GlVec2.fromValues(1, 2); +GlVec2fromValues(1, 2); + +GlVec2.floor([1, 2], [1, 2]); +GlVec2Floor([1, 2], [1, 2]); + +GlVec2.equals([1, 2, 3], [1, 2, 3]); +GlVec2Equals([1, 2, 3], [1, 2, 3]); + +GlVec2.exactEquals([1, 2, 3], [1, 2, 3]); +GlVec2exactEquals([1, 2, 3], [1, 2, 3]); + +GlVec2.inverse([1, 2, 3], [1, 2, 3]); +GlVec2Inverse([1, 2, 3], [1, 2, 3]); + +GlVec2.len([1, 2, 3]); +GlVec2Len([1, 2, 3]); + +GlVec2.lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); +GlVec2Lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); + +GlVec2.limit([1, 2], [1, 2], 5); +GlVec2Limit([1, 2], [1, 2], 5); + +GlVec2.max([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Max([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.min([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Min([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.mul([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Mul([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.negate([1, 2, 3], [1, 2, 3]); +GlVec2Negate([1, 2, 3], [1, 2, 3]); + +GlVec2.normalize([1, 2, 3], [1, 2, 3]); +GlVec2Normalize([1, 2, 3], [1, 2, 3]); + +GlVec2.random([1, 2, 3], 6); +GlVec2Random([1, 2, 3], 6); + +GlVec2.scale([1, 2, 3], [1, 2, 3], 6); +GlVec2Scale([1, 2, 3], [1, 2, 3], 6); + +GlVec2.scaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); +GlVec2ScaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); + +GlVec2.set([1, 2], 1, 2); +GlVec2Set([1, 2], 1, 2); + +GlVec2.sqrDist([1, 2, 3], [1, 2, 3]); +GlVec2SqrDist([1, 2, 3], [1, 2, 3]); + +GlVec2.sqrLen([1, 2, 3]); +GlVec2SqrLen([1, 2, 3]); + +GlVec2.sub([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Sub([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat2d([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]); diff --git a/types/gl-vec2/index.d.ts b/types/gl-vec2/index.d.ts new file mode 100644 index 0000000000..65eb6ae91a --- /dev/null +++ b/types/gl-vec2/index.d.ts @@ -0,0 +1,75 @@ +// Type definitions for gl-vec2 1.3 +// Project: https://github.com/stackgl/gl-vec2 +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import add = require('./add'); +import clone = require('./clone'); +import copy = require('./copy'); +import create = require('./create'); +import cross = require('./cross'); +import dist = require('./dist'); +import div = require('./div'); +import dot = require('./dot'); +import equals = require('./equals'); +import exactEquals = require('./exactEquals'); +import floor = require('./floor'); +import forEach = require('./forEach'); +import fromValues = require('./fromValues'); +import inverse = require('./inverse'); +import len = require('./len'); +import lerp = require('./lerp'); +import limit = require('./limit'); +import max = require('./max'); +import min = require('./min'); +import mul = require('./mul'); +import negate = require('./negate'); +import normalize = require('./normalize'); +import random = require('./random'); +import scale = require('./scale'); +import scaleAndAdd = require('./scaleAndAdd'); +import set = require('./set'); +import sqrDist = require('./sqrDist'); +import sqrLen = require('./sqrLen'); +import sub = require('./sub'); +import transformMat2 = require('./transformMat2'); +import transformMat2d = require('./transformMat2d'); +import transformMat3 = require('./transformMat3'); +import transformMat4 = require('./transformMat4'); + +export { + add, + clone, + copy, + create, + cross, + dist, + div, + dot, + equals, + exactEquals, + floor, + forEach, + fromValues, + inverse, + len, + lerp, + limit, + max, + min, + mul, + negate, + normalize, + random, + scale, + scaleAndAdd, + set, + sqrDist, + sqrLen, + sub, + transformMat2, + transformMat2d, + transformMat3, + transformMat4 +}; diff --git a/types/gl-vec2/inverse.d.ts b/types/gl-vec2/inverse.d.ts new file mode 100644 index 0000000000..af3840b2a0 --- /dev/null +++ b/types/gl-vec2/inverse.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the inverse of the components of a vec2. + */ +declare function inverse(out: number[], a: number[]): number[]; + +export = inverse; diff --git a/types/gl-vec2/len.d.ts b/types/gl-vec2/len.d.ts new file mode 100644 index 0000000000..cfb66abfae --- /dev/null +++ b/types/gl-vec2/len.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the length of a vec2. Aliased as len. + */ +declare function len(a: number[]): number; + +export = len; diff --git a/types/gl-vec2/lerp.d.ts b/types/gl-vec2/lerp.d.ts new file mode 100644 index 0000000000..d0c4ed4cda --- /dev/null +++ b/types/gl-vec2/lerp.d.ts @@ -0,0 +1,6 @@ +/** + * Performs a linear interpolation between two vec2's + */ +declare function lerp(out: number[], a: number[], b: number[], t: number): number[]; + +export = lerp; diff --git a/types/gl-vec2/limit.d.ts b/types/gl-vec2/limit.d.ts new file mode 100644 index 0000000000..abf7af287a --- /dev/null +++ b/types/gl-vec2/limit.d.ts @@ -0,0 +1,6 @@ +/** + * Limit the magnitude of this vector to the value used for the max parameter. + */ +declare function limit(out: number[], a: number[], max: number): number[]; + +export = limit; diff --git a/types/gl-vec2/max.d.ts b/types/gl-vec2/max.d.ts new file mode 100644 index 0000000000..38a64a2c34 --- /dev/null +++ b/types/gl-vec2/max.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the maximum of two vec2's. + */ +declare function max(out: number[], a: number[], b: number[]): number[]; + +export = max; diff --git a/types/gl-vec2/min.d.ts b/types/gl-vec2/min.d.ts new file mode 100644 index 0000000000..19727a0e4e --- /dev/null +++ b/types/gl-vec2/min.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the minimum of two vec2's. + */ +declare function min(out: number[], a: number[], b: number[]): number[]; + +export = min; diff --git a/types/gl-vec2/mul.d.ts b/types/gl-vec2/mul.d.ts new file mode 100644 index 0000000000..0322ca0e9d --- /dev/null +++ b/types/gl-vec2/mul.d.ts @@ -0,0 +1,6 @@ +/** + * Multiplies two vec2's. Aliased as mul. + */ +declare function mul(out: number[], a: number[], b: number[]): number[]; + +export = mul; diff --git a/types/gl-vec2/negate.d.ts b/types/gl-vec2/negate.d.ts new file mode 100644 index 0000000000..6edb8f50f6 --- /dev/null +++ b/types/gl-vec2/negate.d.ts @@ -0,0 +1,6 @@ +/** + * Negates the components of a vec2. + */ +declare function negate(out: number[], a: number[]): number[]; + +export = negate; diff --git a/types/gl-vec2/normalize.d.ts b/types/gl-vec2/normalize.d.ts new file mode 100644 index 0000000000..139a1c708e --- /dev/null +++ b/types/gl-vec2/normalize.d.ts @@ -0,0 +1,6 @@ +/** + * Normalize a number + */ +declare function normalize(out: number[], a: number[]): number[]; + +export = normalize; diff --git a/types/gl-vec2/random.d.ts b/types/gl-vec2/random.d.ts new file mode 100644 index 0000000000..0fa076543a --- /dev/null +++ b/types/gl-vec2/random.d.ts @@ -0,0 +1,6 @@ +/** + * Generates a random vector with the given scale. + */ +declare function random(out: number[], scale: number): number[]; + +export = random; diff --git a/types/gl-vec2/scale.d.ts b/types/gl-vec2/scale.d.ts new file mode 100644 index 0000000000..1348ff78c0 --- /dev/null +++ b/types/gl-vec2/scale.d.ts @@ -0,0 +1,6 @@ +/** + * Scales a vec2 by a scalar number. + */ +declare function scale(out: number[], a: number[], b: number): number[]; + +export = scale; diff --git a/types/gl-vec2/scaleAndAdd.d.ts b/types/gl-vec2/scaleAndAdd.d.ts new file mode 100644 index 0000000000..2a3e9b8a2d --- /dev/null +++ b/types/gl-vec2/scaleAndAdd.d.ts @@ -0,0 +1,6 @@ +/** + * Adds two vec2's after scaling the second operand by a scalar value. + */ +declare function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[]; + +export = scaleAndAdd; diff --git a/types/gl-vec2/set.d.ts b/types/gl-vec2/set.d.ts new file mode 100644 index 0000000000..33ed71f0f3 --- /dev/null +++ b/types/gl-vec2/set.d.ts @@ -0,0 +1,6 @@ +/** + * Set the components of a vec2 to the given values. + */ +declare function set(out: number[], x: number, y: number): number[]; + +export = set; diff --git a/types/gl-vec2/sqrDist.d.ts b/types/gl-vec2/sqrDist.d.ts new file mode 100644 index 0000000000..d510d253e0 --- /dev/null +++ b/types/gl-vec2/sqrDist.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the squared euclidian distance between two vec2's. Aliased as sqrDist. + */ +declare function sqrDist(a: number[], b: number[]): number[]; + +export = sqrDist; diff --git a/types/gl-vec2/sqrLen.d.ts b/types/gl-vec2/sqrLen.d.ts new file mode 100644 index 0000000000..3237540072 --- /dev/null +++ b/types/gl-vec2/sqrLen.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the squared length of a vec2. Aliased as sqrLen. + */ +declare function sqrLen(a: number[]): number[]; + +export = sqrLen; diff --git a/types/gl-vec2/sub.d.ts b/types/gl-vec2/sub.d.ts new file mode 100644 index 0000000000..7b5976404d --- /dev/null +++ b/types/gl-vec2/sub.d.ts @@ -0,0 +1,6 @@ +/** + * Subtracts vector b from vector a. Aliased as sub. + */ +declare function sub(out: number[], a: number[], b: number[]): number[]; + +export = sub; diff --git a/types/gl-vec2/transformMat2.d.ts b/types/gl-vec2/transformMat2.d.ts new file mode 100644 index 0000000000..9ee67f7629 --- /dev/null +++ b/types/gl-vec2/transformMat2.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat2. + */ +declare function transformMat2(out: number[], a: number[], m: number[]): number[]; + +export = transformMat2; diff --git a/types/gl-vec2/transformMat2d.d.ts b/types/gl-vec2/transformMat2d.d.ts new file mode 100644 index 0000000000..978078f1da --- /dev/null +++ b/types/gl-vec2/transformMat2d.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec with a mat2d. + */ +declare function transformMat2d(out: number[], a: number[], m: number[]): number[]; + +export = transformMat2d; diff --git a/types/gl-vec2/transformMat3.d.ts b/types/gl-vec2/transformMat3.d.ts new file mode 100644 index 0000000000..682ded3966 --- /dev/null +++ b/types/gl-vec2/transformMat3.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat3 3rd vector component is implicitly '1' + */ +declare function transformMat3(out: number[], a: number[], m: number[]): number[]; + +export = transformMat3; diff --git a/types/gl-vec2/transformMat4.d.ts b/types/gl-vec2/transformMat4.d.ts new file mode 100644 index 0000000000..f7f96e6d41 --- /dev/null +++ b/types/gl-vec2/transformMat4.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat4 3rd vector component is implicitly '0' 4th vector component is implicitly '1' + */ +declare function transformMat4(out: number[], a: number[], m: number[]): number[]; + +export = transformMat4; diff --git a/types/gl-vec2/tsconfig.json b/types/gl-vec2/tsconfig.json new file mode 100644 index 0000000000..c1f24a1dad --- /dev/null +++ b/types/gl-vec2/tsconfig.json @@ -0,0 +1,58 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "add.d.ts", + "clone.d.ts", + "copy.d.ts", + "create.d.ts", + "cross.d.ts", + "dist.d.ts", + "div.d.ts", + "dot.d.ts", + "equals.d.ts", + "exactEquals.d.ts", + "forEach.d.ts", + "fromValues.d.ts", + "floor.d.ts", + "inverse.d.ts", + "len.d.ts", + "lerp.d.ts", + "limit.d.ts", + "max.d.ts", + "min.d.ts", + "mul.d.ts", + "negate.d.ts", + "normalize.d.ts", + "random.d.ts", + "scale.d.ts", + "scaleAndAdd.d.ts", + "set.d.ts", + "sqrDist.d.ts", + "sqrLen.d.ts", + "sub.d.ts", + "transformMat2.d.ts", + "transformMat2d.d.ts", + "transformMat3.d.ts", + "transformMat4.d.ts", + "gl-vec2-tests.ts" + ] +} diff --git a/types/gl-vec2/tslint.json b/types/gl-vec2/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/gl-vec2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From b2e95f16384b941696ef8b8c36b5c208786a0d72 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 5 Mar 2019 10:59:46 +0100 Subject: [PATCH 143/265] Update Select.d.ts --- types/react-select/lib/Select.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react-select/lib/Select.d.ts b/types/react-select/lib/Select.d.ts index 11853f6be9..fd85909702 100644 --- a/types/react-select/lib/Select.d.ts +++ b/types/react-select/lib/Select.d.ts @@ -50,7 +50,9 @@ export interface FormatOptionLabelMeta { selectValue: ValueType; } -export interface Props { +type SelectComponentsProps = { [key in string]: any }; + +export interface Props extends SelectComponentsProps { /* Aria label (for assistive tech) */ 'aria-label'?: string; /* HTML ID of an element that should be used as the label (for assistive tech) */ From 15e163aef6e358fcf8d522cc5419ab686e6db8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?v=C3=A9gtelens=C3=A9g?= Date: Tue, 5 Mar 2019 13:17:02 +0200 Subject: [PATCH 144/265] Added missing prop for the multi select component --- types/react-widgets/lib/Multiselect.d.ts | 61 ++++-- types/react-widgets/react-widgets-tests.tsx | 196 ++++++++++---------- 2 files changed, 139 insertions(+), 118 deletions(-) diff --git a/types/react-widgets/lib/Multiselect.d.ts b/types/react-widgets/lib/Multiselect.d.ts index 56a2753d3e..afafdfcb12 100644 --- a/types/react-widgets/lib/Multiselect.d.ts +++ b/types/react-widgets/lib/Multiselect.d.ts @@ -1,12 +1,14 @@ -import * as React from 'react'; -import { ReactWidgetsCommonDropdownProps, AutoFocus } from './CommonProps'; +import * as React from "react"; +import { ReactWidgetsCommonDropdownProps, AutoFocus } from "./CommonProps"; -interface MultiselectProps extends ReactWidgetsCommonDropdownProps, AutoFocus { +interface MultiselectProps + extends ReactWidgetsCommonDropdownProps, + AutoFocus { /** * Enables the list option creation UI. onFilter will only the UI when actively filtering for a list item. * @default 'onFilter' */ - allowCreate?: boolean | 'onFilter'; + allowCreate?: boolean | "onFilter"; /** * The current values of the Multiselect. The value should can null, or an array of * valueField values, or an array of objects (such as a few items in the data array) @@ -20,20 +22,26 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps void; + onChange?: ( + dataItems: any[], + metadata: { + dataItem: any; + action: "insert" | "remove"; + originalEvent?: any; + lastValue?: any[]; + searchTerm?: string; + } + ) => void; /** * This handler fires when an item has been selected from the list. It fires before the * onChange handler, and fires regardless of whether the value has actually changed */ - onSelect?: (value: any, metadata: { - originalEvent: any; - }) => void; + onSelect?: ( + value: any, + metadata: { + originalEvent: any; + } + ) => void; /** * This handler fires when the user chooses to create a new tag, not in the data list. It is * up to the widget parent to implement creation logic, a common implementation is shown @@ -100,11 +108,14 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps void; + onSearch?: ( + searchTerm: string, + metadata: { + action: "clear" | "input"; + lastSearchTerm?: string; + originalEvent?: any; + } + ) => void; /** * Whether or not the Multiselect is open. When unset (undefined) the Multiselect will * handle the opening and closing internally. The defaultOpen prop can be used to set an @@ -124,7 +135,12 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps boolean); + filter?: + | false + | "startsWith" + | "endsWith" + | "contains" + | ((dataItem: any, searchTerm: string) => boolean); /** * Use in conjunction with the filter prop. Filter the list without regard for case. This * only applies to non function values for filter. @@ -167,6 +183,11 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps{props.value}; @@ -18,105 +26,97 @@ function listComponent(props: { value: string }) { class Test extends React.Component> { render() { return ( -
- - - - - - - +
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + +
+
+ + + + + + + +
+
+ + + } + /> + + + + + + + +
+
+ } + /> +
-
- - - - - - - -
-
- - - - - -
-
- - - - - - - -
-
- - - - } - /> - - - - - - -
-
- } /> -
-
); } } From 55bfcc3dd9681a8fdb07ee44e900198c39270518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Holhjem?= Date: Tue, 5 Mar 2019 12:57:58 +0100 Subject: [PATCH 145/265] More missing props and some corrections From doc: https://github.com/ericgio/react-bootstrap-typeahead/blob/master/docs/Props.md --- types/react-bootstrap-typeahead/index.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 18311bccb5..f916a4c293 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -5,6 +5,7 @@ // Paito Anderson // Andreas Richter // Dale Fenton +// Håkon Holhjem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -126,7 +127,7 @@ export interface TypeaheadProps { but not the list of original options unless handled as such by Typeahead's parent. The newly added item will always be returned as an object even if the other options are simply strings, so be sure your onChange callback can handle this. */ - allowNew?: boolean | ((results: T[], props: TypeaheadProps) => boolean); + allowNew?: boolean | ((results: T[], props: AllTypeaheadOwnAndInjectedProps) => boolean); /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; @@ -172,6 +173,9 @@ export interface TypeaheadProps { Does not work with allowNew. */ highlightOnlyResult?: boolean; + /* An html id attribute, required for assistive technologies such as screen readers. */ + id?: string | number; + /* Whether the filter should ignore accents and other diacritical marks. */ ignoreDiacritics?: boolean; @@ -198,7 +202,7 @@ export interface TypeaheadProps { so as not to render too many DOM nodes in the case of large data sets. */ maxResults?: number; - /* Id applied to the top-level menu element. Required for accessibility. */ + /* DEPRECATED. Id applied to the top-level menu element. Required for accessibility. */ menuId?: string; /* Number of input characters that must be entered before showing results. */ @@ -253,6 +257,10 @@ export interface TypeaheadProps { /* Placeholder text for the input. */ placeholder?: string; + /* Whether to use fixed positioning for the menu, which is useful when rendering inside a + container with overflow: hidden;. Uses absolute positioning by default. */ + positionFixed?: boolean; + /* Callback for custom menu rendering. */ renderMenu?: (results: Array>, menuProps: any) => React.ReactNode; From ab5ce28a5c986c59398d2d5c4b4295492b604a3a Mon Sep 17 00:00:00 2001 From: Rob Valentine Date: Tue, 5 Mar 2019 14:29:23 +0200 Subject: [PATCH 146/265] Added MouseTransition as per module spec --- types/react-dnd-multi-backend/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index 36c161beb0..ea18d98b1a 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -97,7 +97,10 @@ export interface PreviewProps { * This is frequently used with the Touch backend to provide a preview on mobile devices. */ export class Preview extends PureComponent {} - +/** + * Pre-existing/default react-dnd-multi-backend transition available to use. + */ + export const MouseTransition: Transition; /** * Pre-existing/default react-dnd-touch-backend transition available to use. * This transition has the setting for "enableMouseEvents" turned on. From 95ae13766fa48b9cd17ee73b90ad6f9811f91705 Mon Sep 17 00:00:00 2001 From: Rob Valentine Date: Tue, 5 Mar 2019 14:35:13 +0200 Subject: [PATCH 147/265] Contrib --- types/react-dnd-multi-backend/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index ea18d98b1a..9797be6e28 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/LouisBrunner/react-dnd-multi-backend, https://louisbrunner.github.io/dnd-multi-backend/packages/react-dnd-multi-backend // Definitions by: Janeene Beeforth // Adam Haglund +// Rob Valentine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From e2969b1b13a910c6e4b1d000feec26b92fbef166 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 5 Mar 2019 13:42:13 +0100 Subject: [PATCH 148/265] Update Select.d.ts --- types/react-select/lib/Select.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-select/lib/Select.d.ts b/types/react-select/lib/Select.d.ts index fd85909702..57fef3bb9c 100644 --- a/types/react-select/lib/Select.d.ts +++ b/types/react-select/lib/Select.d.ts @@ -50,7 +50,7 @@ export interface FormatOptionLabelMeta { selectValue: ValueType; } -type SelectComponentsProps = { [key in string]: any }; +export type SelectComponentsProps = { [key in string]: any }; export interface Props extends SelectComponentsProps { /* Aria label (for assistive tech) */ From ea8883df25191abe36aa8c6bf1fa0e1d3c144cd4 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Tue, 5 Mar 2019 14:08:00 +0000 Subject: [PATCH 149/265] Makes some changes but macros are not valid. --- types/collectionsjs/collectionsjs-tests.ts | 5 ++++- types/collectionsjs/index.d.ts | 15 ++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index 1c3b8a5813..bc71c9e544 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -52,7 +52,10 @@ collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number collection.stringify(); // $ExpectType string collection.sum('age'); // $ExpectType any collection.take(2); // $ExpectType Collection<{ name: string; age: number; }> -collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); // $ExpectType any + +// Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); +// const collection2 = new Collection([1,2,3,4]).addToMembers(3); + collection.unique(stark => stark.age); // $ExpectType Collection<{ name: string; age: number; }> collection.values(); // $ExpectType Collection<{ name: string; age: number; }> collection.where('age', 14); // $ExpectType Collection<{ name: string; age: number; }> diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts index 40c616fcdb..364877050d 100644 --- a/types/collectionsjs/index.d.ts +++ b/types/collectionsjs/index.d.ts @@ -16,7 +16,7 @@ export default class Collection { count(): number; each(callback: (item: T) => void): Collection; filter(callback: (item: T) => boolean): Collection; - find(item: any): number; + find(item: T): number; first(callback?: ((item: T) => boolean)|null): T; flatten(deep?: boolean): Collection; get(index: number): T; @@ -24,23 +24,24 @@ export default class Collection { join(separator?: string): string; keys(): Collection; last(callback?: ((item: T) => boolean)|null): T; - map(callback: (item: T) => any): Collection; + map(callback: (item: T) => R): Collection; pluck(property: string): Collection; push(item: T): Collection; - reduce(callback: (previous: T, current: T) => any, initial: any): any; + reduce(callback: (previous: R, current: T) => R, initial: R): R; reject(callback: (item: T) => boolean): Collection; - remove(item: any): boolean; + remove(item: T): boolean; reverse(): Collection; skip(count: number): Collection; slice(start: number, end?: number): Collection; sort(compare?: () => boolean): Collection; sortBy(property: string, order?: string): Collection; stringify(): string; - sum(property?: string|null): any; + sum(property: T extends object ? keyof T : never): number take(count: number): Collection; - macro(name: string, callback: (...args: any) => any): any; + static macro(name: string, callback: (coll: Collection, ...args: unknown[]) => unknown): void; unique(callback?: string|null|((item: T) => any)): Collection; values(): Collection; - where(callback: ((item: T) => boolean)|string, value?: any): Collection; + where(key: K, value: T[K]): Collection + where(callback: (item: T) => boolean): Collection zip(array: T[]|Collection): Collection; } From 974649dd4df36342daadf4ca9d6c8c78938112b1 Mon Sep 17 00:00:00 2001 From: Eugene Kolnick Date: Tue, 5 Mar 2019 10:19:18 -0500 Subject: [PATCH 150/265] Added optional custom strategy option: `userEmailURL` See issue: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33619 --- types/passport-github2/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/passport-github2/index.d.ts b/types/passport-github2/index.d.ts index 0048cfd901..a938e8c36b 100644 --- a/types/passport-github2/index.d.ts +++ b/types/passport-github2/index.d.ts @@ -29,6 +29,7 @@ export interface StrategyOption extends passport.AuthenticateOptions { scopeSeparator?: string; customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; + userEmailURL?: string; } export type OAuth2StrategyOptionsWithoutRequiredURLs = Pick< @@ -50,6 +51,7 @@ export interface _StrategyOptionsBase extends OAuth2StrategyOptionsWithoutRequir scopeSeparator?: string; customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; + userEmailURL?: string; } export interface StrategyOptions extends _StrategyOptionsBase { From 16d1c380cba458122ba900a4fb7245f0efbe4f4a Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Tue, 5 Mar 2019 09:35:08 -0700 Subject: [PATCH 151/265] Event listener callbacks can have variable parameters --- types/cesium/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 398d05ad33..c1be0e4f16 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -706,8 +706,8 @@ declare namespace Cesium { class Event { numberOfListeners: number; - addEventListener(listener: () => void, scope?: any): Event.RemoveCallback; - removeEventListener(listener: () => void, scope?: any): boolean; + addEventListener(listener: (...args: any[]) => void, scope?: any): Event.RemoveCallback; + removeEventListener(listener: (...args: any[]) => void, scope?: any): boolean; raiseEvent(...args: any[]): void; } From a07c515fbd4732a465c01dd617cb99724b71daec Mon Sep 17 00:00:00 2001 From: Ostad Date: Tue, 5 Mar 2019 13:04:15 -0500 Subject: [PATCH 152/265] - add typedef for sendmail package --- types/sendmail/index.d.ts | 70 ++++++++++++++++++++++++++++++++ types/sendmail/sendmail-tests.ts | 24 +++++++++++ types/sendmail/tsconfig.json | 22 ++++++++++ types/sendmail/tslint.json | 1 + 4 files changed, 117 insertions(+) create mode 100644 types/sendmail/index.d.ts create mode 100644 types/sendmail/sendmail-tests.ts create mode 100644 types/sendmail/tsconfig.json create mode 100644 types/sendmail/tslint.json diff --git a/types/sendmail/index.d.ts b/types/sendmail/index.d.ts new file mode 100644 index 0000000000..191c0514fb --- /dev/null +++ b/types/sendmail/index.d.ts @@ -0,0 +1,70 @@ +// Type definitions for sendmail 1.4 +// Project: https://github.com/guileen/node-sendmail +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ If this module is a UMD module that exposes a global variable 'myLib' when + *~ loaded outside a module loader environment, declare that global here. + *~ Otherwise, delete this declaration. + */ +declare namespace sendMailConstructor { + export interface IOptions { + logger?: { + debug?: () => void; + info?: () => void; + warn?: () => void; + error?: () => void; + }; + silent?: boolean; + /** Default: False */ + dkim?: + | boolean + | { + privateKey: string; + keySelector: string; + }; + /** Default: False */ + devPort?: number | boolean; + /** Default: localhost */ + devHost?: string; + /** Default: 25 */ + smtpPort?: number; + /** Default: -1 - extra smtp host after resolveMX */ + smtpHost?: string | number; + } + + export interface IMailInput { + from: string; + to: string; + cc?: string; + bcc?: string; + replyTo?: string; + returnTo?: string; + subject: string; + type?: string; + charset?: string; + encoding?: string; + id?: string; + headers?: object; + content?: string; + html?: string; + attachments?: { + type: string; + filename: string; + content: any; + }[]; + } +} + +type CallbackFn = (err: Error, domain: string) => void; + +type SendMailFn = ( + mail: sendMailConstructor.IMailInput, + callback: CallbackFn +) => void; + +declare function sendMailConstructor( + options: sendMailConstructor.IOptions +): SendMailFn; + +export = sendMailConstructor; diff --git a/types/sendmail/sendmail-tests.ts b/types/sendmail/sendmail-tests.ts new file mode 100644 index 0000000000..f57c3b00d9 --- /dev/null +++ b/types/sendmail/sendmail-tests.ts @@ -0,0 +1,24 @@ +import sendmail = require("sendmail"); + +const emailSender = sendmail({ + silent: false +}); + +const sendEmail = (options: sendmail.IMailInput): Promise => + new Promise((resolve, reject) => { + emailSender(options, (err, reply) => { + // if error happened or returned code is now started with 2** + if (err || !reply.startsWith("2")) { + reject(err); + } else { + resolve(true); + } + }); + }); + +sendEmail({ + from: "Test Mail ", + to: "test@mydomain.com", + subject: "First Test", + html: "This is a Test message!" +}); diff --git a/types/sendmail/tsconfig.json b/types/sendmail/tsconfig.json new file mode 100644 index 0000000000..c4cf4b7613 --- /dev/null +++ b/types/sendmail/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sendmail-tests.ts" + ] +} diff --git a/types/sendmail/tslint.json b/types/sendmail/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sendmail/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 55151c0d425b718ad8a929f2bb981e6d9864289d Mon Sep 17 00:00:00 2001 From: Ostad Date: Tue, 5 Mar 2019 13:25:20 -0500 Subject: [PATCH 153/265] -fix linting problems --- types/sendmail/index.d.ts | 15 ++++++++------- types/sendmail/sendmail-tests.ts | 2 +- types/sendmail/tsconfig.json | 14 ++++---------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/types/sendmail/index.d.ts b/types/sendmail/index.d.ts index 191c0514fb..a70fc9930f 100644 --- a/types/sendmail/index.d.ts +++ b/types/sendmail/index.d.ts @@ -2,13 +2,14 @@ // Project: https://github.com/guileen/node-sendmail // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /*~ If this module is a UMD module that exposes a global variable 'myLib' when *~ loaded outside a module loader environment, declare that global here. *~ Otherwise, delete this declaration. */ declare namespace sendMailConstructor { - export interface IOptions { + interface Options { logger?: { debug?: () => void; info?: () => void; @@ -33,7 +34,7 @@ declare namespace sendMailConstructor { smtpHost?: string | number; } - export interface IMailInput { + interface MailInput { from: string; to: string; cc?: string; @@ -45,26 +46,26 @@ declare namespace sendMailConstructor { charset?: string; encoding?: string; id?: string; - headers?: object; + headers?: any; content?: string; html?: string; - attachments?: { + attachments?: Array<{ type: string; filename: string; content: any; - }[]; + }>; } } type CallbackFn = (err: Error, domain: string) => void; type SendMailFn = ( - mail: sendMailConstructor.IMailInput, + mail: sendMailConstructor.MailInput, callback: CallbackFn ) => void; declare function sendMailConstructor( - options: sendMailConstructor.IOptions + options: sendMailConstructor.Options ): SendMailFn; export = sendMailConstructor; diff --git a/types/sendmail/sendmail-tests.ts b/types/sendmail/sendmail-tests.ts index f57c3b00d9..5b0f50979b 100644 --- a/types/sendmail/sendmail-tests.ts +++ b/types/sendmail/sendmail-tests.ts @@ -4,7 +4,7 @@ const emailSender = sendmail({ silent: false }); -const sendEmail = (options: sendmail.IMailInput): Promise => +const sendEmail = (options: sendmail.MailInput): Promise => new Promise((resolve, reject) => { emailSender(options, (err, reply) => { // if error happened or returned code is now started with 2** diff --git a/types/sendmail/tsconfig.json b/types/sendmail/tsconfig.json index c4cf4b7613..248bfdbfdf 100644 --- a/types/sendmail/tsconfig.json +++ b/types/sendmail/tsconfig.json @@ -1,22 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "sendmail-tests.ts" - ] + "files": ["index.d.ts", "sendmail-tests.ts"] } From db16d65e4c903c410be28bdb7374b6178d15d090 Mon Sep 17 00:00:00 2001 From: helloworld111gh Date: Tue, 5 Mar 2019 10:28:46 -0800 Subject: [PATCH 154/265] fix missing animation frame on FakeMethod --- types/lolex/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 052c9c45dc..1a33a60c7d 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -9,7 +9,7 @@ /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestIdleCallback" | "cancelIdleCallback"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). From d8f10f57fdaf6b1b21f2828e1f92b43d1e3ab261 Mon Sep 17 00:00:00 2001 From: Ostad Date: Tue, 5 Mar 2019 14:26:09 -0500 Subject: [PATCH 155/265] - change Constructor to Factory --- types/sendmail/index.d.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/types/sendmail/index.d.ts b/types/sendmail/index.d.ts index a70fc9930f..ec748e0118 100644 --- a/types/sendmail/index.d.ts +++ b/types/sendmail/index.d.ts @@ -1,14 +1,10 @@ // Type definitions for sendmail 1.4 // Project: https://github.com/guileen/node-sendmail -// Definitions by: My Self +// Definitions by: Saeid Ostad // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -/*~ If this module is a UMD module that exposes a global variable 'myLib' when - *~ loaded outside a module loader environment, declare that global here. - *~ Otherwise, delete this declaration. - */ -declare namespace sendMailConstructor { +declare namespace sendMailFactory { interface Options { logger?: { debug?: () => void; @@ -60,12 +56,10 @@ declare namespace sendMailConstructor { type CallbackFn = (err: Error, domain: string) => void; type SendMailFn = ( - mail: sendMailConstructor.MailInput, + mail: sendMailFactory.MailInput, callback: CallbackFn ) => void; -declare function sendMailConstructor( - options: sendMailConstructor.Options -): SendMailFn; +declare function sendMailFactory(options: sendMailFactory.Options): SendMailFn; -export = sendMailConstructor; +export = sendMailFactory; From 61e8cba63cf392513219a5f1c5445c26f5c2a122 Mon Sep 17 00:00:00 2001 From: pirix-gh Date: Tue, 5 Mar 2019 21:27:10 +0200 Subject: [PATCH 156/265] curry types --- types/ramda/index.d.ts | 121 +++++++------------------------------ types/ramda/ramda-tests.ts | 11 +++- types/ramda/tools.d.ts | 114 ++++++++++++++++++++++++++++++++++ types/ramda/tsconfig.json | 1 + 4 files changed, 146 insertions(+), 101 deletions(-) create mode 100644 types/ramda/tools.d.ts diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index e1b1f21334..e7536220be 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -27,8 +27,9 @@ // John Ottenlips // Nitesh Phadatare // Krantisinh Deshmukh +// Pierre-Antoine Mills // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.2 /// /// @@ -275,6 +276,7 @@ /// /// /// +/// declare let R: R.Static; @@ -366,77 +368,6 @@ declare namespace R { never }; - // @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow - interface CurriedTypeGuard2 { - (t1: T1): (t2: T2) => t2 is R; - (t1: T1, t2: T2): t2 is R; - } - - interface CurriedTypeGuard3 { - (t1: T1): CurriedTypeGuard2; - (t1: T1, t2: T2): (t3: T3) => t3 is R; - (t1: T1, t2: T2, t3: T3): t3 is R; - } - - interface CurriedTypeGuard4 { - (t1: T1): CurriedTypeGuard3; - (t1: T1, t2: T2): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3): (t4: T4) => t4 is R; - (t1: T1, t2: T2, t3: T3, t4: T4): t4 is R; - } - - interface CurriedTypeGuard5 { - (t1: T1): CurriedTypeGuard4; - (t1: T1, t2: T2): CurriedTypeGuard3; - (t1: T1, t2: T2, t3: T3): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => t5 is R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): t5 is R; - } - - interface CurriedTypeGuard6 { - (t1: T1): CurriedTypeGuard5; - (t1: T1, t2: T2): CurriedTypeGuard4; - (t1: T1, t2: T2, t3: T3): CurriedTypeGuard3; - (t1: T1, t2: T2, t3: T3, t4: T4): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => t6 is R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): t6 is R; - } - - interface CurriedFunction2 { - (t1: T1): (t2: T2) => R; - (t1: T1, t2: T2): R; - } - - interface CurriedFunction3 { - (t1: T1): CurriedFunction2; - (t1: T1, t2: T2): (t3: T3) => R; - (t1: T1, t2: T2, t3: T3): R; - } - - interface CurriedFunction4 { - (t1: T1): CurriedFunction3; - (t1: T1, t2: T2): CurriedFunction2; - (t1: T1, t2: T2, t3: T3): (t4: T4) => R; - (t1: T1, t2: T2, t3: T3, t4: T4): R; - } - - interface CurriedFunction5 { - (t1: T1): CurriedFunction4; - (t1: T1, t2: T2): CurriedFunction3; - (t1: T1, t2: T2, t3: T3): CurriedFunction2; - (t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; - } - - interface CurriedFunction6 { - (t1: T1): CurriedFunction5; - (t1: T1, t2: T2): CurriedFunction4; - (t1: T1, t2: T2, t3: T3): CurriedFunction3; - (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction2; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): R; - } - interface Placeholder { __isRamdaPlaceholder__: true; } interface Reduced { @@ -463,11 +394,11 @@ declare namespace R { * Creates a new list iteration function from an existing one by adding two new parameters to its callback * function: the current index, and the entire list. */ - addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): CurriedFunction2<(item: T, idx: number, list?: T[]) => U, ReadonlyArray, U[]>; + addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): Curry.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: ReadonlyArray) => U[]>; /* Special case for forEach */ - addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): CurriedFunction2<(item: T, idx: number, list?: T[]) => void, ReadonlyArray, T[]>; + addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): Curry.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: ReadonlyArray) => T[]>; /* Special case for reduce */ - addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): CurriedFunction3<(acc: U, item: T, idx: number, list?: T[]) => U, U, ReadonlyArray, U>; + addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): Curry.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: ReadonlyArray) => U>; /** * Applies a function to the value at the given index of an array, returning a new copy of the array with the @@ -583,7 +514,7 @@ declare namespace R { assocPath(path: Path, __: Placeholder, obj: U): (val: T) => U; assocPath(path: Path, val: T, obj: U): U; assocPath(path: Path, val: T): (obj: U) => U; - assocPath(path: Path): CurriedFunction2; + assocPath(path: Path): Curry.Curry<(a: T, b: U) => U>; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -835,17 +766,7 @@ declare namespace R { * Returns a curried equivalent of the provided function. The curried function has two unusual capabilities. * First, its arguments needn't be provided one at a time. */ - curry(fn: (a: T1, b: T2) => b is TResult): CurriedTypeGuard2; - curry(fn: (a: T1, b: T2, c: T3) => c is TResult): CurriedTypeGuard3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => d is TResult): CurriedTypeGuard4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => e is TResult): CurriedTypeGuard5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => f is TResult): CurriedTypeGuard6; - curry(fn: (a: T1, b: T2) => TResult): CurriedFunction2; - curry(fn: (a: T1, b: T2, c: T3) => TResult): CurriedFunction3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => TResult): CurriedFunction4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => TResult): CurriedFunction5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => TResult): CurriedFunction6; - curry(fn: (...a: any[]) => any): (...a: any[]) => any; + curry any>(f: F): Curry.Curry; /** * Returns a curried equivalent of the provided function, with the specified arity. The curried function has @@ -970,7 +891,7 @@ declare namespace R { */ eqBy(fn: (a: T) => U, a: T, b: T): boolean; eqBy(fn: (a: T) => U, a: T): (b: T) => boolean; - eqBy(fn: (a: T) => U): CurriedFunction2; + eqBy(fn: (a: T) => U): Curry.Curry<(a: T, b: T) => boolean>; /** * Reports whether two functions have the same value for the specified property. @@ -1444,7 +1365,7 @@ declare namespace R { */ maxBy(keyFn: (a: T) => Ord, a: T, b: T): T; maxBy(keyFn: (a: T) => Ord, a: T): (b: T) => T; - maxBy(keyFn: (a: T) => Ord): CurriedFunction2; + maxBy(keyFn: (a: T) => Ord): Curry.Curry<(a: T, b: T) => T>; /** * Returns the mean of the given list of numbers. @@ -1558,7 +1479,7 @@ declare namespace R { */ minBy(keyFn: (a: T) => Ord, a: T, b: T): T; minBy(keyFn: (a: T) => Ord, a: T): (b: T) => T; - minBy(keyFn: (a: T) => Ord): CurriedFunction2; + minBy(keyFn: (a: T) => Ord): Curry.Curry<(a: T, b: T) => T>; /** * Divides the second parameter by the first and returns the remainder. @@ -1727,7 +1648,7 @@ declare namespace R { */ pathEq(path: Path, val: any, obj: any): boolean; pathEq(path: Path, val: any): (obj: any) => boolean; - pathEq(path: Path): CurriedFunction2; + pathEq(path: Path): Curry.Curry<(a: any, b: any) => boolean>; /** * If the given, non-null object has a value at the given path, returns the value at that path. @@ -1735,14 +1656,14 @@ declare namespace R { */ pathOr(defaultValue: T, path: Path, obj: any): any; pathOr(defaultValue: T, path: Path): (obj: any) => any; - pathOr(defaultValue: T): CurriedFunction2; + pathOr(defaultValue: T): Curry.Curry<(a: Path, b: any) => any>; /** * Returns true if the specified object property at given path satisfies the given predicate; false otherwise. */ pathSatisfies(pred: (val: T) => boolean, path: Path, obj: U): boolean; pathSatisfies(pred: (val: T) => boolean, path: Path): (obj: U) => boolean; - pathSatisfies(pred: (val: T) => boolean): CurriedFunction2; + pathSatisfies(pred: (val: T) => boolean): Curry.Curry<(a: Path, b: U) => boolean>; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the @@ -2180,7 +2101,7 @@ declare namespace R { */ propSatisfies(pred: (val: T) => boolean, name: string, obj: U): boolean; propSatisfies(pred: (val: T) => boolean, name: string): (obj: U) => boolean; - propSatisfies(pred: (val: T) => boolean): CurriedFunction2; + propSatisfies(pred: (val: T) => boolean): Curry.Curry<(a: string, b: U) => boolean>; /** * Returns a list of numbers from `from` (inclusive) to `to` @@ -2205,8 +2126,8 @@ declare namespace R { */ reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: ReadonlyArray): { [index: string]: TResult }; reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: ReadonlyArray) => { [index: string]: TResult }; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): CurriedFunction2<(elem: T) => string, ReadonlyArray, { [index: string]: TResult }>; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult): CurriedFunction3 string, ReadonlyArray, { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): Curry.Curry<(a: (elem: T) => string, b: ReadonlyArray) => { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult): Curry.Curry<(a: TResult, b: (elem: T) => string, c: ReadonlyArray) => { [index: string]: TResult }>; /** * Returns a value wrapped to indicate that it is the final value of the reduce and @@ -2232,8 +2153,8 @@ declare namespace R { */ reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: ReadonlyArray): TResult; reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): CurriedFunction2, TResult>; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean): CurriedFunction3<(acc: TResult, elem: T) => TResult, TResult, ReadonlyArray, TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): Curry.Curry<(a: TResult, b: ReadonlyArray) => TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean): Curry.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: ReadonlyArray) => TResult>; /** * Similar to `filter`, except that it keeps only values for which the given predicate @@ -2387,7 +2308,7 @@ declare namespace R { * Duplication is determined according to the value returned by applying the supplied predicate to two list elements. */ symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - symmetricDifferenceWith(pred: (a: T, b: T) => boolean): CurriedFunction2, ReadonlyArray, T[]>; + symmetricDifferenceWith(pred: (a: T, b: T) => boolean): Curry.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; /** * A function that always returns true. Any passed in parameters are ignored. @@ -2581,7 +2502,7 @@ declare namespace R { * determined according to the value returned by applying the supplied predicate to two list elements. */ unionWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - unionWith(pred: (a: T, b: T) => boolean): CurriedFunction2, ReadonlyArray, T[]>; + unionWith(pred: (a: T, b: T) => boolean): Curry.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; /** * Returns a new list containing only one copy of each element in the original list. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 16ba23d85b..fdac7648db 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -68,6 +68,10 @@ class F2 { return a + b + c + d; } + function addTenFixedNumbers(a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, k: 9, l: 10): number { + return a + b + c + d; + } + const x1: (a: number, b: number, c: number, d: number) => number = R.curry(addFourNumbers); // because of the current way of currying, the following call results in a type error // const x2: Function = R.curry(addFourNumbers)(1,2,4) @@ -76,6 +80,8 @@ class F2 { const y1: number = R.curry(addFourNumbers)(1)(2)(3)(4); const y2: number = R.curry(addFourNumbers)(1, 2)(3, 4); const y3: number = R.curry(addFourNumbers)(1, 2, 3)(4); + const y4: number = R.curry(addTenFixedNumbers)(R.__, 1, 2)(0)(3)(R.__, R.__)(R.__, 5)(4)(6, 7)(R.__)(8, R.__, R.__)(9, 10); + const y5: number = R.curry(addTenFixedNumbers)(R.__, 1, R.__)(R.__, 2)(0, 3)(R.__, 5)(4, R.__)(R.__)(6, R.__, 8, 9, 10)(7); R.nAry(0); R.nAry(0, takesNoArg); @@ -119,7 +125,8 @@ class F2 { const cars: Car[] = [{speed: 65}, {}]; for (const car of cars) { if (typeGuardCurried(1)(2)(3)(4)(5)(car)) { - drive(car); + drive(car); // $ExpectError + // Generic Curry solved a previously non reported issue } } }; @@ -2784,3 +2791,5 @@ class Why { () => { R.bind(console.log, console); }; + +// Curry tests diff --git a/types/ramda/tools.d.ts b/types/ramda/tools.d.ts new file mode 100644 index 0000000000..b6f814012b --- /dev/null +++ b/types/ramda/tools.d.ts @@ -0,0 +1,114 @@ +/// + +// All the following types are explained here: +// https://medium.freecodecamp.org/typescript-curry-ramda-types-f747e99744ab +// https://github.com/pirix-gh/medium/blob/master/types-curry-ramda/src/index.ts +declare namespace Tools { + type Head = + T extends [any, ...any[]] + ? T[0] + : never; + + type Tail = + ((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) + ? TT + : []; + + type HasTail = + T extends ([] | [any]) + ? false + : true; + + type Last = { + 0: Last>; + 1: Head; + }[ + HasTail extends true + ? 0 + : 1 + ]; + + type Length = + T['length']; + + type Prepend = + ((head: E, ...args: T) => any) extends ((...args: infer U) => any) + ? U + : T; + + type Drop = { + 0: Drop, Prepend>; + 1: T; + }[ + Length extends N + ? 1 + : 0 + ]; + + type Cast = X extends Y ? X : Y; + + type Pos = + Length; + + type Next = + Prepend; + + type Prev = + Tail; + + type Iterator = { + 0: Iterator, Next>; + 1: From; + }[ + Pos extends Index + ? 1 + : 0 + ]; + + type Reverse = { + 0: Reverse], R>, Next>; + 1: R; + }[ + Pos extends Length + ? 1 + : 0 + ]; + + type Concat = + Reverse extends infer R ? Cast : never, T2>; + + type Append = + Concat; +} + +declare namespace Curry { + type GapOf = + T1[Tools.Pos] extends R.Placeholder + ? Tools.Append], TN> + : TN; + + type GapsOf = { + 0: GapsOf extends infer G ? Tools.Cast : never, Tools.Next>; + 1: Tools.Concat, T2> extends infer D ? Tools.Cast : never>; + }[ + Tools.Pos extends Tools.Length + ? 1 + : 0 + ]; + + type PartialGaps = { + [K in keyof T]?: T[K] | R.Placeholder + }; + + type CleanedGaps = { + [K in keyof T]: NonNullable + }; + + type Gaps = CleanedGaps>; + + type Curry any)> = + (...args: Tools.Cast>>, any[]>) => + GapsOf> extends [any, ...any[]] + ? Curry<(...args: GapsOf> extends infer G ? Tools.Cast : never) => ReturnType> + : ReturnType; +} diff --git a/types/ramda/tsconfig.json b/types/ramda/tsconfig.json index 4de4f10d8f..92fcdd531d 100644 --- a/types/ramda/tsconfig.json +++ b/types/ramda/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", + "tools.d.ts", "ramda-tests.ts" ] } \ No newline at end of file From 33d021fc473863667468290f569a1fc70923c11e Mon Sep 17 00:00:00 2001 From: Ostad Date: Tue, 5 Mar 2019 14:29:31 -0500 Subject: [PATCH 157/265] - add type to headers probperty instead of any --- types/sendmail/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sendmail/index.d.ts b/types/sendmail/index.d.ts index ec748e0118..1bab6d27b6 100644 --- a/types/sendmail/index.d.ts +++ b/types/sendmail/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/guileen/node-sendmail // Definitions by: Saeid Ostad // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 declare namespace sendMailFactory { interface Options { @@ -42,7 +42,7 @@ declare namespace sendMailFactory { charset?: string; encoding?: string; id?: string; - headers?: any; + headers?: object; content?: string; html?: string; attachments?: Array<{ From 3ea931135ed7225b0182cf4b5aefdb887e5a4252 Mon Sep 17 00:00:00 2001 From: pirix-gh Date: Tue, 5 Mar 2019 21:59:08 +0200 Subject: [PATCH 158/265] ramda update version --- types/ramda/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index e7536220be..e0313e5957 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ramda 0.25 +// Type definitions for ramda 0.26 // Project: https://github.com/donnut/typescript-ramda, https://ramdajs.com // Definitions by: Erwin Poeze // Tycho Grouwstra From 53804821fc3acd0cdec1195a8f1c5e7ed2b2b0c1 Mon Sep 17 00:00:00 2001 From: Seth Butler Date: Tue, 5 Mar 2019 15:06:56 -0500 Subject: [PATCH 159/265] Allowing ttl to be a function --- types/connect-redis/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/connect-redis/index.d.ts b/types/connect-redis/index.d.ts index c5a26de73a..9b56777ac3 100644 --- a/types/connect-redis/index.d.ts +++ b/types/connect-redis/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-redis // Project: https://npmjs.com/package/connect-redis // Definitions by: Xavier Stouder +// Seth Butler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -26,7 +27,7 @@ declare module "connect-redis" { port?: number; socket?: string; url?: string; - ttl?: number; + ttl?: number | string | ((store: RedisStore, sess: Express.SessionData, sid: string) => number); disableTTL?: boolean; db?: number; pass?: string; From 9a9277b1a963e152f315ec0f68436e690e472f31 Mon Sep 17 00:00:00 2001 From: Seth Butler Date: Tue, 5 Mar 2019 15:09:50 -0500 Subject: [PATCH 160/265] Adding test for ttl as function --- types/connect-redis/connect-redis-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/connect-redis/connect-redis-tests.ts b/types/connect-redis/connect-redis-tests.ts index a312ffd3ca..603b226dcc 100644 --- a/types/connect-redis/connect-redis-tests.ts +++ b/types/connect-redis/connect-redis-tests.ts @@ -6,5 +6,8 @@ const store = new RedisStore({ host: 'localhost', port: 6379, logErrors: error => console.warn(error), - scanCount: 80, + scanCount: 80, + ttl: (store, sess, sessionID) => { + return 60; + } }); From 60bfbc16ff78bd0fbe6c5932157e52458ee63375 Mon Sep 17 00:00:00 2001 From: Peter Oxenham Date: Wed, 6 Mar 2019 07:16:46 +1000 Subject: [PATCH 161/265] Updated definition of 'tests' on SchemaDescription --- types/yup/index.d.ts | 2 +- types/yup/yup-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index 58067b926b..f29fe60d23 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -296,7 +296,7 @@ export interface SchemaDescription { type: string; label: string; meta: object; - tests: string[]; + tests: Array<{ name: string, params: object }>; fields: object; } diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 0c515ef78c..152fdd25e4 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -420,7 +420,7 @@ const description: SchemaDescription = { type: "type", label: "label", meta: { key: "value" }, - tests: ["test1", "test2"], + tests: [{ name: "test1", params: {} }, { name: "test2", params: {} }], fields: { key: "value" } }; From 1240929245ca5c59e57673ce2d0d6d0ca6882588 Mon Sep 17 00:00:00 2001 From: Vincent Pizzo Date: Tue, 5 Mar 2019 13:29:46 -0800 Subject: [PATCH 162/265] Add types for react-csv --- .../react-csv/components/CommonPropTypes.d.ts | 22 ++++++ types/react-csv/components/Download.d.ts | 9 +++ types/react-csv/components/Link.d.ts | 5 ++ types/react-csv/index.d.ts | 8 ++ types/react-csv/react-csv-tests.tsx | 78 +++++++++++++++++++ types/react-csv/tsconfig.json | 30 +++++++ types/react-csv/tslint.json | 7 ++ 7 files changed, 159 insertions(+) create mode 100644 types/react-csv/components/CommonPropTypes.d.ts create mode 100644 types/react-csv/components/Download.d.ts create mode 100644 types/react-csv/components/Link.d.ts create mode 100644 types/react-csv/index.d.ts create mode 100644 types/react-csv/react-csv-tests.tsx create mode 100644 types/react-csv/tsconfig.json create mode 100644 types/react-csv/tslint.json diff --git a/types/react-csv/components/CommonPropTypes.d.ts b/types/react-csv/components/CommonPropTypes.d.ts new file mode 100644 index 0000000000..4bad3dd766 --- /dev/null +++ b/types/react-csv/components/CommonPropTypes.d.ts @@ -0,0 +1,22 @@ +import { MouseEventHandler } from "react"; + +export interface LabelKeyObject { + label: string; + key: string; +} + +export type Data = object[]; +export type Headers = LabelKeyObject[] | string[]; +export type SyncClickHandler = (event: MouseEventHandler) => boolean | void; +export type AsyncClickHandler = (event: MouseEventHandler, done: (proceed?: boolean) => void) => void; + +export interface CommonPropTypes { + data: string | Data; + headers?: Headers; + enclosingCharacter?: string; + separator?: string; + filename?: string; + uFEFF?: boolean; + onClick?: SyncClickHandler | AsyncClickHandler; + asyncOnClick?: boolean; +} diff --git a/types/react-csv/components/Download.d.ts b/types/react-csv/components/Download.d.ts new file mode 100644 index 0000000000..282f41596a --- /dev/null +++ b/types/react-csv/components/Download.d.ts @@ -0,0 +1,9 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +export interface DownloadPropTypes extends CommonPropTypes { + target?: string; +} + +export default class Download extends Component { +} diff --git a/types/react-csv/components/Link.d.ts b/types/react-csv/components/Link.d.ts new file mode 100644 index 0000000000..3e133095de --- /dev/null +++ b/types/react-csv/components/Link.d.ts @@ -0,0 +1,5 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +export default class Link extends Component { +} diff --git a/types/react-csv/index.d.ts b/types/react-csv/index.d.ts new file mode 100644 index 0000000000..2fe767d3e7 --- /dev/null +++ b/types/react-csv/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for react-csv 1.1.1 +// Project: https://github.com/react-csv/react-csv +// Definitions by: Vincent Pizzo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export { default as CSVLink } from "./components/Link"; +export { default as CSVDownload } from "./components/Download"; diff --git a/types/react-csv/react-csv-tests.tsx b/types/react-csv/react-csv-tests.tsx new file mode 100644 index 0000000000..a075b8161f --- /dev/null +++ b/types/react-csv/react-csv-tests.tsx @@ -0,0 +1,78 @@ +import * as React from "react"; +import { MouseEventHandler } from "react"; +import { render } from "react-dom"; +import { CSVLink, CSVDownload } from "react-csv"; + +const headers = [ + {label: 'First Name', key: 'details.firstName'}, + {label: 'Last Name', key: 'details.lastName'}, + {label: 'Job', key: 'job'}, +]; + +const headersStrings = ['foo', 'bar']; + +const data = [ + {details: {firstName: 'Ahmed', lastName: 'Tomi'}, job: 'manager'}, + {details: {firstName: 'John', lastName: 'Jones'}, job: 'developer'}, +]; + +const dataString = `firstname,lastname +Ahmed,Tomi +Raed,Labes +Yezzi,Min l3b +`; + +const syncOnClickReturn = (event: MouseEventHandler) => { + window.console.log(event); + return true; +}; +const syncOnClickVoid = (event: MouseEventHandler) => window.console.log(event); +const asyncOnClickReturn = (event: MouseEventHandler, done: (proceed?: boolean) => void) => { + window.console.log(event); + done(true); +}; +const asyncOnClickVoid = (event: MouseEventHandler, done: (proceed?: boolean) => void) => { + window.console.log(event); + done(); +}; + +const node = document.getElementById("main"); + +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); + +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); diff --git a/types/react-csv/tsconfig.json b/types/react-csv/tsconfig.json new file mode 100644 index 0000000000..cc91fd7689 --- /dev/null +++ b/types/react-csv/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "noUnusedParameters": true, + "noUnusedLocals": true + }, + "files": [ + "index.d.ts", + "components/CommonPropTypes.d.ts", + "components/Download.d.ts", + "components/Link.d.ts", + "react-csv-tests.tsx" + ] +} diff --git a/types/react-csv/tslint.json b/types/react-csv/tslint.json new file mode 100644 index 0000000000..b2ecae2fd2 --- /dev/null +++ b/types/react-csv/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-duplicate-imports": false + } +} From a29a1cc518f05808125d978e444e92dee9e3c0e6 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Tue, 5 Mar 2019 22:30:16 +0100 Subject: [PATCH 163/265] Remove upstreamed types --- notNeededPackages.json | 55 ++++++++++++- types/camelcase/camelcase-tests.ts | 10 --- types/camelcase/index.d.ts | 9 --- types/camelcase/tsconfig.json | 23 ------ types/camelcase/tslint.json | 1 - types/conf/conf-tests.ts | 54 ------------- types/conf/index.d.ts | 37 --------- types/conf/tsconfig.json | 24 ------ types/conf/tslint.json | 1 - types/conf/v0/conf-tests.ts | 20 ----- types/conf/v0/index.d.ts | 29 ------- types/conf/v0/tsconfig.json | 29 ------- types/conf/v0/tslint.json | 1 - types/conf/v1/conf-tests.ts | 41 ---------- types/conf/v1/index.d.ts | 31 -------- types/conf/v1/tsconfig.json | 29 ------- types/conf/v1/tslint.json | 1 - types/env-paths/env-paths-tests.ts | 10 --- types/env-paths/index.d.ts | 18 ----- types/env-paths/tsconfig.json | 19 ----- types/env-paths/tslint.json | 3 - types/globby/globby-tests.ts | 71 ----------------- types/globby/index.d.ts | 99 ------------------------ types/globby/package.json | 6 -- types/globby/tsconfig.json | 24 ------ types/globby/tslint.json | 1 - types/log-update/index.d.ts | 17 ---- types/log-update/log-update-tests.ts | 19 ----- types/log-update/tsconfig.json | 23 ------ types/log-update/tslint.json | 1 - types/make-dir/index.d.ts | 41 ---------- types/make-dir/make-dir-tests.ts | 13 ---- types/make-dir/tsconfig.json | 23 ------ types/make-dir/tslint.json | 3 - types/move-file/index.d.ts | 20 ----- types/move-file/move-file-tests.ts | 10 --- types/move-file/tsconfig.json | 23 ------ types/move-file/tslint.json | 1 - types/on-change/index.d.ts | 9 --- types/on-change/on-change-tests.ts | 17 ---- types/on-change/tsconfig.json | 23 ------ types/on-change/tslint.json | 1 - types/query-string/index.d.ts | 48 ------------ types/query-string/query-string-tests.ts | 44 ----------- types/query-string/tsconfig.json | 23 ------ types/query-string/tslint.json | 6 -- 46 files changed, 54 insertions(+), 957 deletions(-) delete mode 100644 types/camelcase/camelcase-tests.ts delete mode 100644 types/camelcase/index.d.ts delete mode 100644 types/camelcase/tsconfig.json delete mode 100644 types/camelcase/tslint.json delete mode 100644 types/conf/conf-tests.ts delete mode 100644 types/conf/index.d.ts delete mode 100644 types/conf/tsconfig.json delete mode 100644 types/conf/tslint.json delete mode 100644 types/conf/v0/conf-tests.ts delete mode 100644 types/conf/v0/index.d.ts delete mode 100644 types/conf/v0/tsconfig.json delete mode 100644 types/conf/v0/tslint.json delete mode 100644 types/conf/v1/conf-tests.ts delete mode 100644 types/conf/v1/index.d.ts delete mode 100644 types/conf/v1/tsconfig.json delete mode 100644 types/conf/v1/tslint.json delete mode 100644 types/env-paths/env-paths-tests.ts delete mode 100644 types/env-paths/index.d.ts delete mode 100644 types/env-paths/tsconfig.json delete mode 100644 types/env-paths/tslint.json delete mode 100644 types/globby/globby-tests.ts delete mode 100644 types/globby/index.d.ts delete mode 100644 types/globby/package.json delete mode 100644 types/globby/tsconfig.json delete mode 100644 types/globby/tslint.json delete mode 100644 types/log-update/index.d.ts delete mode 100644 types/log-update/log-update-tests.ts delete mode 100644 types/log-update/tsconfig.json delete mode 100644 types/log-update/tslint.json delete mode 100644 types/make-dir/index.d.ts delete mode 100644 types/make-dir/make-dir-tests.ts delete mode 100644 types/make-dir/tsconfig.json delete mode 100644 types/make-dir/tslint.json delete mode 100644 types/move-file/index.d.ts delete mode 100644 types/move-file/move-file-tests.ts delete mode 100644 types/move-file/tsconfig.json delete mode 100644 types/move-file/tslint.json delete mode 100644 types/on-change/index.d.ts delete mode 100644 types/on-change/on-change-tests.ts delete mode 100644 types/on-change/tsconfig.json delete mode 100644 types/on-change/tslint.json delete mode 100644 types/query-string/index.d.ts delete mode 100644 types/query-string/query-string-tests.ts delete mode 100644 types/query-string/tsconfig.json delete mode 100644 types/query-string/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index acdb379b38..4b38d00307 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -216,6 +216,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/camel-case", "asOfVersion": "1.2.1" }, + { + "libraryName": "camelcase", + "typingsPackageName": "camelcase", + "sourceRepoURL": "https://github.com/sindresorhus/camelcase", + "asOfVersion": "5.2.0" + }, { "libraryName": "catalog", "typingsPackageName": "catalog", @@ -264,6 +270,12 @@ "sourceRepoURL": "https://github.com/tj/commander.js", "asOfVersion": "2.12.2" }, + { + "libraryName": "conf", + "typingsPackageName": "conf", + "sourceRepoURL": "https://github.com/sindresorhus/conf", + "asOfVersion": "3.0.0" + }, { "libraryName": "confirmdialog", "typingsPackageName": "confirmdialog", @@ -516,6 +528,12 @@ "sourceRepoURL": "https://github.com/Sembiance/email-validator", "asOfVersion": "1.0.6" }, + { + "libraryName": "env-paths", + "typingsPackageName": "env-paths", + "sourceRepoURL": "https://github.com/sindresorhus/env-paths", + "asOfVersion": "2.1.0" + }, { "libraryName": "error-stack-parser", "typingsPackageName": "error-stack-parser", @@ -684,6 +702,12 @@ "sourceRepoURL": "https://github.com/jdalrymple/node-gitlab", "asOfVersion": "2.0.0" }, + { + "libraryName": "globby", + "typingsPackageName": "globby", + "sourceRepoURL": "https://github.com/sindresorhus/globby", + "asOfVersion": "9.1.0" + }, { "libraryName": "Google Cloud Storage", "typingsPackageName": "google-cloud__storage", @@ -1002,6 +1026,12 @@ "sourceRepoURL": "https://github.com/steelsojka/lodash-decorators", "asOfVersion": "4.0.0" }, + { + "libraryName": "log-update", + "typingsPackageName": "log-update", + "sourceRepoURL": "https://github.com/sindresorhus/log-update", + "asOfVersion": "3.1.0" + }, { "libraryName": "log4javascript", "typingsPackageName": "log4javascript", @@ -1026,6 +1056,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/lower-case-first", "asOfVersion": "1.0.1" }, + { + "libraryName": "make-dir", + "typingsPackageName": "make-dir", + "sourceRepoURL": "https://github.com/sindresorhus/make-dir", + "asOfVersion": "2.1.0" + }, { "libraryName": "mali", "typingsPackageName": "mali", @@ -1098,6 +1134,12 @@ "sourceRepoURL": "https://github.com/LearnBoost/monk.git", "asOfVersion": "6.0.0" }, + { + "libraryName": "move-file", + "typingsPackageName": "move-file", + "sourceRepoURL": "https://github.com/sindresorhus/move-file", + "asOfVersion": "1.1.0" + }, { "libraryName": "MQTT", "typingsPackageName": "mqtt", @@ -1152,6 +1194,12 @@ "sourceRepoURL": "https://github.com/foretagsplatsen/numbro/", "asOfVersion": "1.9.3" }, + { + "libraryName": "on-change", + "typingsPackageName": "on-change", + "sourceRepoURL": "https://github.com/sindresorhus/on-change", + "asOfVersion": "1.1.0" + }, { "libraryName": "Onsen UI", "typingsPackageName": "onsenui", @@ -1169,7 +1217,6 @@ "typingsPackageName": "p-limit", "sourceRepoURL": "https://github.com/sindresorhus/p-limit", "asOfVersion": "2.2.0" - }, { "libraryName": "p-map", @@ -1309,6 +1356,12 @@ "sourceRepoURL": "https://github.com/kazuhikoarase/qrcode-generator", "asOfVersion": "1.0.6" }, + { + "libraryName": "query-string", + "typingsPackageName": "query-string", + "sourceRepoURL": "https://github.com/sindresorhus/query-string", + "asOfVersion": "6.3.0" + }, { "libraryName": "Raven JS", "typingsPackageName": "raven-js", diff --git a/types/camelcase/camelcase-tests.ts b/types/camelcase/camelcase-tests.ts deleted file mode 100644 index 871ec5c3b2..0000000000 --- a/types/camelcase/camelcase-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import camelCase = require('camelcase'); - -camelCase('foo-bar'); -camelCase('foo_bar'); -camelCase('Foo-Bar'); -camelCase('--foo.bar'); -camelCase('__foo__bar__'); -camelCase('foo bar'); -camelCase('foo', 'bar'); -camelCase('__foo__', '--bar'); diff --git a/types/camelcase/index.d.ts b/types/camelcase/index.d.ts deleted file mode 100644 index 83abf5a8a5..0000000000 --- a/types/camelcase/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for camelcase 4.1 -// Project: https://github.com/sindresorhus/camelcase -// Definitions by: Sam Verschueren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = camelcase; - -declare function camelcase(...args: string[]): string; -declare namespace camelcase {} diff --git a/types/camelcase/tsconfig.json b/types/camelcase/tsconfig.json deleted file mode 100644 index bcc1b505e1..0000000000 --- a/types/camelcase/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "camelcase-tests.ts" - ] -} \ No newline at end of file diff --git a/types/camelcase/tslint.json b/types/camelcase/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/camelcase/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/conf/conf-tests.ts b/types/conf/conf-tests.ts deleted file mode 100644 index ce67cd4799..0000000000 --- a/types/conf/conf-tests.ts +++ /dev/null @@ -1,54 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -new Conf({ - defaults: { - foo: 'bar', - unicorn: 'rainbow', - }, -}); -new Conf({ configName: '' }); -new Conf({ projectName: 'foo' }); -new Conf({ cwd: '' }); -new Conf({ encryptionKey: '' }); -new Conf({ encryptionKey: new Buffer('') }); -new Conf({ encryptionKey: new Uint8Array([1]) }); -new Conf({ encryptionKey: new DataView(new ArrayBuffer(2)) }); -new Conf({ fileExtension: '.foo' }); - -// $ExpectError -new Conf({ - defaults: { - foo: 'bar', - unicorn: ['rainbow'], - }, -}); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('null', null); // $ExpectError - -conf.get('foo'); // $ExpectType string | number | boolean -conf.get('foo', 'bar'); // $ExpectType string | number | boolean -conf.get('foo', null); // $ExpectError -conf.delete('foo'); -conf.has('foo'); // $ExpectType boolean -conf.clear(); -conf.onDidChange('foo', (oldVal, newVal) => { - // $ExpectType string | number | boolean | undefined - oldVal; - // $ExpectType string | number | boolean | undefined - newVal; -}); - -conf.size; // $ExpectType number -conf.store = { - foo: 'bar', - unicorn: 'rainbow', -}; -conf.path; // $ExpectType string - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean -} diff --git a/types/conf/index.d.ts b/types/conf/index.d.ts deleted file mode 100644 index 57d7285a3e..0000000000 --- a/types/conf/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Type definitions for conf 2.1 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -declare class Conf implements Iterable<[string, T]> { - store: { [key: string]: T }; - readonly path: string; - readonly size: number; - - constructor(options?: Conf.Options); - get(key: string, defaultValue?: T): T; - set(key: string, val: T): void; - set(object: { [key: string]: T }): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - onDidChange(key: string, callback: (oldVal: T | undefined, newVal: T | undefined) => void): void; - [Symbol.iterator](): Iterator<[string, T]>; -} - -declare namespace Conf { - interface Options { - defaults?: { [key: string]: T }; - configName?: string; - projectName?: string; - cwd?: string; - encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView; - fileExtension?: string; - } -} - -export = Conf; diff --git a/types/conf/tsconfig.json b/types/conf/tsconfig.json deleted file mode 100644 index 479fa6b41f..0000000000 --- a/types/conf/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} diff --git a/types/conf/tslint.json b/types/conf/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/conf/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/conf/v0/conf-tests.ts b/types/conf/v0/conf-tests.ts deleted file mode 100644 index 1368e45c29..0000000000 --- a/types/conf/v0/conf-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('object', { - foo: 'bar', - unicorn: ['rainbow'] -}); - -conf.get('foo'); -conf.delete('foo'); -conf.has('foo'); -conf.clear(); - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean | symbol | {} -} diff --git a/types/conf/v0/index.d.ts b/types/conf/v0/index.d.ts deleted file mode 100644 index 21c136e823..0000000000 --- a/types/conf/v0/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for conf 0.11 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Options { - defaults?: any; - configName?: string; - projectName?: string; - cwd?: string; -} - -declare class Conf implements Iterable<[string, string | number | boolean | symbol | {}]> { - path: string; - store: any; - - readonly size: number; - - constructor(options?: Options); - get(key: string): any; - set(key: string, val: string | number | boolean | symbol | {}): void; - set(object: {}): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - [Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]>; -} - -export = Conf; diff --git a/types/conf/v0/tsconfig.json b/types/conf/v0/tsconfig.json deleted file mode 100644 index 004bd4a1b5..0000000000 --- a/types/conf/v0/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "conf": [ - "conf/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} \ No newline at end of file diff --git a/types/conf/v0/tslint.json b/types/conf/v0/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/conf/v0/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/conf/v1/conf-tests.ts b/types/conf/v1/conf-tests.ts deleted file mode 100644 index 4ee492da8d..0000000000 --- a/types/conf/v1/conf-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -new Conf({ - defaults: { - foo: 'bar', - unicorn: 'rainbow', - }, - configName: '', - projectName: 'foo', - cwd: '', -}); -// $ExpectError -new Conf({ - defaults: { - foo: 'bar', - unicorn: ['rainbow'], - }, -}); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('null', null); // $ExpectError - -conf.get('foo'); // $ExpectType string | number | boolean -conf.get('foo', 'bar'); // $ExpectType string | number | boolean -conf.get('foo', null); // $ExpectError -conf.delete('foo'); -conf.has('foo'); // $ExpectType boolean -conf.clear(); - -conf.store = { - foo: 'bar', - unicorn: 'rainbow', -}; -conf.path; // $ExpectType string - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean -} diff --git a/types/conf/v1/index.d.ts b/types/conf/v1/index.d.ts deleted file mode 100644 index f08cff1584..0000000000 --- a/types/conf/v1/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for conf 1.4 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -interface Options { - defaults?: { [key: string]: T }; - configName?: string; - projectName?: string; - cwd?: string; -} - -declare class Conf implements Iterable<[string, T]> { - store: { [key: string]: T }; - readonly path: string; - readonly size: number; - - constructor(options?: Options); - get(key: string, defaultValue?: T): T; - set(key: string, val: T): void; - set(object: { [key: string]: T }): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void; - [Symbol.iterator](): Iterator<[string, T]>; -} - -export = Conf; diff --git a/types/conf/v1/tsconfig.json b/types/conf/v1/tsconfig.json deleted file mode 100644 index 86b3a62f41..0000000000 --- a/types/conf/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "conf": [ - "conf/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} diff --git a/types/conf/v1/tslint.json b/types/conf/v1/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/conf/v1/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/env-paths/env-paths-tests.ts b/types/env-paths/env-paths-tests.ts deleted file mode 100644 index 9f360bbe41..0000000000 --- a/types/env-paths/env-paths-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import envPaths = require('env-paths'); - -// $ExpectType Paths -envPaths('./'); -// $ExpectType Paths -envPaths('./', {suffix: 'test'}); -// $ExpectType Paths -envPaths('./', {suffix: false}); -// $ExpectType Paths -envPaths('./', {suffix: true}); diff --git a/types/env-paths/index.d.ts b/types/env-paths/index.d.ts deleted file mode 100644 index 8b594d8a61..0000000000 --- a/types/env-paths/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for env-paths 1.0 -// Project: https://github.com/sindresorhus/env-paths -// Definitions by: Daniel Byrne -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = envPaths; - -declare function envPaths(name: string, opts?: { suffix: string | boolean }): envPaths.Paths; - -declare namespace envPaths { - interface Paths { - readonly data: string; - readonly config: string; - readonly cache: string; - readonly log: string; - readonly temp: string; - } -} diff --git a/types/env-paths/tsconfig.json b/types/env-paths/tsconfig.json deleted file mode 100644 index 62dcbca022..0000000000 --- a/types/env-paths/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "env-paths-tests.ts" - ] -} diff --git a/types/env-paths/tslint.json b/types/env-paths/tslint.json deleted file mode 100644 index d88586e5bd..0000000000 --- a/types/env-paths/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts deleted file mode 100644 index e1a57adb74..0000000000 --- a/types/globby/globby-tests.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { IOptions } from 'glob'; - -import globby = require('globby'); - -(async () => { - let result: string[]; - - /** - * Standard `pattern` usage - */ - result = await globby('*.tmp'); - result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - - result = globby.sync('*.tmp'); - result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - - /** - * `expandDirectories` option - */ - result = await globby('*.tmp', { expandDirectories: false }); - result = globby.sync('*.tmp', { expandDirectories: false }); - result = await globby('*.tmp', { expandDirectories: ['a*', 'b*'] }); - result = globby.sync('*.tmp', { expandDirectories: ['a*', 'b*'] }); - result = await globby('*.tmp', { - expandDirectories: { - files: ['a', 'b'], - extensions: ['tmp'] - } - }); - result = globby.sync('*.tmp', { - expandDirectories: { - files: ['a', 'b'], - extensions: ['tmp'] - } - }); - - /** - * Options passed through from `fast-glob` - */ - result = await globby('*.tmp', { ignore: ['**/b.tmp'] }); - result = globby.sync('*.tmp', { ignore: ['**/b.tmp'] }); -})(); - -const tasks: Array<{ - pattern: string; - options: IOptions; -}> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], { ignore: ['c.tmp'] }); - -console.log(globby.hasMagic('**')); -console.log(globby.hasMagic(['**', 'path1', 'path2'])); -console.log(!globby.hasMagic(['path1', 'path2'])); - -(async () => { - let result: (path: string) => boolean; - - /** - * Standard `gitignore` usage - */ - result = await globby.gitignore(); - result = globby.gitignore.sync(); - - /** With options */ - result = await globby.gitignore({ - cwd: __dirname, - ignore: ['**/b.tmp'] - }); - result = globby.gitignore.sync({ - cwd: __dirname, - ignore: ['**/b.tmp'] - }); -})(); diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts deleted file mode 100644 index af49813432..0000000000 --- a/types/globby/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -// Type definitions for globby 8.0 -// Project: https://github.com/sindresorhus/globby#readme -// Definitions by: Douglas Duteil -// Ika -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { IOptions as NodeGlobOptions } from 'glob'; -import { Options as FastGlobOptions } from 'fast-glob'; - -type ExpandDirectoriesOption = boolean | string[] | { files: string[]; extensions: string[] }; - -interface Options extends FastGlobOptions { - /** - * If set to `true`, `globby` will automatically glob directories for you. - * If you define an `Array` it will only glob files that matches the patterns inside the Array. - * You can also define an `Object` with `files` and `extensions` like below: - * - * ```js - * (async () => { - * const paths = await globby('images', { - * expandDirectories: { - * files: ['cat', 'unicorn', '*.jpg'], - * extensions: ['png'] - * } - * }); - * console.log(paths); - * //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg'] - * })(); - * ``` - * - * Note that if you set this option to `false`, you won't get back matched directories unless - * you set `onlyFiles: false`. - */ - expandDirectories?: ExpandDirectoriesOption; - /** - * Respect ignore patterns in `.gitignore` files that apply to the globbed files. - */ - gitignore?: boolean; -} - -/** - * Returns a `Promise` of matching paths. - */ -declare function globby(patterns: string | string[], options?: Options): Promise; - -declare namespace globby { - /** - * Returns an `Array` of matching paths. - */ - function sync(patterns: string | string[], options?: Options): string[]; - /** - * Returns an `Array` in the format `{ pattern: string, opts: Object }`, - * which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). - * This is useful for other globbing-related packages. - * - * Note that you should avoid running the same tasks multiple times as they contain a file system cache. - * Instead, run this method each time to ensure file system changes are taken into consideration. - */ - function generateGlobTasks(patterns: string | string[], options?: Options): Array<{ pattern: string; options: Options }>; - /** - * Returns a boolean of whether there are any special glob characters in the `patterns`. - * - * Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not - * be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, - * then that is considered magical, unless `nobrace: true` is set. - * - * This function is backed by [`node-glob`](https://github.com/isaacs/node-glob#globhasmagicpattern-options) - */ - function hasMagic(patterns: string | string[], options?: NodeGlobOptions): boolean; - /** - * Returns a Promise<(path: string) => boolean> indicating whether a given path is ignored - * via a `.gitignore` file. - * - * Takes `cwd?: string` and `ignore?: string[]` as options. `.gitignore` files matched by the - * ignore config are not used for the resulting filter function. - * - * ```js - * const {gitignore} = require('globby'); - * - * (async () => { - * const isIgnored = await gitignore(); - * console.log(isIgnored('some/file')); - * })(); - * ``` - */ - function gitignore(options?: { cwd?: string; ignore?: string[]; }): Promise<(path: string) => boolean>; - - namespace gitignore { - /** - * Returns a `(path: string) => boolean` indicating whether a given path is ignored via a `.gitignore` file. - * - * Takes the same options as `globby.gitignore`. - */ - function sync(options?: { cwd?: string; ignore?: string[]; }): (path: string) => boolean; - } -} - -export = globby; diff --git a/types/globby/package.json b/types/globby/package.json deleted file mode 100644 index 136d4694e9..0000000000 --- a/types/globby/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "fast-glob": "^2.0.2" - } -} diff --git a/types/globby/tsconfig.json b/types/globby/tsconfig.json deleted file mode 100644 index 5cc0a3fe62..0000000000 --- a/types/globby/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "globby-tests.ts" - ] -} \ No newline at end of file diff --git a/types/globby/tslint.json b/types/globby/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/globby/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/log-update/index.d.ts b/types/log-update/index.d.ts deleted file mode 100644 index 544223a766..0000000000 --- a/types/log-update/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for log-update 2.0 -// Project: https://github.com/sindresorhus/log-update#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export = logUpdate; - -declare function logUpdate(...text: string[]): void; - -declare namespace logUpdate { - function clear(): void; - function done(): void; - const stderr: typeof logUpdate; - function create(stream: NodeJS.WritableStream): typeof logUpdate; -} diff --git a/types/log-update/log-update-tests.ts b/types/log-update/log-update-tests.ts deleted file mode 100644 index 9a0955f7d4..0000000000 --- a/types/log-update/log-update-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import logUpdate = require('log-update'); - -logUpdate(` - ♥♥ - unicorns - ♥♥ -`); - -logUpdate.clear(); -logUpdate.done(); - -logUpdate.stderr('oh', 'my', 'oh', 'my'); -logUpdate.stderr.clear(); -logUpdate.stderr.done(); - -const logStdOut = logUpdate.create(process.stdout); -logStdOut('oh', 'my', 'oh', 'my'); -logStdOut.clear(); -logStdOut.done(); diff --git a/types/log-update/tsconfig.json b/types/log-update/tsconfig.json deleted file mode 100644 index 888455297b..0000000000 --- a/types/log-update/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "log-update-tests.ts" - ] -} \ No newline at end of file diff --git a/types/log-update/tslint.json b/types/log-update/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/log-update/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/make-dir/index.d.ts b/types/make-dir/index.d.ts deleted file mode 100644 index 1805280240..0000000000 --- a/types/make-dir/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Type definitions for make-dir 1.0 -// Project: https://github.com/sindresorhus/make-dir -// Definitions by: Ika -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// -import * as fs from 'fs'; - -export = makeDir; - -/** - * Returns a `Promise` for the path to the created directory. - * @param path Directory to create. - */ -declare function makeDir(path: string, options?: makeDir.Options): Promise; - -declare namespace makeDir { - /** - * Returns the path to the created directory. - * @param path Directory to create. - */ - function sync(path: string, options?: Options): string; - - interface Options { - /** - * Default: `0o777 & (~process.umask())` - * - * Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). - */ - mode?: number; - - /** - * Default: `require('fs')` - * - * Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). - */ - fs?: typeof fs; - } -} diff --git a/types/make-dir/make-dir-tests.ts b/types/make-dir/make-dir-tests.ts deleted file mode 100644 index 2767706bf6..0000000000 --- a/types/make-dir/make-dir-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import makeDir = require('make-dir'); -import * as fs from 'fs'; -import * as gfs from 'graceful-fs'; - -makeDir('path/to/somewhere').then(dirname => { - // do something -}); - -const dirname = makeDir.sync('path/to/somewhere'); - -makeDir('path/to/somewhere', {mode: parseInt('777', 8)}); -makeDir('path/to/somewhere', {fs}); -makeDir('path/to/somewhere', {fs: gfs}); diff --git a/types/make-dir/tsconfig.json b/types/make-dir/tsconfig.json deleted file mode 100644 index f1770d52af..0000000000 --- a/types/make-dir/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "make-dir-tests.ts" - ] -} \ No newline at end of file diff --git a/types/make-dir/tslint.json b/types/make-dir/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/make-dir/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} diff --git a/types/move-file/index.d.ts b/types/move-file/index.d.ts deleted file mode 100644 index 7c86feca71..0000000000 --- a/types/move-file/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Type definitions for move-file 1.0 -// Project: https://github.com/sindresorhus/move-file#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = moveFile; - -declare function moveFile( - source: string, - destination: string, - options?: moveFile.Options -): Promise; - -declare namespace moveFile { - function sync(source: string, destination: string, options?: Options): void; - - interface Options { - overwrite?: boolean; - } -} diff --git a/types/move-file/move-file-tests.ts b/types/move-file/move-file-tests.ts deleted file mode 100644 index 36badd38c1..0000000000 --- a/types/move-file/move-file-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import moveFile = require('move-file'); - -// $ExpectType Promise -moveFile('source/unicorn.png', 'destination/unicorn.png'); -// $ExpectType Promise -moveFile('source/unicorn.png', 'destination/unicorn.png', { overwrite: false }); -// $ExpectType void -moveFile.sync('source/unicorn.png', 'destination/unicorn.png'); -// $ExpectType void -moveFile.sync('source/unicorn.png', 'destination/unicorn.png', { overwrite: false }); diff --git a/types/move-file/tsconfig.json b/types/move-file/tsconfig.json deleted file mode 100644 index bcd3f7550e..0000000000 --- a/types/move-file/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "move-file-tests.ts" - ] -} diff --git a/types/move-file/tslint.json b/types/move-file/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/move-file/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/on-change/index.d.ts b/types/on-change/index.d.ts deleted file mode 100644 index 44fff26e60..0000000000 --- a/types/on-change/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for on-change 0.1 -// Project: https://github.com/sindresorhus/on-change#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -export = onChange; - -declare function onChange(object: T, onChange: () => void): T; diff --git a/types/on-change/on-change-tests.ts b/types/on-change/on-change-tests.ts deleted file mode 100644 index 003d89aab7..0000000000 --- a/types/on-change/on-change-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ -import onChange = require('on-change'); - -const object = { - foo: false, - a: { - b: [ - { - c: false, - }, - ], - }, -}; - -const watchedObject = onChange(object, () => {}); - -watchedObject.foo = true; -watchedObject.a.b[0].c = true; diff --git a/types/on-change/tsconfig.json b/types/on-change/tsconfig.json deleted file mode 100644 index 433629ab82..0000000000 --- a/types/on-change/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "on-change-tests.ts" - ] -} diff --git a/types/on-change/tslint.json b/types/on-change/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/on-change/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/query-string/index.d.ts b/types/query-string/index.d.ts deleted file mode 100644 index 3eaf34c159..0000000000 --- a/types/query-string/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for query-string 6.2 -// Project: https://github.com/sindresorhus/query-string -// Definitions by: Sam Verschueren -// Tanguy Krotoff -// HuHuanming -// Madara Uchiha -// Josh Holmer -// Simon Van den Broeck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -export interface ParseOptions { - arrayFormat?: 'bracket' | 'index' | 'none'; - decode?: boolean; -} - -export interface InputParams { - [key: string]: any; -} - -export interface OutputParams { - [key: string]: string | string[] | undefined; -} - -/** - * Parse a query string into an object. - * Leading ? or # are ignored, so you can pass location.search or location.hash directly. - */ -export function parse(str: string, options?: ParseOptions): OutputParams; - -export function parseUrl(str: string, options?: ParseOptions): {url: string, query: OutputParams}; - -export interface StringifyOptions { - strict?: boolean; - encode?: boolean; - arrayFormat?: 'bracket' | 'index' | 'none'; - sort?: ((m: string, n: string) => boolean) | boolean; -} - -/** - * Stringify an object into a query string, sorting the keys. - */ -export function stringify(obj: InputParams, options?: StringifyOptions): string; - -/** - * Extract a query string from a URL that can be passed into .parse(). - */ -export function extract(str: string): string; diff --git a/types/query-string/query-string-tests.ts b/types/query-string/query-string-tests.ts deleted file mode 100644 index 33152ce445..0000000000 --- a/types/query-string/query-string-tests.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as queryString from 'query-string'; - -// stringify -{ - let result: string; - // test obj - result = queryString.stringify({ - str: 'bar', - strArray: ['baz'], - num: 123, - numArray: [456], - bool: true, - boolArray: [false] - }); - - // test options - result = queryString.stringify({ foo: 'bar' }, { strict: false }); - result = queryString.stringify({ foo: 'bar' }, { encode: false }); - result = queryString.stringify({ foo: 'bar' }, { strict: false, encode: false }); -} - -// For each section below, the second line ensures the real answer is of the declared -// type. You can find the real answer by running the first line of each section. - -// parse -{ - let fooBar = queryString.parse('?foo=bar'); - fooBar = {foo: "bar"}; - - let fooBarBaz1 = queryString.parse('&foo=bar&foo=baz'); - fooBarBaz1 = { foo: [ 'bar', 'baz' ] }; - - let fooBarBaz2 = queryString.parse('&foo[]=bar&foo[]=baz', {arrayFormat: 'bracket'}); - fooBarBaz2 = { foo: [ 'bar', 'baz' ] }; -} - -// extract -{ - let result1 = queryString.extract('http://foo.bar/?abc=def&hij=klm'); - result1 = 'abc=def&hij=klm'; - - let result2 = queryString.extract('http://foo.bar/?foo=bar'); - result2 = 'foo=bar'; -} diff --git a/types/query-string/tsconfig.json b/types/query-string/tsconfig.json deleted file mode 100644 index 83d5a52072..0000000000 --- a/types/query-string/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "query-string-tests.ts" - ] -} \ No newline at end of file diff --git a/types/query-string/tslint.json b/types/query-string/tslint.json deleted file mode 100644 index e765bc9e16..0000000000 --- a/types/query-string/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-single-declare-module": false - } -} From 7059ba1e9f54c3c439d522b7234e2a7dde8103a0 Mon Sep 17 00:00:00 2001 From: Vincent Pizzo Date: Tue, 5 Mar 2019 14:31:36 -0800 Subject: [PATCH 164/265] Don't use patch in version --- types/react-csv/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-csv/index.d.ts b/types/react-csv/index.d.ts index 2fe767d3e7..1390ce1361 100644 --- a/types/react-csv/index.d.ts +++ b/types/react-csv/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-csv 1.1.1 +// Type definitions for react-csv 1.1 // Project: https://github.com/react-csv/react-csv // Definitions by: Vincent Pizzo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 9929fd321f9f12616851f65d817f16572e30066b Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Tue, 5 Mar 2019 22:46:02 +0000 Subject: [PATCH 165/265] Update examples. --- types/collectionsjs/collectionsjs-tests.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index bc71c9e544..3748dc234e 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -30,7 +30,7 @@ collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean collection.count(); // $ExpectType number collection.each(stark => stark.age = 3); // $ExpectType Collection<{ name: string; age: number; }> collection.filter(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> -collection.find('bran'); // $ExpectType number +collection.find({ name: 'Bran Stark', age: 7 }); // $ExpectType number collection.first(item => item.age > 7); // $ExpectType { name: string; age: number; } collection.flatten(true); // $ExpectType Collection<{ name: string; age: number; }> collection.get(2); // $ExpectType { name: string; age: number; } @@ -41,7 +41,11 @@ collection.last(); // $ExpectType { name: string; age: number; } collection.map(stark => stark.name); // $ExpectType Collection<{ name: string; age: number; }> collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }> collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }> -collection.reduce((previous, current) => previous.age + current.age, 0); // $ExpectType any + +const value = new Collection([1, 2, 3]).reduce( + (previous, current) => previous + current, + 0 + ); // $ExpectType number collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }> collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }> From fa2d5d5e91e661d6891f1871f60652b38bcbf47d Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Tue, 5 Mar 2019 22:51:45 +0000 Subject: [PATCH 166/265] Amend a few tests and types for linting. --- types/collectionsjs/collectionsjs-tests.ts | 10 ++-------- types/collectionsjs/index.d.ts | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index 3748dc234e..5f40824445 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -41,11 +41,7 @@ collection.last(); // $ExpectType { name: string; age: number; } collection.map(stark => stark.name); // $ExpectType Collection<{ name: string; age: number; }> collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }> collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }> - -const value = new Collection([1, 2, 3]).reduce( - (previous, current) => previous + current, - 0 - ); // $ExpectType number +const value = new Collection([1, 2, 3]).reduce((previous, current) => previous + current, 0); // $ExpectType number collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }> collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }> @@ -56,9 +52,7 @@ collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number collection.stringify(); // $ExpectType string collection.sum('age'); // $ExpectType any collection.take(2); // $ExpectType Collection<{ name: string; age: number; }> - -// Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); -// const collection2 = new Collection([1,2,3,4]).addToMembers(3); +Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); collection.unique(stark => stark.age); // $ExpectType Collection<{ name: string; age: number; }> collection.values(); // $ExpectType Collection<{ name: string; age: number; }> diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts index 364877050d..aaf92fe61e 100644 --- a/types/collectionsjs/index.d.ts +++ b/types/collectionsjs/index.d.ts @@ -36,12 +36,12 @@ export default class Collection { sort(compare?: () => boolean): Collection; sortBy(property: string, order?: string): Collection; stringify(): string; - sum(property: T extends object ? keyof T : never): number + sum(property: T extends object ? keyof T : never): number; take(count: number): Collection; static macro(name: string, callback: (coll: Collection, ...args: unknown[]) => unknown): void; unique(callback?: string|null|((item: T) => any)): Collection; values(): Collection; - where(key: K, value: T[K]): Collection - where(callback: (item: T) => boolean): Collection + where(key: K, value: T[K]): Collection; + where(callback: (item: T) => boolean): Collection; zip(array: T[]|Collection): Collection; } From ee356e5c4ddbf0b5c95e27e449f6a7dfee2061e6 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Tue, 5 Mar 2019 22:55:55 +0000 Subject: [PATCH 167/265] Picks up on the final two issues during testing. --- types/collectionsjs/collectionsjs-tests.ts | 2 +- types/collectionsjs/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index 5f40824445..98cc95cabc 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -50,7 +50,7 @@ collection.slice(1, 3); // $ExpectType Collection<{ name: string; age: number; } collection.sort(); // $ExpectType Collection<{ name: string; age: number; }> collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number; }> collection.stringify(); // $ExpectType string -collection.sum('age'); // $ExpectType any +collection.sum('age'); // $ExpectType number collection.take(2); // $ExpectType Collection<{ name: string; age: number; }> Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts index aaf92fe61e..1a9bfe7062 100644 --- a/types/collectionsjs/index.d.ts +++ b/types/collectionsjs/index.d.ts @@ -24,7 +24,7 @@ export default class Collection { join(separator?: string): string; keys(): Collection; last(callback?: ((item: T) => boolean)|null): T; - map(callback: (item: T) => R): Collection; + map(callback: (item: T) => R): Collection; pluck(property: string): Collection; push(item: T): Collection; reduce(callback: (previous: R, current: T) => R, initial: R): R; From ec421510feb521fd3a1c9892b518498222e2a903 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Tue, 5 Mar 2019 22:59:03 +0000 Subject: [PATCH 168/265] Found another issue with the map function. --- types/collectionsjs/collectionsjs-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts index 98cc95cabc..47ab0b00bb 100644 --- a/types/collectionsjs/collectionsjs-tests.ts +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -38,7 +38,7 @@ collection.has({ name: 'Bran Stark', age: 7 }); // $ExpectType boolean collection.join(); // $ExpectType string collection.keys(); // $ExpectType Collection<{ name: string; age: number; }> collection.last(); // $ExpectType { name: string; age: number; } -collection.map(stark => stark.name); // $ExpectType Collection<{ name: string; age: number; }> +collection.map(stark => stark.name); // $ExpectType Collection collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }> collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }> const value = new Collection([1, 2, 3]).reduce((previous, current) => previous + current, 0); // $ExpectType number From 161917a82a844502caeac3687db37f4c1701959b Mon Sep 17 00:00:00 2001 From: Queenie Ma Date: Tue, 5 Mar 2019 15:00:24 -0800 Subject: [PATCH 169/265] Update keytar typings for v4.4.1 --- types/keytar/index.d.ts | 20 ++++++++++++++++---- types/keytar/keytar-tests.ts | 4 +++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/types/keytar/index.d.ts b/types/keytar/index.d.ts index cf6a16e4f7..f5e8e7367a 100644 --- a/types/keytar/index.d.ts +++ b/types/keytar/index.d.ts @@ -1,6 +1,9 @@ -// Type definitions for keytar 4.0.2 +// Type definitions for keytar 4.4.1 // Project: http://atom.github.io/node-keytar/ -// Definitions by: Milan Burda , Brendan Forster , Hari Juturu +// Definitions by: Milan Burda +// Brendan Forster +// Hari Juturu +// Queenie Ma // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,7 +18,7 @@ export declare function getPassword(service: string, account: string): Promise; /** - * Add the password for the service and account to the keychain. + * Save the password for the service and account to the keychain. Adds a new entry if necessary, or updates an existing entry if one exists. * * @param service The string service name. * @param account The string account name. @@ -36,7 +39,16 @@ export declare function setPassword(service: string, account: string, password: export declare function deletePassword(service: string, account: string): Promise; /** - * Find a password for the service in the keychain. + * Find all accounts and password for the service in the keychain. + * + * @param service The string service name. + * + * @returns A promise for the credentials array. + */ +export declare function findCredentials(service: string): Promise>; + +/** + * Find a password for the service in the keychain. This is ideal for scenarios where an account is not required. * * @param service The string service name. * diff --git a/types/keytar/keytar-tests.ts b/types/keytar/keytar-tests.ts index f6873838c2..18a7423450 100644 --- a/types/keytar/keytar-tests.ts +++ b/types/keytar/keytar-tests.ts @@ -8,6 +8,8 @@ let success: Promise; success = keytar.deletePassword('keytar-tests', 'username'); let password: Promise; - password = keytar.findPassword('keytar-tests'); password = keytar.getPassword('keytar-tests', 'username'); + +let credentials: Promise>; +credentials = keytar.findCredentials('keytar-tests'); From 38c7f6fe6a1d02acfbf09a7ee369417504ebb9d5 Mon Sep 17 00:00:00 2001 From: zzanol Date: Tue, 5 Mar 2019 17:00:05 -0800 Subject: [PATCH 170/265] fix callback argument shape --- types/react-credit-cards/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-credit-cards/index.d.ts b/types/react-credit-cards/index.d.ts index 4cbf2f9830..015334e1c3 100644 --- a/types/react-credit-cards/index.d.ts +++ b/types/react-credit-cards/index.d.ts @@ -1,14 +1,14 @@ -// Type definitions for react-credit-cards 0.7 +// Type definitions for react-credit-cards 0.8 // Project: https://github.com/amarofashion/react-credit-cards -// Definitions by: Vytautas Strimaitis , Ole Frank +// Definitions by: Vytautas Strimaitis , Ole Frank , zzanol // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from "react"; export interface CallbackArgument { - isValid: boolean; - type: { issuer: string; maxLength: number }; + issuer: string; + maxLength: number; } export type Focused = "name" | "number" | "expiry" | "cvc"; From 2ba47ba8919dbd7a7613a6c4fdbf687b86273538 Mon Sep 17 00:00:00 2001 From: pdeva Date: Tue, 5 Mar 2019 20:14:13 -0800 Subject: [PATCH 171/265] removing myself from list --- types/react-redux/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 5adeb43612..bd9ea1cae2 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -6,7 +6,6 @@ // Frank Tan // Nicholas Boll // Dibyo Majumdar -// Prashant Deva // Thomas Charlat // Valentin Descamps // Johann Rakotoharisoa From 1f3fbac02514c332857735efbe8db0172109c1a1 Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Wed, 6 Mar 2019 16:57:59 +1100 Subject: [PATCH 172/265] Added type defs for date-now --- types/date-now/date-now-tests.ts | 5 +++++ types/date-now/index.d.ts | 8 ++++++++ types/date-now/seed.d.ts | 6 ++++++ types/date-now/tsconfig.json | 26 ++++++++++++++++++++++++++ types/date-now/tslint.json | 3 +++ 5 files changed, 48 insertions(+) create mode 100644 types/date-now/date-now-tests.ts create mode 100644 types/date-now/index.d.ts create mode 100644 types/date-now/seed.d.ts create mode 100644 types/date-now/tsconfig.json create mode 100644 types/date-now/tslint.json diff --git a/types/date-now/date-now-tests.ts b/types/date-now/date-now-tests.ts new file mode 100644 index 0000000000..f16487de44 --- /dev/null +++ b/types/date-now/date-now-tests.ts @@ -0,0 +1,5 @@ +import seeded = require('date-now/seed'); +import dateNow = require('date-now'); + +seeded(123); +dateNow(); diff --git a/types/date-now/index.d.ts b/types/date-now/index.d.ts new file mode 100644 index 0000000000..7ed6ab7df3 --- /dev/null +++ b/types/date-now/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for date-now 1.0 +// Project: https://github.com/Raynos/date-now +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function dateNow(): number; + +export = dateNow; diff --git a/types/date-now/seed.d.ts b/types/date-now/seed.d.ts new file mode 100644 index 0000000000..c87a702c55 --- /dev/null +++ b/types/date-now/seed.d.ts @@ -0,0 +1,6 @@ +/** + * Returns a Date.now() like function that's in sync with the seed value. + */ +declare function seeded(seed: number): number; + +export = seeded; diff --git a/types/date-now/tsconfig.json b/types/date-now/tsconfig.json new file mode 100644 index 0000000000..705da71b7b --- /dev/null +++ b/types/date-now/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "seed.d.ts", + "date-now-tests.ts" + ] +} diff --git a/types/date-now/tslint.json b/types/date-now/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/date-now/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 778d161e489437881cc16eebfd415708c494714b Mon Sep 17 00:00:00 2001 From: Rob Valentine Date: Wed, 6 Mar 2019 08:12:03 +0200 Subject: [PATCH 173/265] Fixed space issue --- types/react-dnd-multi-backend/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index 9797be6e28..e0a152c610 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -100,7 +100,7 @@ export interface PreviewProps { export class Preview extends PureComponent {} /** * Pre-existing/default react-dnd-multi-backend transition available to use. - */ + */ export const MouseTransition: Transition; /** * Pre-existing/default react-dnd-touch-backend transition available to use. From 7f1bccc091d452d9d90ada531792c09a309f1adc Mon Sep 17 00:00:00 2001 From: Adam Zerella Date: Wed, 6 Mar 2019 21:44:52 +1100 Subject: [PATCH 174/265] Updated export type --- types/repeat-string/index.d.ts | 4 +++- types/repeat-string/repeat-string-tests.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/repeat-string/index.d.ts b/types/repeat-string/index.d.ts index e593a62b68..5664484e22 100644 --- a/types/repeat-string/index.d.ts +++ b/types/repeat-string/index.d.ts @@ -6,4 +6,6 @@ /** * Repeat the given `string` the specified `number` of times. */ -export default function(str: string, num: number): string; +declare function repeat(str: string, num: number): string; + +export = repeat; diff --git a/types/repeat-string/repeat-string-tests.ts b/types/repeat-string/repeat-string-tests.ts index 7095ea672b..c2692d7569 100644 --- a/types/repeat-string/repeat-string-tests.ts +++ b/types/repeat-string/repeat-string-tests.ts @@ -1,3 +1,3 @@ -import Repeat from "repeat-string"; +import Repeat = require("repeat-string"); Repeat('A', 5); From 0219d7546ed10178d5659696ee431a6613abe088 Mon Sep 17 00:00:00 2001 From: Adam Zerella Date: Wed, 6 Mar 2019 21:51:56 +1100 Subject: [PATCH 175/265] Updated export type --- types/html-truncate/html-truncate-tests.ts | 2 +- types/html-truncate/index.d.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/html-truncate/html-truncate-tests.ts b/types/html-truncate/html-truncate-tests.ts index 0c46bf560b..30f6a19e7c 100644 --- a/types/html-truncate/html-truncate-tests.ts +++ b/types/html-truncate/html-truncate-tests.ts @@ -1,4 +1,4 @@ -import Truncate from "html-truncate"; +import Truncate = require("html-truncate"); Truncate('hello world', 4); diff --git a/types/html-truncate/index.d.ts b/types/html-truncate/index.d.ts index 8be4a950a3..4784caa925 100644 --- a/types/html-truncate/index.d.ts +++ b/types/html-truncate/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/huang47/nodejs-html-truncate // Definitions by: Adam Zerella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 -export interface TruncateOptions { +interface TruncateOptions { /** * Flag to specify if keep image tag, false by default. */ @@ -17,4 +18,6 @@ export interface TruncateOptions { /** * Truncate HTML text and also keep tag safe. */ -export default function truncate(input: string, maxLength: number, options?: TruncateOptions): string; +declare function truncate(input: string, maxLength: number, options?: TruncateOptions): string; + +export = truncate; From 57ee13062763ab3faa6f104624a03dab0f12e0de Mon Sep 17 00:00:00 2001 From: Rocky Warren <1085683+therockstorm@users.noreply.github.com> Date: Wed, 6 Mar 2019 08:31:31 -0600 Subject: [PATCH 176/265] Update SQSMessageAttribute in aws-lambda --- types/aws-lambda/aws-lambda-tests.ts | 14 +++++++++++++- types/aws-lambda/index.d.ts | 12 +++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index ad063c20b6..dc5f9b3eba 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1003,7 +1003,15 @@ const SQSEvent: AWSLambda.SQSEvent = { SenderId: "594035263019", ApproximateFirstReceiveTimestamp: "1529104986230" }, - messageAttributes: {}, + messageAttributes: { + testAttr: { + stringValue: "100", + binaryValue: "base64Str", + stringListValues: [], + binaryListValues: [], + dataType: "Number" + } + }, md5OfBody: "9bb58f26192e4ba00f01e2e7b136bbd8", eventSource: "aws:sqs", eventSourceARN: "arn:aws:sqs:us-west-2:594035263019:NOTFIFOQUEUE", @@ -1039,6 +1047,10 @@ const SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async ( event; str = event.Records[0].messageId; anyObj = event.Records[0].body; + strOrUndefined = event.Records[0].messageAttributes.testAttr.stringValue; + strOrUndefined = event.Records[0].messageAttributes.testAttr.binaryValue; + str = event.Records[0].messageAttributes.testAttr.dataType; + // $ExpectType Context context; str = context.functionName; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 6ebccd452a..25d5c471eb 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -878,11 +878,17 @@ export interface SQSRecordAttributes { SenderId: string; ApproximateFirstReceiveTimestamp: string; } + +export type SQSMessageAttributeDataType = 'String' | 'Number' | 'Binary' | string; + export interface SQSMessageAttribute { - Name: string; - Type: string; - Value: string; + stringValue?: string; + binaryValue?: string; + stringListValues: never[]; // Not implemented. Reserved for future use. + binaryListValues: never[]; // Not implemented. Reserved for future use. + dataType: SQSMessageAttributeDataType; } + export interface SQSMessageAttributes { [name: string]: SQSMessageAttribute; } From 5c9faedd41649bed7ab58670b8dda60f552947c1 Mon Sep 17 00:00:00 2001 From: Jojoshua Date: Wed, 6 Mar 2019 10:17:05 -0500 Subject: [PATCH 177/265] Initial --- types/tabulator-tables/index.d.ts | 1729 +++++++++++++++++ .../tabulator-tables-tests.ts | 427 ++++ types/tabulator-tables/tsconfig.json | 16 + types/tabulator-tables/tslint.json | 1 + 4 files changed, 2173 insertions(+) create mode 100644 types/tabulator-tables/index.d.ts create mode 100644 types/tabulator-tables/tabulator-tables-tests.ts create mode 100644 types/tabulator-tables/tsconfig.json create mode 100644 types/tabulator-tables/tslint.json diff --git a/types/tabulator-tables/index.d.ts b/types/tabulator-tables/index.d.ts new file mode 100644 index 0000000000..3fe21f805f --- /dev/null +++ b/types/tabulator-tables/index.d.ts @@ -0,0 +1,1729 @@ +// Type definitions for tabulator-tables 4.2 +// Project: https://github.com/olifolkerd/tabulator +// Definitions by: Josh Harris +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare namespace Tabulator { + interface Options extends OptionsGeneral, OptionsHistory, OptionsLocale, OptionsDownload, OptionsColumns, OptionsRows, OptionsData, OptionsSorting, OptionsFiltering, OptionsRowGrouping, OptionsPagination, OptionsPersistentConfiguration, OptionsClipboard, OptionsDataTree, OptionsCell {} + + interface OptionsCells extends CellCallbacks { + /**The validationFailed event is triggered when the value entered into a cell during an edit fails to pass validation. */ + validationFailed?: (cell: CellComponent, value: any, validators: Validator[] | StandardValidatorType[]) => void; + } + type OptionsDataTree = { + /**To enable data trees in your table, set the dataTree property to true in your table constructor: */ + dataTree?: boolean; + /** By default the toggle element will be inserted into the first column on the table. If you want the toggle element to be inserted in a different column you can pass the feild name of the column to the dataTreeElementColumn setup option*/ + dataTreeElementColumn?: boolean | string; + /**Show tree branch icon */ + dataTreeBranchElement?: boolean | string; + /**Tree level indent in pixels */ + dataTreeChildIndent?: number; + /**By default Tabulator will look for child rows in the _children field of a row data object. You can change this to look in a different field using the dataTreeChildField property in your table constructor: */ + dataTreeChildField?: string; + /**The toggle button that allows users to collapse and expand the column can be customised to meet your needs. There are two options, dataTreeExpandElement and dataTreeCollapseElement, that can be set to replace the default toggle elements with your own. + + Both options can take either an html string representing the contents of the toggle element */ + dataTreeCollapseElement?: string | HTMLElement | boolean; + /** */ + dataTreeExpandElement?: string | HTMLElement | boolean; + /** By default all nodes on the tree will start collapsed, you can customize the initial expansion state of the tree using the dataTreeStartExpanded option. + * + This option can take one of three possible value types, either a boolean to indicate whether all nodes should start expanded or collapsed: */ + dataTreeStartExpanded?: boolean | boolean[] | ((row: RowComponent, level: number) => boolean); + }; + type OptionsClipboard = { + /**You can enable clipboard functionality using the clipboard config option. It can take one of four possible values: + + true - enable clipboard copy and paste + "copy" - enable only copy functionality + "paste" - enable only paste functionality + false - disable all clipboard functionality (default) */ + clipboard?: boolean | "copy" | "paste"; + /** + * The copy selector is a function that is used to choose which data is copied into the clipboard. Tabulator comes with a few different selectors built in: + active - Copy all table data currently displayed in the table to the clipboard (default) + table - Copy all table data to the clipboard, including data that is currently filtered out + selected - Copy the currently selected rows to the clipboard, including data that is currently filtered out + Tabulator will try to use the best selector to match your table setup. If any text is selected on the table, then it will be that text which is copied. If the table has selectable rows enabled, the it will be the currently selected rows copied to the clipboard in the order in which they were selected. Otherwise the currently visible data in the table will be copied. + + These selectors can also be used when programatically triggering a copy event. in this case if the selector is not specified it will default to the value set in the clipboardCopySelector property (which is active by default). + */ + clipboardCopySelector?: "active" | "table" | "selected"; + /** The copy formatter is used to take the row data provided by the selector and turn it into a text string for the clipboard. + There is one built in copy formatter called table, if you have extended the clipboard module and want to change the default you can use the clipboardCopyFormatter property. you can also pass in a formatting function directly into this property.*/ + clipboardCopyFormatter?: "table" | ((rowData: any[]) => string); + /**By default Tabulator will include the column header titles in any clipboard data, this can be turned off by passing a value of false to the clipboardCopyHeader property: */ + clipboardCopyHeader?: boolean; + /** Tabulator has one built in paste parser, that is designed to take a table formatted text string from the clipboard and turn it into row data. it breaks the tada into rows on a newline character \n and breaks the rows down to columns on a tab character \t. + + It will then attempt to work out which columns in the data correspond to columns in the table. It tries three different ways to achieve this. First it checks the values of all columns in the first row of data to see if they match the titles of columns in the table. If any of the columns don't match it then tries the same approach but with the column fields. If either of those options match, Tabulator will map those columns to the incoming data and import it into rows. If there is no match then Tabulator will assume the columns in the data are in the same order as the visible columns in the table and import them that way. + + The inbuilt parser will reject any clipboard data that does not contain at least one row and two columns, in that case the clipboardPasteError will be triggered. + + If you extend the clipboard module to add your own parser, you can set it to be used as default with the clipboardPasteParser property.*/ + clipboardPasteParser?: string | ((clipboard: any) => any[]); + /**Once the data has been parsed into row data, it will be passed to a paste action to be added to the table. There are three inbuilt paste actions: + + insert - Inserts data into the table using the addRows function (default) + update - Updates data in the table using the updateOrAddData function + replace - replaces all data in the table using the setData function */ + clipboardPasteAction?: "insert" | "update" | "replace"; + + /**By default Tabulator will copy some of the tables styling along with the data to give a better visual appearance when pasted into other documents. + + If you want to only copy the unstyled data then you should set the clipboardCopyStyled option to false in the table options object: */ + clipboardCopyStyled?: boolean; + + /**By default Tabulator includes column headers, row groups and column calculations in the clipboard output. + + You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the clipboardCopyConfig option in the table definition: */ + clipboardCopyConfig?: + | { + columnHeaders?: boolean; + rowGroups?: boolean; + columnCalcs?: boolean; + } + | boolean; + + /**The clipboardCopied event is triggered whenever data is copied to the clipboard. */ + clipboardCopied: () => void; + /**The clipboardPasted event is triggered whenever data is successfuly pasted into the table. */ + clipboardPasted: () => void; + /**The clipboardPasteError event is triggered whenever an atempt to paste data into the table has failed because it was rejected by the paste parser. */ + clipboardPasteError: () => void; + }; + + type OptionsPersistentConfiguration = { + /**ID tag used to identify persistent storage information */ + persistenceID?: string; + /** Persistence information can either be stored in a cookie or in the localSotrage object, you can use the persistenceMode to choose which. It can take three possible values: + + local - (string) Store the persistence information in the localStorage object + cookie - (string) Store the persistence information in a cookie + true - (boolean) check if localStorage is available and store persistence information, otherwise store in cookie (Default option) */ + persistenceMode?: "local" | "cookie" | true; + /**Enable persistsnt storage of column layout information */ + persistentLayout?: boolean; + /**You can ensure the data sorting is stored for the next page load by setting the persistentSort option to true */ + persistentSort?: boolean; + /** You can ensure the data filtering is stored for the next page load by setting the persistentFilter option to true*/ + persistentFilter?: boolean; + }; + + type OptionsPagination = { + /**Choose pagination method, "local" or "remote" */ + pagination?: "remote" | "local"; + /**Set the number of rows in each page */ + paginationSize?: number; + /** Setting this option to true will cause Tabulator to create a list of page size options, that are multiples of the current page size. In the example below, the list will have the values of 5, 10, 15 and 20. + + When using the page size selector like this, if you use the setPageSize function to set the page size to a value not in the list, the list will be regenerated using the new page size as the starting valuer */ + paginationSizeSelector?: true | number[]; + /** By default the pagination controls are added to the footer of the table. If you wish the controls to be created in another element pass a DOM node or a CSS selector for that element to the paginationElement option.*/ + paginationElement?: HTMLElement | "string"; + /**Lookup list to link expected data feilds from the server to their function + * default + * { + "current_page":"current_page", + "last_page":"last_page", + "data":"data", + } + * + * + */ + paginationDataReceived?: Record; + /**Lookup list to link fields expected by the server to their function + * default: + * { + "page":"page", + "size":"size", + "sorters":"sorters", + "filters":"filters", + } + */ + paginationDataSent?: Record; + /**When using the addRow function on a paginated table, rows will be added relative to the current page (ie to the top or bottom of the current page), with overflowing rows being shifted onto the next page. + + If you would prefer rows to be added relative to the table (firs/last page) then you can use the paginationAddRow option. it can take one of two values: + + page - add rows relative to current page (default) + table - add rows relative to the table */ + paginationAddRow?: "table" | "page"; + /** The number of pagination page buttons shown in the footer using the paginationButtonCount option. By default this has a value of 5.*/ + paginationButtonCount?: number; + }; + + type OptionsRowGrouping = { + /**String/function to select field to group rows by */ + groupBy?: string | ((data: any) => any); + /**By default Tabulator will create groups for rows based on the values contained in the row data. if you want to explicitly define which field values groups should be created for at each level, you can use the groupValues option. + + This option takes an array of value arrays, each item in the first array should be a list of acceptable field values for groups at that level */ + groupValues?: any[][]; + + /**You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + groupHeader?: ((value: any, count: number, data: any, group: GroupComponent) => string) | ((value: any, count: number, data: any) => string)[]; + + /**You can set the default open state of groups using the groupStartOpen property + * + * This can take one of three possible values: + + true - all groups start open (default value) + false - all groups start closed + function() - a callback to decide if a group should start open or closed + Group Open Function + If you want to decide on a group by group basis which should start open or closed then you can pass a function to the groupStartOpen property. This should return true if the group should start open or false if the group should start closed. + */ + groupStartOpen?: boolean | ((value: any, count: number, data: any, group: GroupComponent) => boolean); + + /**By default Tabulator allows users to toggle a group open or closed by clicking on the arrow icon in the left of the group header. If you would prefer a different behaviour you can use the groupToggleElement option to choose a different option: + * + * The option can take one of three values: + arrow - togggle group on arrow element click + header - toggle group on click anywhere on the group header element + false - prevent clicking anywhere in the group toggling the group + */ + groupToggleElement?: "arrow" | "header" | false; + + /**show/hide column calculations when group is closed */ + groupClosedShowCalcs?: boolean; + + /**The dataGrouping callback is triggered whenever a data grouping event occurs, before grouping happens. */ + dataGrouping?: () => void; + /**The dataGrouping callback is triggered whenever a data grouping event occurs, after grouping happens. */ + dataGrouped?: () => void; + /**The groupVisibilityChanged callback is triggered whenever a group changes between hidden and visible states. */ + groupVisibilityChanged?: (group: GroupComponent, visible: boolean) => void; + + /**The groupClick callback is triggered when a user clicks on a group header. */ + groupClick?: GroupEventCallback; + /**The groupDblClick callback is triggered when a user double clicks on a group header. */ + groupDblClick?: GroupEventCallback; + /**The groupContext callback is triggered when a user right clicks on a group header. + + If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ + groupContext?: GroupEventCallback; + /**The groupTap callback is triggered when a user taps on a group header on a touch display. */ + groupTap?: GroupEventCallback; + /**The groupDblTap callback is triggered when a user taps on a group header on a touch display twice in under 300ms. */ + groupDblTap?: GroupEventCallback; + /**The groupTapHold callback is triggered when a user taps on a group header on a touch display and holds their finger down for over 1 second */ + groupTapHold?: GroupEventCallback; + }; + + interface Filter { + field: string; + type: FilterType; + value: any; + } + + type FilterFunction = (field: string, type: Tabulator.FilterType, value: any) => void; + + type OptionsFiltering = { + /**Array of filters to be applied on load. */ + initialFilter?: Filter[]; + + /**array of initial values for header filters. */ + initialHeaderFilter?: Pick[]; + + /**The dataFiltering callback is triggered whenever a filter event occurs, before the filter happens. */ + dataFiltering?: (filters: Filter[]) => void; + /**The dataFiltered callback is triggered after the table dataset is filtered. */ + dataFiltered?: (filters: Filter[], rows: RowComponent[]) => void; + }; + type OptionsSorting = { + /**Array of sorters to be applied on load. */ + initialSort?: Sorter[]; + + /**reverse the order that multiple sorters are applied to the table. */ + sortOrderReverse?: boolean; + }; + + interface Sorter { + column: string; + dir: SortDirection; + } + type OptionsData = { + /**A unique index value should be present for each row of data if you want to be able to programatically alter that data at a later point, this should be either numeric or a string. By default Tabulator will look for this value in the id field for the data. If you wish to use a different field as the index, set this using the index option parameter. */ + index?: number | string; + //**Array to hold data that should be loaded on table creation */ + data?: any[]; + + /**If you wish to retrieve your data from a remote source you can set the URL for the request in the ajaxURL option. */ + ajaxURL?: string; + + /**Parameters to be passed to remote Ajax data loading request */ + ajaxParams?: {}; + + /**The HTTP request type for Ajax requests or config object for the request */ + ajaxConfig?: HttpMethod | AjaxConfig; + + /**When using a request method other than "GET" Tabulator will send any parameters with a content type of form data. You can change the content type with the ajaxContentType option. This will ensure parameters are sent in the format you expect, with the correct headers. + * + * The ajaxContentType option can take one of two values: + "form" - send parameters as form data (default option) + "json" - send parameters as JSON encoded string + If you want to use a custom content type then you can pass a content type formatter object into the ajaxContentType option. this object must have two properties, the headers property should contain all headers that should be sent with the request and the body property should contain a function that returns the body content of the request + */ + + ajaxContentType?: "form" | "json" | AjaxContentType; + + /**If you need more control over the url of the request that you can get from the ajaxURL and ajaxParams properties, the you can use the ajaxURLGenerator property to pass in a callback that will generate the URL for you. + + The callback should return a string representing the URL to be requested. */ + ajaxURLGenerator?: (url: string, config: any, params: any) => string; + + /**callback function to replace inbuilt ajax request functionality */ + ajaxRequestFunc?: (url: string, config: any, params: any) => Promise; + + /**Send filter config to server instead of processing locally */ + ajaxFiltering?: boolean; + + /**Send sorter config to server instead of processing locally */ + ajaxSorting?: boolean; + + /**If you are loading a lot of data from a remote source into your table in one go, it can sometimes take a long time for the server to return the request, which can slow down the user experience. + + To speed things up in this situation Tabulator has a progressive load mode, this uses the pagination module to make a series of requests for part of the data set, one at a time, appending it to the table as the data arrives. This mode can be enable using the ajaxProgressiveLoad option. No pagination controls will be visible on screen, it just reusues the functionality of the pagination module to sequentially load the data. + + With this mode enabled, all of the settings outlined in the Ajax Documentation are still available + + There are two different progressive loading modes, to give you a choice of how data is loaded into the table. */ + ajaxProgressiveLoad?: "load" | "scroll"; + /**By default tabulator will make the requests to fill the table as quickly as possible. On some servers these repeates requests from the same client may trigger rate limiting or security systems. In this case you can use the ajaxProgressiveLoadDelay option to add a delay in milliseconds between each page request. */ + ajaxProgressiveLoadDelay?: number; + /**The ajaxProgressiveLoadScrollMargin property determines how close to the bottom of the table in pixels, the scroll bar must be before the next page worth of data is loaded, by default it is set to twice the height of the table. */ + ajaxProgressiveLoadScrollMargin?: number; + + /**Show loader while data is loading, can also take a function that must return a boolean */ + ajaxLoader?: boolean | (() => boolean); + + /**html for loader element */ + ajaxLoaderLoading?: string; + /**html for the loader element in the event of an error */ + ajaxLoaderError?: string; + + /**The ajaxRequesting callback is triggered when ever an ajax request is made. */ + ajaxRequesting?: (url: string, params: any) => boolean; + /**The ajaxResponse callback is triggered when a successful ajax request has been made. This callback can also be used to modify the received data before it is parsed by the table. If you use this callback it must return the data to be parsed by Tabulator, otherwise no data will be rendered */ + ajaxResponse?: (url: string, params: any, response: any) => any; + /**The ajaxError callback is triggered there is an error response to an ajax request. */ + ajaxError?: (xhr: any, textStatus: any, errorThrown: any) => void; + }; + + interface AjaxContentType { + headers: JSONRecord; + body: (url: string, config: any, params: any) => any; + } + + type HttpMethod = "GET" | "POST"; + interface AjaxConfig { + method?: HttpMethod; + headers?: JSONRecord; + mode?: string; + credentials?: string; + } + + type OptionsRows = { + /**Tabulator also allows you to define a row level formatter using the rowFormatter option. this lets you alter each row of the table based on the data it contains. + + The function accepts one argument, the RowComponent for the row being formatted. */ + rowFormatter?: (row: RowComponent) => any; + + /**The position in the table for new rows to be added, "bottom" or "top" */ + addRowPos?: "bottom" | "top"; + + /**The selectable option can take one of a several values: + + false - selectable rows are disabled + true - selectable rows are enabled, and you can select as many as you want + integer - any integer value, this sets the maximum number of rows that can be selected (when the maximum number of selected rows is exeded, the first selected row will be deselected to allow the next row to be selected). + "highlight" (default) - rows have the same hover stylings as selectable rows but do not change state when clicked. This is great for when you want to show that a row is clickable but don't want it to be selectable. */ + selectable?: boolean | number | "highlight"; + + /**By default you can select a range of rows by holding down the shift key and click dragging over a number of rows to toggle the selected state state of all rows the cursor passes over. + + If you would prefere to select a range of row by clicking on the first row then holding down shift and clicking on the end row then you can acheive this by setting the selectableRangeMode to click */ + selectableRangeMode?: "click"; + + /**By default, row selection works on a rolling basis, if you set the selectable option to a numeric value then when you select past this number of rows, the first row to be selected will be deselected. If you want to disable this behaviour and instead prevent selection of new rows once the limit is reached you can set the selectableRollingSelection option to false. */ + selectableRollingSelection?: boolean; + + /**By default Tabulator will maintain selected rows when the table is filtered, sorted or paginated (but NOT when the setData function is used). If you want the selected rows to be cleared whenever the table view is updated then set the selectablePersistence option to false. */ + selectablePersistence?: boolean; + + /**You many want to exclude certain rows from being selected. The selectableCheck options allows you to pass a function to check if the current row should be selectable, returning true will allow row selection, false will result in nothing happening. The function should accept a RowComponent as its first argument. */ + selectableCheck?: (row: RowComponent) => boolean; + + /**To allow the user to move rows up and down the table, set the movableRows parameter in the options: */ + movableRows?: boolean; + + /**Tabulator also allows you to move rows between tables. To enable this you should supply either a valid CSS selector string a DOM node for the table or the Tabuator object for the table to the movableRowsConnectedTables option. if you want to connect to multple tables then you can pass in an array of values to this option. */ + movableRowsConnectedTables?: string | string[] | HTMLElement | HTMLElement[]; + + /**The movableRowsSender option should be set on the sending table, and sets the action that should be taken after the row has been successfuly dropped into the receiving table. + + There are several inbuilt sender functions: + + false - do nothing(default) + delete - deletes the row from the table + You can also pass a callback to the movableRowsSender option for custom sender functionality + */ + movableRowsSender?: false | "delete" | ((fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => any); + + /** The movableRowsReceiver option should be set on the receiving tables, and sets the action that should be taken when the row is dropped into the table. + There are several inbuilt receiver functions: + + insert - inserts row next to the row it was dropped on, if not dropped on a row it is added to the table (default) + add - adds row to the table + update - updates the row it is dropped on with the sent rows data + replace - replaces the row it is dropped on with the sent row*/ + movableRowsReceiver?: "insert" | "add" | "update" | "replace" | ((fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => any); + + /**You can allow the user to manually resize rows by dragging the top or bottom border of a row. To enable this functionality, set the resizableRows property to true */ + resizableRows?: boolean; + + /** + * The default ScrollTo position can be set using the scrollToRowPosition option. It can take one of four possible values: + + top - position row with its top edge at the top of the table (default) + center - position row with its top edge in the center of the table + bottom - position row with its bottom edge at the bottom of the table + nearest - position row on the edge of the table it is closest to + */ + scrollToRowPosition?: ScrollToRowPostition; + + /**The default option for triggering a ScrollTo on a visible element can be set using the scrollToRowIfVisible option. It can take a boolean value: + + true - scroll to row, even if it is visible (default) + false - scroll to row, unless it is currently visible, then don't move */ + scrollToRowIfVisible?: boolean; + + /**The dataTreeRowExpanded callback is triggered when a row with child rows is expanded to reveal the children. */ + dataTreeRowExpanded?: (row: RowComponent, level: number) => void; + + /**The dataTreeRowCollapsed callback is triggered when a row with child rows is collapsed to hide its children.*/ + dataTreeRowCollapsed?: (row: RowComponent, level: number) => void; + + /**The movableRowsSendingStart callback is triggered on the sending table when a row is picked up from a sending table. */ + movableRowsSendingStart?: (toTables: any[]) => void; + + /**The movableRowsSent callback is triggered on the sending table when a row has been successfuly received by a receiving table. */ + movableRowsSent?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; + + /**The movableRowsSentFailed callback is triggered on the sending table when a row has failed to be received by the receiving table.*/ + movableRowsSentFailed?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; + + /**The movableRowsSendingStop callback is triggered on the sending table after a row has been dropped and any senders and receivers have been handled. */ + movableRowsSendingStop?: (toTables: any[]) => void; + + /**The movableRowsReceivingStart callback is triggered on a receiving table when a connection is established with a sending table. */ + movableRowsReceivingStart?: (fromRow: RowComponent, toTable: Tabulator) => void; + + /**The movableRowsReceived callback is triggered on a receiving table when a row has been successfuly received.*/ + movableRowsReceived?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; + + /**The movableRowsReceivedFailed callback is triggered on a receiving table when a row receiver has returned false.*/ + movableRowsReceivedFailed?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; + + /**The movableRowsReceivingStop callback is triggered on a receiving table after a row has been dropped and any senders and receivers have been handled.*/ + movableRowsReceivingStop?: (fromTable: Tabulator) => void; + + /**The rowClick callback is triggered when a user clicks on a row. */ + rowClick?: RowEventCallback; + /**The rowDblClick callback is triggered when a user double clicks on a row. */ + rowDblClick?: RowEventCallback; + /**The rowContext callback is triggered when a user right clicks on a row. + + If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ + rowContext?: RowEventCallback; + /**The rowTap callback is triggered when a user taps on a row on a touch display. */ + rowTap?: RowEventCallback; + /**The rowDblTap callback is triggered when a user taps on a row on a touch display twice in under 300ms. */ + rowDblTap?: RowEventCallback; + /**The rowTapHold callback is triggered when a user taps on a row on a touch display and holds their finger down for over 1 second. */ + rowTapHold?: RowEventCallback; + /**The rowMouseEnter callback is triggered when the mouse pointer enters a row. */ + rowMouseEnter?: RowEventCallback; + /**The rowMouseLeave callback is triggered when the mouse pointer leaves a row. */ + rowMouseLeave?: RowEventCallback; + /** The rowMouseOver callback is triggered when the mouse pointer enters a row or any of its child elements.*/ + rowMouseOver?: RowEventCallback; + /**The rowMouseOut callback is triggered when the mouse pointer leaves a row or any of its child elements. */ + rowMouseOut?: RowEventCallback; + /**The rowMouseMove callback is triggered when the mouse pointer moves over a row. */ + rowMouseMove?: RowEventCallback; + /**The rowAdded callback is triggered when a row is added to the table by the addRow and updateOrAddRow functions. */ + rowAdded?: RowChangedCallback; + /**The rowUpdated callback is triggered when a row is updated by the updateRow, updateOrAddRow, updateData or updateOrAddData, functions. */ + rowUpdated?: RowChangedCallback; + /**The rowDeleted callback is triggered when a row is deleted from the table by the deleteRow function. */ + rowDeleted?: RowChangedCallback; + /**The rowMoved callback will be triggered when a row has been successfuly moved. */ + rowMoved?: RowChangedCallback; + /**The rowResized callback will be triggered when a row has been resized by the user. */ + rowResized?: RowChangedCallback; + /**Whenever the number of selected rows changes, through selection or deselection, the rowSelectionChanged event is triggered. This passes an array of the data objects for each row in the order they were selected as the first argument, and an array of row components for each of the rows in order of selection as the second argument. */ + rowSelectionChanged?: (data: any[], rows: RowComponent[]) => void; + /**The rowSelected event is triggered when a row is selected, either by the user or programatically. */ + rowSelected?: RowChangedCallback; + /**The rowDeselected event is triggered when a row is deselected, either by the user or programatically. */ + rowDeselected?: RowChangedCallback; + }; + + type OptionsColumns = { + /**The column definitions are provided to Tabluator in the columns property of the table constructor object and should take the format of an array of objects, with each object representing the configuration of one column. */ + columns?: ColumnDefinition[]; + + /** + * If you set the autoColumns option to true, every time data is loaded into the table through the data option or through the setData function, Tabulator will examine the first row of the data and build columns to match that data. + */ + autoColumns?: boolean; + + /**By default Tabulator will use the fitData layout mode, which will resize the tables columns to fit the data held in each column, unless you specify a width or minWidth in the column constructor. If the width of all columns exceeds the width of the containing element, a scroll bar will appear. */ + layout?: "fitData" | "fitColumns" | "fitDataFill"; + + /**To keep the layout of the columns consistent, once the column widths have been set on the first data load (either from the data property in the constructor or the setData function) they will not be changed when new data is loaded. + + If you would prefer that the column widths adjust to the data each time you load it into the table you can set the layoutColumnsOnNewData property to true. */ + layoutColumnsOnNewData?: boolean; + + /**Responsive layout will automatically hide/show columns to fit the width of the Tabulator element. This allows for clean rendering of tables on smaller mobile devices, showing important data while avoiding horizontal scroll bars. You can enable responsive layouts using the responsiveLayout option. + + There are two responsive layout modes available: + + hide - hide columns that no longer fit in the table + collapse - collapse columns that no longer fit on the table into a list under the row + + Hide Extra Columns + By default, columns will be hidden from right to left as the width of the table decreases. You can choose exactlyhow columns are hidden using the responsive property in the column definition object. + + When responsive layout is enabled, all columns are given a default responsive value of 1. The higher you set this value the sooner that column will be hidden as the table width decreases. If two columns have the same responsive value then they are hidden from right to left (as defined in the column definition array, ignoring user moving of the columns). If you set the value to 0 then the column will never be hidden regardless of how narrow the table gets. */ + responsiveLayout?: boolean | "hide" | "collapse"; + + /**Collapsed lists are displayed to the user by default, if you would prefer they start closed so the user can open them you can use the responsiveLayoutCollapseStartOpen option */ + responsiveLayoutCollapseStartOpen?: boolean; + + /**By default any formatter set on the column is applied to the value that will appear in the list. while this works for most formatters it can cause issues with the progress formatter which relies on being inside a cell. + + If you would like to disable column formatting in the collapsed list, you can use the responsiveLayoutCollapseUseFormatters option: */ + responsiveLayoutCollapseUseFormatters?: boolean; + + /**If you set the responsiveLayout option to collapse the values from hidden columns will be displayed in a title/value list under the row. + + In this mode an object containing the title of each hidden column and its value is generated and then used to generate a list displayed in a div .tabulator-responsive-collapse under the row data. + + The inbuilt collapse formatter creates a table to neatly display the hidden columns. If you would like to format the data in your own way you can use the responsiveLayoutCollapseFormatter, it take an object of the column values as an argument and must return the HTML content of the div. + + This function should return an empty string if there is no data to display. */ + responsiveLayoutCollapseFormatter?: (data: any[]) => any; + + /**It is possible to set a minimum column width to prevent resizing columns from becoming too small. + + This can be set globally, by setting the columnMinWidth option to the column width when you create your Tabulator. + + This option can be overridden on a per column basis by setting the minWidth property on the column definition. */ + columnMinWidth?: number; + + /**By default it is possible to manually resize columns by dragging the borders of the column in both the column headers and the cells of the column. + + If you want to alter this behaviour you can use the resizableColumns to choose where the resize handles are available. */ + resizableColumns?: true | false | "header" | "cell"; + + /**To allow the user to move columns along the table, set the movableColumns parameter in the options: */ + movableColumns?: boolean; + + /**Header tooltips can be set globally using the tooltipsHeader options parameter */ + tooltipsHeader?: boolean; + + /**You can use the columnVertAlign option to set how the text in your column headers should be vertically */ + columnVertAlign?: "top" | "middle" | "bottom"; + + /**The default placeholder text used for input elements can be set using the headerFilterPlaceholder option in the table definition */ + headerFilterPlaceholder?: string; + + /**The default ScrollTo position can be set using the scrollToColumnPosition option. It can take one of three possible values: + + left - position column with its left edge at the left of the table (default) + center - position column with its left edge in the center of the table + right - position column with its right edge at the right of the table */ + scrollToColumnPosition?: ScrollToColumnPosition; + + /**The default option for triggering a ScrollTo on a visible element can be set using the scrollToColumnIfVisible option. It can take a boolean value: + + true - scroll to column, even if it is visible (default) + false - scroll to column, unless it is currently visible, then don't move */ + scrollToColumnIfVisible?: boolean; + + /**By default column calculations are shown at the top and bottom of the table, unless row grouping is enabled, in which case they are shown at the top and bottom of each group. + + The columnCalcs option lets you decided where the calculations should be displayed, it can take one of four values: + + true - show calcs at top and bottom of the table, unless grouped, then show in groups (boolean, default) + both - show calcs at top and bottom of the table and show in groups + table - show calcs at top and bottom of the table only + group - show calcs in groups only */ + columnCalcs?: boolean | "both" | "table" | "group"; + + /**If you need to use the . character as part of your field name, you can change the separator to any other character using the nestedFieldSeparator option + * Set to false to disable nested data parsing + */ + nestedFieldSeparator?: string | boolean; + + /**multiple or single column sorting */ + columnHeaderSortMulti?: boolean; + + /**The columnMoved callback will be triggered when a column has been successfuly moved. */ + columnMoved?: (column: ColumnComponent, columns: any[]) => void; + columnResized?: (column: ColumnComponent) => void; + /**The columnVisibilityChanged callback is triggered whenever a column changes between hidden and visible states. */ + columnVisibilityChanged?: (column: ColumnComponent, visible: boolean) => void; + + /**The columnTitleChanged callback is triggered whenever a user edits a column title when the editableTitle parameter has been enabled in the column definition array. */ + columnTitleChanged?: (column: ColumnComponent) => void; + }; + + type OptionsCell = { + /**The cellClick callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the option in the columns definition object. */ + cellClick?: CellEventCallback; + cellDblClick?: CellEventCallback; + cellContext?: CellEventCallback; + cellTap?: CellEventCallback; + cellDblTap?: CellEventCallback; + cellTapHold?: CellEventCallback; + cellMouseEnter?: CellEventCallback; + cellMouseLeave?: CellEventCallback; + cellMouseOver?: CellEventCallback; + cellMouseOut?: CellEventCallback; + cellMouseMove?: CellEventCallback; + cellEditing?: CellEditEventCallback; + cellEdited?: CellEditEventCallback; + cellEditCancelled?: CellEditEventCallback; + }; + + type OptionsGeneral = { + /**Sets the height of the containing element, can be set to any valid height css value. If set to false (the default), the height of the table will resize to fit the table data. */ + height?: string | number | false; + /**Enable rendering using the Virtual DOM engine */ + virtualDom?: boolean; + + /**Manually set the size of the virtual DOM buffer */ + virtualDomBuffer?: boolean; + /**placeholder element to display on empty table */ + placeholder?: string | HTMLElement; + + /**Footer element to display for the table */ + footerElement?: string | HTMLElement; + + /**Function to generate tooltips for cells */ + tooltips?: GlobalTooltipOption; + /**When to regenerate cell tooltip value */ + tooltipGenerationMode?: "load"; + + /**Keybinding configuration object */ + keybindings?: false | KeyBinding; + + /** + * The reactivity systems allow Tabulator to watch arrays and objects passed into the table for changes and then automatically update the table. + + This approach means you no longer need to worry about calling a number of different functions on the table to make changes, you simply update the array or object you originally passed into the table and Tabulator will take care of the rest. + + You can enable reactive data by setting the reactiveData option to true in the table constructor, and then passing your data array to the data option. + + Once the table is built any changes to the array will automatically be replicated to the table without needing to call any functions on the table itself*/ + + reactiveData?: boolean; + + //Not listed in options-------------------- + /**Tabulator will automatically attempt to redraw the data contained in the table if the containing element for the table is resized. To disable this functionality, set the autoResize property to false */ + autoResize?: boolean; + + /**When a the tabulator constructor is called, the tableBuilding callback will triggered */ + tableBuilding?: () => void; + + /**When a the tabulator constructor is called and the table has finished being rendered, the tableBuilt callback will triggered: */ + tableBuilt?: () => void; + + /**The renderStarted callback is triggered whenever all the rows in the table are about to be rendered. This can include: + Data is loaded into the table when setData is called + A page is loaded through any form of pagination + Rows are added to the table during progressive rendering + Columns are changed by setColumns + The data is filtered + The data is sorted + The redraw function is called */ + renderStarted?: () => void; + + /**The renderComplete callback is triggered after the table has been rendered */ + renderComplete?: () => void; + + /**The htmlImporting callback is triggered when Tabulator starts importing data from an HTML table. */ + htmlImporting?: EmptyCallback; + + /**The htmlImported callback is triggered when Tabulator finishes importing data from an HTML table. */ + htmlImported?: EmptyCallback; + + /**The dataLoading callback is triggered whenever new data is loaded into the table. */ + dataLoading?: (data: any) => void; + /**The dataLoaded callback is triggered when a new set of data is loaded into the table. */ + dataLoaded?: (data: any) => void; + /**The dataEdited callback is triggered whenever the table data is changed by the user. Triggers for this include editing any cell in the table, adding a row and deleting a row. */ + dataEdited?: (data: any) => void; + + /**Whenever a page has been loaded, the pageLoaded callback is called, passing the current page number as an argument. */ + pageLoaded?: (pageno: number) => void; + + /**The dataSorting callback is triggered whenever a sort event occurs, before sorting happens. */ + dataSorting?: (sorters: Sorter[]) => void; + + /**The dataSorted callback is triggered after the table dataset is sorted. */ + dataSorted?: (sorters: Sorter[], rows: RowComponent[]) => void; + }; + + type DownloadType = "csv" | "json" | "xlsx" | "pdf"; + + interface DownloadOptions extends DownloadCSV, DownloadXLXS, DownloadPDF { + downloadType: DownloadType; + fileName: string; + } + + interface DownloadCSV { + /**By default CSV files are created using a comma (,) delimiter. If you need to change this for any reason the you can pass the options object with a delimiter property to the download function which will then use this delimiter instead of the comma. */ + delimiter?: "string"; + /**If you need the output CSV to include a byte order mark (BOM) to ensure that output with UTF-8 characters can be correctly interpereted across didfferent applications, you should set the bom option to true */ + bom?: boolean; + } + + interface DownloadXLXS { + /**The sheet name must be a valid Excel sheet name, and cannot include any of the following characters \, /, *, [, ], :, */ + sheetName?: string; + } + + interface DownloadPDF { + orientation?: "portrait" | "landscape"; + title?: string; + rowGroupStyles?: any; + rowCalcStyles?: any; + jsPDF?: any; + autoTable?: {} | ((doc: any) => any); + } + + type OptionsDownload = { + /**If you want to make any bulk changes to the table data before it is parsed into the download file you can pass a mutator function to the downloadDataFormatter option in the table definition */ + downloadDataFormatter?: (data: any[]) => any; + + /**The downloadReady callback allows you to intercept the download file data before the users is prompted to save the file. + + In order for the download to proceed the downloadReady callback is expected to return a blob of file to be downloaded. + + If you would prefer to abort the download you can return false from this callback. This could be useful for example if you want to send the created file to a server via ajax rather than allowing the user to download the file. */ + downloadReady?: (fileContents: any, blob: any) => any; + + /**The downloadComplete callback is triggered when the user has been prompted to download the file. */ + downloadComplete?: () => void; + + /**By default Tabulator includes column headers, row groups and column calculations in the download output. + + You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the downloadConfig option in the table definition: */ + + downloadConfig?: { + columnGroups?: boolean; + rowGroups?: boolean; + columnCalcs?: boolean; + }; + }; + + type OptionsLocale = { + /**You can set the current local in one of two ways. If you want to set it when the table is created, simply include the locale option in your Tabulator constructor. You can either pass in a string matching one of the language options you have defined, or pass in the boolean true which will cause Tabulator to auto-detect the browsers language settings from the navigator.language object. */ + locale?: boolean | string; + + /**You can store as many languages as you like, creating an object inside the langs object with a property of the locale code for that language. A list of locale codes can be found here. + + At present there are three parts of the table that can be localised, the column headers, the header filter placeholder text and the pagination buttons. To localize the pagination buttons, create a pagination property inside your language object and give it the properties outlined below. + + If you wish you can also localize column titles by adding a columns property to your language object. You should store a property of the field name of the column you wish to change, with a value of its title. Any fields that match this will use this title instead of the one provided by the column definition array. */ + langs?: any; + + /**When a localization event has occurred , the localized callback will triggered, passing the current locale code and language object: */ + localized?: (locale: string, lang: any) => void; + }; + + type HistoryAction = "cellEdit" | "rowAdd" | "rowDelete" | "rowMoved"; + type OptionsHistory = { + /**Enable user interaction history functionality */ + history?: boolean; + + /**The historyUndo event is triggered when the undo action is triggered. */ + historyUndo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; + /**The historyRedo event is triggered when the redo action is triggered. */ + historyRedo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; + }; + + interface ColumnLayout { + /**title - Required This is the title that will be displayed in the header for this column */ + title: string; + /**field - Required (not required in icon/button columns) this is the key for this column in the data array*/ + field?: string; + /**visible - (boolean, default - true) determines if the column is visible. (see Column Visibility for more details */ + visible?: boolean; + + /**sets the width of this column, this can be set in pixels or as a percentage of total table width (if not set the system will determine the best) */ + width?: number | string; + } + + interface ColumnDefinition extends ColumnLayout, CellCallbacks { + //Layout + /**sets the text alignment for this column */ + align?: "left" | "center" | "right"; //Align? + /**sets the minimum width of this column, this should be set in pixels (this takes priority over the global option of columnMinWidth) */ + minWidth?: number; + + /**The widthGrow property should be used on columns without a width property set. The value is used to work out what fraction of the available will be allocated to the column. The value should be set to a number greater than 0, by default any columns with no width set have a widthGrow value of 1 */ + widthGrow?: number; + + /**The widthShrink property should be used on columns with a width property set. The value is used to work out how to shrink columns with a fixed width when the table is too narrow to fit in all the columns. The value should be set to a number greater than 0, by default columns with a width set have a widthShrink value of 0, meaning they will not be shrunk if the table gets too narrow, and may cause the horizontal scrollbar to appear. */ + widthShrink?: number; + + /**set whether column can be resized by user dragging its edges */ + resizable?: boolean; + /**You can freeze the position of columns on the left and right of the table using the frozen property in the column definition array. This will keep the column still when the table is scrolled horizontally. */ + frozen?: boolean; + /**an integer to determine when the column should be hidden in responsive mode */ + responsive?: number; + /**sets the on hover tooltip for each cell in this column + * + * The tooltip parameter can take three different types of value + boolean - a value of false disables the tooltip, a value of true sets the tooltip of the cell to its value + string - a string that will be displayed for all cells in the matching column/table. + function - a callback function that returns the string for the cell + + * Note: setting a tooltip value on a column will override the global setting. + */ + tooltip?: string | GlobalTooltipOption; + /**sets css classes on header and cells in this column. (value should be a string containing space separated class names) */ + cssClass?: string; + /**sets the column as a row handle, allowing it to be used to drag movable rows. */ + rowHandle?: boolean; + /**When the getHtml function is called, hide the column from the output. */ + hideInHtml?: boolean; + + //Data Manipulation + /** By default Tabulator will attempt to guess which sorter should be applied to a column based on the data contained in the first row. It can determine sorters for strings, numbers, alphanumeric sequences and booleans, anything else will be treated as a string. + +To specify a sorter to be used on a column use the sorter property in the columns definition object + +You can pass an optional additional property with sorter, sorterParams that should contain an object with additional information for configuring the sorter*/ + sorter?: "string" | "number" | "alphanum" | "boolean" | "exists" | "date" | "time" | "datetime" | "array" | ((a: any, b: any, aRow: RowComponent, bRow: RowComponent, column: ColumnComponent, dir: SortDirection, sorterParams: {}) => number); + /**If you want to dynamically generate the sorterParams at the time the sort is called you can pass a function into the property that should return the params object. */ + sorterParams?: ColumnDefinitionSorterParams | ColumnSorterParamLookupFunction; + /** set how you would like the data to be formatted*/ + formatter?: Formatter; + /** You can pass an optional additional parameter with the formatter, formatterParams that should contain an object with additional information for configuring the formatter.*/ + formatterParams?: FormatterParams; + /**alter the row height to fit the contents of the cell instead of hiding overflow */ + variableHeight?: boolean; + /** There are some circumstances where you may want to block editibility of a cell for one reason or another. To meet this need you can use the editable option. This lets you set a callback that is executed before the editor is built, if this callback returns true the editor is added, if it returns false the edit is aborted and the cell remains a non editable cell. The function is passed one parameter, the CellComponent of the cell about to be edited. You can also pass a boolean value instead of a function to this property.*/ + editable?: boolean | ((cell: CellComponent) => boolean); + /**When a user clicks on an editable column the will be able to edit the value for that cell. + + By default Tabulator will use an editor that matches the current formatter for that cell. if you wish to specify a specific editor, you can set them per column using the editor option in the column definition. Passing a value of true to this option will result in Tabulator applying the editor that best matches the columns formatter, if present. + + You can pass an optional additional parameter with the editor, editorParams that should contain an object with additional information for configuring the editor. */ + editor?: Editor; + /** */ + editorParams?: EditorParams; + + /**Validators are used to ensure that any user input into your editable cells matches your requirements. + + Validators can be applied by using the validator property in a columns definition object (see Define Columns for more details). */ + validator?: StandardValidatorType | StandardValidatorType[] | Validator | Validator[]; + + /**Mutators are used to alter data as it is parsed into Tabulator. For example if you wanted to convert a numeric column into a boolean based on its value, before the data is used to build the table. + + You can set mutators on a per column basis using the mutator option in the column definition object. + + You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + mutator?: CustomMutator; + /**You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + mutatorParams?: CustomMutatorParams; + /** only called when data is loaded via a command {eg. setData). */ + mutatorData?: CustomMutator; + mutatorDataParams?: CustomMutatorParams; + + /**only called when data is changed via a user editing a cell. */ + mutatorEdit?: CustomMutator; + mutatorEditParams?: CustomMutatorParams; + + /**only called when data is changed via a user editing a cell. */ + mutatorClipboard?: CustomMutator; + mutatorClipboardParams?: CustomMutatorParams; + + /** Accessors are used to alter data as it is extracted from the table, through commands, the clipboard, or download. + + You can set accessors on a per column basis using the accessor option in the column definition object.*/ + accessor?: CustomAccessor; + /** Each accessor function has its own matching params option, for example accessorDownload has accessorDownloadParams.*/ + accessorParams?: CustomAccessorParams; + /**only called when data is being converted into a downloadable file. */ + accessorDownload?: CustomAccessor; + /** */ + accessorDownloadParams?: CustomAccessorParams; + + /**only called when data is being copied into the clipboard. */ + accessorClipboard?: CustomAccessor; + /** */ + accessorClipboardParams?: CustomAccessorParams; + + /**show or hide column in downloaded data */ + download?: boolean; + /**set custom title for column in download */ + downloadTitle?: string; + + /** the column calculation to be displayed at the top of this column(see Column Calculations for more details) */ + topCalc?: ColumnCalc; + /**additional parameters you can pass to the topCalc calculation function (see Column Calculations for more details) */ + topCalcParams?: ColumnCalcParams; + /**formatter for the topCalc calculation cell */ + topCalcFormatter?: Formatter; + /** additional parameters you can pass to the topCalcFormatter function */ + topCalcFormatterParams?: FormatterParams; + + bottomCalc?: ColumnCalc; + bottomCalcParams?: ColumnCalcParams; + bottomCalcFormatter?: Formatter; + /** additional parameters you can pass to the bottomCalcFormatter function */ + bottomCalcFormatterParams?: FormatterParams; + + //Column Header + /**By default all columns in a table are sortable by clicking on the column header, if you want to disable this behaviour, set the headerSort property to false in the column definition array: */ + headerSort?: boolean; + /**set the starting sort direction when a user first clicks on a header */ + headerSortStartingDir?: SortDirection; + + /**allow tristate toggling of column header sort direction */ + headerSortTristate?: boolean; + + /** callback for when user clicks on the header for this column*/ + headerClick?: ColumnEventCallback; + /** callback for when user double clicks on the header for this column */ + headerDblClick?: ColumnEventCallback; + /**callback for when user right clicks on the header for this column */ + headerContext?: ColumnEventCallback; + /** callback for when user taps on a header for this column, triggered in touch displays. */ + headerTap?: ColumnEventCallback; + /**callback for when user double taps on a header for this column, triggered in touch displays when a user taps the same header twice in under 300ms */ + headerDblTap?: ColumnEventCallback; + /**callback for when user taps and holds on a header for this column, triggered in touch displays when a user taps and holds the same header for 1 second. */ + headerTapHold?: ColumnEventCallback; + /**sets the on hover tooltip for the column header + * + * The tooltip headerTooltip can take three different types of value + + boolean - a value of false disables the tooltip, a value of true sets the tooltip of the column header to its title value. + string - a string that will be displayed for the tooltip. + function - a callback function that returns the string for the column header + * + */ + headerTooltip?: boolean | string | ((column: ColumnComponent) => string); + /**change the orientation of the column header to vertical + * + * The headerVertical property can take one of three values: + + false - vertical columns disabled (default value) + true - vertical columns enabled + "flip" - vertical columns enabled, with text direction flipped by 180 degrees + * + */ + headerVertical?: boolean | "flip"; + + /**allows the user to edit the header titles */ + editableTitle?: boolean; + /** formatter function for header title */ + titleFormatter?: Formatter; + + /**additional parameters you can pass to the header title formatter */ + titleFormatterParams?: FormatterParams; + /** filtering of columns from elements in the header */ + headerFilter?: Editor; + /**additional parameters you can pass to the header filter */ + headerFilterParams?: EditorParams; + + /** placeholder text for the header filter */ + headerFilterPlaceholder?: string; + + /** function to check when the header filter is empty */ + headerFilterEmptyCheck?: ValueBooleanCallback; + /** By default Tabulator will try and match the comparison type to the type of element used for the header filter. + + Standard input elements will use the "like" filter, this allows for the matches to be displayed as the user types. + + For all other element types (select boxes, check boxes, input elements of type number) an "=" filter type is used. + + If you want to specify the type of filter used you can pass it to the headerFilterFunc option in the column definition object. This will take any of the standard filters outlined above or a custom function*/ + headerFilterFunc?: FilterType | ((headerValue: any, rowValue: any, rowdata: any, filterparams: any) => boolean); + /** additional parameters object passed to the headerFilterFunc function */ + headerFilterFuncParams?: any; + + /**disable live filtering of the table */ + headerFilterLiveFilter?: boolean; + } + + interface CellCallbacks { + //Cell Events + /**callback for when user clicks on a cell in this column */ + cellClick?: CellEventCallback; + /** callback for when user double clicks on a cell in this column */ + cellDblClick?: CellEventCallback; + /**callback for when user right clicks on a cell in this column */ + cellContext?: CellEventCallback; + /**callback for when user taps on a cell in this column, triggered in touch displays. */ + cellTap?: CellEventCallback; + /** callback for when user double taps on a cell in this column, triggered in touch displays when a user taps the same cell twice in under 300ms. */ + cellDblTap?: CellEventCallback; + /** callback for when user taps and holds on a cell in this column, triggered in touch displays when a user taps and holds the same cell for 1 second.*/ + cellTapHold?: CellEventCallback; + + /**callback for when the mouse pointer enters a cell */ + cellMouseEnter?: CellEventCallback; + /** callback for when the mouse pointer leaves a cell */ + cellMouseLeave?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell or one of its child elements */ + cellMouseOver?: CellEventCallback; + + /**callback for when the mouse pointer enters a cell or one of its child elements */ + cellMouseOut?: CellEventCallback; + + /**callback for when the mouse pointer moves over a cell */ + cellMouseMove?: CellEventCallback; + + //Cell editing + /**callback for when a cell in this column is being edited by the user */ + cellEditing?: CellEditEventCallback; + + /**callback for when a cell in this column has been edited by the user */ + cellEdited?: CellEditEventCallback; + + /** callback for when an edit on a cell in this column is aborted by the user */ + cellEditCancelled?: CellEditEventCallback; + } + + interface ColumnDefinitionSorterParams { + format?: string; + locale?: string | boolean; + alignEmptyValues?: "top" | "bottom"; + type?: "length" | "sum" | "max" | "min" | "avg"; + } + + type GlobalTooltipOption = boolean | ((cell: CellComponent) => string); + type CustomMutator = (value: any, data: any, type: "data" | "edit", mutatorParams: any, cell?: CellComponent) => any; + type CustomMutatorParams = {} | ((value: any, data: any, type: "data" | "edit", cell?: CellComponent) => any); + type CustomAccessor = (value: any, data: any, type: "data" | "download" | "clipboard", AccessorParams: any, column?: ColumnComponent) => any; + type CustomAccessorParams = {} | ((value: any, data: any, type: "data" | "download" | "clipboard", column?: ColumnComponent) => any); + type ColumnCalc = "avg" | "max" | "min" | "sum" | "concat" | "count" | ((values: Array, data: Array, calcParams: {}) => number); + type ColumnCalcParams = (values: any, data: any) => any; + type Formatter = "plaintext" | "textarea" | "html" | "money" | "image" | "datetime" | "datetimediff" | "link" | "tickCross" | "color" | "star" | "traffic" | "progress" | "lookup" | "buttonTick" | "buttonCross" | "rownum" | "handle" | ((cell: CellComponent, formatterParams: {}, onRendered: EmptyCallback) => string | HTMLElement); + type FormatterParams = MoneyParams | ImageParams | LinkParams | DateTimeParams | DateTimeDifferenceParams | TickCrossParams | TrafficParams | StarRatingParams | JSONRecord | ((cell: CellComponent) => {}); + + type Editor = true | "input" | "textarea" | "number" | "range" | "tick" | "star" | "select" | "autocomplete" | ((cell: CellComponent, onRendered: EmptyCallback, success: ValueVoidCallback, cancel: ValueVoidCallback, editorParams: {}) => HTMLElement | false); + + type EditorParams = NumberParams | CheckboxParams | SelectParams | AutoCompleteParams | ((cell: CellComponent) => {}); + + type ScrollToRowPostition = "top" | "center" | "bottom" | "nearest"; + type ScrollToColumnPosition = "left" | "center" | "middle" | "right"; + + interface MoneyParams { + //Money + decimal?: string; + thousand?: string; + symbol?: string; + symbolAfter?: boolean; + precision?: boolean | number; + } + interface ImageParams { + //Image + height?: string; + width?: string; + } + interface LinkParams { + //Link + labelField?: string; + label?: string; + urlPrefix?: string; + urlField?: string; + url?: string; + target?: string; + } + + interface DateTimeParams { + //datetime + inputFormat?: string; + outputFormat?: string; + invalidPlaceholder?: true | string | number | ValueStringCallback; + } + + interface DateTimeDifferenceParams extends DateTimeParams { + //Date Time Difference + date?: any; + humanize?: boolean; + unit?: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"; + suffix?: boolean; + } + interface TickCrossParams { + //Tick Cross + allowEmpty?: boolean; + allowTruthy?: boolean; + tickElement?: boolean | string; + crossElement?: boolean | string; + } + + interface TrafficParams { + //Traffic + min?: number; + max?: number; + color?: Color; + } + interface ProgressBarParams extends TrafficParams { + //Progress Bar + legend?: string | true | ValueStringCallback; + legendColor?: Color; + legendAlign?: Align; + } + + interface StarRatingParams { + //Star Rating + stars?: number; + } + + interface NumberParams { + //range,number + min?: number; + max?: number; + step?: number; + } + + interface CheckboxParams { + //tick + tristate?: boolean; + indeterminateValue?: string; + } + + interface SelectParams { + values: true | string[] | JSONRecord | SelectParamsGroup[]; + listItemFormatter?: (value: string, text: string) => string; + } + + interface SelectParamsGroup { + label: string; + value?: string | number | boolean; + options?: SelectLabelValue[]; + } + type SelectLabelValue = { label: string; value: string | number | boolean }; + + interface AutoCompleteParams { + values: true | string[] | JSONRecord; + listItemFormatter?: (value: string, text: string) => string; + searchFunc: (term: string, values: string[]) => string[]; + allowEmpty?: boolean; + freetext?: boolean; + showListOnEmpty?: boolean; + } + + type ValueStringCallback = (value: any) => string; + type ValueBooleanCallback = (value: any) => boolean; + type ValueVoidCallback = (value: any) => void; + type EmptyCallback = (callback: () => void) => void; + type CellEventCallback = (e: any, cell: CellComponent) => void; + type CellEditEventCallback = (cell: CellComponent) => void; + type ColumnEventCallback = (e: any, column: ColumnComponent) => void; + type RowEventCallback = (e: any, row: RowComponent) => void; + type RowChangedCallback = (row: RowComponent) => void; + type GroupEventCallback = (e: any, group: GroupComponent) => void; + + type SortDirection = "asc" | "desc"; + type FilterType = "=" | "!=" | "like" | "<" | ">" | "<=" | ">=" | "in" | "regex"; + type Color = string | any[] | ValueStringCallback; + type Align = "center" | "left" | "right" | "justify"; + + type JSONRecord = Record; + + type StandardValidatorType = "required" | "unique" | "integer" | "float" | "numeric" | "string"; + interface Validator { + type: StandardValidatorType | ((cell: CellComponent, value: any, parameters?: any) => boolean); + parameters?: any; + } + + type ColumnSorterParamLookupFunction = (column: ColumnComponent, dir: SortDirection) => {}; + + type ColumnLookup = ColumnComponent | ColumnDefinition | HTMLElement | string; + type RowLookup = RowComponent | HTMLElement | string | number; + + interface KeyBinding { + navPrev?: string | boolean; + navNext?: string | boolean; + navLeft?: string | boolean; + navRight?: string | boolean; + navUp?: string | boolean; + navDown?: string | boolean; + undo?: string | boolean; + redo?: string | boolean; + scrollPageUp?: string | boolean; + scrollPageDown?: string | boolean; + scrollToStart?: string | boolean; + scrollToEnd?: string | boolean; + copyToClipboard?: string | boolean; + } + + //Components------------------------------------------------------------------- + interface CellComponent { + /**The getValue function returns the current value for the cell. */ + getValue: () => any; + /**The getOldValue function returns the previous value of the cell. Very usefull in the event of cell update callbacks. */ + getOldValue: () => any; + /**The restoreOldValue reverts the value of the cell back to its previous value, without triggering any of the cell edit callbacks. */ + restoreOldValue: () => any; + /**The getElement function returns the DOM node for the cell. */ + + getElement: () => HTMLElement; + /**The getTable function returns the Tabulator object for the table containing the cell. */ + getTable: () => Tabulator; + /**The getRow function returns the RowComponent for the row that contains the cell. */ + getRow: () => RowComponent; + + /**The getColumn function returns the ColumnComponent for the column that contains the cell. */ + getColumn: () => ColumnComponent; + + /**The getData function returns the data for the row that contains the cell. */ + getData: () => {}; + /**The getField function returns the field name for the column that contains the cell. */ + getField: () => string; + /**You can change the value of the cell using the setValue function. The first parameter should be the new value for the cell, the second optional parameter will apply the column mutators to the value when set to true (default = true). */ + setValue: (value: any, mutate?: boolean) => void; + /**If you are making manual adjustments to elements contained withing the cell, or the cell itself, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the checkHeight function to check if the height of the cell has changed and normalize the row if it has. */ + checkHeight: () => void; + /**You and programatically cause a cell to open its editor element using the edit function */ + edit: (ignoreEditable?: boolean) => void; + /**You and programatically cancel a cell edit that is currently in progress by calling the cancelEdit function */ + cancelEdit: () => void; + /**When a cell is being edited it is possible to move the editor focus from the current cell to one if its neighbours. There are a number of functions that can be called on the nav function to move the focus in different directions. */ + nav: () => CellNavigation; + } + + interface CellNavigation { + /**prev - next editable cell on the left, if none available move to the right most editable cell on the row above */ + prev: () => boolean; + /**next - next editable cell on the right, if none available move to left most editable cell on the row below */ + next: () => boolean; + /**left - next editable cell on the left, return false if none available on row */ + left: () => boolean; + /**right - next editable cell on the right, return false if none available on row */ + right: () => boolean; + /**up - move to the same cell in the row above */ + up: () => void; + /**down - move to the same cell in the row below */ + down: () => void; + } + + interface RowComponent { + /**The getData function returns the data object for the row.*/ + getData: () => {}; + /**The getElement function returns the DOM node for the row.*/ + getElement: () => HTMLElement; + + /**The getTable function returns the Tabulator object for the table containing the row. */ + getTable: () => Tabulator; + + /**The getNextRow function returns the Row Component for the next visible row in the table, if there is no next row it will return a value of false */ + getNextRow: () => RowComponent | false; + /**The getNextRow function returns the Row Component for the previous visible row in the table, if there is no next row it will return a value of false */ + getPrevRow: () => RowComponent | false; + + /**The getCells function returns an array of CellComponent objects, one for each cell in the row.*/ + getCells: () => Array; + /**The getCell function returns the CellComponent for the specified column from this row.*/ + getCell: (column: ColumnComponent | HTMLElement | string) => CellComponent; + /**The getIndex function returns the index value for the row. (this is the value from the defined index column, NOT the row's position in the table)*/ + getIndex: () => any; + + /**Use the getPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + + If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional first argument of the function. */ + getPosition: (filteredPosition?: boolean) => number; + + /**When using grouped rows, you can retrieve the group component for the current row using the getGroup function. */ + getGroup: () => GroupComponent; + /**The delete function deletes the row, removing its data from the table + * + * The delete method returns a promise, this can be used to run any other commands that have to be run after the row has been deleted. By running them in the promise you ensure they are only run after the row has been deleted. + */ + delete: () => Promise; + /**The scrollTo function will scroll the table to the row if it passes the current filters.*/ + scrollTo: () => Promise; + + /**The pageTo function will load the page for the row if it passes the current filters.*/ + pageTo: () => Promise; + + /** You can move a row next to another row using the move function. + + The first argument should be the target row that you want to move to, and can be any of the standard row component look up options. + + The second argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target*/ + + move: (lookup: RowComponent | HTMLElement | number, belowTarget?: boolean) => void; + + /**You can update the data in the row using the update function. You should pass an object to the function containing any fields you wish to update. This object will not replace the row data, only the fields included in the object will be updated.*/ + update: (data: {}) => Promise; + /**The select function will select the current row.*/ + select: () => void; + /**The deselect function will deselect the current row.*/ + deselect: () => void; + /**The deselect function will toggle the current row.*/ + toggleSelect: () => void; + /**The isSelected function will return a boolean representing the current selected state of the row. */ + isSelected: () => boolean; + /**If you are making manual adjustments to elements contained within the row, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the normalizeHeight function to do this.*/ + normalizeHeight: () => void; + + /**If you want to re-format a row once it has been rendered to re-trigger the cell formatters and the rowFormatter callback, Call the reformat function. */ + reformat: () => void; + + /**You can freeze a row at the top of the table by calling the freeze function. This will insert the row above the scrolling portion of the table in the table header. */ + freeze: () => void; + + /**A frozen row can be unfrozen using the unfreeze function. This will remove the row from the table header and re-insert it back in the table. */ + unfreeze: () => void; + + /**When the tree structure is enabled the treeExpand function will expand current row and show its children. */ + treeExpand: () => void; + + /**When the tree structure is enabled the treeCollapse function will collapse current row and hide its children */ + treeCollapse: () => void; + + /**When the tree structure is enabled the treeToggle function will toggle the collapsed state of the current row. */ + treeToggle: () => void; + + /**When the tree structure is enabled the getTreeParent function will return the Row Component for the parent of this row. If no parent exists, a value of false will be returned. */ + getTreeParent: () => RowComponent | false; + /**When the tree structure is enabled the getTreeChildren function will return an array of Row Components for this rows children. */ + getTreeChildren: () => RowComponent[]; + } + + interface GroupComponent { + /**The getElement function returns the DOM node for the group header. */ + getElement: () => HTMLElement; + + /**The getTable function returns the Tabulator object for the table containing the group */ + getTable: () => Tabulator; + + /**The getKey function returns the unique key that is shared between all rows in this group. */ + getKey: () => any; + + /**The getRows function returns an array of RowComponent objects, one for each row in the group */ + getRows: () => RowComponent[]; + + /**The getSubGroups function returns an array of GroupComponent objects, one for each sub group of this group. */ + getSubGroups: () => GroupComponent[]; + + /**The getParentGroup function returns the GroupComponent for the parent group of this group. if no parent exists, this function will return false */ + getParentGroup: () => GroupComponent | false; + + /** The getVisibility function returns a boolean to show if the group is visible, a value of true means it is visible.*/ + getVisibility: () => boolean; + + /**The show function shows the group if it is hidden. */ + show: () => void; + /**The hide function hides the group if it is visible. */ + hide: () => void; + /**The toggle function toggles the visibility of the group, switching between hidden and visible. */ + toggle: () => void; + } + + interface ColumnComponent { + /*The getElement function returns the DOM node for the colum*/ + getElement: () => HTMLElement; + /**The getTable function returns the Tabulator object for the table containing the column */ + getTable: () => Tabulator; + /**The getDefinition function returns the column definition object for the column.*/ + getDefinition: () => ColumnDefinition; + /**The getField function returns the field name for the column.*/ + getField: () => string; + /**The getCells function returns an array of CellComponent objects, one for each cell in the column.*/ + getCells: () => Array; + + /**The getNextColumn function returns the Column Component for the next visible column in the table, if there is no next column it will return a value of false. */ + getNextColumn: () => ColumnComponent | false; + /**The getPrevColumn function returns the Column Component for the previous visible column in the table, if there is no previous column it will return a value of false. */ + getPrevColumn: () => ColumnComponent | false; + /**The getVisibility function returns a boolean to show if the column is visible, a value of true means it is visible.*/ + getVisibility: () => boolean; + /**The show function shows the column if it is hidden.*/ + show: () => void; + /**The hide function hides the column if it is visible.*/ + hide: () => void; + /**The toggle function toggles the visibility of the column, switching between hidden and visible.*/ + toggle: () => void; + /**The delete function deletes the column, removing it from the table*/ + delete: () => void; + /**The scrollTo function will scroll the table to the column if it is visible. */ + scrollTo: () => Promise; + /**The getSubColumns function returns an array of ColumnComponent objects, one for each sub column of this column. */ + getSubColumns: () => ColumnComponent[]; + + /**The getParentColumn function returns the ColumnComponent for the parent column of this column. if no parent exists, this function will return false */ + getParentColumn: () => ColumnComponent | false; + /**The headerFilterFocus function will place focus on the header filter element for this column if it exists. */ + headerFilterFocus: () => void; + /**The setHeaderFilterValue function set the value of the columns header filter element to the value provided in the first argument. */ + setHeaderFilterValue: (value: any) => void; + /**The reloadHeaderFilter function rebuilds the header filter element, updating any params passed into the editor used to generate the filter. */ + reloadHeaderFilter: () => void; + } +} + +//Tabulator.prototype.(?!registerModule|helpers|_)\w+ +declare class Tabulator { + constructor(selector: string | HTMLElement, options?: Tabulator.Options); + + columnManager: any; + rowManager: any; + footerManager: any; + browser: string; + browserSlow: boolean; + modules: any; + options: Tabulator.Options; + + /**You have a choice of four file types to choose from: + csv - Comma separated value file + json - JSON formatted text file + xlsx - Excel File (Requires the SheetJS Library) + pdf - PDF File (Requires the jsPDF Library and jsPDF-AutoTable Plugin) + To trigger a download, call the download function, passing the file type (from the above list) as the first argument, and an optional second argument of the file name for the download (if this is left out it will be "Tabulator.ext"). The optional third argument is an object containing any setup options for the formatter, such as the delimiter choice for CSV's). + + The PDF downloader requires that the jsPDF Library and jsPDF-AutoTable Plugin be included on your site, this can be included with the following script tags. + + If you want to create a custom file type from the table data then you can pass a function to the type argument, instead of a string value. At the end of this function you must call the setFileContents function, passing the formatted data and the mime type. + */ + download: (downloadType: Tabulator.DownloadType | ((columns: Tabulator.ColumnDefinition[], data: any, options: any, setFileContents: any) => any), fileName: string, params?: Tabulator.DownloadOptions) => void; + + /**If you want to open the generated file in a new browser tab rather than downloading it straight away, you can use the downloadToTab function. This is particularly useful with the PDF downloader, as it allows you to preview the resulting PDF in a new browser ta */ + downloadToTab: (downloadType: Tabulator.DownloadType, fileName: string, params?: Tabulator.DownloadOptions) => void; + + /**The copyToClipboard function allows you to copy the current table data to the clipboard. + + The first argument is the copy selector, you can choose from any of the built in options or pass a function in to the argument, that must return the selected row components. + + If you leave this argument undefined, Tabulator will use the value of the clipboardCopySelector property, which has a default value of table */ + copyToClipboard: (type: "selection" | "table") => void; + + /**With history enabled you can use the undo function to automatically undo a user action, the more times you call the function, the further up the history log you go. */ + undo: () => boolean; + + /**You can use the getHistoryUndoSize function to get a count of the number of history undo actions available. */ + getHistoryUndoSize: () => number | false; + + /**With history enabled you can use the redo function to automatically redo user action that has been undone, the more times you call the function, the further up the history log you go. once a user interacts with the table then can no longer redo any further actions until an undo is performe */ + redo: () => boolean; + + /**You can use the getHistoryRedoSize function to get a count of the number of history redo actions available.*/ + getHistoryRedoSize: () => number | false; + /**Deconstructor */ + destroy: () => void; + /**By default Tabulator will only allow files with a .json extension to be loaded into the table. + + You can allow any other type of file into the file picker by passing the extension or mime type into the first argument of the setDataFromLocalFile function as a comma separated list. This argument will accept any of the values valid for the accept field of an input element */ + setDataFromLocalFile: (extensions: string) => void; + setData: (data: any, params?: any, config?: any) => Promise; + /**You can remove all data from the table using clearData */ + clearData: () => void; + /**You can retrieve the data stored in the table using the getData function. */ + getData: (activeOnly?: boolean) => any[]; + getDataCount: (activeOnly?: boolean) => number; + /**The searchRows function allows you to retreive an array of row components that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + searchRows: Tabulator.FilterFunction; + /**The searchData function allows you to retreive an array of table row data that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + searchData: Tabulator.FilterFunction; + /**You can retrieve the table data as a simple HTML table using the getHtml function. */ + getHtml: (activeOnly?: boolean) => void; + /**You can retrieve the current AJAX URL of the table with the getAjaxUrl function. + * + * This will return a HTML encoded string of the table data. + + By default getHtml will return a table containing all the data held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + */ + getAjaxUrl: () => string; + /**The replaceData function lets you silently replace all data in the table without updating scroll position, sort or filtering, and without triggering the ajax loading popup. This is great if you have a table you want to periodically update with new/updated information without alerting the user to a change. + + It takes the same arguments as the setData function, and behaves in the same way when loading data (ie, it can make ajax requests, parse JSON etc) */ + replaceData: (data?: {}[] | string, params?: any, config?: any) => Promise; + /**If you want to update an existing set of data in the table, without completely replacing the data as the setData method would do, you can use the updateData method. + + This function takes an array of row objects and will update each row based on its index value. (the index defaults to the "id" parameter, this can be set using the index option in the tabulator constructor). Options without an index will be ignored, as will items with an index that is not already in the table data. The addRow function should be used to add new data to the table. */ + updateData: (data: {}[]) => Promise; + /**The addData method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ + addData: (data?: {}[], addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + + /**If the data you are passng to the table contains a mix of existing rows to be updated and new rows to be added then you can call the updateOrAddData function. This will check each row object provided and update the existing row if available, or else create a new row with the data. */ + updateOrAddData: (data: {}[]) => Promise; + /**To rereive the DOM Node of a specific row, you can retrieve the RowComponent with the getRow function, then use the getElement function on the component. The first argument is the row you are looking for, it will take any of the standard row component look up options. */ + getRow: (row: Tabulator.RowLookup) => Tabulator.RowComponent; + + /**You can retrieve the Row Component of a row at a given position in the table using getRowFromPosition function. By default this will return the row based in its position in all table data, including data currently filtered out of the table. + + If you want to get a row based on its position in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. */ + getRowFromPosition: (position: number, activeOnly?: boolean) => void; + /**You can delete any row in the table using the deleteRow function. */ + deleteRow: (row: Tabulator.RowLookup) => void; + + /**You can add a row to the table using the addRow function. + + The first argument should be a row data object. If you do not pass data for a column, it will be left empty. To create a blank row (ie for a user to fill in), pass an empty object to the function. + + The second argument is optional and determines whether the row is added to the top or bottom of the table. A value of true will add the row to the top of the table, a value of false will add the row to the bottom of the table. If the parameter is not set the row will be placed according to the addRowPos global option. */ + addRow: (data?: {}, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + /**If you don't know whether a row already exists you can use the updateOrAddRow function. This will check if a row with a matching index exists, if it does it will update it, if not it will add a new row with that data. This takes the same arguments as the updateRow function. */ + updateOrAddRow: (row: Tabulator.RowLookup, data: {}) => Promise; + /**You can update any row in the table using the updateRow function. + + The first argument is the row you want to update, it will take any of the standard row component look up options. + + The second argument should be the updated data object for the row. As with the updateData function, this will not replace the existing row data object, it will only update any of the provided parameters. + + Once complete, this function will trigger the rowUpdated and dataEdited events. + + This function will return true if the update was successful or false if the requested row could not be found. If the new data matches the existing row data, no update will be performed. + */ + updateRow: (row: Tabulator.RowLookup, data: {}) => boolean; + /**If you want to trigger an animated scroll to a row then you can use the scrollToRow function. + + The first argument should be any of the standard row component look up options for the row you want to scroll to. + + The second argument is optional, and is used to set the position of the row, it should be a string with a value of either top, center, bottom or nearest, if omitted it will be set to the value of the scrollToRowPosition option which has a default value of top. + + The third argument is optional, and is a boolean used to set if the table should scroll if the row is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToRowIfVisible option, which defaults to true */ + scrollToRow: (row: Tabulator.RowLookup, position?: Tabulator.ScrollToRowPostition, ifVisible?: boolean) => Promise; + /**If you want to programmatically move a row to a new position you can use the moveRow function. + + The first argument should be the row you want to move, and can be any of the standard row component look up options. + + The second argument should be the target row that you want to move to, and can be any of the standard row component look up options. + + The third argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target */ + moveRow: (fromRow: Tabulator.RowLookup, toRow: Tabulator.RowLookup, placeAboveTarget?: boolean) => void; + /**You can retrieve all the row components in the table using the getRows function. + * By default getRows will return an array containing all the Row Component's held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + */ + getRows: (activeOnly?: boolean) => Tabulator.RowComponent[]; + /**Use the getRowPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + + The first argument is the row you are looking for, it will take any of the standard row component look up options. If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. + + Note: If the row is not found, a value of -1 will be returned, row positions start at 0 + */ + getRowPosition: (row: Tabulator.RowLookup, activeOnly?: boolean) => number; + /**To replace the current column definitions for a table use the setColumns function. This function takes a column definition array as its only argument. */ + setColumns: (definitions: Tabulator.ColumnDefinition[]) => void; + /**To get an array of Column Components for the current table setup, call the getColumns function. This will only return actual data columns not column groups. + * + * To get a structured array of Column Components that includes column groups, pass a value of true as an argument. + */ + getColumns: (includeColumnGroups?: boolean) => Tabulator.ColumnComponent[] | Tabulator.GroupComponent[]; + /**Using the getColumn function you can retrieve the Column Component */ + getColumn: (column: Tabulator.ColumnLookup) => Tabulator.ColumnComponent; + /**To get the current column definition array (including any changes made through user actions, such as resizing or re-ordering columns), call the getColumnDefinitions function. this will return the current columns definition array. */ + getColumnDefinitions: () => Tabulator.ColumnDefinition[]; + /**If you want to handle column layout persistence manually, for example storing it in a database to use elsewhere, you can use the getColumnLayout function to retrieve a layout object for the current table. */ + getColumnLayout: () => Tabulator.ColumnLayout[]; + /**If you have previously used the getColumnLayout function to retrieve a tables layout, you can use the setColumnLayout function to apply it to a table. */ + setColumnLayout: (layout: Tabulator.ColumnLayout) => void; + /**You can show a hidden column at any point using the showColumn function. */ + showColumn: (column?: Tabulator.ColumnLookup) => void; + /**You can hide a visible column at any point using the hideColumn function. */ + hideColumn: (column?: Tabulator.ColumnLookup) => void; + /**You can toggle the visibility of a column at any point using the toggleColumn function. */ + toggleColumn: (column?: Tabulator.ColumnLookup) => void; + /**If you wish to add a single column to the table, you can do this using the addColumn function. + * This function takes three arguments: + + Columns Definition - The column definition object for the column you want to add. + Before (optional) - Determines how to position the new column. A value of true will insert the column to the left of existing columns, a value of false will insert it to the right. If a Position argument is supplied then this will determine whether the new colum is inserted before or after this column. + Position (optional) - The field to insert the new column next to, this can be any of the standard column component look up options. + * + */ + addColumn: (definition: Tabulator.ColumnDefinition, insertRightOfTarget?: boolean, positionTarget?: Tabulator.ColumnLookup) => void; + /**To permanently remove a column from the table deleteColumn function. This function takes any of the standard column component look up options as its first parameter */ + deleteColumn: (column: Tabulator.ColumnLookup) => void; + /**If you want to trigger an animated scroll to a column then you can use the scrollToColumn function. The first argument should be any of the standard column component look up options for the column you want to scroll to. + + The second argument is optional, and is used to set the position of the column, it should be a string with a value of either left, middle or right, if omitted it will be set to the value of the scrollToColumnPosition option which has a default value of left. + + The third argument is optional, and is a boolean used to set if the table should scroll if the column is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToColumnIfVisible option, which defaults to true + */ + scrollToColumn: (column: Tabulator.ColumnLookup, position?: Tabulator.ScrollToColumnPosition, ifVisible?: boolean) => Promise; + /**You can also set the language at any point after the table has loaded using the setLocale function, which takes the same range of values as the locale setup option mentioned above. */ + setLocale: (locale: string | boolean) => void; + /**It is possible to retrieve the locale code currently being used by Tabulator using the getLocale function: */ + getLocale: () => string; + /**You can then access these at any point using the getLang function, which will return the language object for the currently active locale. */ + getLang: (locale?: string) => any; + /**If the size of the element containing the Tabulator changes (and you are not able to use the in built auto-resize functionality) or you create a table before its containing element is visible, it will necessary to redraw the table to make sure the rows and columns render correctly. + + This can be done by calling the redraw method. For example, to trigger a redraw whenever the viewport width is changed. + + The redraw function also has an optional boolean argument that when set to true triggers a full rerender of the table including all data on all rows.*/ + redraw: (force?: boolean) => void; + /**If you want to manually change the height of the table at any time, you can use the setHeight function, which will also redraw the virtual DOM if necessary. */ + setHeight: (height: number) => void; + /**You can trigger sorting using the setSort function */ + setSort: (sortList: string | Tabulator.Sorter[], dir?: Tabulator.SortDirection) => void; + getSorters: () => void; + /**To remove all sorting from the table, call the clearSort function. */ + clearSort: () => void; + /**To set a filter you need to call the setFilter method, passing the field you wish to filter, the comparison type and the value to filter for. + + This function will replace any exiting filters on the table with the specified filter + + If you want to perform a more complicated filter then you can pass a callback function to the setFilter method, you can also pass an optional second argument, an object with parameters to be passed to the filter function. + */ + setFilter: (p1: string | Tabulator.Filter[] | any[] | ((data: any, filterParams: any) => boolean), p2?: Tabulator.FilterType | {}, value?: any) => void; + /**If you want to add another filter to the existing filters then you can call the addFilter function: */ + addFilter: Tabulator.FilterFunction; + /**You can retrieve an array of the current programtic filters using the getFilters function, this will not include any of the header filters: */ + getFilters: (includeHeaderFilters: boolean) => Tabulator.Filter[]; + /**You can programatically set the header filter value of a column by calling the setHeaderFilterValue function, This function takes any of the standard column component look up options as its first parameter, with the value for the header filter as the second option */ + setHeaderFilterValue: (column: Tabulator.ColumnLookup, value: string) => void; + + /**You can programatically set the focus on a header filter element by calling the setHeaderFilterFocus function, This function takes any of the standard column component look up options as its first parameter */ + setHeaderFilterFocus: (column: Tabulator.ColumnLookup) => void; + /**If you just want to retrieve the current header filters, you can use the getHeaderFilters function: */ + getHeaderFilters: () => Tabulator.Filter[]; + /**If you want to remove one filter from the current list of filters you can use the removeFilter function: */ + removeFilter: Tabulator.FilterFunction; + /**To remove all filters from the table, use the clearFilter function. */ + clearFilter: (includeHeaderFilters: boolean) => void; + /**To remove just the header filters, leaving the programatic filters in place, use the clearHeaderFilter function. */ + clearHeaderFilter: () => void; + /**To programmatically select a row you can use the selectRow function. + + To select a specific row you can pass the any of the standard row component look up options into the first argument of the function. If you leave the argument blank you will select all rows (if you have set the selectable option to a numeric value, it will be ignored when selecting all rows). */ + selectRow: (row?: Tabulator.RowLookup) => void; + deselectRow: (row?: Tabulator.RowLookup) => void; + toggleSelectRow: (row?: Tabulator.RowLookup) => void; + /**To get the RowComponent's for the selected rows at any time you can use the getSelectedRows function. + + This will return an array of RowComponent's for the selected rows in the order in which they were selected. */ + getSelectedRows: () => Tabulator.RowComponent[]; + /**To get the data objects for the selected rows you can use the getSelectedData function. + + This will return an array of the selected rows data objects in the order in which they were selected */ + getSelectedData: () => any[]; + /**set the maxmum page */ + setMaxPage: (max: number) => void; + /**When pagination is enabled the table footer will contain a number of pagination controls for navigating through the data. + + In addition to these controls it is possible to change page using the setPage function + The setPage function takes one parameter, which should be an integer representing the page you wish to see. There are also four strings that you can pass into the parameter for special functions. + + "first" - show the first page + "prev" - show the previous page + "next" - show the next page + "last" - show the last page + The setPage method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + */ + setPage: (page: number | "first" | "prev" | "next" | "last") => Promise; + /**You can load the page for a specific row using the setPageToRow function and passing in any of the standard row component look up options for the row you want to scroll to. + * + * The setPageToRow method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + */ + setPageToRow: (row: Tabulator.RowLookup) => Promise; + + /**You can change the page size at any point by using the setPageSize function. (this setting will be ignored if using remote pagination with the page size set by the server) */ + setPageSize: (size: number) => void; + /**To retrieve the number of rows allowed per page you can call the getPageSize function: */ + getPageSize: () => number; + /**You can change to show the previous page using the previousPage function. */ + previousPage: () => Promise; + /**You can change to show the next page using the previousPage function. */ + + nextPage: () => Promise; + /**To retrieve the current page use the getPage function. this will return the number of the current page. If pagination is disabled this will return false. */ + getPage: () => number | false; + /**To retrieve the maximum available page use the getPageMax function. this will return the number of the maximum available page. If pagination is disabled this will return false. */ + getPageMax: () => number | false; + /**You can use the setGroupBy function to change the fields that rows are grouped by. This function has one argument and takes the same values as passed to the groupBy setup option. */ + setGroupBy: (groups: string | ((data: any) => any)) => void; + /**You can use the setGroupStartOpen function to change the default open state of groups. This function has one argument and takes the same values as passed to the groupStartOpen setup option. + * + * Note: If you use the setGroupStartOpen or setGroupHeader before you have set any groups on the table, the table will not update until the setGroupBy function is called. + */ + setGroupStartOpen: (values: boolean | ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => boolean)) => void; + /**You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + setGroupHeader: (values: ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => string) | ((value: any, count: number, data: any) => string)[]) => void; + /**You can use the getGroups function to retrieve an array of all the first level Group Components in the table. */ + getGroups: () => Tabulator.GroupComponent[]; + /**get grouped table data in the same format as getData() */ + getGroupedData: (activeOnly?: boolean) => any; + /**You can retrieve the results of the column calculations at any point using the getCalcResults function. + * For a table without grouped rows, this will return an object with top and bottom properties, that contain a row data object for all the columns in the table for the top calculations and bottom calculations respectively. + */ + getCalcResults: () => any; + /**Use the navigatePrev function to shift focus to the next editable cell on the left, if none available move to the right most editable cell on the row above. + * + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigatePrev: () => void; + /**Use the navigateNext function to shift focus to the next editable cell on the right, if none available move to left most editable cell on the row below. + * + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateNext: () => void; + /**Use the navigateLeft function to shift focus to next editable cell on the left, return false if none available on row. + * + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateLeft: () => void; + /**Use the navigateRight function to shift focus to next editable cell on the right, return false if none available on row. + * + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateRight: () => void; + /**Use the navigateUp function to shift focus to the same cell in the row above. + + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateUp: () => void; + + /*Use the navigateDown function to shift focus to the same cell in the row below. + + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateDown: () => void; + + /**A lot of the modules come with a range of default settings to make setting up your table easier, for example the sorters, formatters and editors that ship with Tabulator as standard. + + If you are using a lot of custom settings over and over again (for example a custom sorter). you can end up re-delcaring it several time for different tables. To make your life easier Tabulator allows you to extend the default setup of each module to make your custom options as easily accessible as the defaults. + + Using the extendModule function on the global Tabulator variable allows you to globally add these options to all tables. + + The function takes three arguments, the name of the module, the name of the property you want to extend, and an object containing the elements you want to add in your module. In the example below we extend the format module to add two new default formatters: */ + extendModule: (name: string, property: string, values: {}) => void; +} diff --git a/types/tabulator-tables/tabulator-tables-tests.ts b/types/tabulator-tables/tabulator-tables-tests.ts new file mode 100644 index 0000000000..470dce2c76 --- /dev/null +++ b/types/tabulator-tables/tabulator-tables-tests.ts @@ -0,0 +1,427 @@ +//constructor +let table = new Tabulator("#test"); +table.copyToClipboard("selection"); +table.searchRows("name", "<", 3); +table.setFilter("name", "<=", 3); +table.setFilter([ + { field: "age", type: ">", value: 52 }, //filter by age greater than 52 + { field: "height", type: "<", value: 142 }, //and by height less than 142 + { field: "name", type: "in", value: ["steve", "bob", "jim"] } //name must be steve, bob or jim +]); +table.setFilter( + (data, filterParams) => { + //data - the data for the row being filtered + //filterParams - params object passed to the filter + return data.name == "bob" && data.height < filterParams.height; //must return a boolean, true if it passes the filter. + }, + { height: 3 } +); +table.setFilter("age", "in", ["steve", "bob", "jim"]); +table.setFilter([ + { field: "age", type: ">", value: 52 }, //filter by age greater than 52 + [ + { field: "height", type: "<", value: 142 }, //with a height of less than 142 + { field: "name", type: "=", value: "steve" } //or a name of steve + ] +]); + +table + .setPageToRow(12) + .then(function() { + //run code after table has been successfuly updated + }) + .catch(function(error) { + //handle error loading data + }); + +table.setGroupBy("gender"); +table.setGroupStartOpen(true); + +table.setGroupHeader((value, count, data, group) => { + return ""; +}); +table.setGroupHeader((value, count, data) => { + return ""; +}); + +table.setSort([ + { column: "age", dir: "asc" }, //sort by this first + { column: "height", dir: "desc" } //then sort by this second +]); + +table + .scrollToColumn("age", "middle", false) + .then(function() { + //run code after column has been scrolled to + }) + .catch(function(error) { + //handle error scrolling to column + }); + +table + .updateOrAddData([{ id: 1, name: "bob" }, { id: 3, name: "steve" }]) + .then(function(rows) { + //rows - array of the row components for the rows updated or added + //run code after data has been updated + }) + .catch(function(error) { + //handle error updating data + }); + +table.updateData([{ id: 1, name: "bob", gender: "male" }, { id: 2, name: "Jenny", gender: "female" }]); +table + .updateData([{ id: 1, name: "bob" }]) + .then(function() { + //run code after data has been updated + }) + .catch(function(error) { + //handle error updating data + }); + +let row1: Tabulator.RowComponent; +let row2: Tabulator.RowComponent; + +//column definitions +let colDef: Tabulator.ColumnDefinition = {} as Tabulator.ColumnDefinition; +colDef.title = "title"; +colDef.sorter = customSorter; + +function customSorter(a: any, b: any, aRow: Tabulator.RowComponent, bRow: Tabulator.RowComponent, column: Tabulator.ColumnComponent, dir: Tabulator.SortDirection, sorterParams: Tabulator.ColumnDefinitionSorterParams): number { + return 1; +} + +colDef.sorterParams = (col: Tabulator.ColumnComponent, dir: Tabulator.SortDirection) => { + return {}; +}; +colDef.sorterParams = { format: "DD/MM/YY" }; +colDef.formatterParams = { + invalidPlaceholder: val => { + return ""; + } +}; + +colDef.formatterParams = cell => { + //cell - the cell component + + //do some processing and return the param object + return { param1: "green" }; +}; + +//List lookup +colDef.formatterParams = { + small: "Cute", + medium: "Fine", + big: 2, + huge: true +}; +//Custom Formatter +colDef.formatter = (cell: Tabulator.CellComponent, formatterParams: {}, onRendered) => { + onRendered = () => {}; + return ""; +}; + +colDef.editor = true; +colDef.editor = "number"; +colDef.editor = function(cell, onRendered, success, cancel, editorParams) { + //cell - the cell component for the editable cell + //onRendered - function to call when the editor has been rendered + //success - function to call to pass the successfuly updated value to Tabulator + //cancel - function to call to abort the edit and return to a normal cell + //editorParams - params object passed into the editorParams column definition property + + //create and style editor + var editor = document.createElement("input"); + + editor.setAttribute("type", "date"); + + //create and style input + editor.style.padding = "3px"; + editor.style.width = "100%"; + editor.style.boxSizing = "border-box"; + + //Set value of editor to the current value of the cell + editor.value = moment(cell.getValue(), "DD/MM/YYYY"); + + //set focus on the select box when the editor is selected (timeout allows for editor to be added to DOM) + onRendered(function() { + editor.focus(); + editor.style.cssText = "100%"; + }); + + //when the value has been set, trigger the cell to update + function successFunc() { + success(moment(editor.value, "YYYY-MM-DD")); + } + + editor.addEventListener("change", successFunc); + editor.addEventListener("blur", successFunc); + + //return the editor element + return editor; +}; +//Dummy function +function moment(a: any, b: any) { + return ""; +} + +colDef.cellClick = (_e, cell) => { + console.log(cell.checkHeight); +}; + +colDef.formatterParams = { stars: 3 }; + +colDef.editorParams = {}; +colDef.editorParams = { + values: [ + { + //option group + label: "Men", + options: [ + //options in option group + { + label: "Steve Boberson", + value: "steve" + }, + { + label: "Bob Jimmerson", + value: "bob" + } + ] + }, + { + //option group + label: "Women", + options: [ + //options in option group + { + label: "Jenny Jillerson", + value: "jenny" + }, + { + label: "Jill Betterson", + value: "jill" + } + ] + }, + { + //ungrouped option + label: "Other", + value: "other" + } + ] +}; + +let selectParamValues: Tabulator.JSONRecord; +selectParamValues = { + steve: "Steve Boberson", + bob: "Bob Jimmerson", + jim: true +}; +colDef.editorParams = { + values: selectParamValues +}; + +colDef.editorParams = function(cell) { + return {}; +}; + +let autoComplete: Tabulator.AutoCompleteParams = { + showListOnEmpty: true, //show all values when the list is empty, + freetext: true, //allow the user to set the value of the cell to a free text entry + allowEmpty: true, //allow empty string values + searchFunc: (term, values) => { + //search for exact matches + var matches: string[] = []; + return matches; + }, + listItemFormatter: function(value, title) { + //prefix all titles with the work "Mr" + return "Mr " + title; + }, + values: true //create list of values from all values contained in this column +}; +colDef.editorParams = autoComplete; + +colDef.editorParams = { + values: [ + { + //option group + label: "Men", + options: [ + //options in option group + { + label: "Steve Boberson", + value: "steve" + }, + { + label: "Bob Jimmerson", + value: "bob" + } + ] + }, + { + //option group + label: "Women", + options: [ + //options in option group + { + label: "Jenny Jillerson", + value: "jenny" + }, + { + label: "Jill Betterson", + value: "jill" + } + ] + }, + { + //ungrouped option + label: "Other", + value: "other" + } + ] +}; + +//Validators +colDef.validator = { + type: (cell, value, parameters) => { + return true; + }, + parameters: { + divisor: 5 + } +}; +colDef.validator = "float"; +colDef.validator = { type: "float", parameters: {} }; + +let validators: Tabulator.Validator[] = [ + { type: "integer", parameters: {} }, + { + type: (cell, value, parameters) => { + return true; + }, + parameters: {} + } +]; + +colDef.headerFilterFunc = "!="; +colDef.headerFilterFunc = (headerValue, rowValue, rowData, filterParams) => { + return rowData.name == filterParams.name && rowValue < headerValue; //must return a boolean, true if it passes the filter. +}; + +//Cell Component +let cell: Tabulator.CellComponent = {} as Tabulator.CellComponent; +cell.nav().down(); + +let data = cell.getData(); +table = cell.getTable(); + +//Row Component +let row: Tabulator.RowComponent = {} as Tabulator.RowComponent; +row.delete() + .then(function() { + //run code after row has been deleted + }) + .catch(function(error) { + //handle error deleting row + }); + +//Options +let options: Tabulator.Options = {} as Tabulator.Options; +options.keybindings = { + navPrev: "ctrl + 1", + navNext: false +}; + +options.downloadDataFormatter = data => { + // data.forEach(function(row){ + // row.age = row.age >= 18 ? "adult" : "child"; +}; + +options.downloadConfig = { + columnGroups: false, //include column groups in column headers for download + rowGroups: false, //do not include row groups in download + columnCalcs: false //do not include column calculation rows in download +}; + +options.ajaxConfig = "GET"; +options.ajaxConfig = { + mode: "cors", //set request mode to cors + credentials: "same-origin", //send cookies with the request from the matching origin + headers: { + Accept: "application/json", //tell the server we need JSON back + "X-Requested-With": "XMLHttpRequest", //fix to help some frameworks respond correctly to request + "Content-type": "application/json; charset=utf-8", //set the character encoding of the request + "Access-Control-Allow-Origin": "http://yout-site.com" //the URL origin of the site making the request + } +}; +options.ajaxConfig = { + method: "POST", //set request type to Position + headers: { + "Content-type": "application/json; charset=utf-8" //set specific content type + } +}; + +options.ajaxContentType = { + headers: { + "Content-Type": "text/html" + }, + body: function(url, config, params) { + //url - the url of the request + //config - the fetch config object + //params - the request parameters + + //return comma list of params:values + var output = []; + + for (var key in params) { + output.push(key + ":" + params[key]); + } + + return output.join(","); + } +}; + +options.initialSort = [{ column: "name", dir: "asc" }, { column: "name2", dir: "desc" }]; +options.initialFilter = [{ field: "color", type: "=", value: "red" }]; +options.initialHeaderFilter = [ + { field: "color", value: "red" } //set the initial value of the header filter to "red" +]; + +options.groupValues = [ + ["red", "blue", "green"], //create groups for color values of "red", "blue", and "green", + [10, 20, 30] //create sub groups for ages of 10, 20 and 30 +]; + +options.groupHeader = (value, count, data, group) => { + //value - the value all members of this group share + //count - the number of rows in this group + //data - an array of all the row data objects in this group + //group - the group component for the group + + return value + "(" + count + " item)"; +}; + +options.groupHeader = [ + function(value, count, data) { + //generate header contents for gender groups + return value + "(" + count + " item)"; + }, + function(value, count, data) { + //generate header contents for color groups + return value + "(" + count + " item)"; + } +]; + +options.paginationDataReceived = { + last_page: "max_pages", + a: "b" +}; + +options.clipboardPasteParser = clipboard => { + return []; //return array +}; + +options.cellEditing = cell => { + console.log(cell); +}; diff --git a/types/tabulator-tables/tsconfig.json b/types/tabulator-tables/tsconfig.json new file mode 100644 index 0000000000..7f97e421b8 --- /dev/null +++ b/types/tabulator-tables/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "tabulator-tables-tests.ts"] +} diff --git a/types/tabulator-tables/tslint.json b/types/tabulator-tables/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tabulator-tables/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c79ee7b65f500c19ec2bf6e5dccfa9111efe434f Mon Sep 17 00:00:00 2001 From: Jojoshua Date: Wed, 6 Mar 2019 10:39:56 -0500 Subject: [PATCH 178/265] Update project url --- types/tabulator-tables/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tabulator-tables/index.d.ts b/types/tabulator-tables/index.d.ts index 3fe21f805f..3a3e3de64a 100644 --- a/types/tabulator-tables/index.d.ts +++ b/types/tabulator-tables/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for tabulator-tables 4.2 -// Project: https://github.com/olifolkerd/tabulator +// Project: http://tabulator.info // Definitions by: Josh Harris // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From a205830fc92a70ac964cda10264fffb9f02028a6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 6 Mar 2019 09:53:22 -0800 Subject: [PATCH 179/265] Nightly cleanup 06-03-2019 1. Add handlebars depdencies missed in #33518, which deprecated @types/handlebars now that handlebars ships its own types. 2. Add project homepage for kafkajs. --- types/ember/v1/package.json | 6 ++++++ types/ember/v2/package.json | 6 ++++++ types/hbs/package.json | 6 ++++++ types/kafkajs/index.d.ts | 2 +- types/koa-hbs/package.json | 6 ++++++ types/snazzy-info-window/package.json | 6 ++++++ types/swag/package.json | 6 ++++++ 7 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 types/ember/v1/package.json create mode 100644 types/ember/v2/package.json create mode 100644 types/hbs/package.json create mode 100644 types/koa-hbs/package.json create mode 100644 types/snazzy-info-window/package.json create mode 100644 types/swag/package.json diff --git a/types/ember/v1/package.json b/types/ember/v1/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/ember/v1/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/ember/v2/package.json b/types/ember/v2/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/ember/v2/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/hbs/package.json b/types/hbs/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/hbs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/kafkajs/index.d.ts b/types/kafkajs/index.d.ts index a28377e369..c416a07063 100644 --- a/types/kafkajs/index.d.ts +++ b/types/kafkajs/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for kafkajs 1.4 -// Project: https://github.com/tulios/kafkajs +// Project: https://github.com/tulios/kafkajs, https://kafka.js.org // Definitions by: Michal Kaminski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/koa-hbs/package.json b/types/koa-hbs/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/koa-hbs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/snazzy-info-window/package.json b/types/snazzy-info-window/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/snazzy-info-window/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/swag/package.json b/types/swag/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/swag/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} From 322e9ec92ef43cb895984b1e1296baf5ad2616a1 Mon Sep 17 00:00:00 2001 From: Derek Ries Date: Wed, 6 Mar 2019 10:23:24 -0800 Subject: [PATCH 180/265] Updates react-map-gl to include onNativeClick prop --- types/react-map-gl/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-map-gl/index.d.ts b/types/react-map-gl/index.d.ts index 4d147d3611..45752cb2d6 100644 --- a/types/react-map-gl/index.d.ts +++ b/types/react-map-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-map-gl 4.0 +// Type definitions for react-map-gl 4.0.13 // Project: https://github.com/uber/react-map-gl#readme // Definitions by: Robert Imig // Fabio Berta @@ -226,6 +226,7 @@ export interface InteractiveMapProps extends StaticMapProps { keyboard?: boolean; onHover?: (event: PointerEvent) => void; onClick?: (event: PointerEvent) => void; + onNativeClick?: (event: PointerEvent) => void; onDblClick?: (event: PointerEvent) => void; onContextMenu?: (event: PointerEvent) => void; onMouseDown?: (event: PointerEvent) => void; From c372d80438392c137a0851a8599ecc050a6b1ae7 Mon Sep 17 00:00:00 2001 From: Jordi Oliveras Rovira Date: Wed, 6 Mar 2019 19:52:01 +0100 Subject: [PATCH 181/265] Remove sudo: false setting from travis.yml --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9bd31bda14..ab47e3af2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,5 @@ language: node_js node_js: - 8 -sudo: false - notifications: email: false From 506669b0a683996dd0f807fbe12fe72cc3d11784 Mon Sep 17 00:00:00 2001 From: Derek Ries Date: Wed, 6 Mar 2019 11:07:54 -0800 Subject: [PATCH 182/265] removed patch version --- types/react-map-gl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-map-gl/index.d.ts b/types/react-map-gl/index.d.ts index 45752cb2d6..04c4d9aed9 100644 --- a/types/react-map-gl/index.d.ts +++ b/types/react-map-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-map-gl 4.0.13 +// Type definitions for react-map-gl 4.0 // Project: https://github.com/uber/react-map-gl#readme // Definitions by: Robert Imig // Fabio Berta From c650a04ddef9ee4a4d51004006a54ba00fb6ed7c Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sat, 2 Mar 2019 21:42:25 +0100 Subject: [PATCH 183/265] [ora] Remove types --- notNeededPackages.json | 6 + types/ora/index.d.ts | 290 ------------------------------------- types/ora/ora-tests.ts | 49 ------- types/ora/tsconfig.json | 24 --- types/ora/tslint.json | 1 - types/ora/v0/index.d.ts | 34 ----- types/ora/v0/ora-tests.ts | 8 - types/ora/v0/tsconfig.json | 28 ---- types/ora/v0/tslint.json | 1 - types/ora/v1/index.d.ts | 137 ------------------ types/ora/v1/ora-tests.ts | 49 ------- types/ora/v1/tsconfig.json | 29 ---- types/ora/v1/tslint.json | 1 - 13 files changed, 6 insertions(+), 651 deletions(-) delete mode 100644 types/ora/index.d.ts delete mode 100644 types/ora/ora-tests.ts delete mode 100644 types/ora/tsconfig.json delete mode 100644 types/ora/tslint.json delete mode 100644 types/ora/v0/index.d.ts delete mode 100644 types/ora/v0/ora-tests.ts delete mode 100644 types/ora/v0/tsconfig.json delete mode 100644 types/ora/v0/tslint.json delete mode 100644 types/ora/v1/index.d.ts delete mode 100644 types/ora/v1/ora-tests.ts delete mode 100644 types/ora/v1/tsconfig.json delete mode 100644 types/ora/v1/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0edaa82c1e..d13d8d3073 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1176,6 +1176,12 @@ "sourceRepoURL": "http://onsen.io", "asOfVersion": "2.0.0" }, + { + "libraryName": "ora", + "typingsPackageName": "ora", + "sourceRepoURL": "https://github.com/sindresorhus/ora", + "asOfVersion": "3.2.0" + }, { "libraryName": "p-event", "typingsPackageName": "p-event", diff --git a/types/ora/index.d.ts b/types/ora/index.d.ts deleted file mode 100644 index 13104b0b5c..0000000000 --- a/types/ora/index.d.ts +++ /dev/null @@ -1,290 +0,0 @@ -// Type definitions for ora 3.1 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed -// Christian Rackerseder -// BendingBender -// Aleh Zasypkin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -/// - -export = ora; - -/** - * Elegant terminal spinner. - * - * @param options If a string is provided, it is treated as a shortcut for `options.text`. - */ -declare function ora(options?: ora.Options | string): ora.Ora; - -declare namespace ora { - /** - * Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills - * or with `.fail()` if it rejects. - * - * @param action - * @param options If a string is provided, it is treated as a shortcut for `options.text`. - * @returns The spinner instance. - */ - function promise(action: PromiseLike, options?: Options | string): Ora; - - interface Ora { - /** - * A boolean of whether the instance is currently spinning. - */ - readonly isSpinning: boolean; - - /** - * Change the text. - */ - text: string; - - /** - * Change the spinner color. - */ - color: Color; - - /** - * Change the spinner. - */ - spinner: SpinnerName | Spinner; - - /** - * Change the spinner indent. - */ - indent: number; - - /** - * Start the spinner. - * - * @param text Set the current text. - * @returns The spinner instance. - */ - start(text?: string): Ora; - - /** - * Stop and clear the spinner. - * - * @returns The spinner instance. - */ - stop(): Ora; - - /** - * Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - succeed(text?: string): Ora; - - /** - * Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - fail(text?: string): Ora; - - /** - * Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - warn(text?: string): Ora; - - /** - * Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - info(text?: string): Ora; - - /** - * Stop the spinner and change the symbol or text. - * - * @param options - * @returns The spinner instance. - */ - stopAndPersist(options?: PersistOptions): Ora; - - /** - * Clear the spinner. - * @returns The spinner instance. - */ - clear(): Ora; - - /** - * Manually render a new frame. - * @returns The spinner instance. - */ - render(): Ora; - - /** - * Get a new frame. - * @returns The spinner instance. - */ - frame(): Ora; - } - - interface Options { - /** - * Text to display after the spinner. - */ - text?: string; - /** - * Name of one of the provided spinners. See `example.js` in this repo if you want to test out different spinners. - * On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support. - * - * Or an object like: - * - * @example - * { - * interval: 80, // optional - * frames: ['-', '+', '-'] - * } - * - * @default 'dots' - */ - spinner?: SpinnerName | Spinner; - /** - * Color of the spinner. - * @default 'cyan' - */ - color?: Color; - /** - * Set to `false` to stop Ora from hiding the cursor. - * @default true - */ - hideCursor?: boolean; - /** - * Indent the spinner with the given number of spaces. - * @default 0 - */ - indent?: number; - /** - * Interval between each frame. - * - * Spinners provide their own recommended interval, so you don't really need to specify this. - * @default Provided by the spinner or 100 - */ - interval?: number; - /** - * Stream to write the output. - * - * You could for example set this to `process.stdout` instead. - * @default process.stderr - */ - stream?: NodeJS.WritableStream; - /** - * Force enable/disable the spinner. If not specified, the spinner will be enabled - * if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment. - * - * Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, - * colors, and other ansi escape codes. It will still log text. - */ - isEnabled?: boolean; - } - - interface PersistOptions { - /** - * Symbol to replace the spinner with. - * @default ' ' - */ - symbol?: string; - /** - * Text to be persisted. - * @default Current text - */ - text?: string; - } - - interface Spinner { - interval?: number; - frames: string[]; - } - - type SpinnerName = - | 'dots' - | 'dots2' - | 'dots3' - | 'dots4' - | 'dots5' - | 'dots6' - | 'dots7' - | 'dots8' - | 'dots9' - | 'dots10' - | 'dots11' - | 'dots12' - | 'line' - | 'line2' - | 'pipe' - | 'simpleDots' - | 'simpleDotsScrolling' - | 'star' - | 'star2' - | 'flip' - | 'hamburger' - | 'growVertical' - | 'growHorizontal' - | 'balloon' - | 'balloon2' - | 'noise' - | 'bounce' - | 'boxBounce' - | 'boxBounce2' - | 'triangle' - | 'arc' - | 'circle' - | 'squareCorners' - | 'circleQuarters' - | 'circleHalves' - | 'squish' - | 'toggle' - | 'toggle2' - | 'toggle3' - | 'toggle4' - | 'toggle5' - | 'toggle6' - | 'toggle7' - | 'toggle8' - | 'toggle9' - | 'toggle10' - | 'toggle11' - | 'toggle12' - | 'toggle13' - | 'arrow' - | 'arrow2' - | 'arrow3' - | 'bouncingBar' - | 'bouncingBall' - | 'smiley' - | 'monkey' - | 'hearts' - | 'clock' - | 'earth' - | 'moon' - | 'runner' - | 'pong' - | 'shark' - | 'dqpb' - | 'weather' - | 'christmas' - | 'grenade' - | 'point' - | 'layer'; - - type Color = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray'; -} diff --git a/types/ora/ora-tests.ts b/types/ora/ora-tests.ts deleted file mode 100644 index 4e06c11248..0000000000 --- a/types/ora/ora-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { PassThrough } from 'stream'; -import ora = require('ora'); - -const spinner = ora('Loading unicorns'); -ora({ text: 'Loading unicorns' }); -ora({ spinner: 'squish' }); -ora({ spinner: { frames: ['-', '+', '-'] } }); -ora({ spinner: { interval: 80, frames: ['-', '+', '-'] } }); -ora({ color: 'cyan' }); -ora({ color: 'foo' }); // $ExpectError -ora({ hideCursor: true }); -ora({ indent: 1 }); -ora({ interval: 80 }); -ora({ stream: new PassThrough() }); -ora({ isEnabled: true }); - -spinner.color = 'yellow'; -spinner.text = 'Loading rainbows'; -spinner.isSpinning; // $ExpectType boolean -spinner.isSpinning = true; // $ExpectError -spinner.spinner = 'dots'; -spinner.indent = 5; - -spinner.start(); -spinner.start('Test text'); -spinner.stop(); -spinner.succeed(); -spinner.succeed('fooed'); -spinner.fail(); -spinner.fail('failed to foo'); -spinner.warn(); -spinner.warn('warn foo'); -spinner.info(); -spinner.info('info foo'); -spinner.stopAndPersist(); -spinner.stopAndPersist({ text: 'all done' }); -spinner.stopAndPersist({ symbol: '@', text: 'all done' }); -spinner.clear(); -spinner.render(); -spinner.frame(); - -const resolves = Promise.resolve(1); -ora.promise(resolves, 'foo'); -ora.promise(resolves, { - stream: new PassThrough(), - text: 'foo', - color: 'blue', - isEnabled: true, -}); diff --git a/types/ora/tsconfig.json b/types/ora/tsconfig.json deleted file mode 100644 index 302dc253cc..0000000000 --- a/types/ora/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true - }, - "files": [ - "index.d.ts", - "ora-tests.ts" - ] -} diff --git a/types/ora/tslint.json b/types/ora/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/ora/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/ora/v0/index.d.ts b/types/ora/v0/index.d.ts deleted file mode 100644 index 771f6beef6..0000000000 --- a/types/ora/v0/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for ora 0.3 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed , Christian Rackerseder -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; -interface Options { - text?: string; - spinner?: string | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; -} -interface Spinner { - interval?: number; - frames: string[]; -} -interface Instance { - start(): Instance; - stop(): Instance; - succeed(): Instance; - fail(): Instance; - stopAndPersist(symbol?: string): Instance; - clear(): Instance; - render(): Instance; - frame(): Instance; - text: string; - color: Color; -} -declare function ora(options: Options | string): Instance; -export = ora; diff --git a/types/ora/v0/ora-tests.ts b/types/ora/v0/ora-tests.ts deleted file mode 100644 index b6e2a671dc..0000000000 --- a/types/ora/v0/ora-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import ora = require('ora'); - -const spinner = ora('Loading unicorns').start(); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); diff --git a/types/ora/v0/tsconfig.json b/types/ora/v0/tsconfig.json deleted file mode 100644 index b614f6cbc4..0000000000 --- a/types/ora/v0/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ora": [ - "ora/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "ora-tests.ts" - ] -} \ No newline at end of file diff --git a/types/ora/v0/tslint.json b/types/ora/v0/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/ora/v0/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/ora/v1/index.d.ts b/types/ora/v1/index.d.ts deleted file mode 100644 index a3099f6cd9..0000000000 --- a/types/ora/v1/index.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -// Type definitions for ora 1.3 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed -// Christian Rackerseder -// BendingBender -// Aleh Zasypkin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -type SpinnerName = - 'dots' - | 'dots2' - | 'dots3' - | 'dots4' - | 'dots5' - | 'dots6' - | 'dots7' - | 'dots8' - | 'dots9' - | 'dots10' - | 'dots11' - | 'dots12' - | 'line' - | 'line2' - | 'pipe' - | 'simpleDots' - | 'simpleDotsScrolling' - | 'star' - | 'star2' - | 'flip' - | 'hamburger' - | 'growVertical' - | 'growHorizontal' - | 'balloon' - | 'balloon2' - | 'noise' - | 'bounce' - | 'boxBounce' - | 'boxBounce2' - | 'triangle' - | 'arc' - | 'circle' - | 'squareCorners' - | 'circleQuarters' - | 'circleHalves' - | 'squish' - | 'toggle' - | 'toggle2' - | 'toggle3' - | 'toggle4' - | 'toggle5' - | 'toggle6' - | 'toggle7' - | 'toggle8' - | 'toggle9' - | 'toggle10' - | 'toggle11' - | 'toggle12' - | 'toggle13' - | 'arrow' - | 'arrow2' - | 'arrow3' - | 'bouncingBar' - | 'bouncingBall' - | 'smiley' - | 'monkey' - | 'hearts' - | 'clock' - | 'earth' - | 'moon' - | 'runner' - | 'pong' - | 'shark' - | 'dqpb'; - -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - -interface Options { - text?: string; - spinner?: SpinnerName | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; - hideCursor?: boolean; -} - -interface PersistOptions { - symbol?: string; - text?: string; -} - -interface Spinner { - interval?: number; - frames: string[]; -} - -declare class Ora { - start(text?: string): Ora; - - stop(): Ora; - - succeed(text?: string): Ora; - - fail(text?: string): Ora; - - warn(text?: string): Ora; - - info(text?: string): Ora; - - stopAndPersist(options?: PersistOptions | string): Ora; - - clear(): Ora; - - render(): Ora; - - frame(): Ora; - - text: string; - - color: Color; - - frameIndex: number; -} - -interface oraFactory { - (options?: Options | string): Ora; - - new (options?: Options | string): Ora; - - promise(action: PromiseLike, options?: Options | string): Ora; -} - -declare const ora: oraFactory; - -export = ora; diff --git a/types/ora/v1/ora-tests.ts b/types/ora/v1/ora-tests.ts deleted file mode 100644 index 56a0d498c3..0000000000 --- a/types/ora/v1/ora-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { PassThrough } from 'stream'; -import Ora = require('ora'); - -const spinner = Ora('Loading unicorns').start(); - -const spinnerNothing = Ora().start(); - -const spinnerNew = new Ora({ - text: 'Loading unicorns', - spinner: 'squish' -}); - -const spinnerNew2 = new Ora({ - stream: new PassThrough(), - text: 'foo', - color: 'cyan', - enabled: true -}); - -spinner.start(); -spinner.start('Test text'); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); - -setTimeout(() => { - spinner.succeed(); -}, 2000); - -spinner.succeed(); -spinner.succeed('fooed'); -spinner.fail(); -spinner.fail('failed to foo'); -spinner.warn(); -spinner.info(); -spinner.stopAndPersist(); -spinner.stopAndPersist('@'); -spinner.stopAndPersist({text: 'all done'}); -spinner.stopAndPersist({symbol: '@', text: 'all done'}); - -const resolves = Promise.resolve(1); -Ora.promise(resolves, { - stream: new PassThrough(), - text: 'foo', - color: 'blue', - enabled: true -}); diff --git a/types/ora/v1/tsconfig.json b/types/ora/v1/tsconfig.json deleted file mode 100644 index ad30053dff..0000000000 --- a/types/ora/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ora": [ - "ora/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true - }, - "files": [ - "index.d.ts", - "ora-tests.ts" - ] -} diff --git a/types/ora/v1/tslint.json b/types/ora/v1/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/ora/v1/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 9faaa89c157520ae5e7ba93f6b8dcc41fa3afe28 Mon Sep 17 00:00:00 2001 From: Michael Mifsud Date: Thu, 7 Mar 2019 09:46:54 +1100 Subject: [PATCH 184/265] Fix node-dogstatsd constructor type definition As per the documentation the `socket` argument to the constructor is an optional Socket type not a string type. Using a string would result in a fatal error. --- types/node-dogstatsd/index.d.ts | 7 ++++++- types/node-dogstatsd/node-dogstatsd-tests.ts | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/node-dogstatsd/index.d.ts b/types/node-dogstatsd/index.d.ts index 8e818f7cb6..9f3c56dff9 100644 --- a/types/node-dogstatsd/index.d.ts +++ b/types/node-dogstatsd/index.d.ts @@ -4,7 +4,10 @@ // Michael Mifsud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare module "node-dogstatsd" { + import * as dgram from 'dgram'; export interface StatsDOptions { global_tags?: string[]; @@ -25,7 +28,9 @@ declare module "node-dogstatsd" { } export class StatsD implements StatsDClient { - constructor(host: string, port?: number, socket?: string, options?: StatsDOptions); + public socket: dgram.Socket + + constructor(host: string, port?: number, socket?: dgram.Socket, options?: StatsDOptions); timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void; diff --git a/types/node-dogstatsd/node-dogstatsd-tests.ts b/types/node-dogstatsd/node-dogstatsd-tests.ts index 072c5b168e..949ed73eac 100644 --- a/types/node-dogstatsd/node-dogstatsd-tests.ts +++ b/types/node-dogstatsd/node-dogstatsd-tests.ts @@ -1,12 +1,14 @@ +import * as dgram from 'dgram'; import * as datadog from 'node-dogstatsd'; function test_statsd_client() { // can create client with defaults let client = new datadog.StatsD('localhost'); let options: datadog.StatsDOptions = { global_tags: ['environment:definitely_typed']}; + const socket: dgram.Socket = dgram.createSocket('udp4'); // can create client with all params - client = new datadog.StatsD('localhost', 8125, null, options); + client = new datadog.StatsD('localhost', 8125, socket, options); let key: string = 'key'; let timeValue: number = 99; From 46d861bb9865a1a17ccc1104a3f95fe72f1c8630 Mon Sep 17 00:00:00 2001 From: Jojoshua Date: Wed, 6 Mar 2019 19:50:33 -0500 Subject: [PATCH 185/265] Fix linting --- types/tabulator-tables/index.d.ts | 1037 ++++++++--------- .../tabulator-tables-tests.ts | 244 ++-- 2 files changed, 631 insertions(+), 650 deletions(-) diff --git a/types/tabulator-tables/index.d.ts b/types/tabulator-tables/index.d.ts index 3a3e3de64a..328cf80865 100644 --- a/types/tabulator-tables/index.d.ts +++ b/types/tabulator-tables/index.d.ts @@ -4,45 +4,47 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +// tslint:disable:max-line-length +// tslint:disable:jsdoc-format +// tslint:disable:no-trailing-whitespace + declare namespace Tabulator { interface Options extends OptionsGeneral, OptionsHistory, OptionsLocale, OptionsDownload, OptionsColumns, OptionsRows, OptionsData, OptionsSorting, OptionsFiltering, OptionsRowGrouping, OptionsPagination, OptionsPersistentConfiguration, OptionsClipboard, OptionsDataTree, OptionsCell {} interface OptionsCells extends CellCallbacks { - /**The validationFailed event is triggered when the value entered into a cell during an edit fails to pass validation. */ + /** The validationFailed event is triggered when the value entered into a cell during an edit fails to pass validation. */ validationFailed?: (cell: CellComponent, value: any, validators: Validator[] | StandardValidatorType[]) => void; } - type OptionsDataTree = { - /**To enable data trees in your table, set the dataTree property to true in your table constructor: */ + interface OptionsDataTree { + /** To enable data trees in your table, set the dataTree property to true in your table constructor: */ dataTree?: boolean; - /** By default the toggle element will be inserted into the first column on the table. If you want the toggle element to be inserted in a different column you can pass the feild name of the column to the dataTreeElementColumn setup option*/ + /** By default the toggle element will be inserted into the first column on the table. If you want the toggle element to be inserted in a different column you can pass the feild name of the column to the dataTreeElementColumn setup option*/ dataTreeElementColumn?: boolean | string; - /**Show tree branch icon */ + /** Show tree branch icon */ dataTreeBranchElement?: boolean | string; - /**Tree level indent in pixels */ + /** Tree level indent in pixels */ dataTreeChildIndent?: number; - /**By default Tabulator will look for child rows in the _children field of a row data object. You can change this to look in a different field using the dataTreeChildField property in your table constructor: */ + /** By default Tabulator will look for child rows in the _children field of a row data object. You can change this to look in a different field using the dataTreeChildField property in your table constructor: */ dataTreeChildField?: string; - /**The toggle button that allows users to collapse and expand the column can be customised to meet your needs. There are two options, dataTreeExpandElement and dataTreeCollapseElement, that can be set to replace the default toggle elements with your own. + /** The toggle button that allows users to collapse and expand the column can be customised to meet your needs. There are two options, dataTreeExpandElement and dataTreeCollapseElement, that can be set to replace the default toggle elements with your own. Both options can take either an html string representing the contents of the toggle element */ dataTreeCollapseElement?: string | HTMLElement | boolean; - /** */ + /** The toggle button that allows users to expand the column */ dataTreeExpandElement?: string | HTMLElement | boolean; - /** By default all nodes on the tree will start collapsed, you can customize the initial expansion state of the tree using the dataTreeStartExpanded option. - * - This option can take one of three possible value types, either a boolean to indicate whether all nodes should start expanded or collapsed: */ + /** By default all nodes on the tree will start collapsed, you can customize the initial expansion state of the tree using the dataTreeStartExpanded option.* + This option can take one of three possible value types, either a boolean to indicate whether all nodes should start expanded or collapsed: */ dataTreeStartExpanded?: boolean | boolean[] | ((row: RowComponent, level: number) => boolean); - }; - type OptionsClipboard = { - /**You can enable clipboard functionality using the clipboard config option. It can take one of four possible values: + } + interface OptionsClipboard { + /** You can enable clipboard functionality using the clipboard config option. It can take one of four possible values: true - enable clipboard copy and paste "copy" - enable only copy functionality "paste" - enable only paste functionality false - disable all clipboard functionality (default) */ clipboard?: boolean | "copy" | "paste"; - /** - * The copy selector is a function that is used to choose which data is copied into the clipboard. Tabulator comes with a few different selectors built in: + /** * The copy selector is a function that is used to choose which data is copied into the clipboard. Tabulator comes with a few different selectors built in: active - Copy all table data currently displayed in the table to the clipboard (default) table - Copy all table data to the clipboard, including data that is currently filtered out selected - Copy the currently selected rows to the clipboard, including data that is currently filtered out @@ -51,12 +53,12 @@ declare namespace Tabulator { These selectors can also be used when programatically triggering a copy event. in this case if the selector is not specified it will default to the value set in the clipboardCopySelector property (which is active by default). */ clipboardCopySelector?: "active" | "table" | "selected"; - /** The copy formatter is used to take the row data provided by the selector and turn it into a text string for the clipboard. + /** The copy formatter is used to take the row data provided by the selector and turn it into a text string for the clipboard. There is one built in copy formatter called table, if you have extended the clipboard module and want to change the default you can use the clipboardCopyFormatter property. you can also pass in a formatting function directly into this property.*/ clipboardCopyFormatter?: "table" | ((rowData: any[]) => string); - /**By default Tabulator will include the column header titles in any clipboard data, this can be turned off by passing a value of false to the clipboardCopyHeader property: */ + /** By default Tabulator will include the column header titles in any clipboard data, this can be turned off by passing a value of false to the clipboardCopyHeader property: */ clipboardCopyHeader?: boolean; - /** Tabulator has one built in paste parser, that is designed to take a table formatted text string from the clipboard and turn it into row data. it breaks the tada into rows on a newline character \n and breaks the rows down to columns on a tab character \t. + /** Tabulator has one built in paste parser, that is designed to take a table formatted text string from the clipboard and turn it into row data. it breaks the tada into rows on a newline character \n and breaks the rows down to columns on a tab character \t. It will then attempt to work out which columns in the data correspond to columns in the table. It tries three different ways to achieve this. First it checks the values of all columns in the first row of data to see if they match the titles of columns in the table. If any of the columns don't match it then tries the same approach but with the column fields. If either of those options match, Tabulator will map those columns to the incoming data and import it into rows. If there is no match then Tabulator will assume the columns in the data are in the same order as the visible columns in the table and import them that way. @@ -64,19 +66,19 @@ declare namespace Tabulator { If you extend the clipboard module to add your own parser, you can set it to be used as default with the clipboardPasteParser property.*/ clipboardPasteParser?: string | ((clipboard: any) => any[]); - /**Once the data has been parsed into row data, it will be passed to a paste action to be added to the table. There are three inbuilt paste actions: + /** Once the data has been parsed into row data, it will be passed to a paste action to be added to the table. There are three inbuilt paste actions: insert - Inserts data into the table using the addRows function (default) update - Updates data in the table using the updateOrAddData function replace - replaces all data in the table using the setData function */ clipboardPasteAction?: "insert" | "update" | "replace"; - /**By default Tabulator will copy some of the tables styling along with the data to give a better visual appearance when pasted into other documents. + /** By default Tabulator will copy some of the tables styling along with the data to give a better visual appearance when pasted into other documents. If you want to only copy the unstyled data then you should set the clipboardCopyStyled option to false in the table options object: */ clipboardCopyStyled?: boolean; - /**By default Tabulator includes column headers, row groups and column calculations in the clipboard output. + /** By default Tabulator includes column headers, row groups and column calculations in the clipboard output. You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the clipboardCopyConfig option in the table definition: */ clipboardCopyConfig?: @@ -87,56 +89,50 @@ declare namespace Tabulator { } | boolean; - /**The clipboardCopied event is triggered whenever data is copied to the clipboard. */ + /** The clipboardCopied event is triggered whenever data is copied to the clipboard. */ clipboardCopied: () => void; - /**The clipboardPasted event is triggered whenever data is successfuly pasted into the table. */ + /** The clipboardPasted event is triggered whenever data is successfuly pasted into the table. */ clipboardPasted: () => void; - /**The clipboardPasteError event is triggered whenever an atempt to paste data into the table has failed because it was rejected by the paste parser. */ + /** The clipboardPasteError event is triggered whenever an atempt to paste data into the table has failed because it was rejected by the paste parser. */ clipboardPasteError: () => void; - }; + } - type OptionsPersistentConfiguration = { - /**ID tag used to identify persistent storage information */ + interface OptionsPersistentConfiguration { + /** ID tag used to identify persistent storage information */ persistenceID?: string; - /** Persistence information can either be stored in a cookie or in the localSotrage object, you can use the persistenceMode to choose which. It can take three possible values: + /** Persistence information can either be stored in a cookie or in the localSotrage object, you can use the persistenceMode to choose which. It can take three possible values: local - (string) Store the persistence information in the localStorage object cookie - (string) Store the persistence information in a cookie true - (boolean) check if localStorage is available and store persistence information, otherwise store in cookie (Default option) */ persistenceMode?: "local" | "cookie" | true; - /**Enable persistsnt storage of column layout information */ + /** Enable persistsnt storage of column layout information */ persistentLayout?: boolean; - /**You can ensure the data sorting is stored for the next page load by setting the persistentSort option to true */ + /** You can ensure the data sorting is stored for the next page load by setting the persistentSort option to true */ persistentSort?: boolean; - /** You can ensure the data filtering is stored for the next page load by setting the persistentFilter option to true*/ + /** You can ensure the data filtering is stored for the next page load by setting the persistentFilter option to true*/ persistentFilter?: boolean; - }; + } - type OptionsPagination = { - /**Choose pagination method, "local" or "remote" */ + interface OptionsPagination { + /** Choose pagination method, "local" or "remote" */ pagination?: "remote" | "local"; - /**Set the number of rows in each page */ + /** Set the number of rows in each page */ paginationSize?: number; - /** Setting this option to true will cause Tabulator to create a list of page size options, that are multiples of the current page size. In the example below, the list will have the values of 5, 10, 15 and 20. + /** Setting this option to true will cause Tabulator to create a list of page size options, that are multiples of the current page size. In the example below, the list will have the values of 5, 10, 15 and 20. When using the page size selector like this, if you use the setPageSize function to set the page size to a value not in the list, the list will be regenerated using the new page size as the starting valuer */ paginationSizeSelector?: true | number[]; - /** By default the pagination controls are added to the footer of the table. If you wish the controls to be created in another element pass a DOM node or a CSS selector for that element to the paginationElement option.*/ + /** By default the pagination controls are added to the footer of the table. If you wish the controls to be created in another element pass a DOM node or a CSS selector for that element to the paginationElement option.*/ paginationElement?: HTMLElement | "string"; - /**Lookup list to link expected data feilds from the server to their function - * default - * { + /** Lookup list to link expected data feilds from the server to their function * default* { "current_page":"current_page", "last_page":"last_page", "data":"data", - } - * - * + }* * */ paginationDataReceived?: Record; - /**Lookup list to link fields expected by the server to their function - * default: - * { + /** Lookup list to link fields expected by the server to their function* default:* { "page":"page", "size":"size", "sorters":"sorters", @@ -144,31 +140,29 @@ declare namespace Tabulator { } */ paginationDataSent?: Record; - /**When using the addRow function on a paginated table, rows will be added relative to the current page (ie to the top or bottom of the current page), with overflowing rows being shifted onto the next page. + /** When using the addRow function on a paginated table, rows will be added relative to the current page (ie to the top or bottom of the current page), with overflowing rows being shifted onto the next page. If you would prefer rows to be added relative to the table (firs/last page) then you can use the paginationAddRow option. it can take one of two values: page - add rows relative to current page (default) table - add rows relative to the table */ paginationAddRow?: "table" | "page"; - /** The number of pagination page buttons shown in the footer using the paginationButtonCount option. By default this has a value of 5.*/ + /** The number of pagination page buttons shown in the footer using the paginationButtonCount option. By default this has a value of 5.*/ paginationButtonCount?: number; - }; + } - type OptionsRowGrouping = { - /**String/function to select field to group rows by */ + interface OptionsRowGrouping { + /** String/function to select field to group rows by */ groupBy?: string | ((data: any) => any); - /**By default Tabulator will create groups for rows based on the values contained in the row data. if you want to explicitly define which field values groups should be created for at each level, you can use the groupValues option. + /** By default Tabulator will create groups for rows based on the values contained in the row data. if you want to explicitly define which field values groups should be created for at each level, you can use the groupValues option. This option takes an array of value arrays, each item in the first array should be a list of acceptable field values for groups at that level */ groupValues?: any[][]; - /**You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ - groupHeader?: ((value: any, count: number, data: any, group: GroupComponent) => string) | ((value: any, count: number, data: any) => string)[]; + /** You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + groupHeader?: ((value: any, count: number, data: any, group: GroupComponent) => string) | Array<(value: any, count: number, data: any) => string>; - /**You can set the default open state of groups using the groupStartOpen property - * - * This can take one of three possible values: + /** You can set the default open state of groups using the groupStartOpen property* * This can take one of three possible values: true - all groups start open (default value) false - all groups start closed @@ -178,40 +172,38 @@ declare namespace Tabulator { */ groupStartOpen?: boolean | ((value: any, count: number, data: any, group: GroupComponent) => boolean); - /**By default Tabulator allows users to toggle a group open or closed by clicking on the arrow icon in the left of the group header. If you would prefer a different behaviour you can use the groupToggleElement option to choose a different option: - * - * The option can take one of three values: + /** By default Tabulator allows users to toggle a group open or closed by clicking on the arrow icon in the left of the group header. If you would prefer a different behaviour you can use the groupToggleElement option to choose a different option:* * The option can take one of three values: arrow - togggle group on arrow element click header - toggle group on click anywhere on the group header element false - prevent clicking anywhere in the group toggling the group */ groupToggleElement?: "arrow" | "header" | false; - /**show/hide column calculations when group is closed */ + /** show/hide column calculations when group is closed */ groupClosedShowCalcs?: boolean; - /**The dataGrouping callback is triggered whenever a data grouping event occurs, before grouping happens. */ + /** The dataGrouping callback is triggered whenever a data grouping event occurs, before grouping happens. */ dataGrouping?: () => void; - /**The dataGrouping callback is triggered whenever a data grouping event occurs, after grouping happens. */ + /** The dataGrouping callback is triggered whenever a data grouping event occurs, after grouping happens. */ dataGrouped?: () => void; - /**The groupVisibilityChanged callback is triggered whenever a group changes between hidden and visible states. */ + /** The groupVisibilityChanged callback is triggered whenever a group changes between hidden and visible states. */ groupVisibilityChanged?: (group: GroupComponent, visible: boolean) => void; - /**The groupClick callback is triggered when a user clicks on a group header. */ + /** The groupClick callback is triggered when a user clicks on a group header. */ groupClick?: GroupEventCallback; - /**The groupDblClick callback is triggered when a user double clicks on a group header. */ + /** The groupDblClick callback is triggered when a user double clicks on a group header. */ groupDblClick?: GroupEventCallback; - /**The groupContext callback is triggered when a user right clicks on a group header. + /** The groupContext callback is triggered when a user right clicks on a group header. If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ groupContext?: GroupEventCallback; - /**The groupTap callback is triggered when a user taps on a group header on a touch display. */ + /** The groupTap callback is triggered when a user taps on a group header on a touch display. */ groupTap?: GroupEventCallback; - /**The groupDblTap callback is triggered when a user taps on a group header on a touch display twice in under 300ms. */ + /** The groupDblTap callback is triggered when a user taps on a group header on a touch display twice in under 300ms. */ groupDblTap?: GroupEventCallback; - /**The groupTapHold callback is triggered when a user taps on a group header on a touch display and holds their finger down for over 1 second */ + /** The groupTapHold callback is triggered when a user taps on a group header on a touch display and holds their finger down for over 1 second */ groupTapHold?: GroupEventCallback; - }; + } interface Filter { field: string; @@ -219,50 +211,48 @@ declare namespace Tabulator { value: any; } - type FilterFunction = (field: string, type: Tabulator.FilterType, value: any) => void; + type FilterFunction = (field: string, type: FilterType, value: any) => void; - type OptionsFiltering = { - /**Array of filters to be applied on load. */ + interface OptionsFiltering { + /** Array of filters to be applied on load. */ initialFilter?: Filter[]; - /**array of initial values for header filters. */ - initialHeaderFilter?: Pick[]; + /** array of initial values for header filters. */ + initialHeaderFilter?: Array>; - /**The dataFiltering callback is triggered whenever a filter event occurs, before the filter happens. */ + /** The dataFiltering callback is triggered whenever a filter event occurs, before the filter happens. */ dataFiltering?: (filters: Filter[]) => void; - /**The dataFiltered callback is triggered after the table dataset is filtered. */ + /** The dataFiltered callback is triggered after the table dataset is filtered. */ dataFiltered?: (filters: Filter[], rows: RowComponent[]) => void; - }; - type OptionsSorting = { - /**Array of sorters to be applied on load. */ + } + interface OptionsSorting { + /** Array of sorters to be applied on load. */ initialSort?: Sorter[]; - /**reverse the order that multiple sorters are applied to the table. */ + /** reverse the order that multiple sorters are applied to the table. */ sortOrderReverse?: boolean; - }; + } interface Sorter { column: string; dir: SortDirection; } - type OptionsData = { - /**A unique index value should be present for each row of data if you want to be able to programatically alter that data at a later point, this should be either numeric or a string. By default Tabulator will look for this value in the id field for the data. If you wish to use a different field as the index, set this using the index option parameter. */ + interface OptionsData { + /** A unique index value should be present for each row of data if you want to be able to programatically alter that data at a later point, this should be either numeric or a string. By default Tabulator will look for this value in the id field for the data. If you wish to use a different field as the index, set this using the index option parameter. */ index?: number | string; - //**Array to hold data that should be loaded on table creation */ + /** Array to hold data that should be loaded on table creation */ data?: any[]; - /**If you wish to retrieve your data from a remote source you can set the URL for the request in the ajaxURL option. */ + /** If you wish to retrieve your data from a remote source you can set the URL for the request in the ajaxURL option. */ ajaxURL?: string; - /**Parameters to be passed to remote Ajax data loading request */ + /** Parameters to be passed to remote Ajax data loading request */ ajaxParams?: {}; - /**The HTTP request type for Ajax requests or config object for the request */ + /** The HTTP request type for Ajax requests or config object for the request */ ajaxConfig?: HttpMethod | AjaxConfig; - /**When using a request method other than "GET" Tabulator will send any parameters with a content type of form data. You can change the content type with the ajaxContentType option. This will ensure parameters are sent in the format you expect, with the correct headers. - * - * The ajaxContentType option can take one of two values: + /** When using a request method other than "GET" Tabulator will send any parameters with a content type of form data. You can change the content type with the ajaxContentType option. This will ensure parameters are sent in the format you expect, with the correct headers. * * The ajaxContentType option can take one of two values: "form" - send parameters as form data (default option) "json" - send parameters as JSON encoded string If you want to use a custom content type then you can pass a content type formatter object into the ajaxContentType option. this object must have two properties, the headers property should contain all headers that should be sent with the request and the body property should contain a function that returns the body content of the request @@ -270,21 +260,21 @@ declare namespace Tabulator { ajaxContentType?: "form" | "json" | AjaxContentType; - /**If you need more control over the url of the request that you can get from the ajaxURL and ajaxParams properties, the you can use the ajaxURLGenerator property to pass in a callback that will generate the URL for you. + /** If you need more control over the url of the request that you can get from the ajaxURL and ajaxParams properties, the you can use the ajaxURLGenerator property to pass in a callback that will generate the URL for you. The callback should return a string representing the URL to be requested. */ ajaxURLGenerator?: (url: string, config: any, params: any) => string; - /**callback function to replace inbuilt ajax request functionality */ + /** callback function to replace inbuilt ajax request functionality */ ajaxRequestFunc?: (url: string, config: any, params: any) => Promise; - /**Send filter config to server instead of processing locally */ + /** Send filter config to server instead of processing locally */ ajaxFiltering?: boolean; - /**Send sorter config to server instead of processing locally */ + /** Send sorter config to server instead of processing locally */ ajaxSorting?: boolean; - /**If you are loading a lot of data from a remote source into your table in one go, it can sometimes take a long time for the server to return the request, which can slow down the user experience. + /** If you are loading a lot of data from a remote source into your table in one go, it can sometimes take a long time for the server to return the request, which can slow down the user experience. To speed things up in this situation Tabulator has a progressive load mode, this uses the pagination module to make a series of requests for part of the data set, one at a time, appending it to the table as the data arrives. This mode can be enable using the ajaxProgressiveLoad option. No pagination controls will be visible on screen, it just reusues the functionality of the pagination module to sequentially load the data. @@ -292,26 +282,26 @@ declare namespace Tabulator { There are two different progressive loading modes, to give you a choice of how data is loaded into the table. */ ajaxProgressiveLoad?: "load" | "scroll"; - /**By default tabulator will make the requests to fill the table as quickly as possible. On some servers these repeates requests from the same client may trigger rate limiting or security systems. In this case you can use the ajaxProgressiveLoadDelay option to add a delay in milliseconds between each page request. */ + /** By default tabulator will make the requests to fill the table as quickly as possible. On some servers these repeates requests from the same client may trigger rate limiting or security systems. In this case you can use the ajaxProgressiveLoadDelay option to add a delay in milliseconds between each page request. */ ajaxProgressiveLoadDelay?: number; - /**The ajaxProgressiveLoadScrollMargin property determines how close to the bottom of the table in pixels, the scroll bar must be before the next page worth of data is loaded, by default it is set to twice the height of the table. */ + /** The ajaxProgressiveLoadScrollMargin property determines how close to the bottom of the table in pixels, the scroll bar must be before the next page worth of data is loaded, by default it is set to twice the height of the table. */ ajaxProgressiveLoadScrollMargin?: number; - /**Show loader while data is loading, can also take a function that must return a boolean */ + /** Show loader while data is loading, can also take a function that must return a boolean */ ajaxLoader?: boolean | (() => boolean); - /**html for loader element */ + /** html for loader element */ ajaxLoaderLoading?: string; - /**html for the loader element in the event of an error */ + /** html for the loader element in the event of an error */ ajaxLoaderError?: string; - /**The ajaxRequesting callback is triggered when ever an ajax request is made. */ + /** The ajaxRequesting callback is triggered when ever an ajax request is made. */ ajaxRequesting?: (url: string, params: any) => boolean; - /**The ajaxResponse callback is triggered when a successful ajax request has been made. This callback can also be used to modify the received data before it is parsed by the table. If you use this callback it must return the data to be parsed by Tabulator, otherwise no data will be rendered */ + /** The ajaxResponse callback is triggered when a successful ajax request has been made. This callback can also be used to modify the received data before it is parsed by the table. If you use this callback it must return the data to be parsed by Tabulator, otherwise no data will be rendered */ ajaxResponse?: (url: string, params: any, response: any) => any; - /**The ajaxError callback is triggered there is an error response to an ajax request. */ + /** The ajaxError callback is triggered there is an error response to an ajax request. */ ajaxError?: (xhr: any, textStatus: any, errorThrown: any) => void; - }; + } interface AjaxContentType { headers: JSONRecord; @@ -326,16 +316,16 @@ declare namespace Tabulator { credentials?: string; } - type OptionsRows = { - /**Tabulator also allows you to define a row level formatter using the rowFormatter option. this lets you alter each row of the table based on the data it contains. + interface OptionsRows { + /** Tabulator also allows you to define a row level formatter using the rowFormatter option. this lets you alter each row of the table based on the data it contains. The function accepts one argument, the RowComponent for the row being formatted. */ rowFormatter?: (row: RowComponent) => any; - /**The position in the table for new rows to be added, "bottom" or "top" */ + /** The position in the table for new rows to be added, "bottom" or "top" */ addRowPos?: "bottom" | "top"; - /**The selectable option can take one of a several values: + /** The selectable option can take one of a several values: false - selectable rows are disabled true - selectable rows are enabled, and you can select as many as you want @@ -343,37 +333,37 @@ declare namespace Tabulator { "highlight" (default) - rows have the same hover stylings as selectable rows but do not change state when clicked. This is great for when you want to show that a row is clickable but don't want it to be selectable. */ selectable?: boolean | number | "highlight"; - /**By default you can select a range of rows by holding down the shift key and click dragging over a number of rows to toggle the selected state state of all rows the cursor passes over. + /** By default you can select a range of rows by holding down the shift key and click dragging over a number of rows to toggle the selected state state of all rows the cursor passes over. If you would prefere to select a range of row by clicking on the first row then holding down shift and clicking on the end row then you can acheive this by setting the selectableRangeMode to click */ selectableRangeMode?: "click"; - /**By default, row selection works on a rolling basis, if you set the selectable option to a numeric value then when you select past this number of rows, the first row to be selected will be deselected. If you want to disable this behaviour and instead prevent selection of new rows once the limit is reached you can set the selectableRollingSelection option to false. */ + /** By default, row selection works on a rolling basis, if you set the selectable option to a numeric value then when you select past this number of rows, the first row to be selected will be deselected. If you want to disable this behaviour and instead prevent selection of new rows once the limit is reached you can set the selectableRollingSelection option to false. */ selectableRollingSelection?: boolean; - /**By default Tabulator will maintain selected rows when the table is filtered, sorted or paginated (but NOT when the setData function is used). If you want the selected rows to be cleared whenever the table view is updated then set the selectablePersistence option to false. */ + /** By default Tabulator will maintain selected rows when the table is filtered, sorted or paginated (but NOT when the setData function is used). If you want the selected rows to be cleared whenever the table view is updated then set the selectablePersistence option to false. */ selectablePersistence?: boolean; - /**You many want to exclude certain rows from being selected. The selectableCheck options allows you to pass a function to check if the current row should be selectable, returning true will allow row selection, false will result in nothing happening. The function should accept a RowComponent as its first argument. */ + /** You many want to exclude certain rows from being selected. The selectableCheck options allows you to pass a function to check if the current row should be selectable, returning true will allow row selection, false will result in nothing happening. The function should accept a RowComponent as its first argument. */ selectableCheck?: (row: RowComponent) => boolean; - /**To allow the user to move rows up and down the table, set the movableRows parameter in the options: */ + /** To allow the user to move rows up and down the table, set the movableRows parameter in the options: */ movableRows?: boolean; - /**Tabulator also allows you to move rows between tables. To enable this you should supply either a valid CSS selector string a DOM node for the table or the Tabuator object for the table to the movableRowsConnectedTables option. if you want to connect to multple tables then you can pass in an array of values to this option. */ + /** Tabulator also allows you to move rows between tables. To enable this you should supply either a valid CSS selector string a DOM node for the table or the Tabuator object for the table to the movableRowsConnectedTables option. if you want to connect to multple tables then you can pass in an array of values to this option. */ movableRowsConnectedTables?: string | string[] | HTMLElement | HTMLElement[]; - /**The movableRowsSender option should be set on the sending table, and sets the action that should be taken after the row has been successfuly dropped into the receiving table. + /** The movableRowsSender option should be set on the sending table, and sets the action that should be taken after the row has been successfuly dropped into the receiving table. There are several inbuilt sender functions: false - do nothing(default) - delete - deletes the row from the table + delete - deletes the row from the table You can also pass a callback to the movableRowsSender option for custom sender functionality */ movableRowsSender?: false | "delete" | ((fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => any); - /** The movableRowsReceiver option should be set on the receiving tables, and sets the action that should be taken when the row is dropped into the table. + /** The movableRowsReceiver option should be set on the receiving tables, and sets the action that should be taken when the row is dropped into the table. There are several inbuilt receiver functions: insert - inserts row next to the row it was dropped on, if not dropped on a row it is added to the table (default) @@ -382,11 +372,10 @@ declare namespace Tabulator { replace - replaces the row it is dropped on with the sent row*/ movableRowsReceiver?: "insert" | "add" | "update" | "replace" | ((fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => any); - /**You can allow the user to manually resize rows by dragging the top or bottom border of a row. To enable this functionality, set the resizableRows property to true */ + /** You can allow the user to manually resize rows by dragging the top or bottom border of a row. To enable this functionality, set the resizableRows property to true */ resizableRows?: boolean; - /** - * The default ScrollTo position can be set using the scrollToRowPosition option. It can take one of four possible values: + /** * The default ScrollTo position can be set using the scrollToRowPosition option. It can take one of four possible values: top - position row with its top edge at the top of the table (default) center - position row with its top edge in the center of the table @@ -395,86 +384,86 @@ declare namespace Tabulator { */ scrollToRowPosition?: ScrollToRowPostition; - /**The default option for triggering a ScrollTo on a visible element can be set using the scrollToRowIfVisible option. It can take a boolean value: + /** The default option for triggering a ScrollTo on a visible element can be set using the scrollToRowIfVisible option. It can take a boolean value: true - scroll to row, even if it is visible (default) false - scroll to row, unless it is currently visible, then don't move */ scrollToRowIfVisible?: boolean; - /**The dataTreeRowExpanded callback is triggered when a row with child rows is expanded to reveal the children. */ + /** The dataTreeRowExpanded callback is triggered when a row with child rows is expanded to reveal the children. */ dataTreeRowExpanded?: (row: RowComponent, level: number) => void; - /**The dataTreeRowCollapsed callback is triggered when a row with child rows is collapsed to hide its children.*/ + /** The dataTreeRowCollapsed callback is triggered when a row with child rows is collapsed to hide its children.*/ dataTreeRowCollapsed?: (row: RowComponent, level: number) => void; - /**The movableRowsSendingStart callback is triggered on the sending table when a row is picked up from a sending table. */ + /** The movableRowsSendingStart callback is triggered on the sending table when a row is picked up from a sending table. */ movableRowsSendingStart?: (toTables: any[]) => void; - /**The movableRowsSent callback is triggered on the sending table when a row has been successfuly received by a receiving table. */ + /** The movableRowsSent callback is triggered on the sending table when a row has been successfuly received by a receiving table. */ movableRowsSent?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; - /**The movableRowsSentFailed callback is triggered on the sending table when a row has failed to be received by the receiving table.*/ + /** The movableRowsSentFailed callback is triggered on the sending table when a row has failed to be received by the receiving table.*/ movableRowsSentFailed?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; - /**The movableRowsSendingStop callback is triggered on the sending table after a row has been dropped and any senders and receivers have been handled. */ + /** The movableRowsSendingStop callback is triggered on the sending table after a row has been dropped and any senders and receivers have been handled. */ movableRowsSendingStop?: (toTables: any[]) => void; - /**The movableRowsReceivingStart callback is triggered on a receiving table when a connection is established with a sending table. */ + /** The movableRowsReceivingStart callback is triggered on a receiving table when a connection is established with a sending table. */ movableRowsReceivingStart?: (fromRow: RowComponent, toTable: Tabulator) => void; - /**The movableRowsReceived callback is triggered on a receiving table when a row has been successfuly received.*/ + /** The movableRowsReceived callback is triggered on a receiving table when a row has been successfuly received.*/ movableRowsReceived?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; - /**The movableRowsReceivedFailed callback is triggered on a receiving table when a row receiver has returned false.*/ + /** The movableRowsReceivedFailed callback is triggered on a receiving table when a row receiver has returned false.*/ movableRowsReceivedFailed?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; - /**The movableRowsReceivingStop callback is triggered on a receiving table after a row has been dropped and any senders and receivers have been handled.*/ + /** The movableRowsReceivingStop callback is triggered on a receiving table after a row has been dropped and any senders and receivers have been handled.*/ movableRowsReceivingStop?: (fromTable: Tabulator) => void; - /**The rowClick callback is triggered when a user clicks on a row. */ + /** The rowClick callback is triggered when a user clicks on a row. */ rowClick?: RowEventCallback; - /**The rowDblClick callback is triggered when a user double clicks on a row. */ + /** The rowDblClick callback is triggered when a user double clicks on a row. */ rowDblClick?: RowEventCallback; - /**The rowContext callback is triggered when a user right clicks on a row. + /** The rowContext callback is triggered when a user right clicks on a row. If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ rowContext?: RowEventCallback; - /**The rowTap callback is triggered when a user taps on a row on a touch display. */ + /** The rowTap callback is triggered when a user taps on a row on a touch display. */ rowTap?: RowEventCallback; - /**The rowDblTap callback is triggered when a user taps on a row on a touch display twice in under 300ms. */ + /** The rowDblTap callback is triggered when a user taps on a row on a touch display twice in under 300ms. */ rowDblTap?: RowEventCallback; - /**The rowTapHold callback is triggered when a user taps on a row on a touch display and holds their finger down for over 1 second. */ + /** The rowTapHold callback is triggered when a user taps on a row on a touch display and holds their finger down for over 1 second. */ rowTapHold?: RowEventCallback; - /**The rowMouseEnter callback is triggered when the mouse pointer enters a row. */ + /** The rowMouseEnter callback is triggered when the mouse pointer enters a row. */ rowMouseEnter?: RowEventCallback; - /**The rowMouseLeave callback is triggered when the mouse pointer leaves a row. */ + /** The rowMouseLeave callback is triggered when the mouse pointer leaves a row. */ rowMouseLeave?: RowEventCallback; - /** The rowMouseOver callback is triggered when the mouse pointer enters a row or any of its child elements.*/ + /** The rowMouseOver callback is triggered when the mouse pointer enters a row or any of its child elements.*/ rowMouseOver?: RowEventCallback; - /**The rowMouseOut callback is triggered when the mouse pointer leaves a row or any of its child elements. */ + /** The rowMouseOut callback is triggered when the mouse pointer leaves a row or any of its child elements. */ rowMouseOut?: RowEventCallback; - /**The rowMouseMove callback is triggered when the mouse pointer moves over a row. */ + /** The rowMouseMove callback is triggered when the mouse pointer moves over a row. */ rowMouseMove?: RowEventCallback; - /**The rowAdded callback is triggered when a row is added to the table by the addRow and updateOrAddRow functions. */ + /** The rowAdded callback is triggered when a row is added to the table by the addRow and updateOrAddRow functions. */ rowAdded?: RowChangedCallback; - /**The rowUpdated callback is triggered when a row is updated by the updateRow, updateOrAddRow, updateData or updateOrAddData, functions. */ + /** The rowUpdated callback is triggered when a row is updated by the updateRow, updateOrAddRow, updateData or updateOrAddData, functions. */ rowUpdated?: RowChangedCallback; - /**The rowDeleted callback is triggered when a row is deleted from the table by the deleteRow function. */ + /** The rowDeleted callback is triggered when a row is deleted from the table by the deleteRow function. */ rowDeleted?: RowChangedCallback; - /**The rowMoved callback will be triggered when a row has been successfuly moved. */ + /** The rowMoved callback will be triggered when a row has been successfuly moved. */ rowMoved?: RowChangedCallback; - /**The rowResized callback will be triggered when a row has been resized by the user. */ + /** The rowResized callback will be triggered when a row has been resized by the user. */ rowResized?: RowChangedCallback; - /**Whenever the number of selected rows changes, through selection or deselection, the rowSelectionChanged event is triggered. This passes an array of the data objects for each row in the order they were selected as the first argument, and an array of row components for each of the rows in order of selection as the second argument. */ + /** Whenever the number of selected rows changes, through selection or deselection, the rowSelectionChanged event is triggered. This passes an array of the data objects for each row in the order they were selected as the first argument, and an array of row components for each of the rows in order of selection as the second argument. */ rowSelectionChanged?: (data: any[], rows: RowComponent[]) => void; - /**The rowSelected event is triggered when a row is selected, either by the user or programatically. */ + /** The rowSelected event is triggered when a row is selected, either by the user or programatically. */ rowSelected?: RowChangedCallback; - /**The rowDeselected event is triggered when a row is deselected, either by the user or programatically. */ + /** The rowDeselected event is triggered when a row is deselected, either by the user or programatically. */ rowDeselected?: RowChangedCallback; - }; + } - type OptionsColumns = { - /**The column definitions are provided to Tabluator in the columns property of the table constructor object and should take the format of an array of objects, with each object representing the configuration of one column. */ + interface OptionsColumns { + /** The column definitions are provided to Tabluator in the columns property of the table constructor object and should take the format of an array of objects, with each object representing the configuration of one column. */ columns?: ColumnDefinition[]; /** @@ -482,15 +471,15 @@ declare namespace Tabulator { */ autoColumns?: boolean; - /**By default Tabulator will use the fitData layout mode, which will resize the tables columns to fit the data held in each column, unless you specify a width or minWidth in the column constructor. If the width of all columns exceeds the width of the containing element, a scroll bar will appear. */ + /** By default Tabulator will use the fitData layout mode, which will resize the tables columns to fit the data held in each column, unless you specify a width or minWidth in the column constructor. If the width of all columns exceeds the width of the containing element, a scroll bar will appear. */ layout?: "fitData" | "fitColumns" | "fitDataFill"; - /**To keep the layout of the columns consistent, once the column widths have been set on the first data load (either from the data property in the constructor or the setData function) they will not be changed when new data is loaded. + /** To keep the layout of the columns consistent, once the column widths have been set on the first data load (either from the data property in the constructor or the setData function) they will not be changed when new data is loaded. If you would prefer that the column widths adjust to the data each time you load it into the table you can set the layoutColumnsOnNewData property to true. */ layoutColumnsOnNewData?: boolean; - /**Responsive layout will automatically hide/show columns to fit the width of the Tabulator element. This allows for clean rendering of tables on smaller mobile devices, showing important data while avoiding horizontal scroll bars. You can enable responsive layouts using the responsiveLayout option. + /** Responsive layout will automatically hide/show columns to fit the width of the Tabulator element. This allows for clean rendering of tables on smaller mobile devices, showing important data while avoiding horizontal scroll bars. You can enable responsive layouts using the responsiveLayout option. There are two responsive layout modes available: @@ -503,15 +492,15 @@ declare namespace Tabulator { When responsive layout is enabled, all columns are given a default responsive value of 1. The higher you set this value the sooner that column will be hidden as the table width decreases. If two columns have the same responsive value then they are hidden from right to left (as defined in the column definition array, ignoring user moving of the columns). If you set the value to 0 then the column will never be hidden regardless of how narrow the table gets. */ responsiveLayout?: boolean | "hide" | "collapse"; - /**Collapsed lists are displayed to the user by default, if you would prefer they start closed so the user can open them you can use the responsiveLayoutCollapseStartOpen option */ + /** Collapsed lists are displayed to the user by default, if you would prefer they start closed so the user can open them you can use the responsiveLayoutCollapseStartOpen option */ responsiveLayoutCollapseStartOpen?: boolean; - /**By default any formatter set on the column is applied to the value that will appear in the list. while this works for most formatters it can cause issues with the progress formatter which relies on being inside a cell. + /** By default any formatter set on the column is applied to the value that will appear in the list. while this works for most formatters it can cause issues with the progress formatter which relies on being inside a cell. If you would like to disable column formatting in the collapsed list, you can use the responsiveLayoutCollapseUseFormatters option: */ responsiveLayoutCollapseUseFormatters?: boolean; - /**If you set the responsiveLayout option to collapse the values from hidden columns will be displayed in a title/value list under the row. + /** If you set the responsiveLayout option to collapse the values from hidden columns will be displayed in a title/value list under the row. In this mode an object containing the title of each hidden column and its value is generated and then used to generate a list displayed in a div .tabulator-responsive-collapse under the row data. @@ -520,44 +509,44 @@ declare namespace Tabulator { This function should return an empty string if there is no data to display. */ responsiveLayoutCollapseFormatter?: (data: any[]) => any; - /**It is possible to set a minimum column width to prevent resizing columns from becoming too small. + /** It is possible to set a minimum column width to prevent resizing columns from becoming too small. This can be set globally, by setting the columnMinWidth option to the column width when you create your Tabulator. This option can be overridden on a per column basis by setting the minWidth property on the column definition. */ columnMinWidth?: number; - /**By default it is possible to manually resize columns by dragging the borders of the column in both the column headers and the cells of the column. + /** By default it is possible to manually resize columns by dragging the borders of the column in both the column headers and the cells of the column. If you want to alter this behaviour you can use the resizableColumns to choose where the resize handles are available. */ resizableColumns?: true | false | "header" | "cell"; - /**To allow the user to move columns along the table, set the movableColumns parameter in the options: */ + /** To allow the user to move columns along the table, set the movableColumns parameter in the options: */ movableColumns?: boolean; - /**Header tooltips can be set globally using the tooltipsHeader options parameter */ + /** Header tooltips can be set globally using the tooltipsHeader options parameter */ tooltipsHeader?: boolean; - /**You can use the columnVertAlign option to set how the text in your column headers should be vertically */ + /** You can use the columnVertAlign option to set how the text in your column headers should be vertically */ columnVertAlign?: "top" | "middle" | "bottom"; - /**The default placeholder text used for input elements can be set using the headerFilterPlaceholder option in the table definition */ + /** The default placeholder text used for input elements can be set using the headerFilterPlaceholder option in the table definition */ headerFilterPlaceholder?: string; - /**The default ScrollTo position can be set using the scrollToColumnPosition option. It can take one of three possible values: + /** The default ScrollTo position can be set using the scrollToColumnPosition option. It can take one of three possible values: left - position column with its left edge at the left of the table (default) center - position column with its left edge in the center of the table right - position column with its right edge at the right of the table */ scrollToColumnPosition?: ScrollToColumnPosition; - /**The default option for triggering a ScrollTo on a visible element can be set using the scrollToColumnIfVisible option. It can take a boolean value: + /** The default option for triggering a ScrollTo on a visible element can be set using the scrollToColumnIfVisible option. It can take a boolean value: true - scroll to column, even if it is visible (default) false - scroll to column, unless it is currently visible, then don't move */ scrollToColumnIfVisible?: boolean; - /**By default column calculations are shown at the top and bottom of the table, unless row grouping is enabled, in which case they are shown at the top and bottom of each group. + /** By default column calculations are shown at the top and bottom of the table, unless row grouping is enabled, in which case they are shown at the top and bottom of each group. The columnCalcs option lets you decided where the calculations should be displayed, it can take one of four values: @@ -567,26 +556,26 @@ declare namespace Tabulator { group - show calcs in groups only */ columnCalcs?: boolean | "both" | "table" | "group"; - /**If you need to use the . character as part of your field name, you can change the separator to any other character using the nestedFieldSeparator option + /** If you need to use the . character as part of your field name, you can change the separator to any other character using the nestedFieldSeparator option * Set to false to disable nested data parsing */ nestedFieldSeparator?: string | boolean; - /**multiple or single column sorting */ + /** multiple or single column sorting */ columnHeaderSortMulti?: boolean; - /**The columnMoved callback will be triggered when a column has been successfuly moved. */ + /** The columnMoved callback will be triggered when a column has been successfuly moved. */ columnMoved?: (column: ColumnComponent, columns: any[]) => void; columnResized?: (column: ColumnComponent) => void; - /**The columnVisibilityChanged callback is triggered whenever a column changes between hidden and visible states. */ + /** The columnVisibilityChanged callback is triggered whenever a column changes between hidden and visible states. */ columnVisibilityChanged?: (column: ColumnComponent, visible: boolean) => void; - /**The columnTitleChanged callback is triggered whenever a user edits a column title when the editableTitle parameter has been enabled in the column definition array. */ + /** The columnTitleChanged callback is triggered whenever a user edits a column title when the editableTitle parameter has been enabled in the column definition array. */ columnTitleChanged?: (column: ColumnComponent) => void; - }; + } - type OptionsCell = { - /**The cellClick callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the option in the columns definition object. */ + interface OptionsCell { + /** The cellClick callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the option in the columns definition object. */ cellClick?: CellEventCallback; cellDblClick?: CellEventCallback; cellContext?: CellEventCallback; @@ -601,32 +590,31 @@ declare namespace Tabulator { cellEditing?: CellEditEventCallback; cellEdited?: CellEditEventCallback; cellEditCancelled?: CellEditEventCallback; - }; + } - type OptionsGeneral = { - /**Sets the height of the containing element, can be set to any valid height css value. If set to false (the default), the height of the table will resize to fit the table data. */ + interface OptionsGeneral { + /** Sets the height of the containing element, can be set to any valid height css value. If set to false (the default), the height of the table will resize to fit the table data. */ height?: string | number | false; - /**Enable rendering using the Virtual DOM engine */ + /** Enable rendering using the Virtual DOM engine */ virtualDom?: boolean; - /**Manually set the size of the virtual DOM buffer */ + /** Manually set the size of the virtual DOM buffer */ virtualDomBuffer?: boolean; - /**placeholder element to display on empty table */ + /** placeholder element to display on empty table */ placeholder?: string | HTMLElement; - /**Footer element to display for the table */ + /** Footer element to display for the table */ footerElement?: string | HTMLElement; - /**Function to generate tooltips for cells */ + /** Function to generate tooltips for cells */ tooltips?: GlobalTooltipOption; - /**When to regenerate cell tooltip value */ + /** When to regenerate cell tooltip value */ tooltipGenerationMode?: "load"; - /**Keybinding configuration object */ + /** Keybinding configuration object */ keybindings?: false | KeyBinding; - /** - * The reactivity systems allow Tabulator to watch arrays and objects passed into the table for changes and then automatically update the table. + /** * The reactivity systems allow Tabulator to watch arrays and objects passed into the table for changes and then automatically update the table. This approach means you no longer need to worry about calling a number of different functions on the table to make changes, you simply update the array or object you originally passed into the table and Tabulator will take care of the rest. @@ -636,17 +624,17 @@ declare namespace Tabulator { reactiveData?: boolean; - //Not listed in options-------------------- - /**Tabulator will automatically attempt to redraw the data contained in the table if the containing element for the table is resized. To disable this functionality, set the autoResize property to false */ + // Not listed in options-------------------- + /** Tabulator will automatically attempt to redraw the data contained in the table if the containing element for the table is resized. To disable this functionality, set the autoResize property to false */ autoResize?: boolean; - /**When a the tabulator constructor is called, the tableBuilding callback will triggered */ + /** When a the tabulator constructor is called, the tableBuilding callback will triggered */ tableBuilding?: () => void; - /**When a the tabulator constructor is called and the table has finished being rendered, the tableBuilt callback will triggered: */ + /** When a the tabulator constructor is called and the table has finished being rendered, the tableBuilt callback will triggered: */ tableBuilt?: () => void; - /**The renderStarted callback is triggered whenever all the rows in the table are about to be rendered. This can include: + /** The renderStarted callback is triggered whenever all the rows in the table are about to be rendered. This can include: Data is loaded into the table when setData is called A page is loaded through any form of pagination Rows are added to the table during progressive rendering @@ -656,31 +644,31 @@ declare namespace Tabulator { The redraw function is called */ renderStarted?: () => void; - /**The renderComplete callback is triggered after the table has been rendered */ + /** The renderComplete callback is triggered after the table has been rendered */ renderComplete?: () => void; - /**The htmlImporting callback is triggered when Tabulator starts importing data from an HTML table. */ + /** The htmlImporting callback is triggered when Tabulator starts importing data from an HTML table. */ htmlImporting?: EmptyCallback; - /**The htmlImported callback is triggered when Tabulator finishes importing data from an HTML table. */ + /** The htmlImported callback is triggered when Tabulator finishes importing data from an HTML table. */ htmlImported?: EmptyCallback; - /**The dataLoading callback is triggered whenever new data is loaded into the table. */ + /** The dataLoading callback is triggered whenever new data is loaded into the table. */ dataLoading?: (data: any) => void; - /**The dataLoaded callback is triggered when a new set of data is loaded into the table. */ + /** The dataLoaded callback is triggered when a new set of data is loaded into the table. */ dataLoaded?: (data: any) => void; - /**The dataEdited callback is triggered whenever the table data is changed by the user. Triggers for this include editing any cell in the table, adding a row and deleting a row. */ + /** The dataEdited callback is triggered whenever the table data is changed by the user. Triggers for this include editing any cell in the table, adding a row and deleting a row. */ dataEdited?: (data: any) => void; - /**Whenever a page has been loaded, the pageLoaded callback is called, passing the current page number as an argument. */ + /** Whenever a page has been loaded, the pageLoaded callback is called, passing the current page number as an argument. */ pageLoaded?: (pageno: number) => void; - /**The dataSorting callback is triggered whenever a sort event occurs, before sorting happens. */ + /** The dataSorting callback is triggered whenever a sort event occurs, before sorting happens. */ dataSorting?: (sorters: Sorter[]) => void; - /**The dataSorted callback is triggered after the table dataset is sorted. */ + /** The dataSorted callback is triggered after the table dataset is sorted. */ dataSorted?: (sorters: Sorter[], rows: RowComponent[]) => void; - }; + } type DownloadType = "csv" | "json" | "xlsx" | "pdf"; @@ -690,14 +678,14 @@ declare namespace Tabulator { } interface DownloadCSV { - /**By default CSV files are created using a comma (,) delimiter. If you need to change this for any reason the you can pass the options object with a delimiter property to the download function which will then use this delimiter instead of the comma. */ + /** By default CSV files are created using a comma (,) delimiter. If you need to change this for any reason the you can pass the options object with a delimiter property to the download function which will then use this delimiter instead of the comma. */ delimiter?: "string"; - /**If you need the output CSV to include a byte order mark (BOM) to ensure that output with UTF-8 characters can be correctly interpereted across didfferent applications, you should set the bom option to true */ + /** If you need the output CSV to include a byte order mark (BOM) to ensure that output with UTF-8 characters can be correctly interpereted across didfferent applications, you should set the bom option to true */ bom?: boolean; } interface DownloadXLXS { - /**The sheet name must be a valid Excel sheet name, and cannot include any of the following characters \, /, *, [, ], :, */ + /** The sheet name must be a valid Excel sheet name, and cannot include any of the following characters \, /, *, [, ], :, */ sheetName?: string; } @@ -710,21 +698,21 @@ declare namespace Tabulator { autoTable?: {} | ((doc: any) => any); } - type OptionsDownload = { - /**If you want to make any bulk changes to the table data before it is parsed into the download file you can pass a mutator function to the downloadDataFormatter option in the table definition */ + interface OptionsDownload { + /** If you want to make any bulk changes to the table data before it is parsed into the download file you can pass a mutator function to the downloadDataFormatter option in the table definition */ downloadDataFormatter?: (data: any[]) => any; - /**The downloadReady callback allows you to intercept the download file data before the users is prompted to save the file. + /** The downloadReady callback allows you to intercept the download file data before the users is prompted to save the file. In order for the download to proceed the downloadReady callback is expected to return a blob of file to be downloaded. If you would prefer to abort the download you can return false from this callback. This could be useful for example if you want to send the created file to a server via ajax rather than allowing the user to download the file. */ downloadReady?: (fileContents: any, blob: any) => any; - /**The downloadComplete callback is triggered when the user has been prompted to download the file. */ + /** The downloadComplete callback is triggered when the user has been prompted to download the file. */ downloadComplete?: () => void; - /**By default Tabulator includes column headers, row groups and column calculations in the download output. + /** By default Tabulator includes column headers, row groups and column calculations in the download output. You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the downloadConfig option in the table definition: */ @@ -733,229 +721,220 @@ declare namespace Tabulator { rowGroups?: boolean; columnCalcs?: boolean; }; - }; + } - type OptionsLocale = { - /**You can set the current local in one of two ways. If you want to set it when the table is created, simply include the locale option in your Tabulator constructor. You can either pass in a string matching one of the language options you have defined, or pass in the boolean true which will cause Tabulator to auto-detect the browsers language settings from the navigator.language object. */ + interface OptionsLocale { + /** You can set the current local in one of two ways. If you want to set it when the table is created, simply include the locale option in your Tabulator constructor. You can either pass in a string matching one of the language options you have defined, or pass in the boolean true which will cause Tabulator to auto-detect the browsers language settings from the navigator.language object. */ locale?: boolean | string; - /**You can store as many languages as you like, creating an object inside the langs object with a property of the locale code for that language. A list of locale codes can be found here. + /** You can store as many languages as you like, creating an object inside the langs object with a property of the locale code for that language. A list of locale codes can be found here. At present there are three parts of the table that can be localised, the column headers, the header filter placeholder text and the pagination buttons. To localize the pagination buttons, create a pagination property inside your language object and give it the properties outlined below. If you wish you can also localize column titles by adding a columns property to your language object. You should store a property of the field name of the column you wish to change, with a value of its title. Any fields that match this will use this title instead of the one provided by the column definition array. */ langs?: any; - /**When a localization event has occurred , the localized callback will triggered, passing the current locale code and language object: */ + /** When a localization event has occurred , the localized callback will triggered, passing the current locale code and language object: */ localized?: (locale: string, lang: any) => void; - }; + } type HistoryAction = "cellEdit" | "rowAdd" | "rowDelete" | "rowMoved"; - type OptionsHistory = { - /**Enable user interaction history functionality */ + interface OptionsHistory { + /** Enable user interaction history functionality */ history?: boolean; - /**The historyUndo event is triggered when the undo action is triggered. */ + /** The historyUndo event is triggered when the undo action is triggered. */ historyUndo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; - /**The historyRedo event is triggered when the redo action is triggered. */ + /** The historyRedo event is triggered when the redo action is triggered. */ historyRedo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; - }; + } interface ColumnLayout { - /**title - Required This is the title that will be displayed in the header for this column */ + /** title - Required This is the title that will be displayed in the header for this column */ title: string; - /**field - Required (not required in icon/button columns) this is the key for this column in the data array*/ + /** field - Required (not required in icon/button columns) this is the key for this column in the data array*/ field?: string; - /**visible - (boolean, default - true) determines if the column is visible. (see Column Visibility for more details */ + /** visible - (boolean, default - true) determines if the column is visible. (see Column Visibility for more details */ visible?: boolean; - /**sets the width of this column, this can be set in pixels or as a percentage of total table width (if not set the system will determine the best) */ + /** sets the width of this column, this can be set in pixels or as a percentage of total table width (if not set the system will determine the best) */ width?: number | string; } interface ColumnDefinition extends ColumnLayout, CellCallbacks { - //Layout - /**sets the text alignment for this column */ - align?: "left" | "center" | "right"; //Align? - /**sets the minimum width of this column, this should be set in pixels (this takes priority over the global option of columnMinWidth) */ + // Layout + /** sets the text alignment for this column */ + align?: "left" | "center" | "right"; // Align? + /** sets the minimum width of this column, this should be set in pixels (this takes priority over the global option of columnMinWidth) */ minWidth?: number; - /**The widthGrow property should be used on columns without a width property set. The value is used to work out what fraction of the available will be allocated to the column. The value should be set to a number greater than 0, by default any columns with no width set have a widthGrow value of 1 */ + /** The widthGrow property should be used on columns without a width property set. The value is used to work out what fraction of the available will be allocated to the column. The value should be set to a number greater than 0, by default any columns with no width set have a widthGrow value of 1 */ widthGrow?: number; - /**The widthShrink property should be used on columns with a width property set. The value is used to work out how to shrink columns with a fixed width when the table is too narrow to fit in all the columns. The value should be set to a number greater than 0, by default columns with a width set have a widthShrink value of 0, meaning they will not be shrunk if the table gets too narrow, and may cause the horizontal scrollbar to appear. */ + /** The widthShrink property should be used on columns with a width property set. The value is used to work out how to shrink columns with a fixed width when the table is too narrow to fit in all the columns. The value should be set to a number greater than 0, by default columns with a width set have a widthShrink value of 0, meaning they will not be shrunk if the table gets too narrow, and may cause the horizontal scrollbar to appear. */ widthShrink?: number; - /**set whether column can be resized by user dragging its edges */ + /** set whether column can be resized by user dragging its edges */ resizable?: boolean; - /**You can freeze the position of columns on the left and right of the table using the frozen property in the column definition array. This will keep the column still when the table is scrolled horizontally. */ + /** You can freeze the position of columns on the left and right of the table using the frozen property in the column definition array. This will keep the column still when the table is scrolled horizontally. */ frozen?: boolean; - /**an integer to determine when the column should be hidden in responsive mode */ + /** an integer to determine when the column should be hidden in responsive mode */ responsive?: number; - /**sets the on hover tooltip for each cell in this column - * - * The tooltip parameter can take three different types of value + /** sets the on hover tooltip for each cell in this column * * The tooltip parameter can take three different types of value boolean - a value of false disables the tooltip, a value of true sets the tooltip of the cell to its value string - a string that will be displayed for all cells in the matching column/table. function - a callback function that returns the string for the cell - - * Note: setting a tooltip value on a column will override the global setting. + * Note: setting a tooltip value on a column will override the global setting. */ tooltip?: string | GlobalTooltipOption; - /**sets css classes on header and cells in this column. (value should be a string containing space separated class names) */ + /** sets css classes on header and cells in this column. (value should be a string containing space separated class names) */ cssClass?: string; - /**sets the column as a row handle, allowing it to be used to drag movable rows. */ + /** sets the column as a row handle, allowing it to be used to drag movable rows. */ rowHandle?: boolean; - /**When the getHtml function is called, hide the column from the output. */ + /** When the getHtml function is called, hide the column from the output. */ hideInHtml?: boolean; - //Data Manipulation - /** By default Tabulator will attempt to guess which sorter should be applied to a column based on the data contained in the first row. It can determine sorters for strings, numbers, alphanumeric sequences and booleans, anything else will be treated as a string. + // Data Manipulation + /** By default Tabulator will attempt to guess which sorter should be applied to a column based on the data contained in the first row. It can determine sorters for strings, numbers, alphanumeric sequences and booleans, anything else will be treated as a string. To specify a sorter to be used on a column use the sorter property in the columns definition object You can pass an optional additional property with sorter, sorterParams that should contain an object with additional information for configuring the sorter*/ sorter?: "string" | "number" | "alphanum" | "boolean" | "exists" | "date" | "time" | "datetime" | "array" | ((a: any, b: any, aRow: RowComponent, bRow: RowComponent, column: ColumnComponent, dir: SortDirection, sorterParams: {}) => number); - /**If you want to dynamically generate the sorterParams at the time the sort is called you can pass a function into the property that should return the params object. */ + /** If you want to dynamically generate the sorterParams at the time the sort is called you can pass a function into the property that should return the params object. */ sorterParams?: ColumnDefinitionSorterParams | ColumnSorterParamLookupFunction; - /** set how you would like the data to be formatted*/ + /** set how you would like the data to be formatted*/ formatter?: Formatter; - /** You can pass an optional additional parameter with the formatter, formatterParams that should contain an object with additional information for configuring the formatter.*/ + /** You can pass an optional additional parameter with the formatter, formatterParams that should contain an object with additional information for configuring the formatter.*/ formatterParams?: FormatterParams; - /**alter the row height to fit the contents of the cell instead of hiding overflow */ + /** alter the row height to fit the contents of the cell instead of hiding overflow */ variableHeight?: boolean; - /** There are some circumstances where you may want to block editibility of a cell for one reason or another. To meet this need you can use the editable option. This lets you set a callback that is executed before the editor is built, if this callback returns true the editor is added, if it returns false the edit is aborted and the cell remains a non editable cell. The function is passed one parameter, the CellComponent of the cell about to be edited. You can also pass a boolean value instead of a function to this property.*/ + /** There are some circumstances where you may want to block editibility of a cell for one reason or another. To meet this need you can use the editable option. This lets you set a callback that is executed before the editor is built, if this callback returns true the editor is added, if it returns false the edit is aborted and the cell remains a non editable cell. The function is passed one parameter, the CellComponent of the cell about to be edited. You can also pass a boolean value instead of a function to this property.*/ editable?: boolean | ((cell: CellComponent) => boolean); - /**When a user clicks on an editable column the will be able to edit the value for that cell. + /** When a user clicks on an editable column the will be able to edit the value for that cell. By default Tabulator will use an editor that matches the current formatter for that cell. if you wish to specify a specific editor, you can set them per column using the editor option in the column definition. Passing a value of true to this option will result in Tabulator applying the editor that best matches the columns formatter, if present. You can pass an optional additional parameter with the editor, editorParams that should contain an object with additional information for configuring the editor. */ editor?: Editor; - /** */ + /** additional parameters you can pass to the editor */ editorParams?: EditorParams; - /**Validators are used to ensure that any user input into your editable cells matches your requirements. + /** Validators are used to ensure that any user input into your editable cells matches your requirements. Validators can be applied by using the validator property in a columns definition object (see Define Columns for more details). */ validator?: StandardValidatorType | StandardValidatorType[] | Validator | Validator[]; - /**Mutators are used to alter data as it is parsed into Tabulator. For example if you wanted to convert a numeric column into a boolean based on its value, before the data is used to build the table. + /** Mutators are used to alter data as it is parsed into Tabulator. For example if you wanted to convert a numeric column into a boolean based on its value, before the data is used to build the table. You can set mutators on a per column basis using the mutator option in the column definition object. You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ mutator?: CustomMutator; - /**You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + /** You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ mutatorParams?: CustomMutatorParams; - /** only called when data is loaded via a command {eg. setData). */ + /** only called when data is loaded via a command {eg. setData). */ mutatorData?: CustomMutator; mutatorDataParams?: CustomMutatorParams; - /**only called when data is changed via a user editing a cell. */ + /** only called when data is changed via a user editing a cell. */ mutatorEdit?: CustomMutator; mutatorEditParams?: CustomMutatorParams; - /**only called when data is changed via a user editing a cell. */ + /** only called when data is changed via a user editing a cell. */ mutatorClipboard?: CustomMutator; mutatorClipboardParams?: CustomMutatorParams; - /** Accessors are used to alter data as it is extracted from the table, through commands, the clipboard, or download. + /** Accessors are used to alter data as it is extracted from the table, through commands, the clipboard, or download. You can set accessors on a per column basis using the accessor option in the column definition object.*/ accessor?: CustomAccessor; - /** Each accessor function has its own matching params option, for example accessorDownload has accessorDownloadParams.*/ + /** Each accessor function has its own matching params option, for example accessorDownload has accessorDownloadParams.*/ accessorParams?: CustomAccessorParams; - /**only called when data is being converted into a downloadable file. */ + /** only called when data is being converted into a downloadable file. */ accessorDownload?: CustomAccessor; - /** */ + /** additional parameters you can pass to the accessorDownload */ accessorDownloadParams?: CustomAccessorParams; - /**only called when data is being copied into the clipboard. */ + /** only called when data is being copied into the clipboard. */ accessorClipboard?: CustomAccessor; - /** */ + /** additional parameters you can pass to the accessorClipboard*/ accessorClipboardParams?: CustomAccessorParams; - /**show or hide column in downloaded data */ + /** show or hide column in downloaded data */ download?: boolean; - /**set custom title for column in download */ + /** set custom title for column in download */ downloadTitle?: string; - /** the column calculation to be displayed at the top of this column(see Column Calculations for more details) */ + /** the column calculation to be displayed at the top of this column(see Column Calculations for more details) */ topCalc?: ColumnCalc; - /**additional parameters you can pass to the topCalc calculation function (see Column Calculations for more details) */ + /** additional parameters you can pass to the topCalc calculation function (see Column Calculations for more details) */ topCalcParams?: ColumnCalcParams; - /**formatter for the topCalc calculation cell */ + /** formatter for the topCalc calculation cell */ topCalcFormatter?: Formatter; - /** additional parameters you can pass to the topCalcFormatter function */ + /** additional parameters you can pass to the topCalcFormatter function */ topCalcFormatterParams?: FormatterParams; bottomCalc?: ColumnCalc; bottomCalcParams?: ColumnCalcParams; bottomCalcFormatter?: Formatter; - /** additional parameters you can pass to the bottomCalcFormatter function */ + /** additional parameters you can pass to the bottomCalcFormatter function */ bottomCalcFormatterParams?: FormatterParams; - //Column Header - /**By default all columns in a table are sortable by clicking on the column header, if you want to disable this behaviour, set the headerSort property to false in the column definition array: */ + // Column Header + /** By default all columns in a table are sortable by clicking on the column header, if you want to disable this behaviour, set the headerSort property to false in the column definition array: */ headerSort?: boolean; - /**set the starting sort direction when a user first clicks on a header */ + /** set the starting sort direction when a user first clicks on a header */ headerSortStartingDir?: SortDirection; - /**allow tristate toggling of column header sort direction */ + /** allow tristate toggling of column header sort direction */ headerSortTristate?: boolean; - /** callback for when user clicks on the header for this column*/ + /** callback for when user clicks on the header for this column*/ headerClick?: ColumnEventCallback; - /** callback for when user double clicks on the header for this column */ + /** callback for when user double clicks on the header for this column */ headerDblClick?: ColumnEventCallback; - /**callback for when user right clicks on the header for this column */ + /** callback for when user right clicks on the header for this column */ headerContext?: ColumnEventCallback; - /** callback for when user taps on a header for this column, triggered in touch displays. */ + /** callback for when user taps on a header for this column, triggered in touch displays. */ headerTap?: ColumnEventCallback; - /**callback for when user double taps on a header for this column, triggered in touch displays when a user taps the same header twice in under 300ms */ + /** callback for when user double taps on a header for this column, triggered in touch displays when a user taps the same header twice in under 300ms */ headerDblTap?: ColumnEventCallback; - /**callback for when user taps and holds on a header for this column, triggered in touch displays when a user taps and holds the same header for 1 second. */ + /** callback for when user taps and holds on a header for this column, triggered in touch displays when a user taps and holds the same header for 1 second. */ headerTapHold?: ColumnEventCallback; - /**sets the on hover tooltip for the column header - * - * The tooltip headerTooltip can take three different types of value + /** sets the on hover tooltip for the column header* * The tooltip headerTooltip can take three different types of value boolean - a value of false disables the tooltip, a value of true sets the tooltip of the column header to its title value. string - a string that will be displayed for the tooltip. - function - a callback function that returns the string for the column header - * + function - a callback function that returns the string for the column header* */ headerTooltip?: boolean | string | ((column: ColumnComponent) => string); - /**change the orientation of the column header to vertical - * - * The headerVertical property can take one of three values: + /** change the orientation of the column header to vertical* * The headerVertical property can take one of three values: false - vertical columns disabled (default value) true - vertical columns enabled - "flip" - vertical columns enabled, with text direction flipped by 180 degrees - * + "flip" - vertical columns enabled, with text direction flipped by 180 degrees* */ headerVertical?: boolean | "flip"; - /**allows the user to edit the header titles */ + /** allows the user to edit the header titles */ editableTitle?: boolean; - /** formatter function for header title */ + /** formatter function for header title */ titleFormatter?: Formatter; - /**additional parameters you can pass to the header title formatter */ + /** additional parameters you can pass to the header title formatter */ titleFormatterParams?: FormatterParams; - /** filtering of columns from elements in the header */ + /** filtering of columns from elements in the header */ headerFilter?: Editor; - /**additional parameters you can pass to the header filter */ + /** additional parameters you can pass to the header filter */ headerFilterParams?: EditorParams; - /** placeholder text for the header filter */ + /** placeholder text for the header filter */ headerFilterPlaceholder?: string; - /** function to check when the header filter is empty */ + /** function to check when the header filter is empty */ headerFilterEmptyCheck?: ValueBooleanCallback; - /** By default Tabulator will try and match the comparison type to the type of element used for the header filter. + /** By default Tabulator will try and match the comparison type to the type of element used for the header filter. Standard input elements will use the "like" filter, this allows for the matches to be displayed as the user types. @@ -963,50 +942,50 @@ You can pass an optional additional property with sorter, sorterParams that shou If you want to specify the type of filter used you can pass it to the headerFilterFunc option in the column definition object. This will take any of the standard filters outlined above or a custom function*/ headerFilterFunc?: FilterType | ((headerValue: any, rowValue: any, rowdata: any, filterparams: any) => boolean); - /** additional parameters object passed to the headerFilterFunc function */ + /** additional parameters object passed to the headerFilterFunc function */ headerFilterFuncParams?: any; - /**disable live filtering of the table */ + /** disable live filtering of the table */ headerFilterLiveFilter?: boolean; } interface CellCallbacks { - //Cell Events - /**callback for when user clicks on a cell in this column */ + // Cell Events + /** callback for when user clicks on a cell in this column */ cellClick?: CellEventCallback; - /** callback for when user double clicks on a cell in this column */ + /** callback for when user double clicks on a cell in this column */ cellDblClick?: CellEventCallback; - /**callback for when user right clicks on a cell in this column */ + /** callback for when user right clicks on a cell in this column */ cellContext?: CellEventCallback; - /**callback for when user taps on a cell in this column, triggered in touch displays. */ + /** callback for when user taps on a cell in this column, triggered in touch displays. */ cellTap?: CellEventCallback; - /** callback for when user double taps on a cell in this column, triggered in touch displays when a user taps the same cell twice in under 300ms. */ + /** callback for when user double taps on a cell in this column, triggered in touch displays when a user taps the same cell twice in under 300ms. */ cellDblTap?: CellEventCallback; - /** callback for when user taps and holds on a cell in this column, triggered in touch displays when a user taps and holds the same cell for 1 second.*/ + /** callback for when user taps and holds on a cell in this column, triggered in touch displays when a user taps and holds the same cell for 1 second.*/ cellTapHold?: CellEventCallback; - /**callback for when the mouse pointer enters a cell */ + /** callback for when the mouse pointer enters a cell */ cellMouseEnter?: CellEventCallback; - /** callback for when the mouse pointer leaves a cell */ + /** callback for when the mouse pointer leaves a cell */ cellMouseLeave?: CellEventCallback; - /** callback for when the mouse pointer enters a cell or one of its child elements */ + /** callback for when the mouse pointer enters a cell or one of its child elements */ cellMouseOver?: CellEventCallback; - /**callback for when the mouse pointer enters a cell or one of its child elements */ + /** callback for when the mouse pointer enters a cell or one of its child elements */ cellMouseOut?: CellEventCallback; - /**callback for when the mouse pointer moves over a cell */ + /** callback for when the mouse pointer moves over a cell */ cellMouseMove?: CellEventCallback; - //Cell editing - /**callback for when a cell in this column is being edited by the user */ + // Cell editing + /** callback for when a cell in this column is being edited by the user */ cellEditing?: CellEditEventCallback; - /**callback for when a cell in this column has been edited by the user */ + /** callback for when a cell in this column has been edited by the user */ cellEdited?: CellEditEventCallback; - /** callback for when an edit on a cell in this column is aborted by the user */ + /** callback for when an edit on a cell in this column is aborted by the user */ cellEditCancelled?: CellEditEventCallback; } @@ -1022,7 +1001,7 @@ You can pass an optional additional property with sorter, sorterParams that shou type CustomMutatorParams = {} | ((value: any, data: any, type: "data" | "edit", cell?: CellComponent) => any); type CustomAccessor = (value: any, data: any, type: "data" | "download" | "clipboard", AccessorParams: any, column?: ColumnComponent) => any; type CustomAccessorParams = {} | ((value: any, data: any, type: "data" | "download" | "clipboard", column?: ColumnComponent) => any); - type ColumnCalc = "avg" | "max" | "min" | "sum" | "concat" | "count" | ((values: Array, data: Array, calcParams: {}) => number); + type ColumnCalc = "avg" | "max" | "min" | "sum" | "concat" | "count" | ((values: any[], data: any[], calcParams: {}) => number); type ColumnCalcParams = (values: any, data: any) => any; type Formatter = "plaintext" | "textarea" | "html" | "money" | "image" | "datetime" | "datetimediff" | "link" | "tickCross" | "color" | "star" | "traffic" | "progress" | "lookup" | "buttonTick" | "buttonCross" | "rownum" | "handle" | ((cell: CellComponent, formatterParams: {}, onRendered: EmptyCallback) => string | HTMLElement); type FormatterParams = MoneyParams | ImageParams | LinkParams | DateTimeParams | DateTimeDifferenceParams | TickCrossParams | TrafficParams | StarRatingParams | JSONRecord | ((cell: CellComponent) => {}); @@ -1035,7 +1014,7 @@ You can pass an optional additional property with sorter, sorterParams that shou type ScrollToColumnPosition = "left" | "center" | "middle" | "right"; interface MoneyParams { - //Money + // Money decimal?: string; thousand?: string; symbol?: string; @@ -1043,12 +1022,12 @@ You can pass an optional additional property with sorter, sorterParams that shou precision?: boolean | number; } interface ImageParams { - //Image + // Image height?: string; width?: string; } interface LinkParams { - //Link + // Link labelField?: string; label?: string; urlPrefix?: string; @@ -1058,21 +1037,21 @@ You can pass an optional additional property with sorter, sorterParams that shou } interface DateTimeParams { - //datetime + // datetime inputFormat?: string; outputFormat?: string; invalidPlaceholder?: true | string | number | ValueStringCallback; } interface DateTimeDifferenceParams extends DateTimeParams { - //Date Time Difference + // Date Time Difference date?: any; humanize?: boolean; unit?: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"; suffix?: boolean; } interface TickCrossParams { - //Tick Cross + // Tick Cross allowEmpty?: boolean; allowTruthy?: boolean; tickElement?: boolean | string; @@ -1080,32 +1059,32 @@ You can pass an optional additional property with sorter, sorterParams that shou } interface TrafficParams { - //Traffic + // Traffic min?: number; max?: number; color?: Color; } interface ProgressBarParams extends TrafficParams { - //Progress Bar + // Progress Bar legend?: string | true | ValueStringCallback; legendColor?: Color; legendAlign?: Align; } interface StarRatingParams { - //Star Rating + // Star Rating stars?: number; } interface NumberParams { - //range,number + // range,number min?: number; max?: number; step?: number; } interface CheckboxParams { - //tick + // tick tristate?: boolean; indeterminateValue?: string; } @@ -1120,7 +1099,10 @@ You can pass an optional additional property with sorter, sorterParams that shou value?: string | number | boolean; options?: SelectLabelValue[]; } - type SelectLabelValue = { label: string; value: string | number | boolean }; + interface SelectLabelValue { + label: string; + value: string | number | boolean; + } interface AutoCompleteParams { values: true | string[] | JSONRecord; @@ -1176,96 +1158,63 @@ You can pass an optional additional property with sorter, sorterParams that shou copyToClipboard?: string | boolean; } - //Components------------------------------------------------------------------- - interface CellComponent { - /**The getValue function returns the current value for the cell. */ - getValue: () => any; - /**The getOldValue function returns the previous value of the cell. Very usefull in the event of cell update callbacks. */ - getOldValue: () => any; - /**The restoreOldValue reverts the value of the cell back to its previous value, without triggering any of the cell edit callbacks. */ - restoreOldValue: () => any; - /**The getElement function returns the DOM node for the cell. */ - - getElement: () => HTMLElement; - /**The getTable function returns the Tabulator object for the table containing the cell. */ - getTable: () => Tabulator; - /**The getRow function returns the RowComponent for the row that contains the cell. */ - getRow: () => RowComponent; - - /**The getColumn function returns the ColumnComponent for the column that contains the cell. */ - getColumn: () => ColumnComponent; - - /**The getData function returns the data for the row that contains the cell. */ - getData: () => {}; - /**The getField function returns the field name for the column that contains the cell. */ - getField: () => string; - /**You can change the value of the cell using the setValue function. The first parameter should be the new value for the cell, the second optional parameter will apply the column mutators to the value when set to true (default = true). */ - setValue: (value: any, mutate?: boolean) => void; - /**If you are making manual adjustments to elements contained withing the cell, or the cell itself, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the checkHeight function to check if the height of the cell has changed and normalize the row if it has. */ - checkHeight: () => void; - /**You and programatically cause a cell to open its editor element using the edit function */ - edit: (ignoreEditable?: boolean) => void; - /**You and programatically cancel a cell edit that is currently in progress by calling the cancelEdit function */ - cancelEdit: () => void; - /**When a cell is being edited it is possible to move the editor focus from the current cell to one if its neighbours. There are a number of functions that can be called on the nav function to move the focus in different directions. */ - nav: () => CellNavigation; - } + // Components------------------------------------------------------------------- interface CellNavigation { - /**prev - next editable cell on the left, if none available move to the right most editable cell on the row above */ + /** prev - next editable cell on the left, if none available move to the right most editable cell on the row above */ prev: () => boolean; - /**next - next editable cell on the right, if none available move to left most editable cell on the row below */ + /** next - next editable cell on the right, if none available move to left most editable cell on the row below */ next: () => boolean; - /**left - next editable cell on the left, return false if none available on row */ + /** left - next editable cell on the left, return false if none available on row */ left: () => boolean; - /**right - next editable cell on the right, return false if none available on row */ + /** right - next editable cell on the right, return false if none available on row */ right: () => boolean; - /**up - move to the same cell in the row above */ + /** up - move to the same cell in the row above */ up: () => void; - /**down - move to the same cell in the row below */ + /** down - move to the same cell in the row below */ down: () => void; } interface RowComponent { - /**The getData function returns the data object for the row.*/ + /** The getData function returns the data object for the row.*/ getData: () => {}; - /**The getElement function returns the DOM node for the row.*/ + /** The getElement function returns the DOM node for the row.*/ getElement: () => HTMLElement; - /**The getTable function returns the Tabulator object for the table containing the row. */ + /** The getTable function returns the Tabulator object for the table containing the row. */ getTable: () => Tabulator; - /**The getNextRow function returns the Row Component for the next visible row in the table, if there is no next row it will return a value of false */ + /** The getNextRow function returns the Row Component for the next visible row in the table, if there is no next row it will return a value of false */ getNextRow: () => RowComponent | false; - /**The getNextRow function returns the Row Component for the previous visible row in the table, if there is no next row it will return a value of false */ + /** The getNextRow function returns the Row Component for the previous visible row in the table, if there is no next row it will return a value of false */ getPrevRow: () => RowComponent | false; - /**The getCells function returns an array of CellComponent objects, one for each cell in the row.*/ - getCells: () => Array; - /**The getCell function returns the CellComponent for the specified column from this row.*/ + /** The getCells function returns an array of CellComponent objects, one for each cell in the row.*/ + getCells: () => CellComponent[]; + /** The getCell function returns the CellComponent for the specified column from this row.*/ getCell: (column: ColumnComponent | HTMLElement | string) => CellComponent; - /**The getIndex function returns the index value for the row. (this is the value from the defined index column, NOT the row's position in the table)*/ + /** The getIndex function returns the index value for the row. (this is the value from the defined index column, NOT the row's position in the table)*/ getIndex: () => any; - /**Use the getPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + /** Use the getPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional first argument of the function. */ getPosition: (filteredPosition?: boolean) => number; - /**When using grouped rows, you can retrieve the group component for the current row using the getGroup function. */ + /** When using grouped rows, you can retrieve the group component for the current row using the getGroup function. */ getGroup: () => GroupComponent; - /**The delete function deletes the row, removing its data from the table + /** The delete function deletes the row, removing its data from the table * * The delete method returns a promise, this can be used to run any other commands that have to be run after the row has been deleted. By running them in the promise you ensure they are only run after the row has been deleted. */ delete: () => Promise; - /**The scrollTo function will scroll the table to the row if it passes the current filters.*/ + /** The scrollTo function will scroll the table to the row if it passes the current filters.*/ scrollTo: () => Promise; - /**The pageTo function will load the page for the row if it passes the current filters.*/ + /** The pageTo function will load the page for the row if it passes the current filters.*/ pageTo: () => Promise; - /** You can move a row next to another row using the move function. + /** You can move a row next to another row using the move function. The first argument should be the target row that you want to move to, and can be any of the standard row component look up options. @@ -1273,116 +1222,150 @@ You can pass an optional additional property with sorter, sorterParams that shou move: (lookup: RowComponent | HTMLElement | number, belowTarget?: boolean) => void; - /**You can update the data in the row using the update function. You should pass an object to the function containing any fields you wish to update. This object will not replace the row data, only the fields included in the object will be updated.*/ + /** You can update the data in the row using the update function. You should pass an object to the function containing any fields you wish to update. This object will not replace the row data, only the fields included in the object will be updated.*/ update: (data: {}) => Promise; - /**The select function will select the current row.*/ + /** The select function will select the current row.*/ select: () => void; - /**The deselect function will deselect the current row.*/ + /** The deselect function will deselect the current row.*/ deselect: () => void; - /**The deselect function will toggle the current row.*/ + /** The deselect function will toggle the current row.*/ toggleSelect: () => void; - /**The isSelected function will return a boolean representing the current selected state of the row. */ + /** The isSelected function will return a boolean representing the current selected state of the row. */ isSelected: () => boolean; - /**If you are making manual adjustments to elements contained within the row, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the normalizeHeight function to do this.*/ + /** If you are making manual adjustments to elements contained within the row, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the normalizeHeight function to do this.*/ normalizeHeight: () => void; - /**If you want to re-format a row once it has been rendered to re-trigger the cell formatters and the rowFormatter callback, Call the reformat function. */ + /** If you want to re-format a row once it has been rendered to re-trigger the cell formatters and the rowFormatter callback, Call the reformat function. */ reformat: () => void; - /**You can freeze a row at the top of the table by calling the freeze function. This will insert the row above the scrolling portion of the table in the table header. */ + /** You can freeze a row at the top of the table by calling the freeze function. This will insert the row above the scrolling portion of the table in the table header. */ freeze: () => void; - /**A frozen row can be unfrozen using the unfreeze function. This will remove the row from the table header and re-insert it back in the table. */ + /** A frozen row can be unfrozen using the unfreeze function. This will remove the row from the table header and re-insert it back in the table. */ unfreeze: () => void; - /**When the tree structure is enabled the treeExpand function will expand current row and show its children. */ + /** When the tree structure is enabled the treeExpand function will expand current row and show its children. */ treeExpand: () => void; - /**When the tree structure is enabled the treeCollapse function will collapse current row and hide its children */ + /** When the tree structure is enabled the treeCollapse function will collapse current row and hide its children */ treeCollapse: () => void; - /**When the tree structure is enabled the treeToggle function will toggle the collapsed state of the current row. */ + /** When the tree structure is enabled the treeToggle function will toggle the collapsed state of the current row. */ treeToggle: () => void; - /**When the tree structure is enabled the getTreeParent function will return the Row Component for the parent of this row. If no parent exists, a value of false will be returned. */ + /** When the tree structure is enabled the getTreeParent function will return the Row Component for the parent of this row. If no parent exists, a value of false will be returned. */ getTreeParent: () => RowComponent | false; - /**When the tree structure is enabled the getTreeChildren function will return an array of Row Components for this rows children. */ + /** When the tree structure is enabled the getTreeChildren function will return an array of Row Components for this rows children. */ getTreeChildren: () => RowComponent[]; } interface GroupComponent { - /**The getElement function returns the DOM node for the group header. */ + /** The getElement function returns the DOM node for the group header. */ getElement: () => HTMLElement; - /**The getTable function returns the Tabulator object for the table containing the group */ + /** The getTable function returns the Tabulator object for the table containing the group */ getTable: () => Tabulator; - /**The getKey function returns the unique key that is shared between all rows in this group. */ + /** The getKey function returns the unique key that is shared between all rows in this group. */ getKey: () => any; - /**The getRows function returns an array of RowComponent objects, one for each row in the group */ + /** The getRows function returns an array of RowComponent objects, one for each row in the group */ getRows: () => RowComponent[]; - /**The getSubGroups function returns an array of GroupComponent objects, one for each sub group of this group. */ + /** The getSubGroups function returns an array of GroupComponent objects, one for each sub group of this group. */ getSubGroups: () => GroupComponent[]; - /**The getParentGroup function returns the GroupComponent for the parent group of this group. if no parent exists, this function will return false */ + /** The getParentGroup function returns the GroupComponent for the parent group of this group. if no parent exists, this function will return false */ getParentGroup: () => GroupComponent | false; - /** The getVisibility function returns a boolean to show if the group is visible, a value of true means it is visible.*/ + /** The getVisibility function returns a boolean to show if the group is visible, a value of true means it is visible.*/ getVisibility: () => boolean; - /**The show function shows the group if it is hidden. */ + /** The show function shows the group if it is hidden. */ show: () => void; - /**The hide function hides the group if it is visible. */ + /** The hide function hides the group if it is visible. */ hide: () => void; - /**The toggle function toggles the visibility of the group, switching between hidden and visible. */ + /** The toggle function toggles the visibility of the group, switching between hidden and visible. */ toggle: () => void; } interface ColumnComponent { /*The getElement function returns the DOM node for the colum*/ getElement: () => HTMLElement; - /**The getTable function returns the Tabulator object for the table containing the column */ + /** The getTable function returns the Tabulator object for the table containing the column */ getTable: () => Tabulator; - /**The getDefinition function returns the column definition object for the column.*/ + /** The getDefinition function returns the column definition object for the column.*/ getDefinition: () => ColumnDefinition; - /**The getField function returns the field name for the column.*/ + /** The getField function returns the field name for the column.*/ getField: () => string; - /**The getCells function returns an array of CellComponent objects, one for each cell in the column.*/ - getCells: () => Array; + /** The getCells function returns an array of CellComponent objects, one for each cell in the column.*/ + getCells: () => CellComponent[]; - /**The getNextColumn function returns the Column Component for the next visible column in the table, if there is no next column it will return a value of false. */ + /** The getNextColumn function returns the Column Component for the next visible column in the table, if there is no next column it will return a value of false. */ getNextColumn: () => ColumnComponent | false; - /**The getPrevColumn function returns the Column Component for the previous visible column in the table, if there is no previous column it will return a value of false. */ + /** The getPrevColumn function returns the Column Component for the previous visible column in the table, if there is no previous column it will return a value of false. */ getPrevColumn: () => ColumnComponent | false; - /**The getVisibility function returns a boolean to show if the column is visible, a value of true means it is visible.*/ + /** The getVisibility function returns a boolean to show if the column is visible, a value of true means it is visible.*/ getVisibility: () => boolean; - /**The show function shows the column if it is hidden.*/ + /** The show function shows the column if it is hidden.*/ show: () => void; - /**The hide function hides the column if it is visible.*/ + /** The hide function hides the column if it is visible.*/ hide: () => void; - /**The toggle function toggles the visibility of the column, switching between hidden and visible.*/ + /** The toggle function toggles the visibility of the column, switching between hidden and visible.*/ toggle: () => void; - /**The delete function deletes the column, removing it from the table*/ + /** The delete function deletes the column, removing it from the table*/ delete: () => void; - /**The scrollTo function will scroll the table to the column if it is visible. */ + /** The scrollTo function will scroll the table to the column if it is visible. */ scrollTo: () => Promise; - /**The getSubColumns function returns an array of ColumnComponent objects, one for each sub column of this column. */ + /** The getSubColumns function returns an array of ColumnComponent objects, one for each sub column of this column. */ getSubColumns: () => ColumnComponent[]; - /**The getParentColumn function returns the ColumnComponent for the parent column of this column. if no parent exists, this function will return false */ + /** The getParentColumn function returns the ColumnComponent for the parent column of this column. if no parent exists, this function will return false */ getParentColumn: () => ColumnComponent | false; - /**The headerFilterFocus function will place focus on the header filter element for this column if it exists. */ + /** The headerFilterFocus function will place focus on the header filter element for this column if it exists. */ headerFilterFocus: () => void; - /**The setHeaderFilterValue function set the value of the columns header filter element to the value provided in the first argument. */ + /** The setHeaderFilterValue function set the value of the columns header filter element to the value provided in the first argument. */ setHeaderFilterValue: (value: any) => void; - /**The reloadHeaderFilter function rebuilds the header filter element, updating any params passed into the editor used to generate the filter. */ + /** The reloadHeaderFilter function rebuilds the header filter element, updating any params passed into the editor used to generate the filter. */ reloadHeaderFilter: () => void; } + + interface CellComponent { + /** The getValue function returns the current value for the cell. */ + getValue: () => any; + /** The getOldValue function returns the previous value of the cell. Very usefull in the event of cell update callbacks. */ + getOldValue: () => any; + /** The restoreOldValue reverts the value of the cell back to its previous value, without triggering any of the cell edit callbacks. */ + restoreOldValue: () => any; + /** The getElement function returns the DOM node for the cell. */ + + getElement: () => HTMLElement; + /** The getTable function returns the Tabulator object for the table containing the cell. */ + getTable: () => Tabulator; + /** The getRow function returns the RowComponent for the row that contains the cell. */ + getRow: () => RowComponent; + + /** The getColumn function returns the ColumnComponent for the column that contains the cell. */ + getColumn: () => ColumnComponent; + + /** The getData function returns the data for the row that contains the cell. */ + getData: () => {}; + /** The getField function returns the field name for the column that contains the cell. */ + getField: () => string; + /** You can change the value of the cell using the setValue function. The first parameter should be the new value for the cell, the second optional parameter will apply the column mutators to the value when set to true (default = true). */ + setValue: (value: any, mutate?: boolean) => void; + /** If you are making manual adjustments to elements contained withing the cell, or the cell itself, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the checkHeight function to check if the height of the cell has changed and normalize the row if it has. */ + checkHeight: () => void; + /** You and programatically cause a cell to open its editor element using the edit function */ + edit: (ignoreEditable?: boolean) => void; + /** You and programatically cancel a cell edit that is currently in progress by calling the cancelEdit function */ + cancelEdit: () => void; + /** When a cell is being edited it is possible to move the editor focus from the current cell to one if its neighbours. There are a number of functions that can be called on the nav function to move the focus in different directions. */ + nav: () => CellNavigation; + } } -//Tabulator.prototype.(?!registerModule|helpers|_)\w+ +// Tabulator.prototype.(?!registerModule|helpers|_)\w+ declare class Tabulator { constructor(selector: string | HTMLElement, options?: Tabulator.Options); @@ -1394,12 +1377,12 @@ declare class Tabulator { modules: any; options: Tabulator.Options; - /**You have a choice of four file types to choose from: + /** You have a choice of four file types to choose from: csv - Comma separated value file json - JSON formatted text file xlsx - Excel File (Requires the SheetJS Library) pdf - PDF File (Requires the jsPDF Library and jsPDF-AutoTable Plugin) - To trigger a download, call the download function, passing the file type (from the above list) as the first argument, and an optional second argument of the file name for the download (if this is left out it will be "Tabulator.ext"). The optional third argument is an object containing any setup options for the formatter, such as the delimiter choice for CSV's). + To trigger a download, call the download function, passing the file type (from the above list) as the first argument, and an optional second argument of the file name for the download (if this is left out it will be "Tabulator.ext"). The optional third argument is an object containing any setup options for the formatter, such as the delimiter choice for CSV's). The PDF downloader requires that the jsPDF Library and jsPDF-AutoTable Plugin be included on your site, this can be included with the following script tags. @@ -1407,84 +1390,84 @@ declare class Tabulator { */ download: (downloadType: Tabulator.DownloadType | ((columns: Tabulator.ColumnDefinition[], data: any, options: any, setFileContents: any) => any), fileName: string, params?: Tabulator.DownloadOptions) => void; - /**If you want to open the generated file in a new browser tab rather than downloading it straight away, you can use the downloadToTab function. This is particularly useful with the PDF downloader, as it allows you to preview the resulting PDF in a new browser ta */ + /** If you want to open the generated file in a new browser tab rather than downloading it straight away, you can use the downloadToTab function. This is particularly useful with the PDF downloader, as it allows you to preview the resulting PDF in a new browser ta */ downloadToTab: (downloadType: Tabulator.DownloadType, fileName: string, params?: Tabulator.DownloadOptions) => void; - /**The copyToClipboard function allows you to copy the current table data to the clipboard. + /** The copyToClipboard function allows you to copy the current table data to the clipboard. The first argument is the copy selector, you can choose from any of the built in options or pass a function in to the argument, that must return the selected row components. If you leave this argument undefined, Tabulator will use the value of the clipboardCopySelector property, which has a default value of table */ copyToClipboard: (type: "selection" | "table") => void; - /**With history enabled you can use the undo function to automatically undo a user action, the more times you call the function, the further up the history log you go. */ + /** With history enabled you can use the undo function to automatically undo a user action, the more times you call the function, the further up the history log you go. */ undo: () => boolean; - /**You can use the getHistoryUndoSize function to get a count of the number of history undo actions available. */ + /** You can use the getHistoryUndoSize function to get a count of the number of history undo actions available. */ getHistoryUndoSize: () => number | false; - /**With history enabled you can use the redo function to automatically redo user action that has been undone, the more times you call the function, the further up the history log you go. once a user interacts with the table then can no longer redo any further actions until an undo is performe */ + /** With history enabled you can use the redo function to automatically redo user action that has been undone, the more times you call the function, the further up the history log you go. once a user interacts with the table then can no longer redo any further actions until an undo is performe */ redo: () => boolean; - /**You can use the getHistoryRedoSize function to get a count of the number of history redo actions available.*/ + /** You can use the getHistoryRedoSize function to get a count of the number of history redo actions available.*/ getHistoryRedoSize: () => number | false; - /**Deconstructor */ + /** Deconstructor */ destroy: () => void; - /**By default Tabulator will only allow files with a .json extension to be loaded into the table. + /** By default Tabulator will only allow files with a .json extension to be loaded into the table. You can allow any other type of file into the file picker by passing the extension or mime type into the first argument of the setDataFromLocalFile function as a comma separated list. This argument will accept any of the values valid for the accept field of an input element */ setDataFromLocalFile: (extensions: string) => void; setData: (data: any, params?: any, config?: any) => Promise; - /**You can remove all data from the table using clearData */ + /** You can remove all data from the table using clearData */ clearData: () => void; - /**You can retrieve the data stored in the table using the getData function. */ + /** You can retrieve the data stored in the table using the getData function. */ getData: (activeOnly?: boolean) => any[]; getDataCount: (activeOnly?: boolean) => number; - /**The searchRows function allows you to retreive an array of row components that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + /** The searchRows function allows you to retreive an array of row components that match any filters you pass in. it accepts the same arguments as the setFilter function. */ searchRows: Tabulator.FilterFunction; - /**The searchData function allows you to retreive an array of table row data that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + /** The searchData function allows you to retreive an array of table row data that match any filters you pass in. it accepts the same arguments as the setFilter function. */ searchData: Tabulator.FilterFunction; - /**You can retrieve the table data as a simple HTML table using the getHtml function. */ + /** You can retrieve the table data as a simple HTML table using the getHtml function. */ getHtml: (activeOnly?: boolean) => void; - /**You can retrieve the current AJAX URL of the table with the getAjaxUrl function. + /** You can retrieve the current AJAX URL of the table with the getAjaxUrl function. * * This will return a HTML encoded string of the table data. By default getHtml will return a table containing all the data held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. */ getAjaxUrl: () => string; - /**The replaceData function lets you silently replace all data in the table without updating scroll position, sort or filtering, and without triggering the ajax loading popup. This is great if you have a table you want to periodically update with new/updated information without alerting the user to a change. + /** The replaceData function lets you silently replace all data in the table without updating scroll position, sort or filtering, and without triggering the ajax loading popup. This is great if you have a table you want to periodically update with new/updated information without alerting the user to a change. It takes the same arguments as the setData function, and behaves in the same way when loading data (ie, it can make ajax requests, parse JSON etc) */ - replaceData: (data?: {}[] | string, params?: any, config?: any) => Promise; - /**If you want to update an existing set of data in the table, without completely replacing the data as the setData method would do, you can use the updateData method. + replaceData: (data?: Array<{}> | string, params?: any, config?: any) => Promise; + /** If you want to update an existing set of data in the table, without completely replacing the data as the setData method would do, you can use the updateData method. This function takes an array of row objects and will update each row based on its index value. (the index defaults to the "id" parameter, this can be set using the index option in the tabulator constructor). Options without an index will be ignored, as will items with an index that is not already in the table data. The addRow function should be used to add new data to the table. */ - updateData: (data: {}[]) => Promise; - /**The addData method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ - addData: (data?: {}[], addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + updateData: (data: Array<{}>) => Promise; + /** The addData method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ + addData: (data?: Array<{}>, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; - /**If the data you are passng to the table contains a mix of existing rows to be updated and new rows to be added then you can call the updateOrAddData function. This will check each row object provided and update the existing row if available, or else create a new row with the data. */ - updateOrAddData: (data: {}[]) => Promise; - /**To rereive the DOM Node of a specific row, you can retrieve the RowComponent with the getRow function, then use the getElement function on the component. The first argument is the row you are looking for, it will take any of the standard row component look up options. */ + /** If the data you are passng to the table contains a mix of existing rows to be updated and new rows to be added then you can call the updateOrAddData function. This will check each row object provided and update the existing row if available, or else create a new row with the data. */ + updateOrAddData: (data: Array<{}>) => Promise; + /** To rereive the DOM Node of a specific row, you can retrieve the RowComponent with the getRow function, then use the getElement function on the component. The first argument is the row you are looking for, it will take any of the standard row component look up options. */ getRow: (row: Tabulator.RowLookup) => Tabulator.RowComponent; - /**You can retrieve the Row Component of a row at a given position in the table using getRowFromPosition function. By default this will return the row based in its position in all table data, including data currently filtered out of the table. + /** You can retrieve the Row Component of a row at a given position in the table using getRowFromPosition function. By default this will return the row based in its position in all table data, including data currently filtered out of the table. If you want to get a row based on its position in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. */ getRowFromPosition: (position: number, activeOnly?: boolean) => void; - /**You can delete any row in the table using the deleteRow function. */ + /** You can delete any row in the table using the deleteRow function. */ deleteRow: (row: Tabulator.RowLookup) => void; - /**You can add a row to the table using the addRow function. + /** You can add a row to the table using the addRow function. The first argument should be a row data object. If you do not pass data for a column, it will be left empty. To create a blank row (ie for a user to fill in), pass an empty object to the function. The second argument is optional and determines whether the row is added to the top or bottom of the table. A value of true will add the row to the top of the table, a value of false will add the row to the bottom of the table. If the parameter is not set the row will be placed according to the addRowPos global option. */ addRow: (data?: {}, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; - /**If you don't know whether a row already exists you can use the updateOrAddRow function. This will check if a row with a matching index exists, if it does it will update it, if not it will add a new row with that data. This takes the same arguments as the updateRow function. */ + /** If you don't know whether a row already exists you can use the updateOrAddRow function. This will check if a row with a matching index exists, if it does it will update it, if not it will add a new row with that data. This takes the same arguments as the updateRow function. */ updateOrAddRow: (row: Tabulator.RowLookup, data: {}) => Promise; - /**You can update any row in the table using the updateRow function. + /** You can update any row in the table using the updateRow function. The first argument is the row you want to update, it will take any of the standard row component look up options. @@ -1495,7 +1478,7 @@ declare class Tabulator { This function will return true if the update was successful or false if the requested row could not be found. If the new data matches the existing row data, no update will be performed. */ updateRow: (row: Tabulator.RowLookup, data: {}) => boolean; - /**If you want to trigger an animated scroll to a row then you can use the scrollToRow function. + /** If you want to trigger an animated scroll to a row then you can use the scrollToRow function. The first argument should be any of the standard row component look up options for the row you want to scroll to. @@ -1503,7 +1486,7 @@ declare class Tabulator { The third argument is optional, and is a boolean used to set if the table should scroll if the row is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToRowIfVisible option, which defaults to true */ scrollToRow: (row: Tabulator.RowLookup, position?: Tabulator.ScrollToRowPostition, ifVisible?: boolean) => Promise; - /**If you want to programmatically move a row to a new position you can use the moveRow function. + /** If you want to programmatically move a row to a new position you can use the moveRow function. The first argument should be the row you want to move, and can be any of the standard row component look up options. @@ -1511,116 +1494,114 @@ declare class Tabulator { The third argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target */ moveRow: (fromRow: Tabulator.RowLookup, toRow: Tabulator.RowLookup, placeAboveTarget?: boolean) => void; - /**You can retrieve all the row components in the table using the getRows function. - * By default getRows will return an array containing all the Row Component's held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + /** You can retrieve all the row components in the table using the getRows function.* By default getRows will return an array containing all the Row Component's held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. */ getRows: (activeOnly?: boolean) => Tabulator.RowComponent[]; - /**Use the getRowPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + /** Use the getRowPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. The first argument is the row you are looking for, it will take any of the standard row component look up options. If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. Note: If the row is not found, a value of -1 will be returned, row positions start at 0 */ getRowPosition: (row: Tabulator.RowLookup, activeOnly?: boolean) => number; - /**To replace the current column definitions for a table use the setColumns function. This function takes a column definition array as its only argument. */ + /** To replace the current column definitions for a table use the setColumns function. This function takes a column definition array as its only argument. */ setColumns: (definitions: Tabulator.ColumnDefinition[]) => void; - /**To get an array of Column Components for the current table setup, call the getColumns function. This will only return actual data columns not column groups. - * - * To get a structured array of Column Components that includes column groups, pass a value of true as an argument. + /** To get an array of Column Components for the current table setup, call the getColumns function. This will only return actual data columns not column groups. + ** To get a structured array of Column Components that includes column groups, pass a value of true as an argument. */ getColumns: (includeColumnGroups?: boolean) => Tabulator.ColumnComponent[] | Tabulator.GroupComponent[]; - /**Using the getColumn function you can retrieve the Column Component */ + /** Using the getColumn function you can retrieve the Column Component */ getColumn: (column: Tabulator.ColumnLookup) => Tabulator.ColumnComponent; - /**To get the current column definition array (including any changes made through user actions, such as resizing or re-ordering columns), call the getColumnDefinitions function. this will return the current columns definition array. */ + /** To get the current column definition array (including any changes made through user actions, such as resizing or re-ordering columns), call the getColumnDefinitions function. this will return the current columns definition array. */ getColumnDefinitions: () => Tabulator.ColumnDefinition[]; - /**If you want to handle column layout persistence manually, for example storing it in a database to use elsewhere, you can use the getColumnLayout function to retrieve a layout object for the current table. */ + /** If you want to handle column layout persistence manually, for example storing it in a database to use elsewhere, you can use the getColumnLayout function to retrieve a layout object for the current table. */ getColumnLayout: () => Tabulator.ColumnLayout[]; - /**If you have previously used the getColumnLayout function to retrieve a tables layout, you can use the setColumnLayout function to apply it to a table. */ + /** If you have previously used the getColumnLayout function to retrieve a tables layout, you can use the setColumnLayout function to apply it to a table. */ setColumnLayout: (layout: Tabulator.ColumnLayout) => void; - /**You can show a hidden column at any point using the showColumn function. */ + /** You can show a hidden column at any point using the showColumn function. */ showColumn: (column?: Tabulator.ColumnLookup) => void; - /**You can hide a visible column at any point using the hideColumn function. */ + /** You can hide a visible column at any point using the hideColumn function. */ hideColumn: (column?: Tabulator.ColumnLookup) => void; - /**You can toggle the visibility of a column at any point using the toggleColumn function. */ + /** You can toggle the visibility of a column at any point using the toggleColumn function. */ toggleColumn: (column?: Tabulator.ColumnLookup) => void; - /**If you wish to add a single column to the table, you can do this using the addColumn function. + /** If you wish to add a single column to the table, you can do this using the addColumn function. * This function takes three arguments: Columns Definition - The column definition object for the column you want to add. Before (optional) - Determines how to position the new column. A value of true will insert the column to the left of existing columns, a value of false will insert it to the right. If a Position argument is supplied then this will determine whether the new colum is inserted before or after this column. Position (optional) - The field to insert the new column next to, this can be any of the standard column component look up options. - * +* */ addColumn: (definition: Tabulator.ColumnDefinition, insertRightOfTarget?: boolean, positionTarget?: Tabulator.ColumnLookup) => void; - /**To permanently remove a column from the table deleteColumn function. This function takes any of the standard column component look up options as its first parameter */ + /** To permanently remove a column from the table deleteColumn function. This function takes any of the standard column component look up options as its first parameter */ deleteColumn: (column: Tabulator.ColumnLookup) => void; - /**If you want to trigger an animated scroll to a column then you can use the scrollToColumn function. The first argument should be any of the standard column component look up options for the column you want to scroll to. + /** If you want to trigger an animated scroll to a column then you can use the scrollToColumn function. The first argument should be any of the standard column component look up options for the column you want to scroll to. The second argument is optional, and is used to set the position of the column, it should be a string with a value of either left, middle or right, if omitted it will be set to the value of the scrollToColumnPosition option which has a default value of left. The third argument is optional, and is a boolean used to set if the table should scroll if the column is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToColumnIfVisible option, which defaults to true */ scrollToColumn: (column: Tabulator.ColumnLookup, position?: Tabulator.ScrollToColumnPosition, ifVisible?: boolean) => Promise; - /**You can also set the language at any point after the table has loaded using the setLocale function, which takes the same range of values as the locale setup option mentioned above. */ + /** You can also set the language at any point after the table has loaded using the setLocale function, which takes the same range of values as the locale setup option mentioned above. */ setLocale: (locale: string | boolean) => void; - /**It is possible to retrieve the locale code currently being used by Tabulator using the getLocale function: */ + /** It is possible to retrieve the locale code currently being used by Tabulator using the getLocale function: */ getLocale: () => string; - /**You can then access these at any point using the getLang function, which will return the language object for the currently active locale. */ + /** You can then access these at any point using the getLang function, which will return the language object for the currently active locale. */ getLang: (locale?: string) => any; - /**If the size of the element containing the Tabulator changes (and you are not able to use the in built auto-resize functionality) or you create a table before its containing element is visible, it will necessary to redraw the table to make sure the rows and columns render correctly. + /** If the size of the element containing the Tabulator changes (and you are not able to use the in built auto-resize functionality) or you create a table before its containing element is visible, it will necessary to redraw the table to make sure the rows and columns render correctly. This can be done by calling the redraw method. For example, to trigger a redraw whenever the viewport width is changed. The redraw function also has an optional boolean argument that when set to true triggers a full rerender of the table including all data on all rows.*/ redraw: (force?: boolean) => void; - /**If you want to manually change the height of the table at any time, you can use the setHeight function, which will also redraw the virtual DOM if necessary. */ + /** If you want to manually change the height of the table at any time, you can use the setHeight function, which will also redraw the virtual DOM if necessary. */ setHeight: (height: number) => void; - /**You can trigger sorting using the setSort function */ + /** You can trigger sorting using the setSort function */ setSort: (sortList: string | Tabulator.Sorter[], dir?: Tabulator.SortDirection) => void; getSorters: () => void; - /**To remove all sorting from the table, call the clearSort function. */ + /** To remove all sorting from the table, call the clearSort function. */ clearSort: () => void; - /**To set a filter you need to call the setFilter method, passing the field you wish to filter, the comparison type and the value to filter for. + /** To set a filter you need to call the setFilter method, passing the field you wish to filter, the comparison type and the value to filter for. This function will replace any exiting filters on the table with the specified filter If you want to perform a more complicated filter then you can pass a callback function to the setFilter method, you can also pass an optional second argument, an object with parameters to be passed to the filter function. */ setFilter: (p1: string | Tabulator.Filter[] | any[] | ((data: any, filterParams: any) => boolean), p2?: Tabulator.FilterType | {}, value?: any) => void; - /**If you want to add another filter to the existing filters then you can call the addFilter function: */ + /** If you want to add another filter to the existing filters then you can call the addFilter function: */ addFilter: Tabulator.FilterFunction; - /**You can retrieve an array of the current programtic filters using the getFilters function, this will not include any of the header filters: */ + /** You can retrieve an array of the current programtic filters using the getFilters function, this will not include any of the header filters: */ getFilters: (includeHeaderFilters: boolean) => Tabulator.Filter[]; - /**You can programatically set the header filter value of a column by calling the setHeaderFilterValue function, This function takes any of the standard column component look up options as its first parameter, with the value for the header filter as the second option */ + /** You can programatically set the header filter value of a column by calling the setHeaderFilterValue function, This function takes any of the standard column component look up options as its first parameter, with the value for the header filter as the second option */ setHeaderFilterValue: (column: Tabulator.ColumnLookup, value: string) => void; - /**You can programatically set the focus on a header filter element by calling the setHeaderFilterFocus function, This function takes any of the standard column component look up options as its first parameter */ + /** You can programatically set the focus on a header filter element by calling the setHeaderFilterFocus function, This function takes any of the standard column component look up options as its first parameter */ setHeaderFilterFocus: (column: Tabulator.ColumnLookup) => void; - /**If you just want to retrieve the current header filters, you can use the getHeaderFilters function: */ + /** If you just want to retrieve the current header filters, you can use the getHeaderFilters function: */ getHeaderFilters: () => Tabulator.Filter[]; - /**If you want to remove one filter from the current list of filters you can use the removeFilter function: */ + /** If you want to remove one filter from the current list of filters you can use the removeFilter function: */ removeFilter: Tabulator.FilterFunction; - /**To remove all filters from the table, use the clearFilter function. */ + /** To remove all filters from the table, use the clearFilter function. */ clearFilter: (includeHeaderFilters: boolean) => void; - /**To remove just the header filters, leaving the programatic filters in place, use the clearHeaderFilter function. */ + /** To remove just the header filters, leaving the programatic filters in place, use the clearHeaderFilter function. */ clearHeaderFilter: () => void; - /**To programmatically select a row you can use the selectRow function. + /** To programmatically select a row you can use the selectRow function. To select a specific row you can pass the any of the standard row component look up options into the first argument of the function. If you leave the argument blank you will select all rows (if you have set the selectable option to a numeric value, it will be ignored when selecting all rows). */ selectRow: (row?: Tabulator.RowLookup) => void; deselectRow: (row?: Tabulator.RowLookup) => void; toggleSelectRow: (row?: Tabulator.RowLookup) => void; - /**To get the RowComponent's for the selected rows at any time you can use the getSelectedRows function. + /** To get the RowComponent's for the selected rows at any time you can use the getSelectedRows function. This will return an array of RowComponent's for the selected rows in the order in which they were selected. */ getSelectedRows: () => Tabulator.RowComponent[]; - /**To get the data objects for the selected rows you can use the getSelectedData function. + /** To get the data objects for the selected rows you can use the getSelectedData function. This will return an array of the selected rows data objects in the order in which they were selected */ getSelectedData: () => any[]; - /**set the maxmum page */ + /** set the maxmum page */ setMaxPage: (max: number) => void; - /**When pagination is enabled the table footer will contain a number of pagination controls for navigating through the data. + /** When pagination is enabled the table footer will contain a number of pagination controls for navigating through the data. In addition to these controls it is possible to change page using the setPage function The setPage function takes one parameter, which should be an integer representing the page you wish to see. There are also four strings that you can pass into the parameter for special functions. @@ -1632,43 +1613,40 @@ declare class Tabulator { The setPage method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ setPage: (page: number | "first" | "prev" | "next" | "last") => Promise; - /**You can load the page for a specific row using the setPageToRow function and passing in any of the standard row component look up options for the row you want to scroll to. - * - * The setPageToRow method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + /** You can load the page for a specific row using the setPageToRow function and passing in any of the standard row component look up options for the row you want to scroll to. + ** The setPageToRow method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ setPageToRow: (row: Tabulator.RowLookup) => Promise; - /**You can change the page size at any point by using the setPageSize function. (this setting will be ignored if using remote pagination with the page size set by the server) */ + /** You can change the page size at any point by using the setPageSize function. (this setting will be ignored if using remote pagination with the page size set by the server) */ setPageSize: (size: number) => void; - /**To retrieve the number of rows allowed per page you can call the getPageSize function: */ + /** To retrieve the number of rows allowed per page you can call the getPageSize function: */ getPageSize: () => number; - /**You can change to show the previous page using the previousPage function. */ + /** You can change to show the previous page using the previousPage function. */ previousPage: () => Promise; - /**You can change to show the next page using the previousPage function. */ + /** You can change to show the next page using the previousPage function. */ nextPage: () => Promise; - /**To retrieve the current page use the getPage function. this will return the number of the current page. If pagination is disabled this will return false. */ + /** To retrieve the current page use the getPage function. this will return the number of the current page. If pagination is disabled this will return false. */ getPage: () => number | false; - /**To retrieve the maximum available page use the getPageMax function. this will return the number of the maximum available page. If pagination is disabled this will return false. */ + /** To retrieve the maximum available page use the getPageMax function. this will return the number of the maximum available page. If pagination is disabled this will return false. */ getPageMax: () => number | false; - /**You can use the setGroupBy function to change the fields that rows are grouped by. This function has one argument and takes the same values as passed to the groupBy setup option. */ + /** You can use the setGroupBy function to change the fields that rows are grouped by. This function has one argument and takes the same values as passed to the groupBy setup option. */ setGroupBy: (groups: string | ((data: any) => any)) => void; - /**You can use the setGroupStartOpen function to change the default open state of groups. This function has one argument and takes the same values as passed to the groupStartOpen setup option. - * - * Note: If you use the setGroupStartOpen or setGroupHeader before you have set any groups on the table, the table will not update until the setGroupBy function is called. + /** You can use the setGroupStartOpen function to change the default open state of groups. This function has one argument and takes the same values as passed to the groupStartOpen setup option. + ** Note: If you use the setGroupStartOpen or setGroupHeader before you have set any groups on the table, the table will not update until the setGroupBy function is called. */ setGroupStartOpen: (values: boolean | ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => boolean)) => void; - /**You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ - setGroupHeader: (values: ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => string) | ((value: any, count: number, data: any) => string)[]) => void; - /**You can use the getGroups function to retrieve an array of all the first level Group Components in the table. */ + /** You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + setGroupHeader: (values: ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => string) | Array<(value: any, count: number, data: any) => string>) => void; + /** You can use the getGroups function to retrieve an array of all the first level Group Components in the table. */ getGroups: () => Tabulator.GroupComponent[]; - /**get grouped table data in the same format as getData() */ + /** get grouped table data in the same format as getData() */ getGroupedData: (activeOnly?: boolean) => any; - /**You can retrieve the results of the column calculations at any point using the getCalcResults function. - * For a table without grouped rows, this will return an object with top and bottom properties, that contain a row data object for all the columns in the table for the top calculations and bottom calculations respectively. + /** You can retrieve the results of the column calculations at any point using the getCalcResults function.* For a table without grouped rows, this will return an object with top and bottom properties, that contain a row data object for all the columns in the table for the top calculations and bottom calculations respectively. */ getCalcResults: () => any; - /**Use the navigatePrev function to shift focus to the next editable cell on the left, if none available move to the right most editable cell on the row above. + /** Use the navigatePrev function to shift focus to the next editable cell on the left, if none available move to the right most editable cell on the row above. * * Note: These actions will only work when a cell is editable and has focus. @@ -1676,31 +1654,28 @@ declare class Tabulator { * */ navigatePrev: () => void; - /**Use the navigateNext function to shift focus to the next editable cell on the right, if none available move to left most editable cell on the row below. - * + /** Use the navigateNext function to shift focus to the next editable cell on the right, if none available move to left most editable cell on the row below.* * Note: These actions will only work when a cell is editable and has focus. Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. * */ navigateNext: () => void; - /**Use the navigateLeft function to shift focus to next editable cell on the left, return false if none available on row. - * + /** Use the navigateLeft function to shift focus to next editable cell on the left, return false if none available on row.* * Note: These actions will only work when a cell is editable and has focus. Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. * */ navigateLeft: () => void; - /**Use the navigateRight function to shift focus to next editable cell on the right, return false if none available on row. - * + /** Use the navigateRight function to shift focus to next editable cell on the right, return false if none available on row.* * Note: These actions will only work when a cell is editable and has focus. Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. * */ navigateRight: () => void; - /**Use the navigateUp function to shift focus to the same cell in the row above. + /** Use the navigateUp function to shift focus to the same cell in the row above. * Note: These actions will only work when a cell is editable and has focus. @@ -1718,7 +1693,7 @@ declare class Tabulator { */ navigateDown: () => void; - /**A lot of the modules come with a range of default settings to make setting up your table easier, for example the sorters, formatters and editors that ship with Tabulator as standard. + /** A lot of the modules come with a range of default settings to make setting up your table easier, for example the sorters, formatters and editors that ship with Tabulator as standard. If you are using a lot of custom settings over and over again (for example a custom sorter). you can end up re-delcaring it several time for different tables. To make your life easier Tabulator allows you to extend the default setup of each module to make your custom options as easily accessible as the defaults. diff --git a/types/tabulator-tables/tabulator-tables-tests.ts b/types/tabulator-tables/tabulator-tables-tests.ts index 470dce2c76..3a33817b4f 100644 --- a/types/tabulator-tables/tabulator-tables-tests.ts +++ b/types/tabulator-tables/tabulator-tables-tests.ts @@ -1,37 +1,40 @@ -//constructor +// tslint:disable:no-object-literal-type-assertion +// tslint:disable:whitespace + +// constructor let table = new Tabulator("#test"); table.copyToClipboard("selection"); table.searchRows("name", "<", 3); table.setFilter("name", "<=", 3); table.setFilter([ - { field: "age", type: ">", value: 52 }, //filter by age greater than 52 - { field: "height", type: "<", value: 142 }, //and by height less than 142 - { field: "name", type: "in", value: ["steve", "bob", "jim"] } //name must be steve, bob or jim + { field: "age", type: ">", value: 52 }, // filter by age greater than 52 + { field: "height", type: "<", value: 142 }, // and by height less than 142 + { field: "name", type: "in", value: ["steve", "bob", "jim"] } // name must be steve, bob or jim ]); table.setFilter( (data, filterParams) => { - //data - the data for the row being filtered - //filterParams - params object passed to the filter - return data.name == "bob" && data.height < filterParams.height; //must return a boolean, true if it passes the filter. + // data - the data for the row being filtered + // filterParams - params object passed to the filter + return data.name === "bob" && data.height < filterParams.height; // must return a boolean, true if it passes the filter. }, { height: 3 } ); table.setFilter("age", "in", ["steve", "bob", "jim"]); table.setFilter([ - { field: "age", type: ">", value: 52 }, //filter by age greater than 52 + { field: "age", type: ">", value: 52 }, // filter by age greater than 52 [ - { field: "height", type: "<", value: 142 }, //with a height of less than 142 - { field: "name", type: "=", value: "steve" } //or a name of steve + { field: "height", type: "<", value: 142 }, // with a height of less than 142 + { field: "name", type: "=", value: "steve" } // or a name of steve ] ]); table .setPageToRow(12) - .then(function() { - //run code after table has been successfuly updated + .then(() => { + // run code after table has been successfuly updated }) - .catch(function(error) { - //handle error loading data + .catch(error => { + // handle error loading data }); table.setGroupBy("gender"); @@ -45,48 +48,50 @@ table.setGroupHeader((value, count, data) => { }); table.setSort([ - { column: "age", dir: "asc" }, //sort by this first - { column: "height", dir: "desc" } //then sort by this second + { column: "age", dir: "asc" }, // sort by this first + { column: "height", dir: "desc" } // then sort by this second ]); table .scrollToColumn("age", "middle", false) - .then(function() { - //run code after column has been scrolled to + .then(() => { + // run code after column has been scrolled to }) - .catch(function(error) { - //handle error scrolling to column + .catch(error => { + // handle error scrolling to column }); table .updateOrAddData([{ id: 1, name: "bob" }, { id: 3, name: "steve" }]) - .then(function(rows) { - //rows - array of the row components for the rows updated or added - //run code after data has been updated + .then(rows => { + // rows - array of the row components for the rows updated or added + // run code after data has been updated }) - .catch(function(error) { - //handle error updating data + .catch(error => { + // handle error updating data }); table.updateData([{ id: 1, name: "bob", gender: "male" }, { id: 2, name: "Jenny", gender: "female" }]); table .updateData([{ id: 1, name: "bob" }]) - .then(function() { - //run code after data has been updated + .then(() => { + // run code after data has been updated }) - .catch(function(error) { - //handle error updating data + .catch(error => { + // handle error updating data }); let row1: Tabulator.RowComponent; let row2: Tabulator.RowComponent; -//column definitions -let colDef: Tabulator.ColumnDefinition = {} as Tabulator.ColumnDefinition; -colDef.title = "title"; +// column definitions +let colDef: Tabulator.ColumnDefinition = { title: "title" }; colDef.sorter = customSorter; -function customSorter(a: any, b: any, aRow: Tabulator.RowComponent, bRow: Tabulator.RowComponent, column: Tabulator.ColumnComponent, dir: Tabulator.SortDirection, sorterParams: Tabulator.ColumnDefinitionSorterParams): number { +// prettier-ignore +function customSorter(a: any, b: any, aRow: Tabulator.RowComponent, + bRow: Tabulator.RowComponent, column: Tabulator.ColumnComponent, + dir: Tabulator.SortDirection, sorterParams: Tabulator.ColumnDefinitionSorterParams): number { return 1; } @@ -101,20 +106,20 @@ colDef.formatterParams = { }; colDef.formatterParams = cell => { - //cell - the cell component + // cell - the cell component - //do some processing and return the param object + // do some processing and return the param object return { param1: "green" }; }; -//List lookup +// List lookup colDef.formatterParams = { small: "Cute", medium: "Fine", big: 2, huge: true }; -//Custom Formatter +// Custom Formatter colDef.formatter = (cell: Tabulator.CellComponent, formatterParams: {}, onRendered) => { onRendered = () => {}; return ""; @@ -122,33 +127,33 @@ colDef.formatter = (cell: Tabulator.CellComponent, formatterParams: {}, onRender colDef.editor = true; colDef.editor = "number"; -colDef.editor = function(cell, onRendered, success, cancel, editorParams) { - //cell - the cell component for the editable cell - //onRendered - function to call when the editor has been rendered - //success - function to call to pass the successfuly updated value to Tabulator - //cancel - function to call to abort the edit and return to a normal cell - //editorParams - params object passed into the editorParams column definition property +colDef.editor = (cell, onRendered, success, cancel, editorParams) => { + // cell - the cell component for the editable cell + // onRendered - function to call when the editor has been rendered + // success - function to call to pass the successfuly updated value to Tabulator + // cancel - function to call to abort the edit and return to a normal cell + // editorParams - params object passed into the editorParams column definition property - //create and style editor - var editor = document.createElement("input"); + // create and style editor + const editor = document.createElement("input"); editor.setAttribute("type", "date"); - //create and style input + // create and style input editor.style.padding = "3px"; editor.style.width = "100%"; editor.style.boxSizing = "border-box"; - //Set value of editor to the current value of the cell + // Set value of editor to the current value of the cell editor.value = moment(cell.getValue(), "DD/MM/YYYY"); - //set focus on the select box when the editor is selected (timeout allows for editor to be added to DOM) - onRendered(function() { + // set focus on the select box when the editor is selected (timeout allows for editor to be added to DOM) + onRendered(() => { editor.focus(); editor.style.cssText = "100%"; }); - //when the value has been set, trigger the cell to update + // when the value has been set, trigger the cell to update function successFunc() { success(moment(editor.value, "YYYY-MM-DD")); } @@ -156,10 +161,10 @@ colDef.editor = function(cell, onRendered, success, cancel, editorParams) { editor.addEventListener("change", successFunc); editor.addEventListener("blur", successFunc); - //return the editor element + // return the editor element return editor; }; -//Dummy function +// Dummy function function moment(a: any, b: any) { return ""; } @@ -174,10 +179,10 @@ colDef.editorParams = {}; colDef.editorParams = { values: [ { - //option group + // option group label: "Men", options: [ - //options in option group + // options in option group { label: "Steve Boberson", value: "steve" @@ -189,10 +194,10 @@ colDef.editorParams = { ] }, { - //option group + // option group label: "Women", options: [ - //options in option group + // options in option group { label: "Jenny Jillerson", value: "jenny" @@ -204,7 +209,7 @@ colDef.editorParams = { ] }, { - //ungrouped option + // ungrouped option label: "Other", value: "other" } @@ -221,34 +226,34 @@ colDef.editorParams = { values: selectParamValues }; -colDef.editorParams = function(cell) { +colDef.editorParams = cell => { return {}; }; let autoComplete: Tabulator.AutoCompleteParams = { - showListOnEmpty: true, //show all values when the list is empty, - freetext: true, //allow the user to set the value of the cell to a free text entry - allowEmpty: true, //allow empty string values + showListOnEmpty: true, // show all values when the list is empty, + freetext: true, // allow the user to set the value of the cell to a free text entry + allowEmpty: true, // allow empty string values searchFunc: (term, values) => { - //search for exact matches - var matches: string[] = []; + // search for exact matches + const matches: string[] = []; return matches; }, - listItemFormatter: function(value, title) { - //prefix all titles with the work "Mr" + listItemFormatter: (value, title) => { + // prefix all titles with the work "Mr" return "Mr " + title; }, - values: true //create list of values from all values contained in this column + values: true // create list of values from all values contained in this column }; colDef.editorParams = autoComplete; colDef.editorParams = { values: [ { - //option group + // option group label: "Men", options: [ - //options in option group + // options in option group { label: "Steve Boberson", value: "steve" @@ -260,10 +265,10 @@ colDef.editorParams = { ] }, { - //option group + // option group label: "Women", options: [ - //options in option group + // options in option group { label: "Jenny Jillerson", value: "jenny" @@ -275,14 +280,14 @@ colDef.editorParams = { ] }, { - //ungrouped option + // ungrouped option label: "Other", value: "other" } ] }; -//Validators +// Validators colDef.validator = { type: (cell, value, parameters) => { return true; @@ -306,59 +311,60 @@ let validators: Tabulator.Validator[] = [ colDef.headerFilterFunc = "!="; colDef.headerFilterFunc = (headerValue, rowValue, rowData, filterParams) => { - return rowData.name == filterParams.name && rowValue < headerValue; //must return a boolean, true if it passes the filter. + return rowData.name === filterParams.name && rowValue < headerValue; // must return a boolean, true if it passes the filter. }; -//Cell Component -let cell: Tabulator.CellComponent = {} as Tabulator.CellComponent; +// Cell Component + +let cell = {}; cell.nav().down(); let data = cell.getData(); table = cell.getTable(); -//Row Component -let row: Tabulator.RowComponent = {} as Tabulator.RowComponent; +// Row Component +let row = {}; row.delete() - .then(function() { - //run code after row has been deleted + .then(() => { + // run code after row has been deleted }) - .catch(function(error) { - //handle error deleting row + .catch(error => { + // handle error deleting row }); -//Options -let options: Tabulator.Options = {} as Tabulator.Options; +// Options +let options = {}; options.keybindings = { navPrev: "ctrl + 1", navNext: false }; options.downloadDataFormatter = data => { - // data.forEach(function(row){ - // row.age = row.age >= 18 ? "adult" : "child"; + // data.forEach(function(row){ + // row.age = row.age >= 18 ? "adult" : "child"; }; options.downloadConfig = { - columnGroups: false, //include column groups in column headers for download - rowGroups: false, //do not include row groups in download - columnCalcs: false //do not include column calculation rows in download + columnGroups: false, // include column groups in column headers for download + rowGroups: false, // do not include row groups in download + columnCalcs: false // do not include column calculation rows in download }; options.ajaxConfig = "GET"; options.ajaxConfig = { - mode: "cors", //set request mode to cors - credentials: "same-origin", //send cookies with the request from the matching origin + mode: "cors", // set request mode to cors + credentials: "same-origin", // send cookies with the request from the matching origin headers: { - Accept: "application/json", //tell the server we need JSON back - "X-Requested-With": "XMLHttpRequest", //fix to help some frameworks respond correctly to request - "Content-type": "application/json; charset=utf-8", //set the character encoding of the request - "Access-Control-Allow-Origin": "http://yout-site.com" //the URL origin of the site making the request + Accept: "application/json", // tell the server we need JSON back + "X-Requested-With": "XMLHttpRequest", // fix to help some frameworks respond correctly to request + "Content-type": "application/json; charset=utf-8", // set the character encoding of the request + "Access-Control-Allow-Origin": "http:// yout-site.com" // the URL origin of the site making the request } }; options.ajaxConfig = { - method: "POST", //set request type to Position + method: "POST", // set request type to Position headers: { - "Content-type": "application/json; charset=utf-8" //set specific content type + "Content-type": "application/json; charset=utf-8" // set specific content type } }; @@ -366,16 +372,16 @@ options.ajaxContentType = { headers: { "Content-Type": "text/html" }, - body: function(url, config, params) { - //url - the url of the request - //config - the fetch config object - //params - the request parameters + body: (url, config, params) => { + // url - the url of the request + // config - the fetch config object + // params - the request parameters - //return comma list of params:values - var output = []; + // return comma list of params:values + const output = []; - for (var key in params) { - output.push(key + ":" + params[key]); + for (const key in params) { + output.push(`${key} ":" ${params[key]}`); } return output.join(","); @@ -385,31 +391,31 @@ options.ajaxContentType = { options.initialSort = [{ column: "name", dir: "asc" }, { column: "name2", dir: "desc" }]; options.initialFilter = [{ field: "color", type: "=", value: "red" }]; options.initialHeaderFilter = [ - { field: "color", value: "red" } //set the initial value of the header filter to "red" + { field: "color", value: "red" } // set the initial value of the header filter to "red" ]; options.groupValues = [ - ["red", "blue", "green"], //create groups for color values of "red", "blue", and "green", - [10, 20, 30] //create sub groups for ages of 10, 20 and 30 + ["red", "blue", "green"], // create groups for color values of "red", "blue", and "green", + [10, 20, 30] // create sub groups for ages of 10, 20 and 30 ]; options.groupHeader = (value, count, data, group) => { - //value - the value all members of this group share - //count - the number of rows in this group - //data - an array of all the row data objects in this group - //group - the group component for the group + // value - the value all members of this group share + // count - the number of rows in this group + // data - an array of all the row data objects in this group + // group - the group component for the group - return value + "(" + count + " item)"; + return `${value} (${count}item)`; }; options.groupHeader = [ - function(value, count, data) { - //generate header contents for gender groups - return value + "(" + count + " item)"; + (value, count, data) => { + // generate header contents for gender groups + return `${value} (${count}item)`; }, - function(value, count, data) { - //generate header contents for color groups - return value + "(" + count + " item)"; + (value, count, data) => { + // generate header contents for color groups + return `${value} (${count}item)`; } ]; @@ -419,7 +425,7 @@ options.paginationDataReceived = { }; options.clipboardPasteParser = clipboard => { - return []; //return array + return []; // return array }; options.cellEditing = cell => { From 44c10e7262bd247dfce56590136beebd13ec49c3 Mon Sep 17 00:00:00 2001 From: Alan Choi Date: Thu, 7 Mar 2019 10:13:58 +0900 Subject: [PATCH 186/265] keep element type when string literal array passed When select options is an array of string literal union type, select must return the same type of value. --- types/storybook__addon-knobs/index.d.ts | 1 + .../storybook__addon-knobs-tests.tsx | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index 3aab101f74..dbfd84a13d 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -52,6 +52,7 @@ export function object(name: string, value: T, groupId?: string): T; export function radios(name: string, options: { [s: string]: T }, value?: T, groupId?: string): string; export function select(name: string, options: { [s: string]: T }, value: T, groupId?: string): T; +export function select(name: string, options: ReadonlyArray, value: T, groupId?: string): T; export function select(name: string, options: ReadonlyArray, value: string, groupId?: string): string; export function date(name: string, value?: Date, groupId?: string): Date; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index 75ab4c79a9..d09447f75d 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -94,7 +94,15 @@ stories.add('dynamic knobs', () => { }); const readonlyOptionsArray: ReadonlyArray = ['hi']; -select('With readonly array', readonlyOptionsArray, readonlyOptionsArray[0]); +select('With readonly string array', readonlyOptionsArray, readonlyOptionsArray[0]); + +type StringLiteralType = 'Apple' | 'Banana' | 'Grapes'; +const stringLiteralArray: StringLiteralType[] = ['Apple', 'Banana', 'Grapes']; + +let selectedFruit: StringLiteralType; + +// type of value returned from `select` must be `StringLiteralType`. +selectedFruit = select('With string literal array', stringLiteralArray, stringLiteralArray[0]); const optionsObject = { Apple: { taste: 'sweet', color: 'red' }, From 7d67be826cc8c13f7cd238167204704a9408a045 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 6 Mar 2019 19:33:09 -0800 Subject: [PATCH 187/265] Try to add conditional update-codeowners to travis --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9bd31bda14..fa657d16d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,15 @@ sudo: false notifications: email: false + +jobs: + include: + - stage: build + script: npm install + script: npm run build + script: npm run test + - stage: codeowners + script: npm run update-codeowners +stages: + - name: codeowners + if: env(TRAVIS_EVENT_TYPE) = cron \ No newline at end of file From 704068364b2b32773ca32a8b2178625dec4715f7 Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Thu, 7 Mar 2019 14:26:10 +0800 Subject: [PATCH 188/265] [amap-js-api] merge test file & update lint rule --- types/amap-js-api/amap-js-api-tests.ts | 3376 +++++++++++++++++ types/amap-js-api/index.d.ts | 2 +- types/amap-js-api/overlay/markerShape.d.ts | 2 +- types/amap-js-api/test/arryBounds.ts | 18 - types/amap-js-api/test/bounds.ts | 30 - types/amap-js-api/test/browser.ts | 141 - types/amap-js-api/test/convert-from.ts | 25 - types/amap-js-api/test/dom-util.ts | 47 - types/amap-js-api/test/event.ts | 74 - types/amap-js-api/test/geometry-util.ts | 158 - types/amap-js-api/test/layer/buildings.ts | 40 - types/amap-js-api/test/layer/canvasLayer.ts | 53 - types/amap-js-api/test/layer/flexible.ts | 54 - types/amap-js-api/test/layer/imageLayer.ts | 51 - types/amap-js-api/test/layer/layer.ts | 34 - types/amap-js-api/test/layer/layerGroup.ts | 115 - types/amap-js-api/test/layer/massMarks.ts | 83 - types/amap-js-api/test/layer/tileLayer.ts | 60 - types/amap-js-api/test/layer/videoLayer.ts | 51 - types/amap-js-api/test/layer/wms.ts | 89 - types/amap-js-api/test/layer/wmts.ts | 69 - types/amap-js-api/test/lnglat.ts | 48 - types/amap-js-api/test/map.ts | 338 -- types/amap-js-api/test/overlay/bezierCurve.ts | 155 - types/amap-js-api/test/overlay/circle.ts | 150 - types/amap-js-api/test/overlay/contextMenu.ts | 48 - types/amap-js-api/test/overlay/ellipse.ts | 117 - types/amap-js-api/test/overlay/geoJSON.ts | 106 - types/amap-js-api/test/overlay/icon.ts | 32 - types/amap-js-api/test/overlay/infoWindow.ts | 81 - types/amap-js-api/test/overlay/marker.ts | 195 - types/amap-js-api/test/overlay/markerShape.ts | 26 - types/amap-js-api/test/overlay/overlay.ts | 27 - .../amap-js-api/test/overlay/overlayGroup.ts | 108 - types/amap-js-api/test/overlay/polygon.ts | 123 - types/amap-js-api/test/overlay/polyline.ts | 139 - types/amap-js-api/test/overlay/rectangle.ts | 121 - types/amap-js-api/test/overlay/text.ts | 169 - types/amap-js-api/test/pixel.ts | 42 - types/amap-js-api/test/preset.ts | 29 - types/amap-js-api/test/size.ts | 16 - types/amap-js-api/test/util.ts | 79 - types/amap-js-api/test/view2d.ts | 22 - types/amap-js-api/tsconfig.json | 43 +- types/amap-js-api/tslint.json | 9 +- 45 files changed, 3381 insertions(+), 3414 deletions(-) create mode 100644 types/amap-js-api/amap-js-api-tests.ts delete mode 100644 types/amap-js-api/test/arryBounds.ts delete mode 100644 types/amap-js-api/test/bounds.ts delete mode 100644 types/amap-js-api/test/browser.ts delete mode 100644 types/amap-js-api/test/convert-from.ts delete mode 100644 types/amap-js-api/test/dom-util.ts delete mode 100644 types/amap-js-api/test/event.ts delete mode 100644 types/amap-js-api/test/geometry-util.ts delete mode 100644 types/amap-js-api/test/layer/buildings.ts delete mode 100644 types/amap-js-api/test/layer/canvasLayer.ts delete mode 100644 types/amap-js-api/test/layer/flexible.ts delete mode 100644 types/amap-js-api/test/layer/imageLayer.ts delete mode 100644 types/amap-js-api/test/layer/layer.ts delete mode 100644 types/amap-js-api/test/layer/layerGroup.ts delete mode 100644 types/amap-js-api/test/layer/massMarks.ts delete mode 100644 types/amap-js-api/test/layer/tileLayer.ts delete mode 100644 types/amap-js-api/test/layer/videoLayer.ts delete mode 100644 types/amap-js-api/test/layer/wms.ts delete mode 100644 types/amap-js-api/test/layer/wmts.ts delete mode 100644 types/amap-js-api/test/lnglat.ts delete mode 100644 types/amap-js-api/test/map.ts delete mode 100644 types/amap-js-api/test/overlay/bezierCurve.ts delete mode 100644 types/amap-js-api/test/overlay/circle.ts delete mode 100644 types/amap-js-api/test/overlay/contextMenu.ts delete mode 100644 types/amap-js-api/test/overlay/ellipse.ts delete mode 100644 types/amap-js-api/test/overlay/geoJSON.ts delete mode 100644 types/amap-js-api/test/overlay/icon.ts delete mode 100644 types/amap-js-api/test/overlay/infoWindow.ts delete mode 100644 types/amap-js-api/test/overlay/marker.ts delete mode 100644 types/amap-js-api/test/overlay/markerShape.ts delete mode 100644 types/amap-js-api/test/overlay/overlay.ts delete mode 100644 types/amap-js-api/test/overlay/overlayGroup.ts delete mode 100644 types/amap-js-api/test/overlay/polygon.ts delete mode 100644 types/amap-js-api/test/overlay/polyline.ts delete mode 100644 types/amap-js-api/test/overlay/rectangle.ts delete mode 100644 types/amap-js-api/test/overlay/text.ts delete mode 100644 types/amap-js-api/test/pixel.ts delete mode 100644 types/amap-js-api/test/preset.ts delete mode 100644 types/amap-js-api/test/size.ts delete mode 100644 types/amap-js-api/test/util.ts delete mode 100644 types/amap-js-api/test/view2d.ts diff --git a/types/amap-js-api/amap-js-api-tests.ts b/types/amap-js-api/amap-js-api-tests.ts new file mode 100644 index 0000000000..41b0638526 --- /dev/null +++ b/types/amap-js-api/amap-js-api-tests.ts @@ -0,0 +1,3376 @@ +/** + * preset.ts + */ + +declare const map: AMap.Map; +declare const lnglat: AMap.LngLat; +declare const size: AMap.Size; +declare const lnglatTuple: [number, number]; +declare const pixel: AMap.Pixel; +declare const markerShape: AMap.MarkerShape; +declare const icon: AMap.Icon; +declare const bounds: AMap.Bounds; +declare const div: HTMLDivElement; +declare const lang: AMap.Lang; +declare const domEle: HTMLElement; +declare const canvasEle: HTMLCanvasElement; +declare const imgEle: HTMLImageElement; + +declare const circle: AMap.Circle; +declare const marker: AMap.Marker; +declare const layer: AMap.Layer; +declare const tileLayer: AMap.TileLayer; +declare const massMarksLayer: AMap.MassMarks; + +// declare const videoLayer: AMap.VideoLayer; +// declare const buildings: AMap.Buildings; +// declare const canvasLayer: AMap.CanvasLayer; +// declare const flexible: AMap.TileLayer.Flexible; +// declare const imageLayer: AMap.ImageLayer; +// declare const tileLayerGroup: AMap.LayerGroup; +// declare const layerGroup: AMap.LayerGroup; +// declare const trafficLayer: AMap.TileLayer.Traffic; +// declare const bezierCurve: AMap.BezierCurve; +// declare const contextMenu: AMap.ContextMenu; +// declare const polyline: AMap.Polyline; +// declare const polygon: AMap.Polygon; + +/** + * arryBounds.ts + */ + +// $ExpectType ArrayBounds +const testArrayBounds = new AMap.ArrayBounds([lnglat, lnglat, lnglat]); + +// $ExpectType LngLat[] +testArrayBounds.bounds; + +// $ExpectType boolean +testArrayBounds.contains(lnglat); + +// $ExpectType Bounds +testArrayBounds.toBounds(); + +// $ExpectType LngLat +testArrayBounds.getCenter(); + +/** + * bounds.ts + */ + +// $ExpectType Bounds +const testBounds = new AMap.Bounds(lnglat, lnglat); + +// $ExpectType boolean +testBounds.contains(lnglat); +// $ExpectType boolean +testBounds.contains(lnglatTuple); + +// $ExpectType LngLat +testBounds.getCenter(); + +// $ExpectType LngLat +testBounds.getSouthWest(); + +// $ExpectType LngLat +testBounds.getSouthEast(); + +// $ExpectType LngLat +testBounds.getNorthEast(); + +// $ExpectType LngLat +testBounds.getNorthWest(); + +// $ExpectType string +testBounds.toString(); + +/** + * browser.ts + */ + +const brwoser = AMap.Browser; + +// $ExpectType string +brwoser.ua; + +// $ExpectType boolean +brwoser.mobile; + +const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other' = brwoser.plat; + +// $ExpectType boolean +brwoser.mac; + +// $ExpectType boolean +brwoser.windows; + +// $ExpectType boolean +brwoser.ios; + +// $ExpectType boolean +brwoser.iPad; + +// $ExpectType boolean +brwoser.iPhone; + +// $ExpectType boolean +brwoser.android; + +// $ExpectType boolean +brwoser.android23; + +// $ExpectType boolean +brwoser.chrome; + +// $ExpectType boolean +brwoser.firefox; + +// $ExpectType boolean +brwoser.safari; + +// $ExpectType boolean +brwoser.wechat; + +// $ExpectType boolean +brwoser.uc; + +// $ExpectType boolean +brwoser.qq; + +// $ExpectType boolean +brwoser.ie; + +// $ExpectType boolean +brwoser.ie6; + +// $ExpectType boolean +brwoser.ie7; + +// $ExpectType boolean +brwoser.ie8; + +// $ExpectType boolean +brwoser.ie9; + +// $ExpectType boolean +brwoser.ie10; + +// $ExpectType boolean +brwoser.ie11; + +// $ExpectType boolean +brwoser.edge; + +// $ExpectType boolean +brwoser.ielt9; + +// $ExpectType boolean +brwoser.baidu; + +// $ExpectType boolean +brwoser.isLocalStorage; + +// $ExpectType boolean +brwoser.isGeolocation; + +// $ExpectType boolean +brwoser.mobileWebkit; + +// $ExpectType boolean +brwoser.mobileWebkit3d; + +// $ExpectType boolean +brwoser.mobileOpera; + +// $ExpectType boolean +brwoser.retina; + +// $ExpectType boolean +brwoser.touch; + +// $ExpectType boolean +brwoser.msPointer; + +// $ExpectType boolean +brwoser.pointer; + +// $ExpectType boolean +brwoser.webkit; + +// $ExpectType boolean +brwoser.ie3d; + +// $ExpectType boolean +brwoser.webkit3d; + +// $ExpectType boolean +brwoser.gecko3d; + +// $ExpectType boolean +brwoser.opera3d; + +// $ExpectType boolean +brwoser.any3d; + +// $ExpectType boolean +brwoser.isCanvas; + +// $ExpectType boolean +brwoser.isSvg; + +// $ExpectType boolean +brwoser.isVML; + +// $ExpectType boolean +brwoser.isWorker; + +// $ExpectType boolean +brwoser.isWebsocket; + +// $ExpectType boolean +brwoser.isWebGL(); + +/** + * convert-from.ts + */ + +declare const convertType: 'baidu' | 'mapbar' | 'gps' | null; +// $ExpectType void +AMap.convertFrom(lnglat, convertType, (status, result) => { + const temp: 'complete' | 'error' = status; + if (typeof result !== 'string') { + // $ExpectType string + result.info; + // $ExpectType LngLat[] + result.locations; + } else { + // $ExpectType string + result; + } +}); +// $ExpectType void +AMap.convertFrom([lnglat], null, () => { }); +// $ExpectType void +AMap.convertFrom(lnglatTuple, null, () => { }); +// $ExpectType void +AMap.convertFrom([lnglatTuple], null, () => { }); + +/** + * dom-util.ts + */ + +const domUtil = AMap.DomUtil; + +// $ExpectType Size +domUtil.getViewport(div); + +// $ExpectType Pixel +domUtil.getViewportOffset(div); + +// $ExpectType HTMLDivElement +domUtil.create('div'); +// $ExpectType HTMLAnchorElement +domUtil.create('a'); +// $ExpectType HTMLDivElement +domUtil.create('div', div); +// $ExpectType HTMLDivElement +domUtil.create('div', div, 'className'); + +// $ExpectType void +domUtil.setClass(div); +// $ExpectType void +domUtil.setClass(div, 'className'); + +// $ExpectType boolean +domUtil.hasClass(div, 'className'); + +// $ExpectType void +domUtil.removeClass(div, 'className'); + +// $ExpectType void +domUtil.setOpacity(div, 1); + +// $ExpectType void +domUtil.rotate(div, 10); +// $ExpectType void +domUtil.rotate(div, 10, { x: 10, y: 10 }); + +const util2: typeof AMap.DomUtil = domUtil.setCss(div, { textAlign: 'left' }); +// $ExpectError +domUtil.setCss(div, { textAlign: 10 }); + +// $ExpectType void +domUtil.empty(div); + +// $ExpectType void +domUtil.remove(div); + +/** + * event.ts + */ + +// $ExpectType Map +map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; +}); + +// $ExpectType EventListener<0> +AMap.event.addDomListener(div, 'click', event => { + // $ExpectType number + event.clientX; +}); + +// $ExpectType EventListener<1> +AMap.event.addListener(map, 'hotspotclick', function(event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); +AMap.event.addListener(map, 'click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); + +// $ExpectType EventListener<1> +const eventListener = AMap.event.addListenerOnce(map, 'hotspotclick', function(event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +AMap.event.removeListener(eventListener); + +// $ExpectType void +AMap.event.trigger(map, 'click', { + lnglat, + pixel, + target: map +}); +// $ExpectType void +AMap.event.trigger(map, 'hotspotclick', { + lnglat, + name: 'name', + id: 'id', + isIndoorPOI: true +}); +// $ExpectType void +AMap.event.trigger(map, 'complete'); + +/** + * geometry-util.ts + */ + +{ + const point = lnglat; + const pointTuple = lnglatTuple; + const line = [point]; + const lineTuple = [pointTuple]; + const ring = [point]; + const ringTuple = [pointTuple]; + const polygon = [ring]; + const polygonTuple = [ringTuple]; + const geometryUtil = AMap.GeometryUtil; + + // $ExpectType number + geometryUtil.distance(point, point); + // $ExpectType number + geometryUtil.distance(pointTuple, pointTuple); + // $ExpectType number + geometryUtil.distance(point, line); + // $ExpectType number + geometryUtil.distance(pointTuple, lineTuple); + + // $ExpectType number + geometryUtil.ringArea(ring); + // $ExpectType number + geometryUtil.ringArea(ringTuple); + + // $ExpectType boolean + geometryUtil.isClockwise(ring); + // $ExpectType boolean + geometryUtil.isClockwise(ringTuple); + + // $ExpectType number + geometryUtil.distanceOfLine(line); + // $ExpectType number + geometryUtil.distanceOfLine(lineTuple); + + // $ExpectType [number, number][] + geometryUtil.ringRingClip(ring, ring); + // $ExpectType [number, number][] + geometryUtil.ringRingClip(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesRingRingIntersect(ring, ring); + // $ExpectType boolean + geometryUtil.doesRingRingIntersect(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesLineRingIntersect(line, ring); + // $ExpectType boolean + geometryUtil.doesLineRingIntersect(lineTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesLineLineIntersect(line, line); + // $ExpectType boolean + geometryUtil.doesLineLineIntersect(lineTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentPolygonIntersect(point, point, polygon); + // $ExpectType boolean + geometryUtil.doesSegmentPolygonIntersect(pointTuple, pointTuple, polygonTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentRingIntersect(point, point, ring); + // $ExpectType boolean + geometryUtil.doesSegmentRingIntersect(pointTuple, pointTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentLineIntersect(point, point, line); + // $ExpectType boolean + geometryUtil.doesSegmentLineIntersect(pointTuple, pointTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentsIntersect(point, point, point, point); + // $ExpectType boolean + geometryUtil.doesSegmentsIntersect(pointTuple, pointTuple, pointTuple, pointTuple); + + // $ExpectType boolean + geometryUtil.isPointInRing(point, ring); + // $ExpectType boolean + geometryUtil.isPointInRing(pointTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.isRingInRing(ring, ring); + // $ExpectType boolean + geometryUtil.isRingInRing(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.isPointInPolygon(point, polygon); + // $ExpectType boolean + geometryUtil.isPointInPolygon(pointTuple, polygonTuple); + + // $ExpectType [number, number][] + geometryUtil.makesureClockwise(lineTuple); + + // $ExpectType [number, number][] + geometryUtil.makesureAntiClockwise(lineTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnSegment(point, point, point); + // $ExpectType [number, number] + geometryUtil.closestOnSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnSegment(point, point, point); + // $ExpectType [number, number] + geometryUtil.closestOnSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnLine(point, line); + // $ExpectType [number, number] + geometryUtil.closestOnLine(pointTuple, lineTuple); + + // $ExpectType number + geometryUtil.distanceToSegment(point, point, point); + // $ExpectType number + geometryUtil.distanceToSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType number + geometryUtil.distanceToLine(point, line); + // $ExpectType number + geometryUtil.distanceToLine(pointTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.isPointOnSegment(point, point, point); + // $ExpectType boolean + geometryUtil.isPointOnSegment(point, point, point, 1); + // $ExpectType boolean + geometryUtil.isPointOnSegment(pointTuple, pointTuple, pointTuple); + // $ExpectType boolean + geometryUtil.isPointOnSegment(pointTuple, pointTuple, pointTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnLine(point, line); + // $ExpectType boolean + geometryUtil.isPointOnLine(point, line, 1); + // $ExpectType boolean + geometryUtil.isPointOnLine(pointTuple, lineTuple); + // $ExpectType boolean + geometryUtil.isPointOnLine(pointTuple, lineTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnRing(point, ring); + // $ExpectType boolean + geometryUtil.isPointOnRing(point, ring, 1); + // $ExpectType boolean + geometryUtil.isPointOnRing(pointTuple, ringTuple); + // $ExpectType boolean + geometryUtil.isPointOnRing(pointTuple, ringTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnPolygon(point, polygon); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(point, polygon, 1); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(pointTuple, polygonTuple); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(pointTuple, polygonTuple, 1); +} + +/** + * lnglat.ts + */ + +// $ExpectType LngLat +new AMap.LngLat(114, 22); +// $ExpectType LngLat +const testLnglat = new AMap.LngLat(113, 21); + +// $ExpectType LngLat +testLnglat.offset(1, 2); + +// $ExpectType number +testLnglat.distance(testLnglat); +// $ExpectType number +testLnglat.distance([testLnglat]); + +// $ExpectType number +testLnglat.getLng(); + +// $ExpectType number +testLnglat.getLat(); + +// $ExpectType boolean +testLnglat.equals(testLnglat); + +// $ExpectType string +testLnglat.toString(); + +// $ExpectType LngLat +testLnglat.add(testLnglat); +// $ExpectType LngLat +testLnglat.add(testLnglat, true); + +// $ExpectType LngLat +testLnglat.subtract(testLnglat); +// $ExpectType LngLat +testLnglat.subtract(testLnglat, true); + +// $ExpectType LngLat +testLnglat.divideBy(1); +// $ExpectType LngLat +testLnglat.divideBy(1, true); + +// $ExpectType LngLat +testLnglat.multiplyBy(1); +// $ExpectType LngLat +testLnglat.multiplyBy(1, true); + +/** + * map.ts + */ + +// $ExpectType Map +new AMap.Map('map'); +// $ExpectType Map +new AMap.Map(div); + +// $ExpectType Map +new AMap.Map(div, {}); + +// $ExpectType Map +const testMap = new AMap.Map(div, { + layers: [tileLayer], + zoom: 15, + center: [1, 2], + labelzIndex: 110, + zooms: [5, 15], + lang: 'zh_cn', + defaultCursor: 'default', + crs: 'EPSG4326', + animateEnable: true, + isHotspot: false, + defaultLayer: tileLayer, + rotateEnable: true, + resizeEnable: true, + showIndoorMap: true, + // indoorMap, // TODO + expandZoomRange: true, + dragEnable: true, + zoomEnable: true, + doubleClickZoom: true, + keyboardEnable: true, + jogEnable: true, + scrollWheel: true, + touchZoom: true, + mapStyle: '', + features: ['road'], + showBuildingBlock: true, + skyColor: '#fff', + preloadMode: true, + mask: [[1, 2], [2, 3], [3, 4]] +}); + +// $ExpectType number +testMap.getZoom(); + +// $ExpectType Layer[] +testMap.getLayers(); + +// $ExpectType LngLat +testMap.getCenter(); + +// $ExpectType HTMLElement | null +testMap.getContainer(); + +testMap.getCity(city => { + // $ExpectType string + city.city; + // $ExpectType string + city.citycode; + // $ExpectType string + city.district; + // $ExpectType string | never[] + city.province; +}); + +// $ExpectType Bounds +testMap.getBounds(); + +// $ExpectType number +testMap.getLabelzIndex(); + +// $ExpectType Lang +testMap.getLang(); + +// $ExpectType Size +testMap.getSize(); + +// $ExpectType number +testMap.getRotation(); + +// $ExpectType Status +const mapStatus = testMap.getStatus(); +// $ExpectType boolean +mapStatus.animateEnable; +// $ExpectType boolean +mapStatus.doubleClickZoom; +// $ExpectType boolean +mapStatus.dragEnable; +// $ExpectType boolean +mapStatus.isHotspot; +// $ExpectType boolean +mapStatus.jogEnable; +// $ExpectType boolean +mapStatus.keyboardEnable; +// $ExpectType boolean +mapStatus.pitchEnable; +// $ExpectType boolean +mapStatus.resizeEnable; +// $ExpectType boolean +mapStatus.rotateEnable; +// $ExpectType boolean +mapStatus.scrollWheel; +// $ExpectType boolean +mapStatus.touchZoom; +// $ExpectType boolean +mapStatus.zoomEnable; + +// $ExpectType string +testMap.getDefaultCursor(); + +// $ExpectType number +testMap.getResolution(); + +// $ExpectType number +testMap.getScale(); +// $ExpectType number +testMap.getScale(1); + +// $ExpectType void +testMap.setZoom(1); + +// $ExpectType void +testMap.setLabelzIndex(1); + +// $ExpectType void +testMap.setLayers([tileLayer]); + +// $ExpectType void +testMap.setCenter(lnglat); +// $ExpectType void +testMap.setCenter([1, 2]); + +// $ExpectType void +testMap.setZoomAndCenter(13, lnglat); +// $ExpectType void +testMap.setZoomAndCenter(13, [1, 2]); + +// $ExpectType void +testMap.setCity('city', (coord, zoom) => { + // $ExpectType string + coord[0]; + // $ExpectType string + coord[1]; + // $ExpectType number + zoom; +}); + +// $ExpectType Bounds +testMap.setBounds(bounds); + +// $ExpectType void +testMap.setLimitBounds(bounds); + +// $ExpectType void +testMap.clearLimitBounds(); + +// $ExpectType void +testMap.setLang('zh_cn'); + +// $ExpectType void +testMap.setRotation(1); + +// $ExpectType void +testMap.setStatus({}); +// $ExpectType void +testMap.setStatus({ + animateEnable: true, + doubleClickZoom: true, + dragEnable: true, + isHotspot: true, + jogEnable: true, + keyboardEnable: true, + pitchEnable: false, + resizeEnable: false, + rotateEnable: false, + scrollWheel: true, + touchZoom: true, + zoomEnable: true +}); + +// $ExpectType void +testMap.setDefaultCursor('default'); + +// $ExpectType void +testMap.zoomIn(); + +// $ExpectType void +testMap.zoomOut(); + +// $ExpectType void +testMap.panTo([1, 2]); +// $ExpectType void +testMap.panTo(lnglat); + +// $ExpectType void +testMap.panBy(1, 2); + +// $ExpectType void +testMap.clearMap(); + +// $ExpectType Map +testMap.plugin('plugin name', () => { }); +// $ExpectType Map +testMap.plugin(['plugin name'], () => { }); + +// $ExpectType void +testMap.clearInfoWindow(); + +// $ExpectType LngLat +testMap.pixelToLngLat(pixel); +// $ExpectType LngLat +testMap.pixelToLngLat(pixel, 1); + +// $ExpectType Pixel +testMap.lnglatToPixel(lnglat); +// $ExpectType Pixel +testMap.lnglatToPixel(lnglat, 1); + +// $ExpectType LngLat +testMap.containerToLngLat(pixel); + +// $ExpectType Pixel +testMap.lngLatToContainer(lnglat); +// $ExpectType Pixel +testMap.lnglatTocontainer(lnglat); + +// $ExpectType void +testMap.setMapStyle(''); +// $ExpectType string +testMap.getMapStyle(); + +// $ExpectType void +testMap.setFeatures('all'); +// $ExpectType void +testMap.setFeatures(['bg']); + +const feature: 'all' | 'bg' | 'point' | 'road' | 'building' | AMap.Map.Feature[] = testMap.getFeatures(); + +// $ExpectType void +testMap.setDefaultLayer(tileLayer); + +// $ExpectType void +testMap.setPitch(1); +// $ExpectType number +testMap.getPitch(); + +// $ExpectType ViewMode +testMap.getViewMode_(); + +// $ExpectType Pixel +testMap.lngLatToGeodeticCoord(lnglat); +// $ExpectType Pixel +testMap.lngLatToGeodeticCoord(lnglatTuple); + +// $ExpectType LngLat +testMap.geodeticCoordToLngLat(pixel); + +// $ExpectType void +testMap.destroy(); + +declare function dblClickHandler(this: AMap.Map, event: AMap.Map.EventMap['dblclick']): void; + +// $ExpectType Map +testMap.on('click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Pixel + event.pixel; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); +// $ExpectType Map +testMap.on('dblclick', dblClickHandler); +// $ExpectType Map +testMap.on('complete', (event: AMap.Map.EventMap['complete']) => { + // $ExpectType "complete" + event.type; + // $ExpectError + event.value; +}); +// $ExpectType Map +testMap.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType string + event.name; + // $ExpectType "hotspotclick" + event.type; +}); +// $ExpectType Map +testMap.on('custom', (event: AMap.Event<'custom', { test: string }>) => { + // $ExpectType "custom" + event.type; + // $ExpectType string + event.test; +}); + +// $ExpectType Map +testMap.off('dblclick', dblClickHandler); +// $ExpectType Map +testMap.off('click', 'mv'); + +// $ExpectType Map +testMap.emit('click', { + target: testMap, + lnglat, + pixel +}); + +testMap.emit('complete'); +// $ExpectType Map +testMap.emit('hotspotclick', { + lnglat, + name: '123', + id: '123', + isIndoorPOI: true +}); +// $ExpectType Map +testMap.emit('custom', { + test: 1 +}); +// $ExpectType Map +testMap.emit('custom', undefined); + +/** + * pixel.ts + */ + +// $ExpectType Pixel +new AMap.Pixel(10, 20); +// $ExpectType Pixel +const testPixel = new AMap.Pixel(10, 20); + +// $ExpectType number +testPixel.getX(); + +// $ExpectType number +testPixel.getY(); + +// $ExpectType boolean +testPixel.equals(testPixel); + +// $ExpectType string +testPixel.toString(); + +// $ExpectType Pixel +testPixel.add({ x: 1, y: 2 }); +// $ExpectType Pixel +testPixel.add({ x: 1, y: 2 }, false); + +// $ExpectType Pixel +testPixel.round(); + +// $ExpectType Pixel +testPixel.floor(); + +// $ExpectType number +testPixel.length(); + +// $ExpectType number | null +testPixel.direction(); + +// $ExpectType Pixel +testPixel.toFixed(); +// $ExpectType Pixel +testPixel.toFixed(2); + +/** + * size.ts + */ + +// $ExpectType Size +const testSize = new AMap.Size(10, 20); + +// $ExpectType number +testSize.getHeight(); + +// $ExpectType number +testSize.getWidth(); + +// $ExpectType string +testSize.toString(); + +// $ExpectType boolean +testSize.contains({ x: 10, y: 10 }); + +/** + * util.ts + */ + +const util = AMap.Util; + +// $ExpectType string +util.colorNameToHex('colorName'); + +// $ExpectType string +util.rgbHex2Rgba('rgbHex'); + +// $ExpectType string +util.argbHex2Rgba('argbHex'); + +// $ExpectType boolean +util.isEmpty({}); +// $ExpectError +util.isEmpty(1); + +// $ExpectType number[] +util.deleteItemFromArray([1], 1); + +// $ExpectType number[] +util.deleteItemFromArrayByIndex([1], 1); + +// $ExpectType number +util.indexOf([1], 1); +// $ExpectError +util.indexOf([1], '1'); + +// $ExpectType number +util.format(1); +// $ExpectType number +util.format(1, 1); + +declare const value1: number | number[]; +// $ExpectType boolean +util.isArray(value1); +if (util.isArray(value1)) { + // $ExpectType number[] + value1; +} else { + // $ExpectType number + value1; +} + +declare const value2: number | HTMLElement; +// $ExpectType boolean +util.isDOM(value2); +if (util.isDOM(value2)) { + // $ExpectType HTMLElement + value2; +} else { + // $ExpectType number + value2; +} + +// $ExpectType boolean +util.includes([1], 1); +// $ExpectError +util.includes([1], '1'); + +// $ExpectType number +util.requestIdleCallback(() => { }); +// $ExpectType number +const idleCallbackHandle = util.requestIdleCallback(() => { }, { timeout: 1 }); + +// $ExpectType void +util.cancelIdleCallback(idleCallbackHandle); + +// $ExpectType number +util.requestAnimFrame(() => { }); +// $ExpectType number +const animFrameHandle = util.requestAnimFrame(function() { + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +util.cancelAnimFrame(animFrameHandle); + +/** + * view2d.ts + */ + +// $ExpectType View2D +new AMap.View2D(); +// $ExpectType View2D +new AMap.View2D({}); + +// $ExpectType View2D +new AMap.View2D({ + center: [1, 2], + rotation: 1, + zoom: 10, + crs: 'EPGS3395' +}); + +// $ExpectType View2D +const testView2d = new AMap.View2D({ + center: lnglat +}); + +// $ExpectType View2D +testView2d.on('complete', () => { }); + +/** + * layer/buildings.ts + */ + +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +const testBuildings = new AMap.Buildings({ + zooms: [1, 18], + opacity: 0.8, + heightFactor: 1, + visible: true, + zIndex: 10, + map +}); + +testBuildings.setStyle({ + hideWithoutStyle: false, + areas: [ + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [[1, 2]] + }, + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [lnglat] + }, + { + color1: 'ff99ff00', + path: [lnglat] + }, + ] +}); + +/** + * layer/canvasLayer.ts + */ + +// $ExpectType CanvasLayer +new AMap.CanvasLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType CanvasLayer +new AMap.CanvasLayer(); +// $ExpectType CanvasLayer +new AMap.CanvasLayer({}); +// $ExpectType CanvasLayer +const testCanvasLayer = new AMap.CanvasLayer({ + bounds +}); + +// $ExpectType void +testCanvasLayer.setMap(null); +// $ExpectType void +testCanvasLayer.setMap(map); + +// $ExpectType Map | null | undefined +testCanvasLayer.getMap(); + +// $ExpectType void +testCanvasLayer.show(); + +// $ExpectType void +testCanvasLayer.hide(); + +// $ExpectType number +testCanvasLayer.getzIndex(); + +// $ExpectType void +testCanvasLayer.setzIndex(10); + +// $ExpectType HTMLCanvasElement | null +testCanvasLayer.getElement(); + +// $ExpectType void +testCanvasLayer.setCanvas(canvasEle); + +// $ExpectType HTMLCanvasElement | undefined +testCanvasLayer.getCanvas(); + +/** + * layer/flexible.ts + */ + +// $ExpectType Flexible +new AMap.TileLayer.Flexible(); +// $ExpectType Flexible +new AMap.TileLayer.Flexible({}); +// $ExpectType Flexible +const testFlexible = new AMap.TileLayer.Flexible({ + createTile(x, y, z, success, fail) { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + z; + // $ExpectType void + success(imgEle); + // $ExpectType void + success(canvasEle); + // $ExpectType void + fail(); + }, + cacheSize: 10, + opacity: 1, + visible: true, + map, + zIndex: 1, + zooms: [1, 2] +}); + +// $ExpectType void +testFlexible.setMap(null); +// $ExpectType void +testFlexible.setMap(map); + +// $ExpectType Map | null | undefined +testFlexible.getMap(); + +// $ExpectType void +testFlexible.show(); + +// $ExpectType void +testFlexible.hide(); + +// $ExpectType void +testFlexible.setzIndex(10); + +// $ExpectType number +testFlexible.getzIndex(); + +/** + * layer/imageLayer.ts + */ + +// $ExpectType ImageLayer +new AMap.ImageLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType ImageLayer +new AMap.ImageLayer(); +// $ExpectType ImageLayer +new AMap.ImageLayer({}); +// $ExpectType ImageLayer +const testImageLayer = new AMap.ImageLayer({ + bounds +}); + +// $ExpectType void +testImageLayer.setMap(null); +// $ExpectType void +testImageLayer.setMap(map); + +// $ExpectType Map | null | undefined +testImageLayer.getMap(); + +// $ExpectType void +testImageLayer.show(); + +// $ExpectType void +testImageLayer.hide(); + +// $ExpectType number +testImageLayer.getzIndex(); + +// $ExpectType void +testImageLayer.setzIndex(10); + +// $ExpectType HTMLImageElement | null +testImageLayer.getElement(); + +// $ExpectType void +testImageLayer.setImageUrl('url'); + +// $ExpectType string | undefined +testImageLayer.getImageUrl(); + +/** + * layer/layer.ts + */ + +// $ExpectError +new AMap.Layer(); + +// $ExpectType HTMLDivElement | undefined +layer.getContainer(); + +// $ExpectType [number, number] +layer.getZooms(); + +// $ExpectType void +layer.setOpacity(1); + +// $ExpectType number +layer.getOpacity(); + +// $ExpectType void +layer.show(); + +// $ExpectType void +layer.hide(); + +// $ExpectType void +layer.setMap(); +// $ExpectType void +layer.setMap(map); + +// $ExpectType void +layer.setzIndex(1); + +// $ExpectType number +layer.getzIndex(); + +/** + * layer/layerGroup.ts + */ + +// $ExpectError +new AMap.LayerGroup(); + +// $ExpectType LayerGroup +new AMap.LayerGroup(tileLayer); +// $ExpectType LayerGroup +const testTileLayerGroup = new AMap.LayerGroup([tileLayer]); +// $ExpectType LayerGroup +const testAnyLauerGroup = new AMap.LayerGroup([]); + +// $ExpectType LayerGroup +testTileLayerGroup.addLayer(tileLayer); +// $ExpectType LayerGroup +testTileLayerGroup.addLayer([tileLayer]); +// $ExpectError +testTileLayerGroup.addLayer(massMarksLayer); + +// $ExpectType TileLayer[] +testTileLayerGroup.getLayers(); + +// $ExpectType TileLayer | null +testTileLayerGroup.getLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); + +testTileLayerGroup.hasLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); +testTileLayerGroup.hasLayer(tileLayer); + +// $ExpectType LayerGroup +testTileLayerGroup.removeLayer(tileLayer); +// $ExpectType LayerGroup +testTileLayerGroup.removeLayer([tileLayer]); + +// $ExpectType LayerGroup +testTileLayerGroup.clearLayers(); + +testTileLayerGroup.eachLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType TileLayer + this; +}); +testTileLayerGroup.eachLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType LayerGroup +testTileLayerGroup.setMap(map); + +// $ExpectType LayerGroup +testTileLayerGroup.hide(); + +// $ExpectType LayerGroup +testTileLayerGroup.show(); + +// $ExpectType LayerGroup +testTileLayerGroup.reload(); + +// $ExpectType LayerGroup +testTileLayerGroup.setOptions({}); + +// $ExpectType LayerGroup +testTileLayerGroup.setOptions({ + tileSize: 256 +}); +// layerGruop.setOptions({ +// // $ExpectError +// interval: 1 +// }); + +testAnyLauerGroup.addLayer(tileLayer); + +testAnyLauerGroup.addLayer(massMarksLayer); + +testAnyLauerGroup.setOptions({ + test: 1 +}); + +/** + * layer/massMarks.ts + */ + +const massMarksStyle1 = { + anchor: pixel, + url: '', + size, + rotation: 1 +}; +const massMarksStyle2 = { + anchor: pixel, + url: '', + size +}; +const massMarksData1 = { + lnglat +}; + +interface MassMarksCustomData extends AMap.MassMarks.Data { + name: string; + id: string; +} +const massMarksMassMarksCustomData: MassMarksCustomData = { + lnglat: [1, 2], + style: 1, + name: '', + id: '' +}; + +// $ExpectError +new AMap.MassMarks(); +// $ExpectError +new AMap.MassMarks([], {}); + +new AMap.MassMarks([], { + style: [massMarksStyle1, massMarksStyle2] +}); +new AMap.MassMarks([massMarksData1], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType MassMarks +const testMassMarks = new AMap.MassMarks([massMarksMassMarksCustomData], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType void +testMassMarks.setStyle(massMarksStyle1); +// $ExpectType void +testMassMarks.setStyle([massMarksStyle1]); + +// $ExpectType Style | Style[] +testMassMarks.getStyle(); + +// $ExpectType void +testMassMarks.setData(''); + +// $ExpectError +testMassMarks.setData(massMarksData1); +// $ExpectError +testMassMarks.setData(massMarksMassMarksCustomData); + +const massMarksCustomData = testMassMarks.getData()[0]; +// $ExpectType string +massMarksCustomData.name; +// $ExpectType string +massMarksCustomData.id; +// $ExpectType LngLat +massMarksCustomData.lnglat; + +// $ExpectType void +testMassMarks.clear(); + +testMassMarks.on('click', (event: AMap.MassMarks.EventMap['click']) => { + // $ExpectType "click" + event.type; + + // $ExpectType MassMarksCustomData + event.data; + + // $ExpectType MassMarks + event.target; +}); + +/** + * layer/tileLayer.ts + */ + +// $ExpectType TileLayer +new AMap.TileLayer(); + +// $ExpectType TileLayer +new AMap.TileLayer({}); + +// $ExpectType TileLayer +const testTileLayer = new AMap.TileLayer({ + map, + tileSize: 256, + tileUrl: '', + errorUrl: '', + getTileUrl: (x, y, z) => '', + zIndex: 1, + opacity: 0.1, + zooms: [3, 18], + detectRetina: true +}); + +// $ExpectType string[] +testTileLayer.getTiles(); + +// $ExpectType void +testTileLayer.reload(); + +// $ExpectType void +testTileLayer.setTileUrl(''); +// $ExpectType void +testTileLayer.setTileUrl((x, y, level) => { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + level; + return ''; +}); + +// $ExpectType TileLayer +testTileLayer.on('complete', () => { }); + +testTileLayer.off('complete', () => { }); + +testTileLayer.emit('complete'); + +// $ExpectType Traffic +const testTrafficLayer = new AMap.TileLayer.Traffic({}); +// $ExpectType Traffic +new AMap.TileLayer.Traffic({ + autoRefresh: true, + interval: 180 +}); + +testTrafficLayer.on('complete', () => { }); + +/** + * layer/videoLayer.ts + */ + +// $ExpectType VideoLayer +new AMap.VideoLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType VideoLayer +new AMap.VideoLayer(); +// $ExpectType VideoLayer +new AMap.VideoLayer({}); +// $ExpectType VideoLayer +const testVideoLayer = new AMap.VideoLayer({ + bounds +}); + +// $ExpectType void +testVideoLayer.setMap(null); +// $ExpectType void +testVideoLayer.setMap(map); + +// $ExpectType Map | null | undefined +testVideoLayer.getMap(); + +// $ExpectType void +testVideoLayer.show(); + +// $ExpectType void +testVideoLayer.hide(); + +// $ExpectType number +testVideoLayer.getzIndex(); + +// $ExpectType void +testVideoLayer.setzIndex(10); + +// $ExpectType HTMLVideoElement | null +testVideoLayer.getElement(); + +// $ExpectType void +testVideoLayer.setVideoUrl('url'); + +// $ExpectType string | string[] | undefined +testVideoLayer.getVideoUrl(); + +/** + * layer/wms.ts + */ + +// $ExpectType WMS +new AMap.TileLayer.WMS({ + url: 'url', + params: {} +}); +// $ExpectType WMS +const testWms = new AMap.TileLayer.WMS({ + url: 'url', + blend: true, + params: { + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' + }, + zooms: [1, 2], + tileSize: 256, + opacity: 1, + zIndex: 10, + visible: true +}); + +// $ExpectType void +testWms.setMap(map); +// $ExpectType void +testWms.setMap(null); + +// $ExpectType Map | null | undefined +testWms.getMap(); + +// $ExpectType void +testWms.show(); + +// $ExpectType void +testWms.hide(); + +// $ExpectType void +testWms.setzIndex(10); + +// $ExpectType number +testWms.getzIndex(); + +// $ExpectType void +testWms.setUrl('url'); + +// $ExpectType string +testWms.getUrl(); + +// $ExpectType void +testWms.setParams({ + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' +}); + +{ + const params = testWms.getParams(); + // $ExpectType string | undefined + params.VERSION; + // $ExpectType string | undefined + params.LAYERS; + // $ExpectType string | undefined + params.STYLES; + // $ExpectType string | undefined + params.FORMAT; + // $ExpectType "TRUE" | "FALSE" | undefined + params.TRANSPARENT; + // $ExpectType string | undefined + params.BGCOLOR; + // $ExpectType string | undefined + params.EXCEPTIONS; + // $ExpectType string | undefined + params.TIME; + // $ExpectType string | undefined + params.ELEVATION; +} + +/** + * layer/wmts.ts + */ + +// $ExpectType WMTS +new AMap.TileLayer.WMTS({ + url: 'url', + params: {} +}); +// $ExpectType WMTS +const testWmts = new AMap.TileLayer.WMTS({ + url: 'url', + blend: true, + tileSize: 256, + zooms: [1, 2], + opacity: 1, + zIndex: 10, + visible: true, + params: { + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' + } +}); + +// $ExpectType void +testWmts.setMap(map); +// $ExpectType void +testWmts.setMap(null); + +// $ExpectType Map | null | undefined +testWmts.getMap(); + +// $ExpectType void +testWmts.show(); + +// $ExpectType void +testWmts.hide(); + +// $ExpectType void +testWmts.setzIndex(10); + +// $ExpectType number +testWmts.getzIndex(); + +// $ExpectType void +testWmts.setUrl('url'); + +// $ExpectType string +testWmts.getUrl(); + +// $ExpectType void +testWmts.setParams({ + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' +}); + +{ + const params = testWmts.getParams(); + // $ExpectType string | undefined + params.Version; + // $ExpectType string | undefined + params.Layer; + // $ExpectType string | undefined + params.Style; + // $ExpectType string | undefined + params.Format; +} + +/** + * overlay/bezierCurve.ts + */ + +interface BezierCurveExtraData { + test: number; +} + +const bezierCurvePath = [ + [1, 2, 3, 4], + [1, 2, 3], + [ + [1, 2, 3], + [1, 2] + ], + [1, 2] +]; + +// $ExpectError +new AMap.BezierCurve(); +// $ExpectError +new AMap.BezierCurve({}); +// $ExpectType BezierCurve +const testBezierCurve = new AMap.BezierCurve({ + map, + path: bezierCurvePath, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +// $ExpectType void +testBezierCurve.setPath(bezierCurvePath); + +// $ExpectType void +testBezierCurve.setPath(bezierCurvePath); + +// $ExpectType void +testBezierCurve.setOptions({}); +testBezierCurve.setOptions({ + map, + path: bezierCurvePath, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +{ + const options = testBezierCurve.getOptions(); + + // $ExpectType number | undefined + options.borderWeight; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType string | undefined + options.dirColor; + // $ExpectType string | undefined + options.dirImg; + // $ExpectType {} | BezierCurveExtraData | undefined + options.extData; + // $ExpectType boolean | undefined + options.geodesic; + // $ExpectType boolean | undefined + options.isOutline; + // $ExpectType "round" | "butt" | "square" | undefined + options.lineCap; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType string | undefined + options.outlineColor; + // $ExpectType (LngLat & { controlPoints: LngLat[]; })[] | undefined + options.path; + // $ExpectType boolean | undefined + options.showDir; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType number +testBezierCurve.getLength(); + +// $ExpectType Bounds | null +testBezierCurve.getBounds(); + +// $ExpectType void +testBezierCurve.show(); + +// $ExpectType void +testBezierCurve.hide(); + +// $ExpectType void +testBezierCurve.setMap(null); +testBezierCurve.setMap(map); + +// $ExpectType void +testBezierCurve.setExtData({ test: 1 }); +// $ExpectError +testBezierCurve.setExtData({ test: '123' }); + +// $ExpectType {} | BezierCurveExtraData +testBezierCurve.getExtData(); + +testBezierCurve.on('click', (event: AMap.BezierCurve.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType BezierCurve + event.target; +}); + +testBezierCurve.on('show', (event: AMap.BezierCurve.EventMap['show']) => { + // $ExpectType "show" + event.type; + // $ExpectType BezierCurve + event.target; +}); + +testBezierCurve.on('options', (event: AMap.BezierCurve.EventMap['options']) => { + // $ExpectType "options" + event.type; + // $ExpectError + event.target; +}); + +/** + * overlay/circle.ts + */ + +interface CircleExtraData { + test: number; +} + +// $ExpectType Circle +new AMap.Circle(); +new AMap.Circle({}); +// $ExpectType Circle +const testCircle = new AMap.Circle({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +// $ExpectType void +testCircle.setCenter(lnglat); +// $ExpectType void +testCircle.setCenter(lnglatTuple); + +// $ExpectType LngLat | undefined +testCircle.getCenter(); + +// $ExpectType Bounds | null +testCircle.getBounds(); + +// $ExpectType void +testCircle.setRadius(100); + +// $ExpectType number +testCircle.getRadius(); + +// $ExpectType void +testCircle.setOptions({}); +testCircle.setOptions({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +{ + const options = testCircle.getOptions(); + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType LngLat | undefined + options.center; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | CircleExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType number | undefined + options.radius; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType Bounds | null +testCircle.getBounds(); + +// $ExpectType void +testCircle.hide(); + +// $ExpectType void +testCircle.show(); + +// $ExpectType void +testCircle.setMap(null); +// $ExpectType void +testCircle.setMap(map); + +// $ExpectType void +testCircle.setExtData({ test: 2 }); +// $ExpectError +testCircle.setExtData({ test: '1' }); + +// $ExpectType {} | CircleExtraData +testCircle.getExtData(); + +// $ExpectType boolean +testCircle.contains(lnglat); +// $ExpectType boolean +testCircle.contains(lnglatTuple); + +testCircle.on('click', (event: AMap.Circle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Circle + event.target; +}); + +testCircle.on('setCenter', (event: AMap.Circle.EventMap['setCenter']) => { + // $ExpectType "setCenter" + event.type; + // $ExpectError + event.target; +}); + +testCircle.on('change', (event: AMap.Circle.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType Circle + event.target; +}); + +/** + * overlay/contextMenu.ts + */ + +interface ContextMenuExtraData { + test: number; +} +// $ExpectType ContextMenu +new AMap.ContextMenu(); +// $ExpectType ContextMenu +new AMap.ContextMenu({}); +// $ExpectType ContextMenu +const testContextMenu = new AMap.ContextMenu({ + content: '
content
', +}); + +// $ExpectType void +testContextMenu.addItem('item', function() { + // $ExpectType HTMLLIElement + this; +}); +// $ExpectType void +testContextMenu.addItem('item', () => { }, 1); + +// $ExpectType void +testContextMenu.removeItem('item', () => {}); + +// $ExpectType void +testContextMenu.open(map, lnglatTuple); +// $ExpectType void +testContextMenu.open(map, lnglat); + +// $ExpectType void +testContextMenu.close(); + +testContextMenu.on('items', (event: AMap.ContextMenu.EventMap['items']) => { + // $ExpectType "items" + event.type; +}); + +testContextMenu.on('open', (event: AMap.ContextMenu.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType ContextMenu + event.target; +}); + +/** + * overlay/ellipse.ts + */ + +interface EllipseExtraData { + test: number; +} +// $ExpectType Ellipse +new AMap.Ellipse(); +// $ExpectType Ellipse +new AMap.Ellipse({}); +// $ExpectType Ellipse +const testEllipse = new AMap.Ellipse({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType LngLat | undefined +testEllipse.getCenter(); + +// $ExpectType void +testEllipse.setCenter(lnglat); +// $ExpectType void +testEllipse.setCenter(lnglatTuple); + +// $ExpectType Bounds | null +testEllipse.getBounds(); + +// $ExpectType void +testEllipse.setOptions({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +{ + const options = testEllipse.getOptions(); + + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType LngLat | undefined + options.center; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | EllipseExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType [number, number] | undefined + options.radius; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType void +testEllipse.hide(); + +// $ExpectType void +testEllipse.show(); + +// $ExpectType void +testEllipse.setMap(null); +// $ExpectType void +testEllipse.setMap(map); + +// $ExpectType void +testEllipse.setExtData({ test: 2 }); +// $ExpectType {} | EllipseExtraData +testEllipse.getExtData(); + +// $ExpectType boolean +testEllipse.contains(lnglat); +// $ExpectType boolean +testEllipse.contains(lnglatTuple); + +/** + * overlay/geoJSON.ts + */ + +interface GeoJSONExtraData { + test: number; +} + +const geoJSONObject: AMap.GeoJSON.GeoJSONObject[] = [ + { + type: 'Feature', + properties: {}, + geometry: { + type: 'Point', + coordinates: lnglatTuple + } + }, + { + type: 'Feature', + properties: { test: 1 }, + geometry: { + type: 'LineString', + coordinates: [lnglatTuple, lnglatTuple] + } + } +]; + +// $ExpectType GeoJSON +new AMap.GeoJSON(); +// $ExpectType GeoJSON +new AMap.GeoJSON({}); +// $ExpectType GeoJSON +const testGeoJSON = new AMap.GeoJSON({ + geoJSON: geoJSONObject, + getMarker(obj, lnglat) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat + lnglat; + return testMarker; + }, + getPolyline(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return testPolyline; + }, + getPolygon(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return testPolygon; + }, + coordsToLatLng(coord) { + // $ExpectType LngLat + coord; + return coord; + } +}); + +// $ExpectType void +testGeoJSON.importData(geoJSONObject); + +// $ExpectType GeoJSON +testGeoJSON.removeOverlay(testMarker); +// $ExpectType GeoJSON +testGeoJSON.removeOverlay([testMarker]); + +// $ExpectType boolean +testGeoJSON.hasOverlay(testMarker); +// $ExpectType boolean +testGeoJSON.hasOverlay(m => m === testMarker); + +// $ExpectType GeoJSON +testGeoJSON.addOverlay(testMarker); +// $ExpectType GeoJSON +testGeoJSON.addOverlay([testMarker]); + +// $ExpectType GeoJSONObject[] +testGeoJSON.toGeoJSON(); + +// $ExpectType GeoJSON +testGeoJSON.setMap(null); +// $ExpectType GeoJSON +testGeoJSON.setMap(map); + +// $ExpectType GeoJSON +testGeoJSON.hide(); + +// $ExpectType GeoJSON +testGeoJSON.show(); + +testGeoJSON.on('click', (event: AMap.MapsEvent<'click', AMap.Overlay>) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); + +/** + * overlay/icon.ts + */ + +// $ExpectType Icon +new AMap.Icon(); +// $ExpectType Icon +new AMap.Icon({}); +// $ExpectType Icon +new AMap.Icon({ + size, + imageOffset: pixel, + image: 'image uri', + imageSize: size +}); +// $ExpectType Icon +const testIcon = new AMap.Icon({ + size: [1, 2], + imageOffset: pixel, + image: 'image uri', + imageSize: [1, 2] +}); + +// $ExpectType Size +testIcon.getImageSize(); + +// $ExpectType void +testIcon.setImageSize(size); +// $ExpectType void +testIcon.setImageSize([1, 2]); + +/** + * overlay/infoWindow.ts + */ + +interface InfoWindowExtraData { + test: number; +} + +// $ExpectType InfoWindow +new AMap.InfoWindow(); +// $ExpectType InfoWindow +new AMap.InfoWindow({}); +// $ExpectType InfoWindow +const testInfoWindow = new AMap.InfoWindow({ + isCustom: false, + autoMove: false, + closeWhenClickMap: false, + content: 'content', + size: [100, 100], + offset: new AMap.Pixel(10, 10), + position: lnglat, + showShadow: true +}); + +// $ExpectType void +testInfoWindow.open(map); +// $ExpectType void +testInfoWindow.open(map, lnglat); +// $ExpectType void +testInfoWindow.open(map, lnglatTuple); + +// $ExpectType void +testInfoWindow.close(); + +// $ExpectType boolean +testInfoWindow.getIsOpen(); + +// $ExpectType void +testInfoWindow.setContent('content'); +// $ExpectType void +testInfoWindow.setContent(div); + +// $ExpectType string | HTMLElement | undefined +testInfoWindow.getContent(); + +// $ExpectType void +testInfoWindow.setPosition(lnglat); +// $ExpectType void +testInfoWindow.setPosition(lnglatTuple); + +// $ExpectType LngLat | undefined +testInfoWindow.getPosition(); + +// $ExpectType Size | undefined +testInfoWindow.getSize(); + +testInfoWindow.on('change', (event: AMap.InfoWindow.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +testInfoWindow.on('close', (event: AMap.InfoWindow.EventMap['close']) => { + // $ExpectType "close" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +testInfoWindow.on('open', (event: AMap.InfoWindow.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +/** + * overlay/marker.ts + */ + +interface MarkerExtraData { + test: number; +} + +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker({}); +// $ExpectType Marker +const testMarker = new AMap.Marker({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType void +testMarker.markOnAMAP({ + name: '123', + position: [1, 2] +}); +// $ExpectType void +testMarker.markOnAMAP(); +// $ExpectType void +testMarker.markOnAMAP({}); +// $ExpectType void +testMarker.markOnAMAP({ + position: [1, 2], + name: '123' +}); + +// $ExpectType Pixel +testMarker.getOffset(); + +// $ExpectType void +testMarker.setOffset(pixel); + +// $ExpectType void +testMarker.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +testMarker.getAnimation(); + +// $ExpectType void +testMarker.setClickable(true); + +// $ExpectType boolean +testMarker.getClickable(); + +// $ExpectType LngLat | undefined +testMarker.getPosition(); + +// $ExpectType void +testMarker.setPosition(lnglat); + +// $ExpectType void +testMarker.setAngle(0); + +// $ExpectType void +testMarker.setLabel(); +// $ExpectType void +testMarker.setLabel({}); +// $ExpectType void +testMarker.setLabel({ + content: 'label content', + offset: pixel +}); + +// $ExpectType Label | undefined +testMarker.getLabel(); + +// $ExpectType number +testMarker.getAngle(); + +// $ExpectType void +testMarker.setzIndex(100); + +// $ExpectType number +testMarker.getzIndex(); + +// $ExpectType void +testMarker.setIcon('icon uri'); +// $ExpectType void +testMarker.setIcon(icon); + +// $ExpectType string | Icon | undefined +testMarker.getIcon(); + +// $ExpectType void +testMarker.setDraggable(true); + +// $ExpectType boolean +testMarker.getDraggable(); + +// $ExpectType void +testMarker.setCursor('default'); + +// $ExpectType void +testMarker.setContent('content'); +// $ExpectType void +testMarker.setContent(domEle); + +// $ExpectType string | HTMLElement +testMarker.getContent(); + +// $ExpectType void +testMarker.moveAlong([lnglat], 100); +// $ExpectError +testMarker.moveAlong([[1, 2]], 100); +// $ExpectType void +testMarker.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +testMarker.moveTo(lnglat, 100); +// $ExpectType void +testMarker.moveTo([1, 2], 100); +// $ExpectType void +testMarker.moveTo([1, 2], 100, t => t); + +// $ExpectType void +testMarker.stopMove(); + +// $ExpectType boolean +testMarker.pauseMove(); + +// $ExpectType boolean +testMarker.resumeMove(); + +// $ExpectType void +testMarker.setMap(map); + +// $ExpectType void +testMarker.setTitle('title'); +// $ExpectError +testMarker.setTitle(); + +// $ExpectType string | undefined +testMarker.getTitle(); + +// $ExpectType void +testMarker.setTop(true); + +// $ExpectType boolean +testMarker.getTop(); + +// $ExpectType void +testMarker.setShadow(); +// $ExpectType void +testMarker.setShadow(icon); +// $ExpectType void +testMarker.setShadow('shadow url'); + +// $ExpectType string | Icon | undefined +testMarker.getShadow(); + +// $ExpectType void +testMarker.setShape(); +// $ExpectType void +testMarker.setShape(markerShape); + +// $ExpectType MarkerShape | undefined +testMarker.getShape(); + +testMarker.on('click', (event: AMap.Marker.EventMap['click']) => { + // $ExpectType {} | MarkerExtraData + event.target.getExtData(); +}); + +/** + * overlay/markerShape.ts + */ + +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1, 1] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'poly', + coords: [1, 2, 3, 4, 5] +}); + +// $ExpectError +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1] +}); +// $ExpectError +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2, 2] +}); + +/** + * overlay/overlay.ts + */ + +interface OverlayExtraData { + test: number; +} +declare const testOverlay: AMap.Overlay; + +// $ExpectType void +testOverlay.show(); + +// $ExpectType void +testOverlay.hide(); + +// $ExpectType Map | null | undefined +testOverlay.getMap(); + +// $ExpectType void +testOverlay.setMap(map); +// $ExpectType void +testOverlay.setMap(null); + +// $ExpectError +testOverlay.setExtData({ any: 123 }); + +// $ExpectError OverlayExtraData +testOverlay.getExtData(); + +/** + * overlay/overlayGroup.ts + */ + +// $ExpectType OverlayGroup, any> +const testOverlayGroup2 = new AMap.OverlayGroup(); +// $ExpectType OverlayGroup, any> +new AMap.OverlayGroup(testMarker); +// $ExpectType OverlayGroup, any> +const testOverlayGroup = new AMap.OverlayGroup([testMarker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlay(testMarker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlay([testMarker]); +// $ExpectError +testOverlayGroup.addOverlay([testCircle]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlays(testMarker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlays([testMarker]); + +// $ExpectType Marker[] +testOverlayGroup.getOverlays(); + +// $ExpectType boolean +testOverlayGroup.hasOverlay(testMarker); +// $ExpectType boolean +testOverlayGroup.hasOverlay(o => o === testMarker); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlay(testMarker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlay([testMarker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlays(testMarker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlays([testMarker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.clearOverlays(); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.eachOverlay(function(overlay, index, overlays) { + // $ExpectType Marker + overlay; + // $ExpectType number + index; + // $ExpectType Marker[] + overlays; + // $ExpectType Marker + this; +}); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.setMap(null); +// $ExpectType OverlayGroup, any> +testOverlayGroup.setMap(map); + +// $ExpectType OverlayGroup, any> +testOverlayGroup2.setOptions({ + test: 1 +}); +// $ExpectType OverlayGroup, any> +testOverlayGroup.setOptions({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.show(); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.hide(); + +testOverlayGroup.on('click', (event: AMap.MapsEvent<'click', AMap.Overlay>) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); + +/** + * overlay/polygon.ts + */ + +interface PolygonExtraData { + test: number; +} + +const polygonPath1 = [lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple]; +const polygonPath2 = [lnglat, lnglat, lnglat, lnglat, lnglat]; + +// $ExpectType Polygon +new AMap.Polygon(); +// $ExpectType Polygon +new AMap.Polygon({}); +// $ExpectType Polygon +const testPolygon = new AMap.Polygon({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.3, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [2, 4], + path: polygonPath1 +}); + +// $ExpectType void +testPolygon.setPath(polygonPath1); +// $ExpectType void +testPolygon.setPath(polygonPath2); +// $ExpectType void +testPolygon.setPath([polygonPath1, polygonPath2]); + +// $ExpectType LngLat[] | LngLat[][] +testPolygon.getPath(); + +// $ExpectType void +testPolygon.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [4, 2], + path: [polygonPath2, polygonPath1] +}); + +{ + const options = testPolygon.getOptions(); + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | PolygonExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | LngLat[][] | undefined + options.path; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType Bounds | null +testPolygon.getBounds(); + +// $ExpectType number +testPolygon.getArea(); + +// $ExpectType void +testPolygon.setMap(null); +// $ExpectType void +testPolygon.setMap(map); + +// $ExpectType void +testPolygon.setExtData({ test: 1 }); + +// $ExpectType {} | PolygonExtraData +testPolygon.getExtData(); + +// $ExpectType boolean +testPolygon.contains(lnglat); +// $ExpectType boolean +testPolygon.contains(lnglatTuple); + +testPolygon.on('click', (event: AMap.Polygon.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polygon + event.target; +}); + +/** + * overlay/polyline.ts + */ + +interface PolylineExtraData { + test: number; +} + +// $ExpectType Polyline +new AMap.Polyline(); +// $ExpectType Polyline +new AMap.Polyline({}); +// $ExpectType Polyline +const testPolyline = new AMap.Polyline({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); +// Polyline + +// $ExpectType void +testPolyline.setPath([lnglat]); +// $ExpectType void +testPolyline.setPath([lnglatTuple]); + +// $ExpectType void +testPolyline.setOptions({}); +// $ExpectType void +testPolyline.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat, lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); + +{ + const options = testPolyline.getOptions(); + // $ExpectType number | undefined + options.borderWeight; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType string | undefined + options.dirColor; + // $ExpectType string | undefined + options.dirImg; + // $ExpectType {} | PolylineExtraData | undefined + options.extData; + // $ExpectType boolean | undefined + options.geodesic; + // $ExpectType boolean | undefined + options.isOutline; + // $ExpectType "round" | "butt" | "square" | undefined + options.lineCap; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType string | undefined + options.outlineColor; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType boolean | undefined + options.showDir; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType number +testPolyline.getLength(); + +// $ExpectType Bounds | null +testPolyline.getBounds(); + +// $ExpectType void +testPolyline.hide(); + +// $ExpectType void +testPolyline.show(); + +// $ExpectType void +testPolyline.setMap(null); +// $ExpectType void +testPolyline.setMap(map); + +// $ExpectType void +testPolyline.setExtData({ test: 1 }); + +// $ExpectType {} | PolylineExtraData +testPolyline.getExtData(); + +testPolyline.on('click', (event: AMap.Polyline.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polyline + event.target; +}); + +/** + * overlay/rectangle.ts + */ + +interface RectangleExtraData { + test: number; +} + +// $ExpectType Rectangle +new AMap.Rectangle(); +// $ExpectType Rectangle +new AMap.Rectangle({}); +// $ExpectType Rectangle +const testRectangle = new AMap.Rectangle({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType Bounds | undefined +testRectangle.getBounds(); + +// $ExpectType void +testRectangle.setBounds(bounds); + +// $ExpectType void +testRectangle.setOptions({}); +// $ExpectType void +testRectangle.setOptions({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +{ + const options = testRectangle.getOptions(); + // $ExpectType Bounds | undefined + options.bounds; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | RectangleExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType void +testRectangle.hide(); + +// $ExpectType void +testRectangle.show(); + +// $ExpectType void +testRectangle.setExtData({test: 2}); + +// $ExpectType {} | RectangleExtraData +testRectangle.getExtData(); + +// $ExpectType boolean +testRectangle.contains(lnglat); +// $ExpectType boolean +testRectangle.contains(lnglatTuple); + +testRectangle.on('click', (event: AMap.Rectangle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Rectangle + event.target; +}); + +testRectangle.on('setBounds', (event: AMap.Rectangle.EventMap['setBounds']) => { + // $ExpectType "setBounds" + event.type; + // $ExpectError + event.target; +}); + +/** + * overlay/text.ts + */ + +interface TextExtraData { + test: number; +} + +// $ExpectType Text +new AMap.Text(); +// $ExpectType Text +new AMap.Text({}); +// $ExpectType Text +const testText = new AMap.Text({ + text: 'content', + textAlign: 'center', + verticalAlign: 'top', + map, + position: lnglat, + offset: pixel, + topWhenClick: true, + bubble: true, + draggable: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 100, + angle: 45, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: 'https://webapi.amap.com/theme/v1.3/markers/0.png', + title: 'title', + clickable: true, + extData: { test: 1 } +}); + +// $ExpectType string +testText.getText(); + +// $ExpectType void +testText.setText('123'); + +// $ExpectType void +testText.setStyle({ + background: 'red', + width: '200px' +}); + +// $ExpectType void +testText.markOnAMAP({ + name: '123', + position: lnglatTuple +}); + +// $ExpectType Pixel +testText.getOffset(); + +// $ExpectType void +testText.setOffset(pixel); + +// $ExpectType void +testText.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +testText.getAnimation(); + +// $ExpectType void +testText.setClickable(true); + +// $ExpectType boolean +testText.getClickable(); + +// $ExpectType LngLat | undefined +testText.getPosition(); + +// $ExpectType void +testText.setAngle(10); + +// $ExpectType number +testText.getAngle(); + +// $ExpectType void +testText.setzIndex(1); + +// $ExpectType number +testText.getzIndex(); + +// $ExpectType void +testText.setDraggable(true); + +// $ExpectType boolean +testText.getDraggable(); + +// $ExpectType void +testText.hide(); + +// $ExpectType void +testText.show(); + +// $ExpectType void +testText.setCursor('default'); + +// $ExpectType void +testText.moveAlong([lnglat], 100); + +// $ExpectType void +testText.moveAlong([lnglat], 100); +// $ExpectError +testText.moveAlong([[1, 2]], 100); +// $ExpectType void +testText.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +testText.moveTo(lnglat, 100); +// $ExpectType void +testText.moveTo([1, 2], 100); +// $ExpectType void +testText.moveTo([1, 2], 100, t => t); + +// $ExpectType void +testText.stopMove(); + +// $ExpectType boolean +testText.pauseMove(); + +// $ExpectType boolean +testText.resumeMove(); + +// $ExpectType void +testText.setMap(map); + +// $ExpectType void +testText.setTitle('title'); +// $ExpectError +testText.setTitle(); + +// $ExpectType string | undefined +testText.getTitle(); + +// $ExpectType void +testText.setTop(true); + +// $ExpectType boolean +testText.getTop(); + +// $ExpectType void +testText.setShadow(); +// $ExpectType void +testText.setShadow(icon); +// $ExpectType void +testText.setShadow('shadow url'); + +// $ExpectType void +testText.setExtData({test: 1}); + +// $ExpectType {} | TextExtraData +testText.getExtData(); + +testText.on('click', (event: AMap.Text.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Text + event.target; +}); diff --git a/types/amap-js-api/index.d.ts b/types/amap-js-api/index.d.ts index 54f79c08ea..5b8c1a5b94 100644 --- a/types/amap-js-api/index.d.ts +++ b/types/amap-js-api/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package amap-js-sdk 1.4 +// Type definitions for non-npm package amap-js-api 1.4 // Project: https://lbs.amap.com/api/javascript-api/summary // Definitions by: breeze9527 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/amap-js-api/overlay/markerShape.d.ts b/types/amap-js-api/overlay/markerShape.d.ts index c8efd93850..f0d6c39bac 100644 --- a/types/amap-js-api/overlay/markerShape.d.ts +++ b/types/amap-js-api/overlay/markerShape.d.ts @@ -15,7 +15,7 @@ declare namespace AMap { type Options = CircleOptions | PolyOptions | RectOptions; } - class MarkerShape { + class MarkerShape extends EventEmitter { constructor(options: MarkerShape.Options); } } diff --git a/types/amap-js-api/test/arryBounds.ts b/types/amap-js-api/test/arryBounds.ts deleted file mode 100644 index 1ccc4d0488..0000000000 --- a/types/amap-js-api/test/arryBounds.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { - lnglat -} from './preset'; - -// $ExpectType ArrayBounds -const arrayBounds = new AMap.ArrayBounds([lnglat, lnglat, lnglat]); - -// $ExpectType LngLat[] -arrayBounds.bounds; - -// $ExpectType boolean -arrayBounds.contains(lnglat); - -// $ExpectType Bounds -arrayBounds.toBounds(); - -// $ExpectType LngLat -arrayBounds.getCenter(); diff --git a/types/amap-js-api/test/bounds.ts b/types/amap-js-api/test/bounds.ts deleted file mode 100644 index d22ba697f9..0000000000 --- a/types/amap-js-api/test/bounds.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { - lnglat, - lnglatTuple -} from './preset'; - -// $ExpectType Bounds -const bounds = new AMap.Bounds(lnglat, lnglat); - -// $ExpectType boolean -bounds.contains(lnglat); -// $ExpectType boolean -bounds.contains(lnglatTuple); - -// $ExpectType LngLat -bounds.getCenter(); - -// $ExpectType LngLat -bounds.getSouthWest(); - -// $ExpectType LngLat -bounds.getSouthEast(); - -// $ExpectType LngLat -bounds.getNorthEast(); - -// $ExpectType LngLat -bounds.getNorthWest(); - -// $ExpectType string -bounds.toString(); diff --git a/types/amap-js-api/test/browser.ts b/types/amap-js-api/test/browser.ts deleted file mode 100644 index b80d8cd3ff..0000000000 --- a/types/amap-js-api/test/browser.ts +++ /dev/null @@ -1,141 +0,0 @@ -const brwoser = AMap.Browser; - -// $ExpectType string -brwoser.ua; - -// $ExpectType boolean -brwoser.mobile; - -const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other' = brwoser.plat; - -// $ExpectType boolean -brwoser.mac; - -// $ExpectType boolean -brwoser.windows; - -// $ExpectType boolean -brwoser.ios; - -// $ExpectType boolean -brwoser.iPad; - -// $ExpectType boolean -brwoser.iPhone; - -// $ExpectType boolean -brwoser.android; - -// $ExpectType boolean -brwoser.android23; - -// $ExpectType boolean -brwoser.chrome; - -// $ExpectType boolean -brwoser.firefox; - -// $ExpectType boolean -brwoser.safari; - -// $ExpectType boolean -brwoser.wechat; - -// $ExpectType boolean -brwoser.uc; - -// $ExpectType boolean -brwoser.qq; - -// $ExpectType boolean -brwoser.ie; - -// $ExpectType boolean -brwoser.ie6; - -// $ExpectType boolean -brwoser.ie7; - -// $ExpectType boolean -brwoser.ie8; - -// $ExpectType boolean -brwoser.ie9; - -// $ExpectType boolean -brwoser.ie10; - -// $ExpectType boolean -brwoser.ie11; - -// $ExpectType boolean -brwoser.edge; - -// $ExpectType boolean -brwoser.ielt9; - -// $ExpectType boolean -brwoser.baidu; - -// $ExpectType boolean -brwoser.isLocalStorage; - -// $ExpectType boolean -brwoser.isGeolocation; - -// $ExpectType boolean -brwoser.mobileWebkit; - -// $ExpectType boolean -brwoser.mobileWebkit3d; - -// $ExpectType boolean -brwoser.mobileOpera; - -// $ExpectType boolean -brwoser.retina; - -// $ExpectType boolean -brwoser.touch; - -// $ExpectType boolean -brwoser.msPointer; - -// $ExpectType boolean -brwoser.pointer; - -// $ExpectType boolean -brwoser.webkit; - -// $ExpectType boolean -brwoser.ie3d; - -// $ExpectType boolean -brwoser.webkit3d; - -// $ExpectType boolean -brwoser.gecko3d; - -// $ExpectType boolean -brwoser.opera3d; - -// $ExpectType boolean -brwoser.any3d; - -// $ExpectType boolean -brwoser.isCanvas; - -// $ExpectType boolean -brwoser.isSvg; - -// $ExpectType boolean -brwoser.isVML; - -// $ExpectType boolean -brwoser.isWorker; - -// $ExpectType boolean -brwoser.isWebsocket; - -// $ExpectType boolean -brwoser.isWebGL(); diff --git a/types/amap-js-api/test/convert-from.ts b/types/amap-js-api/test/convert-from.ts deleted file mode 100644 index 8cb9b8502c..0000000000 --- a/types/amap-js-api/test/convert-from.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - lnglat, - lnglatTuple -} from './preset'; - -declare const convertType: 'baidu' | 'mapbar' | 'gps' | null; -// $ExpectType void -AMap.convertFrom(lnglat, convertType, (status, result) => { - const temp: 'complete' | 'error' = status; - if (typeof result !== 'string') { - // $ExpectType string - result.info; - // $ExpectType LngLat[] - result.locations; - } else { - // $ExpectType string - result; - } -}); -// $ExpectType void -AMap.convertFrom([lnglat], null, () => { }); -// $ExpectType void -AMap.convertFrom(lnglatTuple, null, () => { }); -// $ExpectType void -AMap.convertFrom([lnglatTuple], null, () => { }); diff --git a/types/amap-js-api/test/dom-util.ts b/types/amap-js-api/test/dom-util.ts deleted file mode 100644 index 6cb0bce511..0000000000 --- a/types/amap-js-api/test/dom-util.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { div } from './preset'; - -const util = AMap.DomUtil; - -// $ExpectType Size -util.getViewport(div); - -// $ExpectType Pixel -util.getViewportOffset(div); - -// $ExpectType HTMLDivElement -util.create('div'); -// $ExpectType HTMLAnchorElement -util.create('a'); -// $ExpectType HTMLDivElement -util.create('div', div); -// $ExpectType HTMLDivElement -util.create('div', div, 'className'); - -// $ExpectType void -util.setClass(div); -// $ExpectType void -util.setClass(div, 'className'); - -// $ExpectType boolean -util.hasClass(div, 'className'); - -// $ExpectType void -util.removeClass(div, 'className'); - -// $ExpectType void -util.setOpacity(div, 1); - -// $ExpectType void -util.rotate(div, 10); -// $ExpectType void -util.rotate(div, 10, { x: 10, y: 10 }); - -const util2: typeof AMap.DomUtil = util.setCss(div, { textAlign: 'left' }); -// $ExpectError -util.setCss(div, { textAlign: 10 }); - -// $ExpectType void -util.empty(div); - -// $ExpectType void -util.remove(div); diff --git a/types/amap-js-api/test/event.ts b/types/amap-js-api/test/event.ts deleted file mode 100644 index 8061b0d747..0000000000 --- a/types/amap-js-api/test/event.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - lnglat, - pixel, - map -} from './preset'; -declare var div: HTMLDivElement; -declare var input: HTMLInputElement; - -// $ExpectType Map -map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { - // $ExpectType "hotspotclick" - event.type; - // $ExpectType string - event.id; - // $ExpectType LngLat - event.lnglat; -}); - -// $ExpectType EventListener<0> -AMap.event.addDomListener(div, 'click', event => { - // $ExpectType number - event.clientX; -}); - -// $ExpectType EventListener<1> -AMap.event.addListener(map, 'hotspotclick', function (event: AMap.Map.EventMap['hotspotclick']) { - // $ExpectType "hotspotclick" - event.type; - // $ExpectType string - event.id; - // $ExpectType LngLat - event.lnglat; - // $ExpectType number - this.test; -}, { test: 1 }); -AMap.event.addListener(map, 'click', (event: AMap.Map.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType LngLat - event.lnglat; - // $ExpectType Map - event.target; -}); - -// $ExpectType EventListener<1> -const eventListener = AMap.event.addListenerOnce(map, 'hotspotclick', function (event: AMap.Map.EventMap['hotspotclick']) { - // $ExpectType "hotspotclick" - event.type; - // $ExpectType string - event.id; - // $ExpectType LngLat - event.lnglat; - // $ExpectType number - this.test; -}, { test: 1 }); - -// $ExpectType void -AMap.event.removeListener(eventListener); - -// $ExpectType void -AMap.event.trigger(map, 'click', { - lnglat, - pixel, - target: map -}); -// $ExpectType void -AMap.event.trigger(map, 'hotspotclick', { - lnglat, - name: 'name', - id: 'id', - isIndoorPOI: true -}); -// $ExpectType void -AMap.event.trigger(map, 'complete'); diff --git a/types/amap-js-api/test/geometry-util.ts b/types/amap-js-api/test/geometry-util.ts deleted file mode 100644 index 98a8263fb0..0000000000 --- a/types/amap-js-api/test/geometry-util.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { - lnglat as point, - lnglatTuple as pointTuple -} from './preset'; - -const line = [point]; -const lineTuple = [pointTuple]; -const ring = [point]; -const ringTuple = [pointTuple]; -const polygon = [ring]; -const polygonTuple = [ringTuple]; -const util = AMap.GeometryUtil; - -// $ExpectType number -util.distance(point, point); -// $ExpectType number -util.distance(pointTuple, pointTuple); -// $ExpectType number -util.distance(point, line); -// $ExpectType number -util.distance(pointTuple, lineTuple); - -// $ExpectType number -util.ringArea(ring); -// $ExpectType number -util.ringArea(ringTuple); - -// $ExpectType boolean -util.isClockwise(ring); -// $ExpectType boolean -util.isClockwise(ringTuple); - -// $ExpectType number -util.distanceOfLine(line); -// $ExpectType number -util.distanceOfLine(lineTuple); - -// $ExpectType [number, number][] -util.ringRingClip(ring, ring); -// $ExpectType [number, number][] -util.ringRingClip(ringTuple, ringTuple); - -// $ExpectType boolean -util.doesRingRingIntersect(ring, ring); -// $ExpectType boolean -util.doesRingRingIntersect(ringTuple, ringTuple); - -// $ExpectType boolean -util.doesLineRingIntersect(line, ring); -// $ExpectType boolean -util.doesLineRingIntersect(lineTuple, ringTuple); - -// $ExpectType boolean -util.doesLineLineIntersect(line, line); -// $ExpectType boolean -util.doesLineLineIntersect(lineTuple, lineTuple); - -// $ExpectType boolean -util.doesSegmentPolygonIntersect(point, point, polygon); -// $ExpectType boolean -util.doesSegmentPolygonIntersect(pointTuple, pointTuple, polygonTuple); - -// $ExpectType boolean -util.doesSegmentRingIntersect(point, point, ring); -// $ExpectType boolean -util.doesSegmentRingIntersect(pointTuple, pointTuple, ringTuple); - -// $ExpectType boolean -util.doesSegmentLineIntersect(point, point, line); -// $ExpectType boolean -util.doesSegmentLineIntersect(pointTuple, pointTuple, lineTuple); - -// $ExpectType boolean -util.doesSegmentsIntersect(point, point, point, point); -// $ExpectType boolean -util.doesSegmentsIntersect(pointTuple, pointTuple, pointTuple, pointTuple); - -// $ExpectType boolean -util.isPointInRing(point, ring); -// $ExpectType boolean -util.isPointInRing(pointTuple, ringTuple); - -// $ExpectType boolean -util.isRingInRing(ring, ring); -// $ExpectType boolean -util.isRingInRing(ringTuple, ringTuple); - -// $ExpectType boolean -util.isPointInPolygon(point, polygon); -// $ExpectType boolean -util.isPointInPolygon(pointTuple, polygonTuple); - -// $ExpectType [number, number][] -util.makesureClockwise(lineTuple); - -// $ExpectType [number, number][] -util.makesureAntiClockwise(lineTuple); - -// $ExpectType [number, number] -util.closestOnSegment(point, point, point); -// $ExpectType [number, number] -util.closestOnSegment(pointTuple, pointTuple, pointTuple); - -// $ExpectType [number, number] -util.closestOnSegment(point, point, point); -// $ExpectType [number, number] -util.closestOnSegment(pointTuple, pointTuple, pointTuple); - -// $ExpectType [number, number] -util.closestOnLine(point, line); -// $ExpectType [number, number] -util.closestOnLine(pointTuple, lineTuple); - -// $ExpectType number -util.distanceToSegment(point, point, point); -// $ExpectType number -util.distanceToSegment(pointTuple, pointTuple, pointTuple); - -// $ExpectType number -util.distanceToLine(point, line); -// $ExpectType number -util.distanceToLine(pointTuple, lineTuple); - -// $ExpectType boolean -util.isPointOnSegment(point, point, point); -// $ExpectType boolean -util.isPointOnSegment(point, point, point, 1); -// $ExpectType boolean -util.isPointOnSegment(pointTuple, pointTuple, pointTuple); -// $ExpectType boolean -util.isPointOnSegment(pointTuple, pointTuple, pointTuple, 1); - -// $ExpectType boolean -util.isPointOnLine(point, line); -// $ExpectType boolean -util.isPointOnLine(point, line, 1); -// $ExpectType boolean -util.isPointOnLine(pointTuple, lineTuple); -// $ExpectType boolean -util.isPointOnLine(pointTuple, lineTuple, 1); - -// $ExpectType boolean -util.isPointOnRing(point, ring); -// $ExpectType boolean -util.isPointOnRing(point, ring, 1); -// $ExpectType boolean -util.isPointOnRing(pointTuple, ringTuple); -// $ExpectType boolean -util.isPointOnRing(pointTuple, ringTuple, 1); - -// $ExpectType boolean -util.isPointOnPolygon(point, polygon); -// $ExpectType boolean -util.isPointOnPolygon(point, polygon, 1); -// $ExpectType boolean -util.isPointOnPolygon(pointTuple, polygonTuple); -// $ExpectType boolean -util.isPointOnPolygon(pointTuple, polygonTuple, 1); diff --git a/types/amap-js-api/test/layer/buildings.ts b/types/amap-js-api/test/layer/buildings.ts deleted file mode 100644 index 209b3c490b..0000000000 --- a/types/amap-js-api/test/layer/buildings.ts +++ /dev/null @@ -1,40 +0,0 @@ -declare var map: AMap.Map; -declare var lnglat: AMap.LngLat; - -// $ExpectType Buildings -var buildings = new AMap.Buildings(); -// $ExpectType Buildings -new AMap.Buildings(); -// $ExpectType Buildings -new AMap.Buildings({ - zooms: [1, 18], - opacity: 0.8, - heightFactor: 1, - visible: true, - zIndex: 10, - map -}); - -buildings.setStyle({ - hideWithoutStyle: false, - areas: [ - { - visible: true, - rejectTexture: true, - color1: 'ffffff00', - color2: 'ffffcc00', - path: [[1, 2]] - }, - { - visible: true, - rejectTexture: true, - color1: 'ffffff00', - color2: 'ffffcc00', - path: [lnglat] - }, - { - color1: 'ff99ff00', - path: [lnglat] - }, - ] -}); diff --git a/types/amap-js-api/test/layer/canvasLayer.ts b/types/amap-js-api/test/layer/canvasLayer.ts deleted file mode 100644 index 577d032b2c..0000000000 --- a/types/amap-js-api/test/layer/canvasLayer.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - map, - bounds -} from '../preset'; - -declare const canvas: HTMLCanvasElement; - -// $ExpectType CanvasLayer -new AMap.CanvasLayer({ - map, - bounds, - visible: true, - zooms: [1, 2], - opacity: 1 -}); - -// $ExpectType CanvasLayer -new AMap.CanvasLayer(); -// $ExpectType CanvasLayer -new AMap.CanvasLayer({}); -// $ExpectType CanvasLayer -const canvasLayer = new AMap.CanvasLayer({ - bounds -}); - -// $ExpectType void -canvasLayer.setMap(null); -// $ExpectType void -canvasLayer.setMap(map); - -// $ExpectType Map | null | undefined -canvasLayer.getMap(); - -// $ExpectType void -canvasLayer.show(); - -// $ExpectType void -canvasLayer.hide(); - -// $ExpectType number -canvasLayer.getzIndex(); - -// $ExpectType void -canvasLayer.setzIndex(10); - -// $ExpectType HTMLCanvasElement | null -canvasLayer.getElement(); - -// $ExpectType void -canvasLayer.setCanvas(canvas); - -// $ExpectType HTMLCanvasElement | undefined -canvasLayer.getCanvas(); diff --git a/types/amap-js-api/test/layer/flexible.ts b/types/amap-js-api/test/layer/flexible.ts deleted file mode 100644 index 5a0e3f7aa7..0000000000 --- a/types/amap-js-api/test/layer/flexible.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { - map -} from '../preset'; - -const img = document.createElement('img'); -const canvas = document.createElement('canvas'); - -// $ExpectType Flexible -new AMap.TileLayer.Flexible(); -// $ExpectType Flexible -new AMap.TileLayer.Flexible({}); -// $ExpectType Flexible -const flexible = new AMap.TileLayer.Flexible({ - createTile(x, y, z, success, fail) { - // $ExpectType number - x; - // $ExpectType number - y; - // $ExpectType number - z; - // $ExpectType void - success(img); - // $ExpectType void - success(canvas); - // $ExpectType void - fail(); - }, - cacheSize: 10, - opacity: 1, - visible: true, - map, - zIndex: 1, - zooms: [1, 2] -}); - -// $ExpectType void -flexible.setMap(null); -// $ExpectType void -flexible.setMap(map); - -// $ExpectType Map | null | undefined -flexible.getMap(); - -// $ExpectType void -flexible.show(); - -// $ExpectType void -flexible.hide(); - -// $ExpectType void -flexible.setzIndex(10); - -// $ExpectType number -flexible.getzIndex(); diff --git a/types/amap-js-api/test/layer/imageLayer.ts b/types/amap-js-api/test/layer/imageLayer.ts deleted file mode 100644 index 06b9fc076e..0000000000 --- a/types/amap-js-api/test/layer/imageLayer.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - map, - bounds -} from '../preset'; - -// $ExpectType ImageLayer -new AMap.ImageLayer({ - map, - bounds, - visible: true, - zooms: [1, 2], - opacity: 1 -}); - -// $ExpectType ImageLayer -new AMap.ImageLayer(); -// $ExpectType ImageLayer -new AMap.ImageLayer({}); -// $ExpectType ImageLayer -const imageLayer = new AMap.ImageLayer({ - bounds -}); - -// $ExpectType void -imageLayer.setMap(null); -// $ExpectType void -imageLayer.setMap(map); - -// $ExpectType Map | null | undefined -imageLayer.getMap(); - -// $ExpectType void -imageLayer.show(); - -// $ExpectType void -imageLayer.hide(); - -// $ExpectType number -imageLayer.getzIndex(); - -// $ExpectType void -imageLayer.setzIndex(10); - -// $ExpectType HTMLImageElement | null -imageLayer.getElement(); - -// $ExpectType void -imageLayer.setImageUrl('url'); - -// $ExpectType string | undefined -imageLayer.getImageUrl(); diff --git a/types/amap-js-api/test/layer/layer.ts b/types/amap-js-api/test/layer/layer.ts deleted file mode 100644 index 921c90e52d..0000000000 --- a/types/amap-js-api/test/layer/layer.ts +++ /dev/null @@ -1,34 +0,0 @@ -declare var layer: AMap.Layer; -declare var map: AMap.Map; - -// $ExpectError -new AMap.Layer(); - -// $ExpectType HTMLDivElement | undefined -layer.getContainer(); - -// $ExpectType [number, number] -layer.getZooms(); - -// $ExpectType void -layer.setOpacity(1); - -// $ExpectType number -layer.getOpacity(); - -// $ExpectType void -layer.show(); - -// $ExpectType void -layer.hide(); - -// $ExpectType void -layer.setMap(); -// $ExpectType void -layer.setMap(map); - -// $ExpectType void -layer.setzIndex(1); - -// $ExpectType number -layer.getzIndex(); diff --git a/types/amap-js-api/test/layer/layerGroup.ts b/types/amap-js-api/test/layer/layerGroup.ts deleted file mode 100644 index bcad7d6f50..0000000000 --- a/types/amap-js-api/test/layer/layerGroup.ts +++ /dev/null @@ -1,115 +0,0 @@ -declare var map: AMap.Map; -declare var tileLayer: AMap.TileLayer; -declare var massMarksLayer: AMap.MassMarks; -declare var layer: AMap.Layer; - -// $ExpectError -new AMap.LayerGroup(); - -// $ExpectType LayerGroup -new AMap.LayerGroup(tileLayer); -// $ExpectType LayerGroup -new AMap.LayerGroup([tileLayer]); - -declare var layerGruop: AMap.LayerGroup; - -// $ExpectType LayerGroup -layerGruop.addLayer(tileLayer); -// $ExpectType LayerGroup -layerGruop.addLayer([tileLayer]); -// $ExpectError -layerGruop.addLayer(massMarksLayer); - -// $ExpectType TileLayer[] -layerGruop.getLayers(); - -// $ExpectType TileLayer | null -layerGruop.getLayer(function (item, index, list) { - // $ExpectType TileLayer - item; - // $ExpectType number - index; - // $ExpectType TileLayer[] - list; - // $ExpectType null - this; - - return true; -}); - -layerGruop.hasLayer(function (item, index, list) { - // $ExpectType TileLayer - item; - // $ExpectType number - index; - // $ExpectType TileLayer[] - list; - // $ExpectType null - this; - - return true; -}); -layerGruop.hasLayer(tileLayer); - -// $ExpectType LayerGroup -layerGruop.removeLayer(tileLayer); -// $ExpectType LayerGroup -layerGruop.removeLayer([tileLayer]); - -// $ExpectType LayerGroup -layerGruop.clearLayers(); - -layerGruop.eachLayer(function (item, index, list) { - // $ExpectType TileLayer - item; - // $ExpectType number - index; - // $ExpectType TileLayer[] - list; - // $ExpectType TileLayer - this; -}); -layerGruop.eachLayer(function (item, index, list) { - // $ExpectType TileLayer - item; - // $ExpectType number - index; - // $ExpectType TileLayer[] - list; - // $ExpectType number - this.test; -}, { test: 1 }); - -// $ExpectType LayerGroup -layerGruop.setMap(map); - -// $ExpectType LayerGroup -layerGruop.hide(); - -// $ExpectType LayerGroup -layerGruop.show(); - -// $ExpectType LayerGroup -layerGruop.reload(); - -// $ExpectType LayerGroup -layerGruop.setOptions({}); - -// $ExpectType LayerGroup -layerGruop.setOptions({ - tileSize: 256 -}); -// layerGruop.setOptions({ -// // $ExpectError -// interval: 1 -// }); - -declare var layerGroup2: AMap.LayerGroup; - -layerGroup2.addLayer(tileLayer); - -layerGroup2.addLayer(massMarksLayer); - -layerGroup2.setOptions({ - test: 1 -}); diff --git a/types/amap-js-api/test/layer/massMarks.ts b/types/amap-js-api/test/layer/massMarks.ts deleted file mode 100644 index 5f4bfbf455..0000000000 --- a/types/amap-js-api/test/layer/massMarks.ts +++ /dev/null @@ -1,83 +0,0 @@ -declare var pixel: AMap.Pixel; -declare var size: AMap.Size; -declare var lnglat: AMap.LngLat; -var massMarksStyle1 = { - anchor: pixel, - url: '', - size, - rotation: 1 -}; -var massMarksStyle2 = { - anchor: pixel, - url: '', - size -}; -var massMarksData1 = { - lnglat -}; - -interface CustomData extends AMap.MassMarks.Data { - name: string; - id: string; -} -var massMarksCustomData: CustomData = { - lnglat: [1, 2], - style: 1, - name: '', - id: '' -}; - -// $ExpectError -new AMap.MassMarks(); -// $ExpectError -new AMap.MassMarks([], {}); - -new AMap.MassMarks([], { - style: [massMarksStyle1, massMarksStyle2] -}); -new AMap.MassMarks([massMarksData1], { - style: [massMarksStyle1, massMarksStyle2] -}); - -// $ExpectType MassMarks -var massMarks = new AMap.MassMarks([massMarksCustomData], { - style: [massMarksStyle1, massMarksStyle2] -}); - -// $ExpectType void -massMarks.setStyle(massMarksStyle1); -// $ExpectType void -massMarks.setStyle([massMarksStyle1]); - -// $ExpectType Style | Style[] -massMarks.getStyle(); - -// $ExpectType void -massMarks.setData(''); - -// $ExpectError -massMarks.setData(massMarksData1); -// $ExpectError -massMarks.setData(massMarksCustomData); - -var _customData = massMarks.getData()[0]; -// $ExpectType string -_customData.name; -// $ExpectType string -_customData.id; -// $ExpectType LngLat -_customData.lnglat; - -// $ExpectType void -massMarks.clear(); - -massMarks.on('click', (event: AMap.MassMarks.EventMap['click']) => { - // $ExpectType "click" - event.type; - - // $ExpectType CustomData - event.data; - - // $ExpectType MassMarks - event.target; -}); diff --git a/types/amap-js-api/test/layer/tileLayer.ts b/types/amap-js-api/test/layer/tileLayer.ts deleted file mode 100644 index 7e4e2dc2e4..0000000000 --- a/types/amap-js-api/test/layer/tileLayer.ts +++ /dev/null @@ -1,60 +0,0 @@ -declare var map: AMap.Map; - -// $ExpectType TileLayer -var tileLayer = new AMap.TileLayer(); - -// $ExpectType TileLayer -new AMap.TileLayer({}); - -// $ExpectType TileLayer -new AMap.TileLayer({ - map, - tileSize: 256, - tileUrl: '', - errorUrl: '', - getTileUrl: (x, y, z) => '', - zIndex: 1, - opacity: 0.1, - zooms: [3, 18], - detectRetina: true -}); - -// $ExpectType string[] -tileLayer.getTiles(); - -// $ExpectType void -tileLayer.reload(); - -// $ExpectType void -tileLayer.setTileUrl(''); -// $ExpectType void -tileLayer.setTileUrl((x, y, level) => { - // $ExpectType number - x; - // $ExpectType number - y; - // $ExpectType number - level; - return ''; -}); - -// Traffic - -// $ExpectType Traffic -let trafficLayer = new AMap.TileLayer.Traffic(); -// $ExpectType Traffic -new AMap.TileLayer.Traffic({}); -// $ExpectType Traffic -new AMap.TileLayer.Traffic({ - autoRefresh: true, - interval: 180 -}); - -// $ExpectType TileLayer -tileLayer.on('complete', () => { }); - -tileLayer.off('complete', () => { }); - -tileLayer.emit('complete'); - -trafficLayer.on('complete', () => { }); diff --git a/types/amap-js-api/test/layer/videoLayer.ts b/types/amap-js-api/test/layer/videoLayer.ts deleted file mode 100644 index e34718193c..0000000000 --- a/types/amap-js-api/test/layer/videoLayer.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - map, - bounds -} from '../preset'; - -// $ExpectType VideoLayer -new AMap.VideoLayer({ - map, - bounds, - visible: true, - zooms: [1, 2], - opacity: 1 -}); - -// $ExpectType VideoLayer -new AMap.VideoLayer(); -// $ExpectType VideoLayer -new AMap.VideoLayer({}); -// $ExpectType VideoLayer -const videoLayer = new AMap.VideoLayer({ - bounds -}); - -// $ExpectType void -videoLayer.setMap(null); -// $ExpectType void -videoLayer.setMap(map); - -// $ExpectType Map | null | undefined -videoLayer.getMap(); - -// $ExpectType void -videoLayer.show(); - -// $ExpectType void -videoLayer.hide(); - -// $ExpectType number -videoLayer.getzIndex(); - -// $ExpectType void -videoLayer.setzIndex(10); - -// $ExpectType HTMLVideoElement | null -videoLayer.getElement(); - -// $ExpectType void -videoLayer.setVideoUrl('url'); - -// $ExpectType string | string[] | undefined -videoLayer.getVideoUrl(); diff --git a/types/amap-js-api/test/layer/wms.ts b/types/amap-js-api/test/layer/wms.ts deleted file mode 100644 index 255affa216..0000000000 --- a/types/amap-js-api/test/layer/wms.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { - map -} from '../preset'; - -// $ExpectType WMS -new AMap.TileLayer.WMS({ - url: 'url', - params: {} -}); -// $ExpectType WMS -const wms = new AMap.TileLayer.WMS({ - url: 'url', - blend: true, - params: { - VERSION: 'version', - LAYERS: 'layers', - STYLES: 'styles', - FORMAT: 'format', - TRANSPARENT: 'TRUE', - BGCOLOR: '#000', - EXCEPTIONS: 'exceptions', - TIME: 'time', - ELEVATION: 'elevation' - }, - zooms: [1, 2], - tileSize: 256, - opacity: 1, - zIndex: 10, - visible: true -}); - -// $ExpectType void -wms.setMap(map); -// $ExpectType void -wms.setMap(null); - -// $ExpectType Map | null | undefined -wms.getMap(); - -// $ExpectType void -wms.show(); - -// $ExpectType void -wms.hide(); - -// $ExpectType void -wms.setzIndex(10); - -// $ExpectType number -wms.getzIndex(); - -// $ExpectType void -wms.setUrl('url'); - -// $ExpectType string -wms.getUrl(); - -// $ExpectType void -wms.setParams({ - VERSION: 'version', - LAYERS: 'layers', - STYLES: 'styles', - FORMAT: 'format', - TRANSPARENT: 'TRUE', - BGCOLOR: '#000', - EXCEPTIONS: 'exceptions', - TIME: 'time', - ELEVATION: 'elevation' -}); - -const params = wms.getParams(); -// $ExpectType string | undefined -params.VERSION; -// $ExpectType string | undefined -params.LAYERS; -// $ExpectType string | undefined -params.STYLES; -// $ExpectType string | undefined -params.FORMAT; -// $ExpectType "TRUE" | "FALSE" | undefined -params.TRANSPARENT; -// $ExpectType string | undefined -params.BGCOLOR; -// $ExpectType string | undefined -params.EXCEPTIONS; -// $ExpectType string | undefined -params.TIME; -// $ExpectType string | undefined -params.ELEVATION; diff --git a/types/amap-js-api/test/layer/wmts.ts b/types/amap-js-api/test/layer/wmts.ts deleted file mode 100644 index bc167c1189..0000000000 --- a/types/amap-js-api/test/layer/wmts.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - map -} from '../preset'; - -// $ExpectType WMTS -new AMap.TileLayer.WMTS({ - url: 'url', - params: {} -}); -// $ExpectType WMTS -const wmts = new AMap.TileLayer.WMTS({ - url: 'url', - blend: true, - tileSize: 256, - zooms: [1, 2], - opacity: 1, - zIndex: 10, - visible: true, - params: { - Version: 'version', - Layer: 'layers', - Style: 'style', - Format: 'format' - } -}); - -// $ExpectType void -wmts.setMap(map); -// $ExpectType void -wmts.setMap(null); - -// $ExpectType Map | null | undefined -wmts.getMap(); - -// $ExpectType void -wmts.show(); - -// $ExpectType void -wmts.hide(); - -// $ExpectType void -wmts.setzIndex(10); - -// $ExpectType number -wmts.getzIndex(); - -// $ExpectType void -wmts.setUrl('url'); - -// $ExpectType string -wmts.getUrl(); - -// $ExpectType void -wmts.setParams({ - Version: 'version', - Layer: 'layers', - Style: 'style', - Format: 'format' -}); - -const params = wmts.getParams(); -// $ExpectType string | undefined -params.Version; -// $ExpectType string | undefined -params.Layer; -// $ExpectType string | undefined -params.Style; -// $ExpectType string | undefined -params.Format; diff --git a/types/amap-js-api/test/lnglat.ts b/types/amap-js-api/test/lnglat.ts deleted file mode 100644 index 92057953ee..0000000000 --- a/types/amap-js-api/test/lnglat.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - lnglat -} from './preset'; - -// $ExpectType LngLat -new AMap.LngLat(114, 22); -// $ExpectType LngLat -new AMap.LngLat(113, 21); - -// $ExpectType LngLat -lnglat.offset(1, 2); - -// $ExpectType number -lnglat.distance(lnglat); -// $ExpectType number -lnglat.distance([lnglat]); - -// $ExpectType number -lnglat.getLng(); - -// $ExpectType number -lnglat.getLat(); - -// $ExpectType boolean -lnglat.equals(lnglat); - -// $ExpectType string -lnglat.toString(); - -// $ExpectType LngLat -lnglat.add(lnglat); -// $ExpectType LngLat -lnglat.add(lnglat, true); - -// $ExpectType LngLat -lnglat.subtract(lnglat); -// $ExpectType LngLat -lnglat.subtract(lnglat, true); - -// $ExpectType LngLat -lnglat.divideBy(1); -// $ExpectType LngLat -lnglat.divideBy(1, true); - -// $ExpectType LngLat -lnglat.multiplyBy(1); -// $ExpectType LngLat -lnglat.multiplyBy(1, true); diff --git a/types/amap-js-api/test/map.ts b/types/amap-js-api/test/map.ts deleted file mode 100644 index 6f2b027e60..0000000000 --- a/types/amap-js-api/test/map.ts +++ /dev/null @@ -1,338 +0,0 @@ -import { - lnglat, - bounds, - lnglatTuple, - pixel -} from './preset'; - -declare const container: HTMLDivElement; -declare const tileLayer: AMap.TileLayer; - -// declare var indoorMap: AMap.IndoorMap - -// $ExpectType Map -new AMap.Map('map'); -// $ExpectType Map -new AMap.Map(container); - -// $ExpectType Map -new AMap.Map(container, {}); - -// $ExpectType Map -const map = new AMap.Map(container, { - layers: [tileLayer], - zoom: 15, - center: [1, 2], - labelzIndex: 110, - zooms: [5, 15], - lang: 'zh_cn', - defaultCursor: 'default', - crs: 'EPSG4326', - animateEnable: true, - isHotspot: false, - defaultLayer: tileLayer, - rotateEnable: true, - resizeEnable: true, - showIndoorMap: true, - // indoorMap, // TODO - expandZoomRange: true, - dragEnable: true, - zoomEnable: true, - doubleClickZoom: true, - keyboardEnable: true, - jogEnable: true, - scrollWheel: true, - touchZoom: true, - mapStyle: '', - features: ['road'], - showBuildingBlock: true, - skyColor: '#fff', - preloadMode: true, - mask: [[1, 2], [2, 3], [3, 4]] -}); - -// $ExpectType number -map.getZoom(); - -// $ExpectType Layer[] -map.getLayers(); - -// $ExpectType LngLat -map.getCenter(); - -// $ExpectType HTMLElement | null -map.getContainer(); - -map.getCity(city => { - // $ExpectType string - city.city; - // $ExpectType string - city.citycode; - // $ExpectType string - city.district; - // $ExpectType string | never[] - city.province; -}); - -// $ExpectType Bounds -map.getBounds(); - -// $ExpectType number -map.getLabelzIndex(); - -// $ExpectType Lang -map.getLang(); - -// $ExpectType Size -map.getSize(); - -// $ExpectType number -map.getRotation(); - -// $ExpectType Status -const mapStatus = map.getStatus(); -// $ExpectType boolean -mapStatus.animateEnable; -// $ExpectType boolean -mapStatus.doubleClickZoom; -// $ExpectType boolean -mapStatus.dragEnable; -// $ExpectType boolean -mapStatus.isHotspot; -// $ExpectType boolean -mapStatus.jogEnable; -// $ExpectType boolean -mapStatus.keyboardEnable; -// $ExpectType boolean -mapStatus.pitchEnable; -// $ExpectType boolean -mapStatus.resizeEnable; -// $ExpectType boolean -mapStatus.rotateEnable; -// $ExpectType boolean -mapStatus.scrollWheel; -// $ExpectType boolean -mapStatus.touchZoom; -// $ExpectType boolean -mapStatus.zoomEnable; - -// $ExpectType string -map.getDefaultCursor(); - -// $ExpectType number -map.getResolution(); - -// $ExpectType number -map.getScale(); -// $ExpectType number -map.getScale(1); - -// $ExpectType void -map.setZoom(1); - -// $ExpectType void -map.setLabelzIndex(1); - -// $ExpectType void -map.setLayers([tileLayer]); - -// $ExpectType void -map.setCenter(lnglat); -// $ExpectType void -map.setCenter([1, 2]); - -// $ExpectType void -map.setZoomAndCenter(13, lnglat); -// $ExpectType void -map.setZoomAndCenter(13, [1, 2]); - -// $ExpectType void -map.setCity('city', (coord, zoom) => { - // $ExpectType string - coord[0]; - // $ExpectType string - coord[1]; - // $ExpectType number - zoom; -}); - -// $ExpectType Bounds -map.setBounds(bounds); - -// $ExpectType void -map.setLimitBounds(bounds); - -// $ExpectType void -map.clearLimitBounds(); - -// $ExpectType void -map.setLang('zh_cn'); - -// $ExpectType void -map.setRotation(1); - -// $ExpectType void -map.setStatus({}); -// $ExpectType void -map.setStatus({ - animateEnable: true, - doubleClickZoom: true, - dragEnable: true, - isHotspot: true, - jogEnable: true, - keyboardEnable: true, - pitchEnable: false, - resizeEnable: false, - rotateEnable: false, - scrollWheel: true, - touchZoom: true, - zoomEnable: true -}); - -// $ExpectType void -map.setDefaultCursor('default'); - -// $ExpectType void -map.zoomIn(); - -// $ExpectType void -map.zoomOut(); - -// $ExpectType void -map.panTo([1, 2]); -// $ExpectType void -map.panTo(lnglat); - -// $ExpectType void -map.panBy(1, 2); - -// $ExpectType void -map.clearMap(); - -// $ExpectType Map -map.plugin('plugin name', () => { }); -// $ExpectType Map -map.plugin(['plugin name'], () => { }); - -// $ExpectType void -map.clearInfoWindow(); - -// $ExpectType LngLat -map.pixelToLngLat(pixel); -// $ExpectType LngLat -map.pixelToLngLat(pixel, 1); - -// $ExpectType Pixel -map.lnglatToPixel(lnglat); -// $ExpectType Pixel -map.lnglatToPixel(lnglat, 1); - -// $ExpectType LngLat -map.containerToLngLat(pixel); - -// $ExpectType Pixel -map.lngLatToContainer(lnglat); -// $ExpectType Pixel -map.lnglatTocontainer(lnglat); - -// $ExpectType void -map.setMapStyle(''); -// $ExpectType string -map.getMapStyle(); - -// $ExpectType void -map.setFeatures('all'); -// $ExpectType void -map.setFeatures(['bg']); - -const feature: 'all' | 'bg' | 'point' | 'road' | 'building' | AMap.Map.Feature[] = map.getFeatures(); - -// $ExpectType void -map.setDefaultLayer(tileLayer); - -// $ExpectType void -map.setPitch(1); -// $ExpectType number -map.getPitch(); - -// $ExpectType ViewMode -map.getViewMode_(); - -// $ExpectType Pixel -map.lngLatToGeodeticCoord(lnglat); -// $ExpectType Pixel -map.lngLatToGeodeticCoord(lnglatTuple); - -// $ExpectType LngLat -map.geodeticCoordToLngLat(pixel); - -// $ExpectType void -map.destroy(); - -declare function dblClickHandler(this: AMap.Map, event: AMap.Map.EventMap['dblclick']): void; - -// $ExpectType Map -map.on('click', (event: AMap.Map.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType Pixel - event.pixel; - // $ExpectType LngLat - event.lnglat; - // $ExpectType Map - event.target; -}); -// $ExpectType Map -map.on('dblclick', dblClickHandler); -// $ExpectType Map -map.on('complete', (event: AMap.Map.EventMap['complete']) => { - // $ExpectType "complete" - event.type; - // $ExpectError - event.value; -}); -// $ExpectType Map -map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { - // $ExpectType string - event.id; - // $ExpectType LngLat - event.lnglat; - // $ExpectType string - event.name; - // $ExpectType "hotspotclick" - event.type; -}); -// $ExpectType Map -map.on('custom', (event: AMap.Event<'custom', { test: string }>) => { - // $ExpectType "custom" - event.type; - // $ExpectType string - event.test; -}); - -// $ExpectType Map -map.off('dblclick', dblClickHandler); -// $ExpectType Map -map.off('click', 'mv'); - -// $ExpectType Map -map.emit('click', { - target: map, - lnglat, - pixel -}); - -map.emit('complete'); -// $ExpectType Map -map.emit('hotspotclick', { - lnglat, - name: '123', - id: '123', - isIndoorPOI: true -}); -// $ExpectType Map -map.emit('custom', { - test: 1 -}); -// $ExpectType Map -map.emit('custom', undefined); diff --git a/types/amap-js-api/test/overlay/bezierCurve.ts b/types/amap-js-api/test/overlay/bezierCurve.ts deleted file mode 100644 index abf0640fc9..0000000000 --- a/types/amap-js-api/test/overlay/bezierCurve.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { - map, - lnglat -} from '../preset'; - -interface ExtraData { - test: number; -} - -const path = [ - [1, 2, 3, 4], - [1, 2, 3], - [ - [1, 2, 3], - [1, 2] - ], - [1, 2] -]; - -// $ExpectError -new AMap.BezierCurve(); -// $ExpectError -new AMap.BezierCurve({}); -// $ExpectType BezierCurve -const bezierCurve = new AMap.BezierCurve({ - map, - path, - strokeColor: '#FF0000', - strokeOpacity: 0.6, - strokeWeight: 10, - strokeStyle: 'dashed', - strokeDasharray: [1, 5], - zIndex: 10, - bubble: false, - showDir: true, - cursor: 'pointer', - isOutline: true, - outlineColor: '#00FF00', - borderWeight: 2 -}); - -// $ExpectType void -bezierCurve.setPath(path); - -// $ExpectType void -bezierCurve.setPath(path); - -// $ExpectType void -bezierCurve.setOptions({}); -bezierCurve.setOptions({ - map, - path, - strokeColor: '#FF0000', - strokeOpacity: 0.6, - strokeWeight: 10, - strokeStyle: 'dashed', - strokeDasharray: [1, 5], - zIndex: 10, - bubble: false, - showDir: true, - cursor: 'pointer', - isOutline: true, - outlineColor: '#00FF00', - borderWeight: 2 -}); - -const options = bezierCurve.getOptions(); - -// $ExpectType number | undefined -options.borderWeight; -// $ExpectType boolean | undefined -options.bubble; -// $ExpectType boolean | undefined -options.clickable; -// $ExpectType string | undefined -options.dirColor; -// $ExpectType string | undefined -options.dirImg; -// $ExpectType {} | ExtraData | undefined -options.extData; -// $ExpectType boolean | undefined -options.geodesic; -// $ExpectType boolean | undefined -options.isOutline; -// $ExpectType "round" | "butt" | "square" | undefined -options.lineCap; -// $ExpectType "miter" | "round" | "bevel" | undefined -options.lineJoin; -// $ExpectType Map | undefined -options.map; -// $ExpectType string | undefined -options.outlineColor; -// $ExpectType (LngLat & { controlPoints: LngLat[]; })[] | undefined -options.path; -// $ExpectType boolean | undefined -options.showDir; -// $ExpectType string | undefined -options.strokeColor; -// $ExpectType number[] | undefined -options.strokeDasharray; -// $ExpectType number | undefined -options.strokeOpacity; -// $ExpectType "dashed" | "solid" | undefined -options.strokeStyle; -// $ExpectType number | undefined -options.strokeWeight; -// $ExpectType number | undefined -options.zIndex; - -// $ExpectType number -bezierCurve.getLength(); - -// $ExpectType Bounds | null -bezierCurve.getBounds(); - -// $ExpectType void -bezierCurve.show(); - -// $ExpectType void -bezierCurve.hide(); - -// $ExpectType void -bezierCurve.setMap(null); -bezierCurve.setMap(map); - -// $ExpectType void -bezierCurve.setExtData({ test: 1 }); -// $ExpectError -bezierCurve.setExtData({ test: '123' }); - -// $ExpectType {} | ExtraData -bezierCurve.getExtData(); - -bezierCurve.on('click', (event: AMap.BezierCurve.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType LngLat - event.lnglat; - // $ExpectType BezierCurve - event.target; -}); - -bezierCurve.on('show', (event: AMap.BezierCurve.EventMap['show']) => { - // $ExpectType "show" - event.type; - // $ExpectType BezierCurve - event.target; -}); - -bezierCurve.on('options', (event: AMap.BezierCurve.EventMap['options']) => { - // $ExpectType "options" - event.type; - // $ExpectError - event.target; -}); diff --git a/types/amap-js-api/test/overlay/circle.ts b/types/amap-js-api/test/overlay/circle.ts deleted file mode 100644 index 28822b9ec9..0000000000 --- a/types/amap-js-api/test/overlay/circle.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { - map, - lnglat, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} - -// $ExpectType Circle -new AMap.Circle(); -new AMap.Circle({}); -// $ExpectType Circle -const circle = new AMap.Circle({ - map, - zIndex: 10, - center: lnglat, - bubble: true, - cursor: 'pointer', - radius: 1000, - strokeColor: '#FF0000', - strokeOpcity: 0.8, - strokeWeight: 3, - fillColor: '#00FF00', - fillOpacity: 0.5, - strokeStyle: 'dashed', - extData: { test: 1 }, - strokeDasharray: [2, 4] -}); - -// $ExpectType void -circle.setCenter(lnglat); -// $ExpectType void -circle.setCenter(lnglatTuple); - -// $ExpectType LngLat | undefined -circle.getCenter(); - -// $ExpectType Bounds | null -circle.getBounds(); - -// $ExpectType void -circle.setRadius(100); - -// $ExpectType number -circle.getRadius(); - -// $ExpectType void -circle.setOptions({}); -circle.setOptions({ - map, - zIndex: 10, - center: lnglat, - bubble: true, - cursor: 'pointer', - radius: 1000, - strokeColor: '#FF0000', - strokeOpcity: 0.8, - strokeWeight: 3, - fillColor: '#00FF00', - fillOpacity: 0.5, - strokeStyle: 'dashed', - extData: { test: 1 }, - strokeDasharray: [2, 4] -}); - -const options = circle.getOptions(); -// $ExpectType boolean | undefined -options.bubble; -// $ExpectType LngLat | undefined -options.center; -// $ExpectType boolean | undefined -options.clickable; -// $ExpectType {} | ExtraData | undefined -options.extData; -// $ExpectType string | undefined -options.fillColor; -// $ExpectType number | undefined -options.fillOpacity; -// $ExpectType "miter" | "round" | "bevel" | undefined -options.lineJoin; -// $ExpectType Map | undefined -options.map; -// $ExpectType LngLat[] | undefined -options.path; -// $ExpectType number | undefined -options.radius; -// $ExpectType string | undefined -options.strokeColor; -// $ExpectType number[] | undefined -options.strokeDasharray; -// $ExpectType number | undefined -options.strokeOpacity; -// $ExpectType "dashed" | "solid" | undefined -options.strokeStyle; -// $ExpectType number | undefined -options.strokeWeight; -// $ExpectType string | undefined -options.texture; -// $ExpectType number | undefined -options.zIndex; - -// $ExpectType Bounds | null -circle.getBounds(); - -// $ExpectType void -circle.hide(); - -// $ExpectType void -circle.show(); - -// $ExpectType void -circle.setMap(null); -// $ExpectType void -circle.setMap(map); - -// $ExpectType void -circle.setExtData({ test: 2 }); -// $ExpectError -circle.setExtData({ test: '1' }); - -// $ExpectType {} | ExtraData -circle.getExtData(); - -// $ExpectType boolean -circle.contains(lnglat); -// $ExpectType boolean -circle.contains(lnglatTuple); - -circle.on('click', (event: AMap.Circle.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType Circle - event.target; -}); - -circle.on('setCenter', (event: AMap.Circle.EventMap['setCenter']) => { - // $ExpectType "setCenter" - event.type; - // $ExpectError - event.target; -}); - -circle.on('change', (event: AMap.Circle.EventMap['change']) => { - // $ExpectType "change" - event.type; - // $ExpectType Circle - event.target; -}); diff --git a/types/amap-js-api/test/overlay/contextMenu.ts b/types/amap-js-api/test/overlay/contextMenu.ts deleted file mode 100644 index 5c7173d26b..0000000000 --- a/types/amap-js-api/test/overlay/contextMenu.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - map, - lnglat, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} -// $ExpectType ContextMenu -new AMap.ContextMenu(); -// $ExpectType ContextMenu -new AMap.ContextMenu({}); -// $ExpectType ContextMenu -const contextMenu = new AMap.ContextMenu({ - content: '
content
', -}); - -// $ExpectType void -contextMenu.addItem('item', function () { - // $ExpectType HTMLLIElement - this; -}); -// $ExpectType void -contextMenu.addItem('item', () => { }, 1); - -// $ExpectType void -contextMenu.removeItem('item', () => {}); - -// $ExpectType void -contextMenu.open(map, lnglatTuple); -// $ExpectType void -contextMenu.open(map, lnglat); - -// $ExpectType void -contextMenu.close(); - -contextMenu.on('items', (event: AMap.ContextMenu.EventMap['items']) => { - // $ExpectType "items" - event.type; -}); - -contextMenu.on('open', (event: AMap.ContextMenu.EventMap['open']) => { - // $ExpectType "open" - event.type; - // $ExpectType ContextMenu - event.target; -}); diff --git a/types/amap-js-api/test/overlay/ellipse.ts b/types/amap-js-api/test/overlay/ellipse.ts deleted file mode 100644 index c5205d9915..0000000000 --- a/types/amap-js-api/test/overlay/ellipse.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - map, - lnglat, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} -// $ExpectType Ellipse -new AMap.Ellipse(); -// $ExpectType Ellipse -new AMap.Ellipse({}); -// $ExpectType Ellipse -const ellipse = new AMap.Ellipse({ - map, - zIndex: 10, - center: lnglat, - radius: [10000, 15000], - bubble: false, - cursor: 'pointer', - strokeColor: '#FF0000', - strokeOpacity: 0.8, - strokeWeight: 2, - fillColor: '#0000FF', - fillOpacity: 0.5, - strokeStyle: 'dashed', - extData: { test: 1 }, - strokeDasharray: [1, 5] -}); - -// $ExpectType LngLat | undefined -ellipse.getCenter(); - -// $ExpectType void -ellipse.setCenter(lnglat); -// $ExpectType void -ellipse.setCenter(lnglatTuple); - -// $ExpectType Bounds | null -ellipse.getBounds(); - -// $ExpectType void -ellipse.setOptions({ - map, - zIndex: 10, - center: lnglat, - radius: [10000, 15000], - bubble: false, - cursor: 'pointer', - strokeColor: '#FF0000', - strokeOpacity: 0.8, - strokeWeight: 2, - fillColor: '#0000FF', - fillOpacity: 0.5, - strokeStyle: 'dashed', - extData: { test: 1 }, - strokeDasharray: [1, 5] -}); - -const options = ellipse.getOptions(); - -// $ExpectType boolean | undefined -options.bubble; -// $ExpectType LngLat | undefined -options.center; -// $ExpectType boolean | undefined -options.clickable; -// $ExpectType {} | ExtraData | undefined -options.extData; -// $ExpectType string | undefined -options.fillColor; -// $ExpectType number | undefined -options.fillOpacity; -// $ExpectType "miter" | "round" | "bevel" | undefined -options.lineJoin; -// $ExpectType Map | undefined -options.map; -// $ExpectType LngLat[] | undefined -options.path; -// $ExpectType [number, number] | undefined -options.radius; -// $ExpectType string | undefined -options.strokeColor; -// $ExpectType number[] | undefined -options.strokeDasharray; -// $ExpectType number | undefined -options.strokeOpacity; -// $ExpectType "dashed" | "solid" | undefined -options.strokeStyle; -// $ExpectType number | undefined -options.strokeWeight; -// $ExpectType string | undefined -options.texture; -// $ExpectType number | undefined -options.zIndex; - -// $ExpectType void -ellipse.hide(); - -// $ExpectType void -ellipse.show(); - -// $ExpectType void -ellipse.setMap(null); -// $ExpectType void -ellipse.setMap(map); - -// $ExpectType void -ellipse.setExtData({test: 2}); -// $ExpectType {} | ExtraData -ellipse.getExtData(); - -// $ExpectType boolean -ellipse.contains(lnglat); -// $ExpectType boolean -ellipse.contains(lnglatTuple); diff --git a/types/amap-js-api/test/overlay/geoJSON.ts b/types/amap-js-api/test/overlay/geoJSON.ts deleted file mode 100644 index ee8c501472..0000000000 --- a/types/amap-js-api/test/overlay/geoJSON.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { - map, - lnglatTuple -} from '../preset'; - -declare const marker: AMap.Marker; -declare const polyline: AMap.Polyline; -declare const polygon: AMap.Polygon; - -interface ExtraData { - test: number; -} - -const geoJSONObject: AMap.GeoJSON.GeoJSONObject[] = [ - { - type: 'Feature', - properties: {}, - geometry: { - type: 'Point', - coordinates: lnglatTuple - } - }, - { - type: 'Feature', - properties: { test: 1 }, - geometry: { - type: 'LineString', - coordinates: [lnglatTuple, lnglatTuple] - } - } -]; - -// $ExpectType GeoJSON -new AMap.GeoJSON(); -// $ExpectType GeoJSON -new AMap.GeoJSON({}); -// $ExpectType GeoJSON -const geoJSON = new AMap.GeoJSON({ - geoJSON: geoJSONObject, - getMarker(obj, lnglat) { - // $ExpectType GeoJSONObject - obj; - // $ExpectType LngLat - lnglat; - return marker; - }, - getPolyline(obj, lnglats) { - // $ExpectType GeoJSONObject - obj; - // $ExpectType LngLat[] - lnglats; - return polyline; - }, - getPolygon(obj, lnglats) { - // $ExpectType GeoJSONObject - obj; - // $ExpectType LngLat[] - lnglats; - return polygon; - }, - coordsToLatLng(coord) { - // $ExpectType LngLat - coord; - return coord; - } -}); - -// $ExpectType void -geoJSON.importData(geoJSONObject); - -// $ExpectType GeoJSON -geoJSON.removeOverlay(marker); -// $ExpectType GeoJSON -geoJSON.removeOverlay([marker]); - -// $ExpectType boolean -geoJSON.hasOverlay(marker); -// $ExpectType boolean -geoJSON.hasOverlay(m => m === marker); - -// $ExpectType GeoJSON -geoJSON.addOverlay(marker); -// $ExpectType GeoJSON -geoJSON.addOverlay([marker]); - -// $ExpectType GeoJSONObject[] -geoJSON.toGeoJSON(); - -// $ExpectType GeoJSON -geoJSON.setMap(null); -// $ExpectType GeoJSON -geoJSON.setMap(map); - -// $ExpectType GeoJSON -geoJSON.hide(); - -// $ExpectType GeoJSON -geoJSON.show(); - -type ClickEvent = AMap.MapsEvent<'click', AMap.Overlay>; -geoJSON.on('click', (event: ClickEvent) => { - // $ExpectType "click" - event.type; - // $ExpectType Overlay - event.target; -}); diff --git a/types/amap-js-api/test/overlay/icon.ts b/types/amap-js-api/test/overlay/icon.ts deleted file mode 100644 index 8576685b8a..0000000000 --- a/types/amap-js-api/test/overlay/icon.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { - size, - pixel, - icon -} from '../preset'; - -// $ExpectType Icon -new AMap.Icon(); -// $ExpectType Icon -new AMap.Icon({}); -// $ExpectType Icon -new AMap.Icon({ - size, - imageOffset: pixel, - image: 'image uri', - imageSize: size -}); -// $ExpectType Icon -new AMap.Icon({ - size: [1, 2], - imageOffset: pixel, - image: 'image uri', - imageSize: [1, 2] -}); - -// $ExpectType Size -icon.getImageSize(); - -// $ExpectType void -icon.setImageSize(size); -// $ExpectType void -icon.setImageSize([1, 2]); diff --git a/types/amap-js-api/test/overlay/infoWindow.ts b/types/amap-js-api/test/overlay/infoWindow.ts deleted file mode 100644 index 3fa4b0e656..0000000000 --- a/types/amap-js-api/test/overlay/infoWindow.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { - map, - lnglat, - size, - pixel, - div, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} - -// $ExpectType InfoWindow -new AMap.InfoWindow(); -// $ExpectType InfoWindow -new AMap.InfoWindow({}); -// $ExpectType InfoWindow -const infoWindow = new AMap.InfoWindow({ - isCustom: false, - autoMove: false, - closeWhenClickMap: false, - content: 'content', - size: [100, 100], - offset: new AMap.Pixel(10, 10), - position: lnglat, - showShadow: true -}); - -// $ExpectType void -infoWindow.open(map); -// $ExpectType void -infoWindow.open(map, lnglat); -// $ExpectType void -infoWindow.open(map, lnglatTuple); - -// $ExpectType void -infoWindow.close(); - -// $ExpectType boolean -infoWindow.getIsOpen(); - -// $ExpectType void -infoWindow.setContent('content'); -// $ExpectType void -infoWindow.setContent(div); - -// $ExpectType string | HTMLElement | undefined -infoWindow.getContent(); - -// $ExpectType void -infoWindow.setPosition(lnglat); -// $ExpectType void -infoWindow.setPosition(lnglatTuple); - -// $ExpectType LngLat | undefined -infoWindow.getPosition(); - -// $ExpectType Size | undefined -infoWindow.getSize(); - -infoWindow.on('change', (event: AMap.InfoWindow.EventMap['change']) => { - // $ExpectType "change" - event.type; - // $ExpectType InfoWindow - event.target; -}); - -infoWindow.on('close', (event: AMap.InfoWindow.EventMap['close']) => { - // $ExpectType "close" - event.type; - // $ExpectType InfoWindow - event.target; -}); - -infoWindow.on('open', (event: AMap.InfoWindow.EventMap['open']) => { - // $ExpectType "open" - event.type; - // $ExpectType InfoWindow - event.target; -}); diff --git a/types/amap-js-api/test/overlay/marker.ts b/types/amap-js-api/test/overlay/marker.ts deleted file mode 100644 index 635ce724c8..0000000000 --- a/types/amap-js-api/test/overlay/marker.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { - map, - lnglat -} from '../preset'; - -declare var pixel: AMap.Pixel; -declare var domEle: HTMLElement; -declare var markerShape: AMap.MarkerShape; -declare var icon: AMap.Icon; - -interface ExtraData { - test: number; -} - -// $ExpectType Marker -new AMap.Marker(); -// $ExpectType Marker -new AMap.Marker(); -// $ExpectType Marker -new AMap.Marker({}); -// $ExpectType Marker -const marker = new AMap.Marker({ - map, - position: lnglat, - offset: pixel, - icon: 'iconUrl', - content: 'htmlString', - topWhenClick: true, - raiseOnDrag: true, - cursor: 'default', - visible: true, - zIndex: 10, - angle: 10, - autoRotation: true, - animation: 'AMAP_ANIMATION_BOUNCE', - shadow: icon, - title: '123', - clickable: true, - shape: markerShape, - extData: { - test: 123 - } -}); - -// $ExpectType void -marker.markOnAMAP({ - name: '123', - position: [1, 2] -}); -// $ExpectType void -marker.markOnAMAP(); -// $ExpectType void -marker.markOnAMAP({}); -// $ExpectType void -marker.markOnAMAP({ - position: [1, 2], - name: '123' -}); - -// $ExpectType Pixel -marker.getOffset(); - -// $ExpectType void -marker.setOffset(pixel); - -// $ExpectType void -marker.setAnimation('AMAP_ANIMATION_BOUNCE'); - -// $ExpectType AnimationName -marker.getAnimation(); - -// $ExpectType void -marker.setClickable(true); - -// $ExpectType boolean -marker.getClickable(); - -// $ExpectType LngLat | undefined -marker.getPosition(); - -// $ExpectType void -marker.setPosition(lnglat); - -// $ExpectType void -marker.setAngle(0); - -// $ExpectType void -marker.setLabel(); -// $ExpectType void -marker.setLabel({}); -// $ExpectType void -marker.setLabel({ - content: 'label content', - offset: pixel -}); - -// $ExpectType Label | undefined -marker.getLabel(); - -// $ExpectType number -marker.getAngle(); - -// $ExpectType void -marker.setzIndex(100); - -// $ExpectType number -marker.getzIndex(); - -// $ExpectType void -marker.setIcon('icon uri'); -// $ExpectType void -marker.setIcon(icon); - -// $ExpectType string | Icon | undefined -marker.getIcon(); - -// $ExpectType void -marker.setDraggable(true); - -// $ExpectType boolean -marker.getDraggable(); - -// $ExpectType void -marker.setCursor('default'); - -// $ExpectType void -marker.setContent('content'); -// $ExpectType void -marker.setContent(domEle); - -// $ExpectType string | HTMLElement -marker.getContent(); - -// $ExpectType void -marker.moveAlong([lnglat], 100); -// $ExpectError -marker.moveAlong([[1, 2]], 100); -// $ExpectType void -marker.moveAlong([lnglat], 100, t => t, false); - -// $ExpectType void -marker.moveTo(lnglat, 100); -// $ExpectType void -marker.moveTo([1, 2], 100); -// $ExpectType void -marker.moveTo([1, 2], 100, t => t); - -// $ExpectType void -marker.stopMove(); - -// $ExpectType boolean -marker.pauseMove(); - -// $ExpectType boolean -marker.resumeMove(); - -// $ExpectType void -marker.setMap(map); - -// $ExpectType void -marker.setTitle('title'); -// $ExpectError -marker.setTitle(); - -// $ExpectType string | undefined -marker.getTitle(); - -// $ExpectType void -marker.setTop(true); - -// $ExpectType boolean -marker.getTop(); - -// $ExpectType void -marker.setShadow(); -// $ExpectType void -marker.setShadow(icon); -// $ExpectType void -marker.setShadow('shadow url'); - -// $ExpectType string | Icon | undefined -marker.getShadow(); - -// $ExpectType void -marker.setShape(); -// $ExpectType void -marker.setShape(markerShape); - -// $ExpectType MarkerShape | undefined -marker.getShape(); - -marker.on('click', (event: AMap.Marker.EventMap['click']) => { - // $ExpectType {} | ExtraData - event.target.getExtData(); -}); diff --git a/types/amap-js-api/test/overlay/markerShape.ts b/types/amap-js-api/test/overlay/markerShape.ts deleted file mode 100644 index 259b68cf20..0000000000 --- a/types/amap-js-api/test/overlay/markerShape.ts +++ /dev/null @@ -1,26 +0,0 @@ -// $ExpectType MarkerShape -new AMap.MarkerShape({ - type: 'circle', - coords: [1, 1, 1] -}); -// $ExpectType MarkerShape -new AMap.MarkerShape({ - type: 'rect', - coords: [1, 1, 1, 2] -}); -// $ExpectType MarkerShape -new AMap.MarkerShape({ - type: 'poly', - coords: [1, 2, 3, 4, 5] -}); - -// $ExpectError -new AMap.MarkerShape({ - type: 'circle', - coords: [1, 1] -}); -// $ExpectError -new AMap.MarkerShape({ - type: 'rect', - coords: [1, 1, 1, 2, 2] -}); diff --git a/types/amap-js-api/test/overlay/overlay.ts b/types/amap-js-api/test/overlay/overlay.ts deleted file mode 100644 index 6a301e7091..0000000000 --- a/types/amap-js-api/test/overlay/overlay.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { - map -} from '../preset'; -interface ExtraData { - test: number; -} -declare const overlay: AMap.Overlay; - -// $ExpectType void -overlay.show(); - -// $ExpectType void -overlay.hide(); - -// $ExpectType Map | null | undefined -overlay.getMap(); - -// $ExpectType void -overlay.setMap(map); -// $ExpectType void -overlay.setMap(null); - -// $ExpectError -overlay.setExtData({ any: 123 }); - -// $ExpectError ExtraData -overlay.getExtData(); diff --git a/types/amap-js-api/test/overlay/overlayGroup.ts b/types/amap-js-api/test/overlay/overlayGroup.ts deleted file mode 100644 index 11e04f91cf..0000000000 --- a/types/amap-js-api/test/overlay/overlayGroup.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { - map, - lnglat, - pixel, - circle, - marker, - markerShape, - icon -} from '../preset'; - -// $ExpectType OverlayGroup, any> -const overlayGroup2 = new AMap.OverlayGroup(); -// $ExpectType OverlayGroup, any> -new AMap.OverlayGroup(marker); -// $ExpectType OverlayGroup, any> -const overlayGroup = new AMap.OverlayGroup([marker]); - -// $ExpectType OverlayGroup, any> -overlayGroup.addOverlay(marker); -// $ExpectType OverlayGroup, any> -overlayGroup.addOverlay([marker]); -// $ExpectError -overlayGroup.addOverlay([circle]); - -// $ExpectType OverlayGroup, any> -overlayGroup.addOverlays(marker); -// $ExpectType OverlayGroup, any> -overlayGroup.addOverlays([marker]); - -// $ExpectType Marker[] -overlayGroup.getOverlays(); - -// $ExpectType boolean -overlayGroup.hasOverlay(marker); -// $ExpectType boolean -overlayGroup.hasOverlay(o => o === marker); - -// $ExpectType OverlayGroup, any> -overlayGroup.removeOverlay(marker); -// $ExpectType OverlayGroup, any> -overlayGroup.removeOverlay([marker]); - -// $ExpectType OverlayGroup, any> -overlayGroup.removeOverlays(marker); -// $ExpectType OverlayGroup, any> -overlayGroup.removeOverlays([marker]); - -// $ExpectType OverlayGroup, any> -overlayGroup.clearOverlays(); - -// $ExpectType OverlayGroup, any> -overlayGroup.eachOverlay(function(overlay, index, overlays) { - // $ExpectType Marker - overlay; - // $ExpectType number - index; - // $ExpectType Marker[] - overlays; - // $ExpectType Marker - this; -}); - -// $ExpectType OverlayGroup, any> -overlayGroup.setMap(null); -// $ExpectType OverlayGroup, any> -overlayGroup.setMap(map); - -// $ExpectType OverlayGroup, any> -overlayGroup2.setOptions({ - test: 1 -}); -// $ExpectType OverlayGroup, any> -overlayGroup.setOptions({ - map, - position: lnglat, - offset: pixel, - icon: 'iconUrl', - content: 'htmlString', - topWhenClick: true, - raiseOnDrag: true, - cursor: 'default', - visible: true, - zIndex: 10, - angle: 10, - autoRotation: true, - animation: 'AMAP_ANIMATION_BOUNCE', - shadow: icon, - title: '123', - clickable: true, - shape: markerShape, - extData: { - test: 123 - } -}); - -// $ExpectType OverlayGroup, any> -overlayGroup.show(); - -// $ExpectType OverlayGroup, any> -overlayGroup.hide(); - -type ClickEvent = AMap.MapsEvent<'click', AMap.Overlay>; -overlayGroup.on('click', (event: ClickEvent) => { - // $ExpectType "click" - event.type; - // $ExpectType Overlay - event.target; -}); diff --git a/types/amap-js-api/test/overlay/polygon.ts b/types/amap-js-api/test/overlay/polygon.ts deleted file mode 100644 index d41a597d45..0000000000 --- a/types/amap-js-api/test/overlay/polygon.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { - map, - lnglat, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} - -const path1 = [lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple]; -const path2 = [lnglat, lnglat, lnglat, lnglat, lnglat]; - -// $ExpectType Polygon -new AMap.Polygon(); -// $ExpectType Polygon -new AMap.Polygon({}); -// $ExpectType Polygon -const polygon = new AMap.Polygon({ - map, - zIndex: 10, - bubble: true, - cursor: 'pointer', - strokeColor: '#00FF00', - strokeOpacity: 0.3, - strokeWeight: 5, - fillColor: '#0000FF', - fillOpacity: 0.5, - draggable: true, - extData: { test: 1 }, - strokeStyle: 'dashed', - strokeDasharray: [2, 4], - path: path1 -}); - -// $ExpectType void -polygon.setPath(path1); -// $ExpectType void -polygon.setPath(path2); -// $ExpectType void -polygon.setPath([path1, path2]); - -// $ExpectType LngLat[] | LngLat[][] -polygon.getPath(); - -// $ExpectType void -polygon.setOptions({ - map, - zIndex: 10, - bubble: true, - cursor: 'pointer', - strokeColor: '#00FF00', - strokeOpacity: 0.8, - strokeWeight: 5, - fillColor: '#0000FF', - fillOpacity: 0.5, - draggable: true, - extData: { test: 1 }, - strokeStyle: 'dashed', - strokeDasharray: [4, 2], - path: [path2, path1] -}); - -const options = polygon.getOptions(); -// $ExpectType boolean | undefined -options.bubble; -// $ExpectType boolean | undefined -options.clickable; -// $ExpectType {} | ExtraData | undefined -options.extData; -// $ExpectType string | undefined -options.fillColor; -// $ExpectType number | undefined -options.fillOpacity; -// $ExpectType "miter" | "round" | "bevel" | undefined -options.lineJoin; -// $ExpectType Map | undefined -options.map; -// $ExpectType LngLat[] | LngLat[][] | undefined -options.path; -// $ExpectType string | undefined -options.strokeColor; -// $ExpectType number[] | undefined -options.strokeDasharray; -// $ExpectType number | undefined -options.strokeOpacity; -// $ExpectType "dashed" | "solid" | undefined -options.strokeStyle; -// $ExpectType number | undefined -options.strokeWeight; -// $ExpectType string | undefined -options.texture; -// $ExpectType number | undefined -options.zIndex; - -// $ExpectType Bounds | null -polygon.getBounds(); - -// $ExpectType number -polygon.getArea(); - -// $ExpectType void -polygon.setMap(null); -// $ExpectType void -polygon.setMap(map); - -// $ExpectType void -polygon.setExtData({ test: 1 }); - -// $ExpectType {} | ExtraData -polygon.getExtData(); - -// $ExpectType boolean -polygon.contains(lnglat); -// $ExpectType boolean -polygon.contains(lnglatTuple); - -polygon.on('click', (event: AMap.Polygon.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType Polygon - event.target; -}); diff --git a/types/amap-js-api/test/overlay/polyline.ts b/types/amap-js-api/test/overlay/polyline.ts deleted file mode 100644 index fc8d52b058..0000000000 --- a/types/amap-js-api/test/overlay/polyline.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { - map, - lnglat, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} - -// $ExpectType Polyline -new AMap.Polyline(); -// $ExpectType Polyline -new AMap.Polyline({}); -// $ExpectType Polyline -const polyline = new AMap.Polyline({ - map, - zIndex: 10, - bubble: true, - cursor: 'default', - geodesic: true, - isOutline: true, - borderWeight: 1, - outlineColor: '#AA0000', - path: [lnglat], - strokeColor: '#0000AA', - strokeOpacity: 0.5, - strokeWeight: 10, - strokeStyle: 'dashed', - strokeDasharray: [20, 10, 20], - lineJoin: 'bevel', - lineCap: 'butt', - draggable: true, - extData: { test: 1 }, - showDir: true -}); -// Polyline - -// $ExpectType void -polyline.setPath([lnglat]); -// $ExpectType void -polyline.setPath([lnglatTuple]); - -// $ExpectType void -polyline.setOptions({}); -// $ExpectType void -polyline.setOptions({ - map, - zIndex: 10, - bubble: true, - cursor: 'default', - geodesic: true, - isOutline: true, - borderWeight: 1, - outlineColor: '#AA0000', - path: [lnglat, lnglat], - strokeColor: '#0000AA', - strokeOpacity: 0.5, - strokeWeight: 10, - strokeStyle: 'dashed', - strokeDasharray: [20, 10, 20], - lineJoin: 'bevel', - lineCap: 'butt', - draggable: true, - extData: { test: 1 }, - showDir: true -}); - -const options = polyline.getOptions(); -// $ExpectType number | undefined -options.borderWeight; -// $ExpectType boolean | undefined -options.bubble; -// $ExpectType boolean | undefined -options.clickable; -// $ExpectType string | undefined -options.dirColor; -// $ExpectType string | undefined -options.dirImg; -// $ExpectType {} | ExtraData | undefined -options.extData; -// $ExpectType boolean | undefined -options.geodesic; -// $ExpectType boolean | undefined -options.isOutline; -// $ExpectType "round" | "butt" | "square" | undefined -options.lineCap; -// $ExpectType "miter" | "round" | "bevel" | undefined -options.lineJoin; -// $ExpectType Map | undefined -options.map; -// $ExpectType string | undefined -options.outlineColor; -// $ExpectType LngLat[] | undefined -options.path; -// $ExpectType boolean | undefined -options.showDir; -// $ExpectType string | undefined -options.strokeColor; -// $ExpectType number[] | undefined -options.strokeDasharray; -// $ExpectType number | undefined -options.strokeOpacity; -// $ExpectType "dashed" | "solid" | undefined -options.strokeStyle; -// $ExpectType number | undefined -options.strokeWeight; -// $ExpectType number | undefined -options.zIndex; - -// $ExpectType number -polyline.getLength(); - -// $ExpectType Bounds | null -polyline.getBounds(); - -// $ExpectType void -polyline.hide(); - -// $ExpectType void -polyline.show(); - -// $ExpectType void -polyline.setMap(null); -// $ExpectType void -polyline.setMap(map); - -// $ExpectType void -polyline.setExtData({test: 1}); - -// $ExpectType {} | ExtraData -polyline.getExtData(); - -polyline.on('click', (event: AMap.Polyline.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType Polyline - event.target; -}); diff --git a/types/amap-js-api/test/overlay/rectangle.ts b/types/amap-js-api/test/overlay/rectangle.ts deleted file mode 100644 index d2cafa8f09..0000000000 --- a/types/amap-js-api/test/overlay/rectangle.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { - map, - lnglat, - bounds, - lnglatTuple -} from '../preset'; - -interface ExtraData { - test: number; -} - -// $ExpectType Rectangle -new AMap.Rectangle(); -// $ExpectType Rectangle -new AMap.Rectangle({}); -// $ExpectType Rectangle -const rectangle = new AMap.Rectangle({ - map, - zIndex: 10, - bounds, - bubble: false, - cursor: 'pointer', - strokeColor: '#00FF00', - strokeOpacity: 0.8, - strokeWeight: 2, - fillColor: '#0000FF', - fillOpacity: 0.5, - strokeStyle: 'solid', - extData: { test: 1 }, - strokeDasharray: [1, 5] -}); - -// $ExpectType Bounds | undefined -rectangle.getBounds(); - -// $ExpectType void -rectangle.setBounds(bounds); - -// $ExpectType void -rectangle.setOptions({}); -// $ExpectType void -rectangle.setOptions({ - map, - zIndex: 10, - bounds, - bubble: false, - cursor: 'pointer', - strokeColor: '#00FF00', - strokeOpacity: 0.8, - strokeWeight: 2, - fillColor: '#0000FF', - fillOpacity: 0.5, - strokeStyle: 'solid', - extData: { test: 1 }, - strokeDasharray: [1, 5] -}); - -const options = rectangle.getOptions(); -// $ExpectType Bounds | undefined -options.bounds; -// $ExpectType boolean | undefined -options.bubble; -// $ExpectType boolean | undefined -options.clickable; -// $ExpectType {} | ExtraData | undefined -options.extData; -// $ExpectType string | undefined -options.fillColor; -// $ExpectType number | undefined -options.fillOpacity; -// $ExpectType "miter" | "round" | "bevel" | undefined -options.lineJoin; -// $ExpectType Map | undefined -options.map; -// $ExpectType LngLat[] | undefined -options.path; -// $ExpectType string | undefined -options.strokeColor; -// $ExpectType number[] | undefined -options.strokeDasharray; -// $ExpectType number | undefined -options.strokeOpacity; -// $ExpectType "dashed" | "solid" | undefined -options.strokeStyle; -// $ExpectType number | undefined -options.strokeWeight; -// $ExpectType string | undefined -options.texture; -// $ExpectType number | undefined -options.zIndex; - -// $ExpectType void -rectangle.hide(); - -// $ExpectType void -rectangle.show(); - -// $ExpectType void -rectangle.setExtData({test: 2}); - -// $ExpectType {} | ExtraData -rectangle.getExtData(); - -// $ExpectType boolean -rectangle.contains(lnglat); -// $ExpectType boolean -rectangle.contains(lnglatTuple); - -rectangle.on('click', (event: AMap.Rectangle.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType Rectangle - event.target; -}); - -rectangle.on('setBounds', (event: AMap.Rectangle.EventMap['setBounds']) => { - // $ExpectType "setBounds" - event.type; - // $ExpectError - event.target; -}); diff --git a/types/amap-js-api/test/overlay/text.ts b/types/amap-js-api/test/overlay/text.ts deleted file mode 100644 index c4d678493c..0000000000 --- a/types/amap-js-api/test/overlay/text.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { - map, - marker, - lnglat, - pixel, - lnglatTuple, - icon -} from '../preset'; - -interface ExtraData { - test: number; -} - -// $ExpectType Text -new AMap.Text(); -// $ExpectType Text -new AMap.Text({}); -// $ExpectType Text -const text = new AMap.Text({ - text: 'content', - textAlign: 'center', - verticalAlign: 'top', - map, - position: lnglat, - offset: pixel, - topWhenClick: true, - bubble: true, - draggable: true, - raiseOnDrag: true, - cursor: 'default', - visible: true, - zIndex: 100, - angle: 45, - autoRotation: true, - animation: 'AMAP_ANIMATION_BOUNCE', - shadow: 'https://webapi.amap.com/theme/v1.3/markers/0.png', - title: 'title', - clickable: true, - extData: { test: 1 } -}); - -// $ExpectType string -text.getText(); - -// $ExpectType void -text.setText('123'); - -// $ExpectType void -text.setStyle({ - background: 'red', - width: '200px' -}); - -// $ExpectType void -text.markOnAMAP({ - name: '123', - position: lnglatTuple -}); - -// $ExpectType Pixel -text.getOffset(); - -// $ExpectType void -text.setOffset(pixel); - -// $ExpectType void -text.setAnimation('AMAP_ANIMATION_BOUNCE'); - -// $ExpectType AnimationName -text.getAnimation(); - -// $ExpectType void -text.setClickable(true); - -// $ExpectType boolean -text.getClickable(); - -// $ExpectType LngLat | undefined -text.getPosition(); - -// $ExpectType void -text.setAngle(10); - -// $ExpectType number -text.getAngle(); - -// $ExpectType void -text.setzIndex(1); - -// $ExpectType number -text.getzIndex(); - -// $ExpectType void -text.setDraggable(true); - -// $ExpectType boolean -text.getDraggable(); - -// $ExpectType void -text.hide(); - -// $ExpectType void -text.show(); - -// $ExpectType void -text.setCursor('default'); - -// $ExpectType void -text.moveAlong([lnglat], 100); - -// $ExpectType void -text.moveAlong([lnglat], 100); -// $ExpectError -text.moveAlong([[1, 2]], 100); -// $ExpectType void -text.moveAlong([lnglat], 100, t => t, false); - -// $ExpectType void -text.moveTo(lnglat, 100); -// $ExpectType void -text.moveTo([1, 2], 100); -// $ExpectType void -text.moveTo([1, 2], 100, t => t); - -// $ExpectType void -text.stopMove(); - -// $ExpectType boolean -text.pauseMove(); - -// $ExpectType boolean -text.resumeMove(); - -// $ExpectType void -text.setMap(map); - -// $ExpectType void -text.setTitle('title'); -// $ExpectError -text.setTitle(); - -// $ExpectType string | undefined -text.getTitle(); - -// $ExpectType void -text.setTop(true); - -// $ExpectType boolean -text.getTop(); - -// $ExpectType void -text.setShadow(); -// $ExpectType void -text.setShadow(icon); -// $ExpectType void -text.setShadow('shadow url'); - -// $ExpectType void -text.setExtData({test: 1}); - -// $ExpectType {} | ExtraData -text.getExtData(); - -text.on('click', (event: AMap.Text.EventMap['click']) => { - // $ExpectType "click" - event.type; - // $ExpectType Text - event.target; -}); diff --git a/types/amap-js-api/test/pixel.ts b/types/amap-js-api/test/pixel.ts deleted file mode 100644 index bcb96e4b77..0000000000 --- a/types/amap-js-api/test/pixel.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - pixel -} from './preset'; - -// $ExpectType Pixel -new AMap.Pixel(10, 20); -// $ExpectType Pixel -new AMap.Pixel(10, 20); - -// $ExpectType number -pixel.getX(); - -// $ExpectType number -pixel.getY(); - -// $ExpectType boolean -pixel.equals(pixel); - -// $ExpectType string -pixel.toString(); - -// $ExpectType Pixel -pixel.add({ x: 1, y: 2 }); -// $ExpectType Pixel -pixel.add({ x: 1, y: 2 }, false); - -// $ExpectType Pixel -pixel.round(); - -// $ExpectType Pixel -pixel.floor(); - -// $ExpectType number -pixel.length(); - -// $ExpectType number | null -pixel.direction(); - -// $ExpectType Pixel -pixel.toFixed(); -// $ExpectType Pixel -pixel.toFixed(2); diff --git a/types/amap-js-api/test/preset.ts b/types/amap-js-api/test/preset.ts deleted file mode 100644 index 2c7bb37d59..0000000000 --- a/types/amap-js-api/test/preset.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const map: AMap.Map; -declare const lnglat: AMap.LngLat; -declare const size: AMap.Size; -declare const lnglatTuple: [number, number]; -declare const pixel: AMap.Pixel; -declare const marker: AMap.Marker; -declare const circle: AMap.Circle; -declare const markerShape: AMap.MarkerShape; -declare const icon: AMap.Icon; -declare const bounds: AMap.Bounds; -declare const div: HTMLDivElement; -declare const polygon: AMap.Polygon; -declare const lang: AMap.Lang; - -export { - map, - lnglat, - size, - lnglatTuple, - pixel, - marker, - circle, - markerShape, - icon, - bounds, - div, - polygon, - lang -}; diff --git a/types/amap-js-api/test/size.ts b/types/amap-js-api/test/size.ts deleted file mode 100644 index bdd700f532..0000000000 --- a/types/amap-js-api/test/size.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { size } from './preset'; - -// $ExpectType Size -new AMap.Size(10, 20); - -// $ExpectType number -size.getHeight(); - -// $ExpectType number -size.getWidth(); - -// $ExpectType string -size.toString(); - -// $ExpectType boolean -size.contains({ x: 10, y: 10 }); diff --git a/types/amap-js-api/test/util.ts b/types/amap-js-api/test/util.ts deleted file mode 100644 index c238070e21..0000000000 --- a/types/amap-js-api/test/util.ts +++ /dev/null @@ -1,79 +0,0 @@ -import * as preset from './preset'; - -const util = AMap.Util; - -// $ExpectType string -util.colorNameToHex('colorName'); - -// $ExpectType string -util.rgbHex2Rgba('rgbHex'); - -// $ExpectType string -util.argbHex2Rgba('argbHex'); - -// $ExpectType boolean -util.isEmpty({}); -// $ExpectError -util.isEmpty(1); - -// $ExpectType number[] -util.deleteItemFromArray([1], 1); - -// $ExpectType number[] -util.deleteItemFromArrayByIndex([1], 1); - -// $ExpectType number -util.indexOf([1], 1); -// $ExpectError -util.indexOf([1], '1'); - -// $ExpectType number -util.format(1); -// $ExpectType number -util.format(1, 1); - -declare const value1: number | number[]; -// $ExpectType boolean -util.isArray(value1); -if (util.isArray(value1)) { - // $ExpectType number[] - value1; -} else { - // $ExpectType number - value1; -} - -declare const value2: number | HTMLElement; -// $ExpectType boolean -util.isDOM(value2); -if (util.isDOM(value2)) { - // $ExpectType HTMLElement - value2; -} else { - // $ExpectType number - value2; -} - -// $ExpectType boolean -util.includes([1], 1); -// $ExpectError -util.includes([1], '1'); - -// $ExpectType number -util.requestIdleCallback(() => { }); -// $ExpectType number -const idleCallbackHandle = util.requestIdleCallback(() => { }, { timeout: 1 }); - -// $ExpectType void -util.cancelIdleCallback(idleCallbackHandle); - -// $ExpectType number -util.requestAnimFrame(() => { }); -// $ExpectType number -const animFrameHandle = util.requestAnimFrame(function () { - // $ExpectType number - this.test; -}, { test: 1 }); - -// $ExpectType void -util.cancelAnimFrame(animFrameHandle); diff --git a/types/amap-js-api/test/view2d.ts b/types/amap-js-api/test/view2d.ts deleted file mode 100644 index 2560922a5a..0000000000 --- a/types/amap-js-api/test/view2d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { lnglat } from './preset'; - -// $ExpectType View2D -new AMap.View2D(); -// $ExpectType View2D -new AMap.View2D({}); - -// $ExpectType View2D -new AMap.View2D({ - center: [1, 2], - rotation: 1, - zoom: 10, - crs: 'EPGS3395' -}); - -// $ExpectType View2D -const view2d = new AMap.View2D({ - center: lnglat -}); - -// $ExpectType View2D -view2d.on('complete', () => { }); diff --git a/types/amap-js-api/tsconfig.json b/types/amap-js-api/tsconfig.json index e63a35d326..a26facba9e 100644 --- a/types/amap-js-api/tsconfig.json +++ b/types/amap-js-api/tsconfig.json @@ -58,48 +58,9 @@ "overlay/text.d.ts", "pixel.d.ts", "size.d.ts", - "test/arryBounds.ts", - "test/bounds.ts", - "test/browser.ts", - "test/convert-from.ts", - "test/dom-util.ts", - "test/event.ts", - "test/geometry-util.ts", - "test/layer/buildings.ts", - "test/layer/canvasLayer.ts", - "test/layer/flexible.ts", - "test/layer/imageLayer.ts", - "test/layer/layer.ts", - "test/layer/layerGroup.ts", - "test/layer/massMarks.ts", - "test/layer/tileLayer.ts", - "test/layer/videoLayer.ts", - "test/layer/wms.ts", - "test/layer/wmts.ts", - "test/lnglat.ts", - "test/map.ts", - "test/overlay/bezierCurve.ts", - "test/overlay/circle.ts", - "test/overlay/contextMenu.ts", - "test/overlay/ellipse.ts", - "test/overlay/geoJSON.ts", - "test/overlay/icon.ts", - "test/overlay/infoWindow.ts", - "test/overlay/marker.ts", - "test/overlay/markerShape.ts", - "test/overlay/overlay.ts", - "test/overlay/overlayGroup.ts", - "test/overlay/polygon.ts", - "test/overlay/polyline.ts", - "test/overlay/rectangle.ts", - "test/overlay/text.ts", - "test/pixel.ts", - "test/preset.ts", - "test/size.ts", - "test/util.ts", - "test/view2d.ts", "type-util.d.ts", "util.d.ts", - "view2D.d.ts" + "view2D.d.ts", + "amap-js-api-tests.ts" ] } diff --git a/types/amap-js-api/tslint.json b/types/amap-js-api/tslint.json index ab1e56673f..f93cf8562a 100644 --- a/types/amap-js-api/tslint.json +++ b/types/amap-js-api/tslint.json @@ -1,10 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "only-arrow-functions": false, - "space-before-function-paren": false, - "no-var-keyword": false, - "no-unnecessary-class": false, - "file-name-casing": false - } + "extends": "dtslint/dt.json" } From c9c0a8d4055892ad1d328d6fc17d554bfd62d215 Mon Sep 17 00:00:00 2001 From: Wpapsco Date: Wed, 6 Mar 2019 22:35:25 -0800 Subject: [PATCH 189/265] Updated for 1.4 --- types/tmi.js/index.d.ts | 81 ++++++++++++++++++++++++++++++------ types/tmi.js/tmi.js-tests.ts | 4 +- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/types/tmi.js/index.d.ts b/types/tmi.js/index.d.ts index 86076ce202..cfbd9500ca 100644 --- a/types/tmi.js/index.d.ts +++ b/types/tmi.js/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for tmi.js 1.3 +// Type definitions for tmi.js 1.4 // Project: https://github.com/tmijs/tmi.js // Definitions by: William Papsco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.3 // Twitch IRC docs: https://dev.twitch.tv/docs/irc/ -// Last updated: 2019/2/27 +// Last updated: 2019/3/06 import { StrictEventEmitter } from "./strict-event-emitter-types"; @@ -16,6 +16,7 @@ export interface Actions { color(color: string): Promise<[string]>; commercial(channel: string, seconds: number): Promise<[string, number]>; connect(): Promise<[string, number]>; + deletemessage(channel: string, messageUUID: string): Promise<[string]>; disconnect(): Promise<[string, number]>; emoteonly(channel: string): Promise<[string]>; emoteonlyoff(channel: string): Promise<[string]>; @@ -39,11 +40,15 @@ export interface Actions { unban(channel: string, username: string): Promise<[string, string]>; unhost(channel: string): Promise<[string]>; unmod(channel: string, username: string): Promise<[string, string]>; + unvip(channel: string, username: string): Promise<[string, string]>; + vip(channel: string, username: string): Promise<[string, string]>; + vips(channel: string): Promise; whisper(username: string, message: string): Promise<[string, string]>; } export interface Events { action(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + anongiftpaidupgrade(channel: string, username: string, userstate: AnonSubGiftUpgradeUserstate): void; ban(channel: string, username: string, reason: string): void; chat(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; cheer(channel: string, userstate: ChatUserstate, message: string): void; @@ -54,11 +59,13 @@ export interface Events { emoteonly(channel: string, enabled: boolean): void; emotesets(sets: string, obj: EmoteObj): void; followersonly(channel: string, enabled: boolean, length: number): void; + giftpaidupgrade(channel: string, username: string, sender: string, userstate: SubGiftUpgradeUserstate): void; hosted(channel: string, username: string, viewers: number, autohost: boolean): void; hosting(channel: string, target: string, viewers: number): void; join(channel: string, username: string, self: boolean): void; logon(): void; message(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + messagedeleted(channel: string, username: string, deletedMessage: string, userstate: DeleteUserstate): void; mod(channel: string, username: string): void; mods(channel: string, mods: string[]): void; notice(channel: string, msgid: MsgID, message: string): void; @@ -66,16 +73,21 @@ export interface Events { ping(): void; pong(latency: number): void; r9kbeta(channel: string, enabled: boolean): void; + raided(channel: string, username: string, viewers: number): void; + "raw_message": (messageCloned: { [property: string]: any }, message: { [property: string]: any }) => void; reconnect(): void; - resub(channel: string, username: string, months: number, message: string, userstate: SubUserstate, methods: ResubMethod): void; + resub(channel: string, username: string, months: number, message: string, userstate: SubUserstate, methods: SubMethods): void; roomstate(channel: string, state: RoomState): void; serverchange(channel: string): void; slowmode(channel: string, enabled: boolean, length: number): void; + subgift(channel: string, username: string, streakMonths: number, recipient: string, methods: SubMethods, userstate: SubGiftUserstate): void; + submysterygift(channel: string, username: string, numbOfSubs: number, methods: SubMethods, userstate: SubMysteryGiftUserstate): void; subscribers(channel: string, enabled: boolean): void; - subscription(channel: string, username: string, method: ResubMethod, message: string, userstate: SubUserstate): void; + subscription(channel: string, username: string, methods: SubMethods, message: string, userstate: SubUserstate): void; timeout(channel: string, username: string, reason: string, duration: number): void; unhost(channel: string, viewers: number): void; unmod(channel: string, username: string): void; + vips(channel: string, vips: string[]): void; whisper(from: string, userstate: ChatUserstate, message: string, self: boolean): void; } @@ -108,6 +120,18 @@ export interface Badges { premium?: string; } +export interface SubMethods { + prime?: boolean; + plan?: SubMethod; + planName?: string; +} + +export interface DeleteUserstate { + login?: string; + message?: string; + "target-msg-id"?: string; +} + export interface CommonUserstate { badges?: Badges; color?: string; @@ -130,13 +154,21 @@ export interface UserNoticeState extends CommonUserstate { login?: string; message?: string; "system-msg"?: string; + [paramater: string]: any; } export interface CommonSubUserstate extends UserNoticeState { - "msg-param-sub-plan"?: ResubMethod; + "msg-param-sub-plan"?: SubMethod; "msg-param-sub-plan-name"?: string; } +export interface CommonGiftSubUserstate extends CommonSubUserstate { + "msg-param-recipient-display-name"?: string; + "msg-param-recipient-id"?: string; + "msg-param-recipient-user-name"?: string; + "msg-param-months"?: boolean | string; +} + export interface ChatUserstate extends CommonUserstate { 'message-type'?: "chat" | "action" | "whisper"; username?: string; @@ -150,11 +182,28 @@ export interface SubUserstate extends CommonSubUserstate { "msg-param-streak-months"?: string | boolean; } -export interface SubGiftUserstate extends CommonSubUserstate { - 'message-type'?: "subgift" | "anonsubgift"; - "msg-param-recipient-display-name"?: string; - "msg-param-recipient-id"?: string; - "msg-param-recipient-user-name"?: string; +export interface SubMysteryGiftUserstate extends CommonSubUserstate { + 'message-type'?: "submysterygift"; + "msg-param-sender-count"?: string | boolean; +} + +export interface SubGiftUserstate extends CommonGiftSubUserstate { + 'message-type'?: "subgift"; + "msg-param-sender-count"?: string | boolean; +} + +export interface AnonSubGiftUserstate extends CommonGiftSubUserstate { + "message-type"?: "anonsubgift"; +} + +export interface SubGiftUpgradeUserstate extends CommonSubUserstate { + "message-type"?: "giftpaidupgrade"; + "msg-param-sender-name"?: string; + "msg-param-sender-login"?: string; +} + +export interface AnonSubGiftUpgradeUserstate extends CommonSubUserstate { + "message-type"?: "anongiftpaidupgrade"; } export interface RaidUserstate extends UserNoticeState { @@ -169,7 +218,15 @@ export interface RitualUserstate extends UserNoticeState { "msg-param-ritual-name"?: "new_chatter"; } -export type Userstate = ChatUserstate | SubGiftUserstate | SubUserstate | RaidUserstate | RitualUserstate; +export type Userstate = ChatUserstate | + SubUserstate | + SubGiftUserstate | + SubGiftUpgradeUserstate | + AnonSubGiftUserstate | + SubMysteryGiftUserstate | + AnonSubGiftUpgradeUserstate | + RaidUserstate | + RitualUserstate; export interface EmoteObj { [id: string]: [{ @@ -251,7 +308,7 @@ export type MsgID = "already_banned" | "whisper_limit_per_sec" | "whisper_restricted_recipient"; -export type ResubMethod = "Prime" | "1000" | "2000" | "3000"; +export type SubMethod = "Prime" | "1000" | "2000" | "3000"; export interface RoomState { "broadcaster-lang"?: string; diff --git a/types/tmi.js/tmi.js-tests.ts b/types/tmi.js/tmi.js-tests.ts index 6cd2c62629..28a380088b 100644 --- a/types/tmi.js/tmi.js-tests.ts +++ b/types/tmi.js/tmi.js-tests.ts @@ -30,7 +30,7 @@ const options: tmi.Options = { const client: tmi.Client = tmi.Client(options); client.connect().then(() => { - client.on("subscription", (channel: string, username: string, method: tmi.ResubMethod, msg: string, userstate: tmi.SubUserstate) => { + client.on("subscription", (channel: string, username: string, methods: tmi.SubMethods, msg: string, userstate: tmi.SubUserstate) => { client.say(channel, `Thank you to ${userstate["display-name"]} for subscribing!`); client.ping(); client.r9kbeta(channel); @@ -56,7 +56,7 @@ client.connect().then(() => { client.unmod(channel, username); client.whisper(username, "whisper"); client.part(channel); - switch (method) { + switch (methods.plan) { case "1000": case "2000": case "3000": From ccaaedb36c7db966284ebdefe20e4a7556dcc5dd Mon Sep 17 00:00:00 2001 From: Wpapsco Date: Wed, 6 Mar 2019 22:43:37 -0800 Subject: [PATCH 190/265] Moved index signature up the hierarchy of userstates --- types/tmi.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tmi.js/index.d.ts b/types/tmi.js/index.d.ts index cfbd9500ca..0363842148 100644 --- a/types/tmi.js/index.d.ts +++ b/types/tmi.js/index.d.ts @@ -148,13 +148,13 @@ export interface CommonUserstate { "user-id"?: string; "tmi-sent-ts"?: string; flags?: string; + [paramater: string]: any; } export interface UserNoticeState extends CommonUserstate { login?: string; message?: string; "system-msg"?: string; - [paramater: string]: any; } export interface CommonSubUserstate extends UserNoticeState { From bc341d3bc709dd8e3288c46cb9811f235ff22546 Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Thu, 7 Mar 2019 14:52:59 +0800 Subject: [PATCH 191/265] [amap-js-api] fix lint error --- types/amap-js-api/amap-js-api-tests.ts | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/types/amap-js-api/amap-js-api-tests.ts b/types/amap-js-api/amap-js-api-tests.ts index 41b0638526..ee7a2ac583 100644 --- a/types/amap-js-api/amap-js-api-tests.ts +++ b/types/amap-js-api/amap-js-api-tests.ts @@ -2303,7 +2303,7 @@ const testGeoJSON = new AMap.GeoJSON({ obj; // $ExpectType LngLat lnglat; - return testMarker; + return marker; }, getPolyline(obj, lnglats) { // $ExpectType GeoJSONObject @@ -2330,19 +2330,19 @@ const testGeoJSON = new AMap.GeoJSON({ testGeoJSON.importData(geoJSONObject); // $ExpectType GeoJSON -testGeoJSON.removeOverlay(testMarker); +testGeoJSON.removeOverlay(marker); // $ExpectType GeoJSON -testGeoJSON.removeOverlay([testMarker]); +testGeoJSON.removeOverlay([marker]); // $ExpectType boolean -testGeoJSON.hasOverlay(testMarker); +testGeoJSON.hasOverlay(marker); // $ExpectType boolean -testGeoJSON.hasOverlay(m => m === testMarker); +testGeoJSON.hasOverlay(m => m === marker); // $ExpectType GeoJSON -testGeoJSON.addOverlay(testMarker); +testGeoJSON.addOverlay(marker); // $ExpectType GeoJSON -testGeoJSON.addOverlay([testMarker]); +testGeoJSON.addOverlay([marker]); // $ExpectType GeoJSONObject[] testGeoJSON.toGeoJSON(); @@ -2488,7 +2488,7 @@ new AMap.Marker(); // $ExpectType Marker new AMap.Marker({}); // $ExpectType Marker -const testMarker = new AMap.Marker({ +export const testMarker = new AMap.Marker({ map, position: lnglat, offset: pixel, @@ -2730,39 +2730,39 @@ testOverlay.getExtData(); // $ExpectType OverlayGroup, any> const testOverlayGroup2 = new AMap.OverlayGroup(); // $ExpectType OverlayGroup, any> -new AMap.OverlayGroup(testMarker); +new AMap.OverlayGroup(marker); // $ExpectType OverlayGroup, any> -const testOverlayGroup = new AMap.OverlayGroup([testMarker]); +const testOverlayGroup = new AMap.OverlayGroup([marker]); // $ExpectType OverlayGroup, any> -testOverlayGroup.addOverlay(testMarker); +testOverlayGroup.addOverlay(marker); // $ExpectType OverlayGroup, any> -testOverlayGroup.addOverlay([testMarker]); +testOverlayGroup.addOverlay([marker]); // $ExpectError testOverlayGroup.addOverlay([testCircle]); // $ExpectType OverlayGroup, any> -testOverlayGroup.addOverlays(testMarker); +testOverlayGroup.addOverlays(marker); // $ExpectType OverlayGroup, any> -testOverlayGroup.addOverlays([testMarker]); +testOverlayGroup.addOverlays([marker]); // $ExpectType Marker[] testOverlayGroup.getOverlays(); // $ExpectType boolean -testOverlayGroup.hasOverlay(testMarker); +testOverlayGroup.hasOverlay(marker); // $ExpectType boolean -testOverlayGroup.hasOverlay(o => o === testMarker); +testOverlayGroup.hasOverlay(o => o === marker); // $ExpectType OverlayGroup, any> -testOverlayGroup.removeOverlay(testMarker); +testOverlayGroup.removeOverlay(marker); // $ExpectType OverlayGroup, any> -testOverlayGroup.removeOverlay([testMarker]); +testOverlayGroup.removeOverlay([marker]); // $ExpectType OverlayGroup, any> -testOverlayGroup.removeOverlays(testMarker); +testOverlayGroup.removeOverlays(marker); // $ExpectType OverlayGroup, any> -testOverlayGroup.removeOverlays([testMarker]); +testOverlayGroup.removeOverlays([marker]); // $ExpectType OverlayGroup, any> testOverlayGroup.clearOverlays(); From d6748925aae7eb34de578f623c72995b7f392d71 Mon Sep 17 00:00:00 2001 From: Jonas Keisel Date: Thu, 7 Mar 2019 11:25:14 +0100 Subject: [PATCH 192/265] =?UTF-8?q?added=20missing=20`paymentIntents.cance?= =?UTF-8?q?l(=E2=80=A6)`=20signatures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/stripe/index.d.ts | 9 +++++++++ types/stripe/stripe-tests.ts | 2 ++ 2 files changed, 11 insertions(+) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index d7d198d746..d747fc6de9 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -7337,6 +7337,11 @@ declare namespace Stripe { options: HeaderOptions, response?: IResponseFn, ): Promise; + cancel( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; cancel( paymentIntentId: string, data: { @@ -7344,6 +7349,10 @@ declare namespace Stripe { }, response?: IResponseFn, ): Promise; + cancel( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; } class Payouts extends StripeResource { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 6fc4a5ac25..bffadadb23 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1057,6 +1057,8 @@ stripe.paymentIntents.confirm("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); stripe.paymentIntents.capture("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); stripe.paymentIntents.capture("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", (err, intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo").then((intent) => {}); stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", { cancellation_reason: 'duplicate' }, (err, intent) => {}); From b26e09b0deefa5442d085e09daa685382b2d4486 Mon Sep 17 00:00:00 2001 From: Jonas Keisel Date: Thu, 7 Mar 2019 11:38:42 +0100 Subject: [PATCH 193/265] Added missing signatures based on the Java implementation --- types/stripe/index.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index d747fc6de9..772a4bdb87 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -3359,6 +3359,15 @@ declare namespace Stripe { source?: string; } + interface IPaymentIntentRetrieveOptions { + /** + * The client secret of the PaymentIntent. Required if a publishable key is used to retrieve the source. + * + * REQUIRED IF USING PUBLISHABLE KEY! + */ + client_secret: string; + } + interface IPaymentIntentCaptureOptions { /** * The amount to capture (in cents) from the PaymentIntent, which must be less than or equal to the original amount. Any additional amount will be automatically refunded. Defaults to the full `amount_capturable` if not provided. @@ -7276,6 +7285,17 @@ declare namespace Stripe { * Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string. * When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the payment intent object reference for more details. */ + retrieve( + id: string, + data: paymentIntents.IPaymentIntentRetrieveOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + retrieve( + id: string, + data: paymentIntents.IPaymentIntentRetrieveOptions, + response?: IResponseFn, + ): Promise; retrieve( id: string, options: HeaderOptions, @@ -7304,6 +7324,15 @@ declare namespace Stripe { data: paymentIntents.IPaymentIntentConfirmOptions, response?: IResponseFn, ): Promise; + confirm( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + confirm( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; /** * Capture the funds of an existing uncaptured PaymentIntent where `required_action="requires_capture"`. @@ -7322,6 +7351,15 @@ declare namespace Stripe { data: paymentIntents.IPaymentIntentCaptureOptions, response?: IResponseFn, ): Promise; + capture( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + capture( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; /** * A PaymentIntent object can be canceled when it is in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_action`. From 9baa009b9275341490c53ad040af363fd847f0ce Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Thu, 7 Mar 2019 11:02:18 +0000 Subject: [PATCH 194/265] condense-whitespace: Add type definitions. --- .../condense-whitespace-tests.ts | 7 ++++++ types/condense-whitespace/index.d.ts | 8 +++++++ types/condense-whitespace/tsconfig.json | 23 +++++++++++++++++++ types/condense-whitespace/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/condense-whitespace/condense-whitespace-tests.ts create mode 100644 types/condense-whitespace/index.d.ts create mode 100644 types/condense-whitespace/tsconfig.json create mode 100644 types/condense-whitespace/tslint.json diff --git a/types/condense-whitespace/condense-whitespace-tests.ts b/types/condense-whitespace/condense-whitespace-tests.ts new file mode 100644 index 0000000000..027b106195 --- /dev/null +++ b/types/condense-whitespace/condense-whitespace-tests.ts @@ -0,0 +1,7 @@ +import condense = require("condense-whitespace"); + +// $ExpectType string +condense(" \n\n\t Hello World \t\n"); + +// $ExpectError +condense(1); diff --git a/types/condense-whitespace/index.d.ts b/types/condense-whitespace/index.d.ts new file mode 100644 index 0000000000..403d0eeec1 --- /dev/null +++ b/types/condense-whitespace/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for condense-whitespace 1.0 +// Project: https://github.com/sindresorhus/condense-whitespace +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function condenseWhitespace(str: string): string; + +export = condenseWhitespace; diff --git a/types/condense-whitespace/tsconfig.json b/types/condense-whitespace/tsconfig.json new file mode 100644 index 0000000000..8d5705205d --- /dev/null +++ b/types/condense-whitespace/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "condense-whitespace-tests.ts" + ] +} diff --git a/types/condense-whitespace/tslint.json b/types/condense-whitespace/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/condense-whitespace/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bac137341280d31ee0f8159ddad66b0fa144e5fa Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Thu, 7 Mar 2019 01:01:02 +0100 Subject: [PATCH 195/265] feat(node): v11.11 --- types/node/globals.d.ts | 12 +++++++++++- types/node/index.d.ts | 2 +- types/node/test/util.ts | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/types/node/globals.d.ts b/types/node/globals.d.ts index 210830f7e8..36726f5cc0 100644 --- a/types/node/globals.d.ts +++ b/types/node/globals.d.ts @@ -465,7 +465,17 @@ declare namespace NodeJS { showProxy?: boolean; maxArrayLength?: number | null; breakLength?: number; - compact?: boolean; + /** + * Setting this to `false` causes each object key + * to be displayed on a new line. It will also add new lines to text that is + * longer than `breakLength`. If set to a number, the most `n` inner elements + * are united on a single line as long as all properties fit into + * `breakLength`. Short array elements are also grouped together. Note that no + * text will be reduced below 16 characters, no matter the `breakLength` size. + * For more information, see the example below. + * @default `true` + */ + compact?: boolean | number; sorted?: boolean | ((a: string, b: string) => number); } diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 23b53a5f0d..1c22d95b69 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Node.js 11.10 +// Type definitions for non-npm package Node.js 11.11 // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped diff --git a/types/node/test/util.ts b/types/node/test/util.ts index 252e8824ae..3af024972e 100644 --- a/types/node/test/util.ts +++ b/types/node/test/util.ts @@ -30,6 +30,9 @@ import { readFile } from 'fs'; sorted: true, getters: 'set', }); + util.inspect(["This is nice"], { + compact: 42, + }); assert(typeof util.inspect.custom === 'symbol'); util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); From 78a310b4695760d5f2650017a287fcf355c18e4f Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Thu, 7 Mar 2019 13:15:46 +0100 Subject: [PATCH 196/265] [@types/sequelize] Fix imports cases according to the source code of sequelize to allow for different import syntaxes other than require --- types/sequelize/index.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 35b790c0f9..6e25100255 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -1379,7 +1379,7 @@ declare namespace sequelize { * Should the join model have timestamps */ timestamps?: boolean; - + /** * Belongs-To-Many creates a unique key when primary key is not present on through model. This unique key name can be overridden using uniqueKey option. */ @@ -5938,6 +5938,15 @@ declare namespace sequelize { cls: any; useCLS(namespace:cls.Namespace): Sequelize; + /** + * Default export for `import Sequelize from 'sequelize';` kind of imports + */ + default: SequelizeStatic; + + /** + * Export sequelize static on the instance for `import Sequelize from 'sequelize';` kind of imports + */ + Sequelize: SequelizeStatic; } interface QueryOptionsTransactionRequired { } From a2c1169fe1405516f33577a775eeb584792a65c8 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Thu, 7 Mar 2019 13:32:00 +0100 Subject: [PATCH 197/265] Add test entries for the different import types --- types/sequelize/sequelize-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 3e5fc74142..224c883459 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -26,6 +26,9 @@ var Post = s.define( 'post', {} ); var t : Sequelize.Transaction = null; s.transaction().then( ( a ) => t = a ); +var sequelizeAsDefaultImport = Sequelize.default; +var sequelizeAsExportClause = Sequelize.Sequelize; + // // Generics // ~~~~~~~~~~ From 58273fe4bb2f0f6c304432fa5c7c6d934576051d Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Thu, 7 Mar 2019 13:32:10 +0100 Subject: [PATCH 198/265] Add test entries for the different import types --- types/sequelize/sequelize-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 224c883459..063048ebd7 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1,6 +1,8 @@ import Sequelize = require("sequelize"); import Q = require('q'); import Bluebird = require('bluebird'); +import SequelizeAsDefault from 'sequelize'; +import { Sequelize as SequelizeAsIndividualExport } from 'sequelize'; // // Fixtures @@ -26,8 +28,6 @@ var Post = s.define( 'post', {} ); var t : Sequelize.Transaction = null; s.transaction().then( ( a ) => t = a ); -var sequelizeAsDefaultImport = Sequelize.default; -var sequelizeAsExportClause = Sequelize.Sequelize; // // Generics From 19ebc96bce15d686843a9577affbad9acfdcdd8a Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Thu, 7 Mar 2019 13:38:00 +0100 Subject: [PATCH 199/265] Try breaking tests --- types/sequelize/index.d.ts | 2 +- types/sequelize/sequelize-tests.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 6e25100255..0d800c47f5 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -5941,7 +5941,7 @@ declare namespace sequelize { /** * Default export for `import Sequelize from 'sequelize';` kind of imports */ - default: SequelizeStatic; + // default: SequelizeStatic; /** * Export sequelize static on the instance for `import Sequelize from 'sequelize';` kind of imports diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 063048ebd7..caecd33972 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -4,6 +4,14 @@ import Bluebird = require('bluebird'); import SequelizeAsDefault from 'sequelize'; import { Sequelize as SequelizeAsIndividualExport } from 'sequelize'; +// +// Import checks +// ~~~~~~~~~~~~~ +// +Sequelize.Model.Instance +SequelizeAsDefault.Model.Instance +SequelizeAsIndividualExport.Model.Instance + // // Fixtures // ~~~~~~~~~~ @@ -28,7 +36,6 @@ var Post = s.define( 'post', {} ); var t : Sequelize.Transaction = null; s.transaction().then( ( a ) => t = a ); - // // Generics // ~~~~~~~~~~ From e4d23a96625aee57bf6f792b7fdf00bf62e4a56f Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Thu, 7 Mar 2019 13:41:46 +0100 Subject: [PATCH 200/265] Fix tests --- types/sequelize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 0d800c47f5..6e25100255 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -5941,7 +5941,7 @@ declare namespace sequelize { /** * Default export for `import Sequelize from 'sequelize';` kind of imports */ - // default: SequelizeStatic; + default: SequelizeStatic; /** * Export sequelize static on the instance for `import Sequelize from 'sequelize';` kind of imports From 8e97f1789d6ac063ddb115bcb5b9b0642632e75b Mon Sep 17 00:00:00 2001 From: maruware Date: Thu, 7 Mar 2019 22:17:06 +0900 Subject: [PATCH 201/265] [sequelize] Add include option to HasManyGetAssociationsMixinOptions --- types/sequelize/index.d.ts | 5 +++++ types/sequelize/sequelize-tests.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 35b790c0f9..7c1c290b95 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -281,6 +281,11 @@ declare namespace sequelize { * Apply a scope on the related model, or remove its default scope by passing false. */ scope?: string | boolean; + + /** + * Load further nested related models + */ + include?: IncludeOptions; } /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 3e5fc74142..e00d4f187b 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -239,6 +239,13 @@ warehouse.getProducts(); warehouse.getProducts({ where: {}, scope: false }); warehouse.getProducts({ where: {}, scope: false }).then((products) => products[0].id); +interface ProductInstanceIncludeBarcode extends ProductInstance { + barcode: BarcodeInstance +} +warehouse.getProducts({ where: {}, scope: false, include: {model: Barcode, as: 'barcode'} }).then((products) => { + (products[0] as ProductInstanceIncludeBarcode).barcode +}); + warehouse.setProducts(); warehouse.setProducts([product]); warehouse.setProducts([product], { validate: true }).then(() => { }); From 6a5f2760b9f757ab4bf372ff9caa392ba182a689 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 7 Mar 2019 07:13:10 -0800 Subject: [PATCH 202/265] Try travis code from Wesley --- .travis.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa657d16d7..30cde88e5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,9 @@ sudo: false notifications: email: false -jobs: - include: - - stage: build - script: npm install - script: npm run build - script: npm run test - - stage: codeowners - script: npm run update-codeowners -stages: - - name: codeowners - if: env(TRAVIS_EVENT_TYPE) = cron \ No newline at end of file +script: + - npm install + - npm run build + - npm run test + - if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate + 1; fi \ No newline at end of file From f95172ea59b77244102f2f5a3ad450346f8a4dae Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 7 Mar 2019 07:23:39 -0800 Subject: [PATCH 203/265] Do not need npm install or run build --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 30cde88e5d..e3d7a6fcc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,5 @@ notifications: email: false script: - - npm install - - npm run build - npm run test - - if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate - 1; fi \ No newline at end of file + - if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate 1; fi \ No newline at end of file From e06aadbe407509674cef01261556c3b1714eb849 Mon Sep 17 00:00:00 2001 From: chdanielmueller Date: Thu, 7 Mar 2019 16:45:40 +0100 Subject: [PATCH 204/265] Including both options --- types/helmet/helmet-tests.ts | 13 +++++++++++++ types/helmet/index.d.ts | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/types/helmet/helmet-tests.ts b/types/helmet/helmet-tests.ts index f73095b714..39414a7d5f 100644 --- a/types/helmet/helmet-tests.ts +++ b/types/helmet/helmet-tests.ts @@ -125,6 +125,13 @@ function hpkpTest() { includeSubDomains: false })); + // Deprecated: Use includeSubDomains instead. (Uppercase "D") + app.use(helmet.hpkp({ + maxAge: 7776000000, + sha256s: ['AbCdEf123=', 'ZyXwVu456='], + includeSubdomains: false + })); + app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], @@ -167,6 +174,12 @@ function hstsTest() { includeSubDomains: true })); + // Deprecated: Use includeSubDomains instead. (Uppercase "D") + app.use(helmet.hsts({ + maxAge: 7776000000, + includeSubdomains: true + })); + app.use(helmet.hsts({ maxAge: 7776000000, preload: true diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index 573395831b..1a8c713da1 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -134,6 +134,10 @@ declare namespace helmet { export interface IHelmetHpkpConfiguration { maxAge: number; sha256s: string[]; + /** + * @deprecated Use includeSubDomains instead. (Uppercase "D") + */ + includeSubdomains?: boolean; includeSubDomains?: boolean; reportUri?: string; reportOnly?: boolean; @@ -142,6 +146,10 @@ declare namespace helmet { export interface IHelmetHstsConfiguration { maxAge?: number; + /** + * @deprecated Use includeSubDomains instead. (Uppercase "D") + */ + includeSubdomains?: boolean; includeSubDomains?: boolean; preload?: boolean; setIf?: IHelmetSetIfFunction; From ff7c8f87987004f2d5957937f935dc2c8124aa94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Moura?= Date: Thu, 7 Mar 2019 15:49:35 +0000 Subject: [PATCH 205/265] Added type definitions for voucher-code-generator --- types/voucher-code-generator/index.d.ts | 19 +++++++++++++++ types/voucher-code-generator/tsconfig.json | 23 +++++++++++++++++++ types/voucher-code-generator/tslint.json | 1 + .../voucher-code-generator-tests.ts | 18 +++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 types/voucher-code-generator/index.d.ts create mode 100644 types/voucher-code-generator/tsconfig.json create mode 100644 types/voucher-code-generator/tslint.json create mode 100644 types/voucher-code-generator/voucher-code-generator-tests.ts diff --git a/types/voucher-code-generator/index.d.ts b/types/voucher-code-generator/index.d.ts new file mode 100644 index 0000000000..fd57466c26 --- /dev/null +++ b/types/voucher-code-generator/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for voucher-code-generator 1.1 +// Project: http://www.voucherify.io/ +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ If this module has methods, declare them as functions like so. + */ +export function charset(name: "numbers" | "alphabetic" | "alphanumeric"): string; +export function generate(config?: generatorConfig): string[]; + +/*~ You can declare types that are available via importing the module */ +export interface generatorConfig { + length?: number; + count?: number; + charset?: string; + prefix?: string; + postfix?: string; + pattern?: string; +} diff --git a/types/voucher-code-generator/tsconfig.json b/types/voucher-code-generator/tsconfig.json new file mode 100644 index 0000000000..dc5d0025be --- /dev/null +++ b/types/voucher-code-generator/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "voucher-code-generator-tests.ts" + ] +} diff --git a/types/voucher-code-generator/tslint.json b/types/voucher-code-generator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/voucher-code-generator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/voucher-code-generator/voucher-code-generator-tests.ts b/types/voucher-code-generator/voucher-code-generator-tests.ts new file mode 100644 index 0000000000..3232be37aa --- /dev/null +++ b/types/voucher-code-generator/voucher-code-generator-tests.ts @@ -0,0 +1,18 @@ +import voucherGenerator = require('voucher-code-generator'); +import { generatorConfig } from 'voucher-code-generator'; + +const config: generatorConfig = { + length: 6, + count: 3, + charset: "0123456789", + prefix: "offer-", + postfix: "-2019", + pattern: "######" +}; + +voucherGenerator.charset('numbers'); +voucherGenerator.charset('alphabetic'); +voucherGenerator.charset('alphanumeric'); + +voucherGenerator.generate(); +voucherGenerator.generate(config); From 282744882ddc7b945fdf2d456644f5e7ed93b393 Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Thu, 7 Mar 2019 15:49:16 +0000 Subject: [PATCH 206/265] trim-newlines: Add type definitions. --- types/trim-newlines/index.d.ts | 13 ++++++++++++ types/trim-newlines/trim-newlines-tests.ts | 10 ++++++++++ types/trim-newlines/tsconfig.json | 23 ++++++++++++++++++++++ types/trim-newlines/tslint.json | 1 + 4 files changed, 47 insertions(+) create mode 100644 types/trim-newlines/index.d.ts create mode 100644 types/trim-newlines/trim-newlines-tests.ts create mode 100644 types/trim-newlines/tsconfig.json create mode 100644 types/trim-newlines/tslint.json diff --git a/types/trim-newlines/index.d.ts b/types/trim-newlines/index.d.ts new file mode 100644 index 0000000000..7abe323fe2 --- /dev/null +++ b/types/trim-newlines/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for trim-newlines 2.0 +// Project: https://github.com/sindresorhus/trim-newlines#readme +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function trimNewlines(input: string): string; + +declare namespace trimNewlines { + function start(input: string): string; + function end(input: string): string; +} + +export = trimNewlines; diff --git a/types/trim-newlines/trim-newlines-tests.ts b/types/trim-newlines/trim-newlines-tests.ts new file mode 100644 index 0000000000..e3bc17661a --- /dev/null +++ b/types/trim-newlines/trim-newlines-tests.ts @@ -0,0 +1,10 @@ +import trimNewlines = require("trim-newlines"); + +// $ExpectType string +trimNewlines('\nunicorn\r\n'); + +// $ExpectType string +trimNewlines.start("\n\npony\n"); + +// $ExpectType string +trimNewlines.end("\ndonk\n\n"); diff --git a/types/trim-newlines/tsconfig.json b/types/trim-newlines/tsconfig.json new file mode 100644 index 0000000000..8dbcfef306 --- /dev/null +++ b/types/trim-newlines/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "trim-newlines-tests.ts" + ] +} diff --git a/types/trim-newlines/tslint.json b/types/trim-newlines/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/trim-newlines/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 11b2a55bdc1c075d56c24195333d1ecaf060e0d9 Mon Sep 17 00:00:00 2001 From: Gregory Assasie Date: Thu, 7 Mar 2019 16:18:05 +0000 Subject: [PATCH 207/265] Add isolateModule under jest namespace --- types/jest/index.d.ts | 5 +++++ types/jest/jest-tests.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index deb9c92619..f038da0d49 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -154,6 +154,11 @@ declare namespace jest { * useful to isolate modules where local state might conflict between tests. */ function resetModules(): typeof jest; + /** + * Creates a sandbox registry for the modules that are loaded inside the callback function.. + * This is useful to isolate specific modules for every test so that local module state doesn't conflict between tests. + */ + function isolateModules(fn: () => void): typeof jest; /** * Runs failed tests n-times until they pass or until the max number of retries is exhausted. * This only works with jest-circus! diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index c643ca6a57..07fc1675da 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -267,6 +267,7 @@ jest .mock("moduleName", jest.fn(), { virtual: true }) .resetModuleRegistry() .resetModules() + .isolateModules(() => {}) .retryTimes(3) .runAllImmediates() .runAllTicks() From 37ee59cc6aa3dc7a7595094daac996f1f3d77d64 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Thu, 7 Mar 2019 16:33:55 +0000 Subject: [PATCH 208/265] Update CODEOWNERS --- .github/CODEOWNERS | 406 +++++++++++++++++++++++++++------------------ 1 file changed, 248 insertions(+), 158 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6477b03f07..5af21f27d2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -49,7 +49,7 @@ /types/adal-angular/ @unindented @aciccarello /types/add-zero/ @Roaders /types/adlib/ @Esri @MikeTschudi -/types/adm-zip/ @jvilk @abner +/types/adm-zip/ @jvilk @abner @BendingBender /types/adone/ @s0m3on3 @maxveres /types/aes-js/ @federicobond /types/aframe/ @devpaul @bertoritger @twastvedt @@ -59,12 +59,14 @@ /types/agora-rtc-sdk/ @menthays /types/airbnb-prop-types/ @milesj /types/ajv-errors/ @afshawnlotfi +/types/ajv-merge-patch/ @littlepiggy03 /types/ale-url-parser/ @msn0 /types/alertify/ @jjeffery /types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 @alexmalcoci /types/alexa-voice-service/ @dolanmiu /types/algebra.js/ @CaselIT -/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger +/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger @neryortez @antoinerousseau +/types/algoliasearch-helper/ @gburgett @haroenv @samouss /types/ali-app/ @taoqf /types/ali-oss/ @ptrdu /types/all-keys/ @BendingBender @@ -160,7 +162,7 @@ /types/angularlocalstorage/ @horiuchi /types/angulartics/ @bateast2 /types/animation-frame/ @qinfchen -/types/animejs/ @A-Babin +/types/animejs/ @A-Babin @supaiku0 /types/annyang/ @hisham @theluk /types/ansi/ @Gustavo6046 /types/ansi-colors/ @rogierschouten @BendingBender @@ -204,7 +206,7 @@ /types/archy/ @vvakame /types/are-we-there-yet/ @brianloveswords /types/argon2-browser/ @ivangabriele -/types/argparse/ @arcticwaters @tlaziuk @eps1lon +/types/argparse/ @arcticwaters @tlaziuk @eps1lon @cakoose /types/args/ @Slessi /types/argv/ @hookclaw /types/arr-diff/ @BendingBender @@ -273,7 +275,8 @@ /types/await-timeout/ @szhu /types/awesomplete/ @webbiesdk @bmdixon @tbekolay @chrislopresto /types/aws-iot-device-sdk/ @niik @mlamp -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory @dalen +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory @dalen @loikg @skyzenr @richardcornelissen +/types/aws-param-store/ @jasonthomasgray /types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axe-webdriverjs/ @JoshuaKGoldberg @@ -295,7 +298,7 @@ /types/babel-types/ @yortus @baxtersa @marvinhagemeister @bcherny /types/babel-webpack-plugin/ @j-f1 /types/babel__code-frame/ @mohsen1 @ForbesLindesay -/types/babel__core/ @yortus @marvinhagemeister @mgroenhoff +/types/babel__core/ @yortus @marvinhagemeister @mgroenhoff @Jessidhia /types/babel__generator/ @yortus @johnnyestilles @mgroenhoff /types/babel__template/ @yortus @marvinhagemeister @mgroenhoff /types/babel__traverse/ @yortus @marvinhagemeister @rpetrich @mgroenhoff @@ -303,15 +306,15 @@ /types/babylon/ @yortus @marvinhagemeister /types/babylon-walk/ @czbuchi /types/babyparse/ @cdiddy77 -/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas +/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas @jgonggrijp /types/backbone-associations/ @craigbrett17 /types/backbone-fetch-cache/ @delphinus35 -/types/backbone-relational/ @eirikhm +/types/backbone-relational/ @eirikhm @jgonggrijp /types/backbone.layoutmanager/ @hejiang2000 /types/backbone.localstorage/ @lgrignon -/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas +/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas @jgonggrijp /types/backbone.paginator/ @Nyamazing -/types/backbone.radio/ @alphaleonis +/types/backbone.radio/ @alphaleonis @jgonggrijp /types/backgrid/ @jlujan /types/backlog-js/ @vvatanabe /types/backo2/ @Retsam @@ -375,6 +378,7 @@ /types/bip38/ @micksatana /types/bip39/ @micksatana /types/bit-array/ @mudkipme +/types/bit-twiddle/ @adamzerella /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh @kento1218 /types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk @@ -414,6 +418,7 @@ /types/bootstrap/ @denisname /types/bootstrap/v3/ @borisyankov @denisname /types/bootstrap-3-typeahead/ @AndersonFriaca +/types/bootstrap-colorpicker/ @aleksandar-manukov /types/bootstrap-datepicker/ @borisyankov /types/bootstrap-fileinput/ @CheCoxshall /types/bootstrap-growl-ifightcrime/ @AndersonFriaca @@ -457,7 +462,7 @@ /types/browserslist-useragent/ @nju33 /types/bs58/ @chrootsu @BendingBender /types/bs58/v3/ @chrootsu -/types/bson/ @horiuchi @CaselIT +/types/bson/ @horiuchi @CaselIT @justingrant /types/btoa/ @johngeorgewright @bricka /types/buble/ @Kocal /types/bucks/ @zaneli @@ -469,6 +474,7 @@ /types/buffer-xor/ @danwbyrne /types/buffers/ @rhencke /types/bufferstream/ @Bartvds +/types/build-output-script/ @BendingBender /types/builtin-modules/ @ajafff /types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana @kjellmorten @pc-jedi /types/bull/v2/ @bgrieder @JProgrammer @@ -480,11 +486,13 @@ /types/bunyan-config/ @cyrilschumacher /types/bunyan-format/ @dex4er /types/bunyan-prettystream/ @jasonswearingen @enlight +/types/bunyan-seq/ @raybooysen /types/bunyan-winston-adapter/ @stevehipwell /types/busboy/ @jacobbaskin /types/business-rules-engine/ @rsamec /types/bwip-js/ @MugeSo /types/byline/ @reppners +/types/byte-range/ @BendingBender /types/bytebuffer/ @cappellin /types/bytes/ @danny8002 @believer /types/bytewise/ @danwbyrne @@ -501,6 +509,7 @@ /types/camaro/ @tuananh /types/camelcase/ @samverschueren /types/camelcase-keys/ @mhegazy +/types/camljs/ @andrei-markeev /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang /types/caniuse-api/ @davecardwell @@ -511,16 +520,22 @@ /types/canvasjs/ @brutalimp /types/capitalize/ @frederickfogerty /types/capture-console/ @AustonZ +/types/carbon__colors/ @vpicone +/types/carbon__layout/ @vpicone +/types/carbon__motion/ @vpicone +/types/carbon__themes/ @vpicone +/types/carbon__type/ @vpicone /types/card-validator/ @ChanceM /types/case-sensitive-paths-webpack-plugin/ @r3nya /types/caseless/ @downace @mastermatt /types/cash/ @akvlko /types/casperjs/ @jedmao @urielch -/types/cassandra-driver/ @Svjard @pc-jedi +/types/cassandra-driver/ @Svjard @pc-jedi @michal-b-kaminski /types/catbox/ @jasonswearingen @AJamesPhillips @saboya /types/catbox/v7/ @jasonswearingen @AJamesPhillips /types/catbox-memory/ @SimonSchick /types/catbox-redis/ @SimonSchick +/types/cavy/ @tyler-hoffman /types/cbor/ @pushplay /types/ccap/ @taoqf /types/cesium/ @Zuzon @hnipps @szechyjs @golyalpha @@ -561,11 +576,10 @@ /types/check-types/ @idchlife /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten -/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz +/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz @nwtgck /types/chess.js/ @JacobFischer /types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender -/types/chokidar/ @reppners @felixfbecker @bayssmekanique /types/chordsheetjs/ @adamsbloom /types/chosen-js/ @borisyankov @denisname /types/chownr/ @BendingBender @@ -576,6 +590,7 @@ /types/chromecast-caf-receiver/ @craigrbruce /types/chromecast-caf-sender/ @samuelmaddock /types/chromedriver/ @pe8ter +/types/cipher-base/ @adamzerella /types/circuit-breaker-js/ @DeTeam /types/circular-json/ @jpevarnek /types/ckeditor/ @wittwert @stuartlong @viktorpegy @@ -627,6 +642,7 @@ /types/cls-hooked/ @aleung /types/clusterize.js/ @Pr1st0n /types/cmd-shim/ @cspotcode +/types/co/ @doniyor2109 /types/co-body/ @geoffreak /types/co-views/ @devlee @geoffreak /types/code/ @prashaantt @@ -646,6 +662,7 @@ /types/color-name/ @Ailrun /types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall +/types/color-support/ @Yavanosta /types/colorbrewer/ @mtraynham /types/colornames/ @manuth /types/colresizable/ @gilleswaeber @@ -654,7 +671,7 @@ /types/combine-source-map/ @TeamworkGuy2 /types/combined-stream/ @felixge @tlaziuk @konpikwastaken /types/combokeys/ @iclanton -/types/cometd/ @derekcicerone @unindented @alxHenry +/types/cometd/ @derekcicerone @unindented @alxHenry @hagl /types/command-exists/ @BendingBender /types/command-line-args/ @75lb /types/command-line-args/v4/ @CzBuCHi @75lb @@ -672,6 +689,7 @@ /types/compare-version/ @jpevarnek /types/compare-versions/ @LogvinovLeon /types/complex/ @AyaMorisawa @pavasich +/types/complex.js/ @adamzerella /types/component-emitter/ @psnider /types/compose-function/ @denis-sokolov /types/compressible/ @BendingBender @@ -692,10 +710,11 @@ /types/confit/ @ethanresnick /types/connect/ @SomaticIT @EvanHahn /types/connect-busboy/ @pinguet62 -/types/connect-datadog/ @moshegood +/types/connect-datadog/ @moshegood @xzyfer /types/connect-ensure-login/ @0x6368656174 /types/connect-flash/ @AndreasGassmann /types/connect-history-api-fallback/ @douglasduteil +/types/connect-history-api-fallback-exclusions/ @tonystonee /types/connect-livereload/ @SomaticIT /types/connect-modrewrite/ @tinganho /types/connect-mongo/ @Syati @@ -785,6 +804,7 @@ /types/create-html-element/ @BendingBender /types/create-react-class/ @jgoz /types/create-subscription/ @Asana @vsiao +/types/create-xpub/ @BendingBender /types/createjs/ @evilangelist @gyohk /types/createjs-lib/ @evilangelist @gyohk /types/credential/ @phuvo @@ -814,6 +834,7 @@ /types/css-to-style/ @bengry /types/css-tree/ @erik-kallen /types/cssbeautify/ @rictic +/types/cssesc/ @djcsdy /types/cssnano/ @odnamrataizem /types/csso/ @screendriver @erik-kallen /types/csurf/ @horiuchi @@ -845,7 +866,7 @@ /types/d3-box/ @lk-chen /types/d3-brush/ @tomwanzek @gustavderdrache @borisyankov /types/d3-chord/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-cloud/ @hansrwindhoff +/types/d3-cloud/ @hansrwindhoff @locknono /types/d3-collection/ @tomwanzek @gustavderdrache @borisyankov /types/d3-color/ @tomwanzek @gustavderdrache @borisyankov @denisname @ledragon /types/d3-contour/ @tomwanzek @Ledragon @@ -855,7 +876,7 @@ /types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov /types/d3-fetch/ @ledragon @denisname -/types/d3-force/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-force/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-geo/ @ledragon @tomwanzek @gustavderdrache @borisyankov /types/d3-graphviz/ @DomParfitt @@ -894,6 +915,7 @@ /types/dat.gui/ @gyohk @sonic3d @rroylance @singuerinc /types/data-driven/ @mrhen /types/datadog-metrics/ @pushplay +/types/datadog-statsd-metrics-collector/ @xzyfer /types/datadog-tracer/ @dineshsaravanan /types/datatables.net/ @Silver-Connection @omidkrad @pragmatrix @CNBoland /types/datatables.net-autofill/ @andy-maca @@ -904,6 +926,7 @@ /types/datatables.net-rowreorder/ @baywet /types/datatables.net-scroller/ @RohdeK /types/datatables.net-select/ @szechyjs +/types/date-and-time/ @danplisetsky /types/date-arithmetic/ @HeeL /types/date.format.js/ @balrob /types/dateformat/ @aicest @BendingBender @@ -916,13 +939,12 @@ /types/db-migrate-pg/ @nickiannone /types/db.js/ @cgwrench /types/dc/ @hansrwindhoff @mtraynham @MatthiasJobst -/types/dd-trace/ @ColinBradley @alloy /types/deasync/ @Sicilica /types/debessmann/ @vkorehov /types/debounce/ @denis-sokolov @joshuakgoldberg @wcarson /types/debounce-fn/ @BendingBender /types/debounce-promise/ @whtsky -/types/debug/ @swook @galtalmor @zamb3zi @brasten +/types/debug/ @swook @galtalmor @zamb3zi @brasten @npenin /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decode-entities/ @waspothegreat @@ -934,6 +956,7 @@ /types/deep-assign/ @souldreamer /types/deep-diff/ @ZauberNerd /types/deep-equal/ @remojansen @janslow +/types/deep-equal-in-any-order/ @bcaudan /types/deep-extend/ @rhysd /types/deep-freeze/ @Bartvds @aluanhaddad /types/deep-freeze-es6/ @mattbishop @@ -946,8 +969,6 @@ /types/defined/ @BendingBender /types/deglob/ @saadq /types/deku/ @pocka -/types/del/ @AyaMorisawa @BendingBender @bitjson -/types/del/v2/ @AyaMorisawa /types/delaunator/ @DenisCarriere @BTOdell /types/delete-empty/ @Alorel /types/deline/ @iarroyo5 @@ -963,7 +984,6 @@ /types/derhuerst__cli-on-key/ @jacobbubu /types/destroy/ @BendingBender /types/destroy-on-hwm/ @BendingBender -/types/detect-browser/ @rogierschouten @carusology /types/detect-character-encoding/ @BendingBender /types/detect-hover/ @thomastilkema /types/detect-indent/ @Bartvds @BendingBender @@ -997,7 +1017,7 @@ /types/dir-resolve/ @andy-ms /types/dirname-regex/ @BendingBender /types/discontinuous-range/ @OiCMudkips -/types/discord-rpc/ @jasonhaxstuff +/types/discord-rpc/ @jasonhaxstuff @lolPants /types/discourse-sso/ @championswimmer /types/dispatchr/ @Ragg- /types/disposable-email-domains/ @geoffreak @@ -1051,6 +1071,7 @@ /types/draggabilly/ @jaydubu /types/dragster/ @zskovacs /types/dragula/ @pwelter34 @abruzzihraig +/types/driftless/ @dandelany /types/drivelist/ @WholeMilk /types/dropbox-chooser/ @quas94 /types/dropboxjs/ @Steve-Fenton @xperiments @@ -1083,7 +1104,7 @@ /types/easy-xapi/ @DeadAlready /types/easy-xapi-utils/ @DeadAlready /types/ebongarde-root/ @Ebongarde -/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 +/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 @bilalucar /types/ecma-proposal-math-extensions/ @ksm2 /types/ecurve/ @mhegazy /types/ed25519/ @erikma @@ -1182,7 +1203,7 @@ /types/env-paths/ @danwbyrne /types/env-to-object/ @MugeSo /types/envify/ @tkQubo -/types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell +/types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell @screendriver /types/enzyme-adapter-react-15/ @tkrotoff /types/enzyme-adapter-react-15.4/ @nali /types/enzyme-adapter-react-16/ @tkrotoff @@ -1221,12 +1242,13 @@ /types/estree/ @RReverser /types/etag/ @BendingBender /types/eth-lightwallet/ @LogvinovLeon +/types/eth-sig-util/ @quezak /types/ethereum-protocol/ @LogvinovLeon -/types/ethereumjs-abi/ @LogvinovLeon +/types/ethereumjs-abi/ @LogvinovLeon @quezak /types/ethereumjs-tx/ @LogvinovLeon @dmihal /types/ethereumjs-util/ @cortopy /types/ethjs-signer/ @doppio -/types/eureka-js-client/ @Schnillz @karl-run @tombarton +/types/eureka-js-client/ @Schnillz @karl-run @tombarton @jpsullivan /types/evaporate/ @kookster @chrisrhoden @ailrun /types/event-emitter/ @LKay /types/event-emitter-es6/ @ahstro @@ -1253,9 +1275,11 @@ /types/expect-puppeteer/ @JoshuaKGoldberg @tkrotoff /types/expect.js/ @teppeis /types/expectations/ @vvakame +/types/expired/ @BendingBender /types/expired-storage/ @intolerance /types/expirymanager/ @DanielRose -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 +/types/expo/v31/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 /types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh @@ -1313,7 +1337,8 @@ /types/express-slow-down/ @jdforsythe /types/express-socket.io-session/ @AylaJK /types/express-to-koa/ @xiaohanzhang -/types/express-unless/ @wokim +/types/express-unless/ @wokim @joaovieira @michal-b-kaminski +/types/express-urlrewrite/ @mgroenhoff /types/express-version-request/ @weffe /types/express-version-route/ @weffe /types/express-wechat-access/ @simmons8616 @@ -1332,7 +1357,7 @@ /types/eyes/ @brynbellomy /types/ez-plus/ @AndersonFriaca /types/f1/ @neolwc -/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill +/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill @bmkrol823 @glenngartner /types/facebook-instant-games/ @menushka @oyvindjam /types/facebook-js-sdk/ @amritk @mahmoudzohdi @fluidsonic /types/facebook-pixel/ @noctishsu @@ -1346,7 +1371,7 @@ /types/falcor-router/ @Quramy @cdhgee /types/famous/ @borisvasilenko /types/fancy-log/ @pine -/types/fancybox/ @borisyankov +/types/fancybox/ @borisyankov @SPWizard01 /types/farbtastic/ @EnableSoftware /types/fast-json-stable-stringify/ @BendingBender /types/fast-levenshtein/ @mizunashi-mana @@ -1355,12 +1380,8 @@ /types/fast64/ @rarmatei /types/fastclick/ @shinnn /types/fastify-accepts/ @leomelzer -/types/fastify-cors/ @jannikkeye /types/fastify-favicon/ @tuelsch -/types/fastify-jwt/ @jannikkeye -/types/fastify-multipart/ @jannikkeye /types/fastify-rate-limit/ @pc-jedi -/types/fastify-static/ @leomelzer /types/favico.js/ @drowse314-dev-ymat /types/favicons/ @mohsen1 @metsawyr /types/fb/ @JoshStrobl @@ -1375,7 +1396,7 @@ /types/feathersjs__authentication-oauth1/ @j2L4e /types/feathersjs__authentication-oauth2/ @j2L4e @NickBolles /types/feathersjs__configuration/ @j2L4e -/types/feathersjs__errors/ @j2L4e +/types/feathersjs__errors/ @j2L4e @RazzM13 /types/feathersjs__express/ @j2L4e @DadUndead /types/feathersjs__feathers/ @j2L4e @AbraaoAlves @TimMensch /types/feathersjs__primus/ @j2L4e @@ -1467,11 +1488,12 @@ /types/focus-within/ @eramdam /types/fontfaceobserver/ @RandScullard /types/fontoxml/ @rolandzwaga +/types/force-graph/ @p-kimberley /types/forever-agent/ @yavanosta /types/forever-monitor/ @shuntksh @wrboyce /types/forge-apis/ @Autodesk-Forge /types/forge-di/ @adamcarr -/types/forge-viewer/ @Autodesk-Forge +/types/forge-viewer/ @Autodesk-Forge @alansmithnbs /types/form-data/ @soywiz @leonyu @BendingBender /types/form-serialize/ @tyler-johnson /types/form-serializer/ @flqw @@ -1685,7 +1707,7 @@ /types/geolite2/ @ffflorian /types/geometry-dom/ @nakakura /types/geopattern/ @Gaelan -/types/gestalt/ @serranoarevalo +/types/gestalt/ @serranoarevalo @joshgachnang /types/get-caller-file/ @ajafff /types/get-certain/ @BendingBender /types/get-emails/ @BendingBender @@ -1708,7 +1730,8 @@ /types/ghauth/ @Leko /types/gifffer/ @gatimus /types/gijgo/ @atatanasov -/types/giraffe/ @darthapo +/types/giphy-api/ @screendriver +/types/giraffe/ @darthapo @jgonggrijp /types/git/ @vvakame /types/git-add-remote/ @BendingBender /types/git-branch/ @rynclark @@ -1735,6 +1758,8 @@ /types/gl-react-native/ @jussikinnula /types/gl-shader/ @MathiasPaumgarten /types/gl-texture2d/ @MathiasPaumgarten +/types/gl-vec3/ @adamzerella +/types/gl-vec4/ @adamzerella /types/gldatepicker/ @qcz /types/glidejs/ @milanjaros /types/glob/ @vvakame @voy @ajafff @@ -1780,7 +1805,7 @@ /types/google.script.client-side/ @clomie /types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm @shrujalshah28 /types/google__maps/ @indrimuska -/types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm +/types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm @captain-igloo /types/googlemaps.infobubble/ @Dashue /types/googlepay/ @Fluccioni @Radu-Raicea @fstanis /types/got/ @BendingBender @LinusU @ikokostya @stijnvn @@ -1792,7 +1817,7 @@ /types/gramps__rest-helpers/ @claude /types/graphite-udp/ @EricByers /types/graphlib-dot/ @DomParfitt -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel @mc0 /types/graphql-date/ @enaeseth /types/graphql-deduplicator/ @lfades /types/graphql-depth-limit/ @eritikass @@ -1817,7 +1842,7 @@ /types/gridstack/ @PascalSenn @ZoolWay @Sl1MBoy /types/grpc-error/ @danwbyrne /types/grunt/ @jeffmay @basarat -/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp +/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp @AdemHodzic /types/gtin/ @RafaelKr /types/guardian__prosemirror-invisibles/ @dddotsev /types/guid/ @maroy1986 @@ -1845,6 +1870,7 @@ /types/gulp-file-include/ @DanielRosenwasser /types/gulp-filter/ @tkrotoff /types/gulp-flatten/ @k-kagurazaka +/types/gulp-gh-pages/ @ntnyq /types/gulp-gzip/ @tkQubo /types/gulp-help/ @tkQubo /types/gulp-help-doc/ @Mikhus @@ -1898,6 +1924,7 @@ /types/gulp-util/ @jedmao /types/gulp-watch/ @tkrotoff /types/gulp-zip/ @dudeofawesome +/types/gun/ @Jack-Works /types/gzip-js/ @rhysd /types/gzip-size/ @plantain-00 @jimivdw @andrewiggins /types/gzip-size/v3/ @plantain-00 @@ -1905,7 +1932,6 @@ /types/halfred/ @dherges /types/halogen/ @steller /types/hammerjs/ @milkisevil @codler -/types/handlebars/ @borisyankov @evil-shrike /types/handlebars-helpers/ @Toilal /types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick @saboya /types/hapi/v17/ @rafaelsouzaf @jhsimms @SimonSchick @saboya @@ -1954,6 +1980,7 @@ /types/heroku-logger/ @kylevogt /types/hex-rgb/ @BendingBender /types/hex-rgba/ @r3nya +/types/hexo/ @kentarouTakeda /types/hexo-bunyan/ @segayuu /types/hexo-fs/ @segayuu /types/hexo-log/ @segayuu @@ -1969,15 +1996,15 @@ /types/history.js/ @borisyankov @gjunge /types/historykana/ @h-shiratsuki /types/hjson/ @crunchie84 -/types/hls.js/ @jgainfort @brookback @adripanico +/types/hls.js/ @jgainfort @brookback @adripanico @beraliv /types/hoek/ @prashaantt -/types/hoist-non-react-statics/ @JounQin +/types/hoist-non-react-statics/ @JounQin @jamesreggio /types/holderjs/ @renjfk /types/hooker/ @misak113 /types/hopscotch/ @pimterry @Aurimas1 /types/host-validation/ @dintopple /types/hosted-git-info/ @OiyouYeahYou -/types/howler/ @xperiments @tdukart @alien35 @nicholashza +/types/howler/ @xperiments @alien35 @nicholashza @cjurango /types/hpp/ @kryops /types/html-entities/ @xstoudi /types/html-minifier/ @tkrotoff @rikuayanokozy @@ -1990,6 +2017,7 @@ /types/html-webpack-plugin/ @deevus @bumbleblym @tlaziuk /types/html-webpack-template/ @bumbleblym /types/html2canvas/ @rwhepburn @tan9 @sschocke @Ristaaf +/types/html5plus/ @dcloudio /types/htmlbars-inline-precompile/ @chriskrycho /types/htmlparser2/ @staticfunction @LinusU /types/htmltojsx/ @basarat @@ -2009,9 +2037,10 @@ /types/http-status/ @misak113 /types/http-string-parser/ @pine613 /types/httperr/ @yortus -/types/hubot/ @dirk @KeesCBakker +/types/hubot/ @dirk @KeesCBakker @eeemil /types/hubspot-pace/ @borislavjivkov /types/humane/ @jmvrbanac +/types/humanize-ms/ @adamzerella /types/humanize-plus/ @DenisCarriere /types/humanize-string/ @ragnarok56 /types/humanize-url/ @BendingBender @@ -2028,13 +2057,10 @@ /types/i18next/ @mxl @deerawan @GiedriusGrabauskas @lenovouser @qqilihq @butchyyyy /types/i18next/v8/ @mxl @deerawan @GiedriusGrabauskas /types/i18next/v2/ @mxl @deerawan @GiedriusGrabauskas -/types/i18next-browser-languagedetector/ @cyrilschumacher @GiedriusGrabauskas -/types/i18next-browser-languagedetector/v0/ @cyrilschumacher @GiedriusGrabauskas /types/i18next-express-middleware/ @cyrilschumacher /types/i18next-ko/ @dwaxweiler /types/i18next-node-fs-backend/ @cyrilschumacher @lenovouser /types/i18next-sprintf-postprocessor/ @cyrilschumacher -/types/i18next-xhr-backend/ @jamuhl @GiedriusGrabauskas /types/i2c-bus/ @101100 /types/iarna__toml/ @ajafff /types/iban/ @cyrilschumacher @@ -2075,6 +2101,7 @@ /types/in-range/ @DanielRosenwasser /types/inboxsdk/ @rdoursenaud @amiram /types/incremental-dom/ @basarat @lanthaler @vvakame +/types/indefinite/ @omaishr /types/indent-string/ @mhegazy @BendingBender /types/inert/ @nycdotnet @AJamesPhillips @lenovouser /types/inert/v4/ @nycdotnet @AJamesPhillips @@ -2085,8 +2112,12 @@ /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung /types/ink/ @cprecioso +/types/ink-spinner/ @lukostry +/types/ink-table/ @lukostry +/types/ink-text-input/ @lukostry /types/inline-css/ @philipisapain /types/inline-style-prefixer/ @ahz @dpetrezselyova @franklixuefei +/types/inputmask/ @dmester /types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun /types/inquirer-npm-name/ @manuth /types/insert-css/ @hvoecking @@ -2097,8 +2128,6 @@ /types/intercom-client/ @jineshshah36 @peping /types/intercom-web/ @fongandrew @salbahra @onatm /types/intercomjs/ @spencerwi -/types/internal-ip/ @BendingBender -/types/internal-ip/v2/ @BendingBender /types/interpret/ @BendingBender /types/intl/ @RagibHasin /types/intl-locales-supported/ @Slessi @@ -2135,6 +2164,7 @@ /types/is-array/ @pine /types/is-array-sorted/ @BendingBender /types/is-binary-path/ @DanielRosenwasser +/types/is-blank/ @heygambo /types/is-buffer/ @rokt33r /types/is-callable/ @nieltg /types/is-charging/ @BendingBender @@ -2156,11 +2186,12 @@ /types/is-ip/ @coderslagoon /types/is-mobile/ @LogvinovLeon /types/is-my-json-valid/ @kruncher +/types/is-natural-number/ @adamzerella /types/is-negated-glob/ @ajafff /types/is-number/ @harryshipton /types/is-obj/ @forivall /types/is-object/ @wbhob -/types/is-online/ @BendingBender +/types/is-odd/ @adamzerella /types/is-path-cwd/ @DanielRosenwasser /types/is-path-in-cwd/ @mhegazy /types/is-plain-obj/ @BendingBender @@ -2196,7 +2227,7 @@ /types/iso-3166-2/ @sicilica /types/iso8601-localizer/ @avielfedida /types/isomorphic-fetch/ @toddlucas -/types/isotope-layout/ @avidenic @malinushj +/types/isotope-layout/ @avidenic @malinushj @SPWizard01 /types/issue-parser/ @Leko /types/issue-regex/ @BendingBender /types/istanbul/ @tkrotoff @@ -2240,14 +2271,14 @@ /types/jcanvas/ @rogierschouten /types/jdataview/ @RReverser /types/jdenticon/ @mtr -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 @antoinebrault /types/jest/v16/ @NoHomey @jwbay /types/jest-axe/ @JoshuaKGoldberg /types/jest-cli/ @lifeiscontent /types/jest-diff/ @myabc /types/jest-docblock/ @ikatyang /types/jest-each/ @theutz @nickmccurdy -/types/jest-environment-puppeteer/ @joshuakgoldberg +/types/jest-environment-puppeteer/ @joshuakgoldberg @ifiokjr /types/jest-get-type/ @myabc /types/jest-image-snapshot/ @dawnmist /types/jest-in-case/ @geovanisouza92 @@ -2267,7 +2298,7 @@ /types/jjve/ @Nemo157 /types/jmespath/ @pushplay /types/johnny-five/ @nakakura @ujvzolee @workshop2 @xtrimsystems @marcinobiedz -/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick +/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick @afharo /types/joi/v13/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @aconanlai /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @@ -2423,8 +2454,10 @@ /types/js.spec/ @mattbishop /types/jsbn/ @Evgenus @al2xed /types/jschannel/ @yitzchok @McFlat +/types/jscodeshift/ @brieb /types/jscrollpane/ @qcz /types/jsdeferred/ @minodisk +/types/jsdoc-to-markdown/ @adamzerella /types/jsdom/ @leonard-thieu @palmfjord /types/jsen/ @vladeck /types/jsend/ @CaselIT @@ -2452,13 +2485,14 @@ /types/json-stringify-safe/ @BendingBender /types/json2csv/ @juanjoDiaz /types/json2md/ @MartynasZilinskas +/types/json2mq/ @ZhangYiJiang /types/json3/ @NN--- /types/json5/ @Esemesek /types/json_ml/ @pluma /types/jsonabc/ @ffflorian /types/jsonapi-serializer/ @chiangf /types/jsonata/ @nick121212 -/types/jsoneditor/ @alejo90 @errietta +/types/jsoneditor/ @alejo90 @errietta @adamvig /types/jsoneditor-for-react/ @joshuakgoldberg /types/jsoneditoronline/ @vbortone /types/jsonfile/ @dbowring @BendingBender @@ -2515,7 +2549,8 @@ /types/jwt-simple/ @kenfdev @GaelMagnan /types/jwt-then/ @phenomax /types/k6/ @MajorBreakfast -/types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram +/types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram @insanehong +/types/kafkajs/ @michal-b-kaminski /types/karma/ @tkrotoff @43081j @devoto13 /types/karma/v1/ @tkrotoff @43081j /types/karma-chai/ @JayAndCatchFire @@ -2525,7 +2560,7 @@ /types/karma-jasmine/ @michelsalib /types/karma-viewport/ @karak /types/karma-webpack/ @mtraynham -/types/katex/ @mrand01 @knguyen0125 +/types/katex/ @mrand01 @knguyen0125 @dreamerblue /types/kcors/ @Xstoudi @izayoiko /types/kdbush/ @DenisCarriere @chrfrasco /types/kdbxweb/ @Roang-zero1 @@ -2548,7 +2583,8 @@ /types/keyv__redis/ @BendingBender /types/keyv__sqlite/ @BendingBender /types/kik-browser/ @joelday -/types/klaw/ @mceachen +/types/kissfft-js/ @racerhere +/types/klaw/ @mceachen @p4sca1 /types/klaw/v1/ @mceachen /types/klaw-sync/ @shiftkey /types/kms-json/ @sunnyone @@ -2579,7 +2615,7 @@ /types/koa-better-body/ @danwbyrne /types/koa-bodyparser/ @hellopao @anup-2s @hirochachacha /types/koa-bouncer/ @maruware -/types/koa-bunyan-logger/ @sjmcdowall +/types/koa-bunyan-logger/ @sjmcdowall @jankdc /types/koa-cache-control/ @pe8ter /types/koa-compose/ @jkeylu /types/koa-compress/ @hellopao @@ -2593,7 +2629,7 @@ /types/koa-hbs/ @jcbmln @mudkipme /types/koa-helmet/ @me /types/koa-html-minifier/ @romain-faust -/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha +/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha @NotWoods /types/koa-json/ @brooklyndev /types/koa-json-error/ @mudkipme /types/koa-log/ @havenchyk @@ -2618,7 +2654,7 @@ /types/koa-send/ @pe8ter @tlaziuk /types/koa-session/ @kerol2r20 @tlaziuk @hirochachacha /types/koa-session-minimal/ @longztian -/types/koa-sslify/ @wingsbob +/types/koa-sslify/ @wingsbob @msokk /types/koa-static/ @hellopao @tlaziuk /types/koa-static-cache/ @JounQin /types/koa-static-server/ @wulunyi @@ -2657,7 +2693,7 @@ /types/ldap-filters/ @pluma /types/ldapjs/ @cvillemure @peterkooijmans /types/leadfoot/ @theintern -/types/leaflet/ @alejo90 @atd-schubert @mcauer +/types/leaflet/ @alejo90 @atd-schubert @mcauer @ronikar /types/leaflet/v0/ @rgripper /types/leaflet-areaselect/ @awallat /types/leaflet-curve/ @onikiienko @@ -2711,6 +2747,7 @@ /types/libxslt/ @alejo90 /types/license-checker/ @rogierschouten @unindented /types/liftoff/ @BendingBender +/types/lil-uri/ @wcarson /types/lil-uuid/ @Pr1st0n /types/lime-js/ @arthur-xavier /types/line-by-line/ @etomsen @@ -2726,6 +2763,7 @@ /types/linkifyjs/ @szhu @ovidiubute /types/list-git-remotes/ @BendingBender /types/list-stream/ @IanStorm +/types/list.js/ @jeffreymeng /types/listr/ @durad /types/lls/ @borislavjivkov /types/load-google-maps-api/ @oBusk @@ -3045,7 +3083,7 @@ /types/loglevel/ @Pro @szmeti @screendriver /types/logrotate-stream/ @rogierschouten /types/lokijs/ @TeamworkGuy2 @thomasconner -/types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten +/types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten @zyishai /types/long/ @peterkooijmans /types/looks-same/ @xcatliu /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @karimsa @@ -3059,6 +3097,7 @@ /types/lowlight/ @NoHomey /types/lozad/ @plantain-00 /types/lru-cache/ @Bartvds @BendingBender +/types/lru-cache/v4/ @Bartvds @BendingBender /types/lscache/ @Chris-Martinezz /types/ltx/ @PJakcson @BendingBender /types/luaparse/ @stpettersens @@ -3077,7 +3116,7 @@ /types/maildev/ @cyrilschumacher @zbarbuto /types/mailgen/ @vothanhkiet @jordanfarrer /types/mailgun-js/ @sampsonjoliver @andipaetzold -/types/mailparser/ @psnider +/types/mailparser/ @psnider @Avol-V /types/main-bower-files/ @k-kagurazaka /types/make-dir/ @ikatyang @BendingBender /types/maker.js/ @danmarshall @@ -3092,13 +3131,14 @@ /types/mangopay2-nodejs-sdk/ @ifiokjr /types/map-obj/ @BendingBender /types/mapbox/ @anahkiasen @Fluccioni -/types/mapbox-gl/ @dobrud @patrickr +/types/mapbox-gl/ @dobrud @patrickr @macobo /types/mapbox-gl-leaflet/ @agorshkov23 /types/mapbox__geo-viewport/ @fnberta /types/mapbox__geojson-area/ @n0nick /types/mapbox__polyline/ @Kern0 @mklopets /types/mapbox__s3urls/ @sebastianvera /types/mapbox__shelf-pack/ @Perlmint +/types/mapbox__sphericalmercator/ @nhusher /types/mapnik/ @ipv4sec /types/mapsjs/ @davismj /types/mariasql/ @bennett000 @@ -3109,7 +3149,7 @@ /types/markdown-it-lazy-headers/ @knom /types/markdown-pdf/ @MonsieurMan /types/markdownlint/ @ark120202 -/types/marked/ @worr @BendingBender @CrossR @mwickett +/types/marked/ @worr @BendingBender @CrossR @mwickett @htkzhtm /types/marked-terminal/ @bkendall /types/marker-animate-unobtrusive/ @viskin /types/markerclustererplus/ @enanox @mxl @@ -3177,7 +3217,7 @@ /types/mem-fs-editor/ @MyFoodBag /types/memcached/ @KentarouTakeda /types/memdown/ @MeirionHughes @danwbyrne -/types/memjs/ @leizongmin +/types/memjs/ @leizongmin @BendingBender /types/memoize-one/ @karol-majewski @franklixuefei /types/memoize-one/v3/ @karol-majewski @franklixuefei /types/memoizee/ @juanpicado @@ -3217,6 +3257,7 @@ /types/micro-events/ @AlexanderSychev /types/micromatch/ @glen-84 @vemoo /types/micromatch/v2/ @glen-84 +/types/micromodal/ @wcarson /types/microrouter/ @mathieudutour /types/microservice-utilities/ @runebaas /types/microsoft-ajax/ @pjmagee @@ -3279,6 +3320,7 @@ /types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu @bendykowski /types/moment-holiday/ @rwdalpe /types/moment-jalaali/ @alitaheri +/types/moment-precise-range-plugin/ @gricey432 /types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas @chemass /types/moment-round/ @jacobbaskin /types/moment-shortformat/ @whatasoda @@ -3286,11 +3328,11 @@ /types/moment-timezone/ @michelsalib @alanblins @asermax /types/money-math/ @taoqf /types/mongo-sanitize/ @CedricCazin -/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 +/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 @Manc /types/mongodb/v2/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi /types/mongodb-memory-server/ @dmitryrogozhny /types/mongodb-uri/ @mernxl -/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen +/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen @penumbra1 /types/mongoose/v4/ @simonxca @horiuchi @lukasz-zak /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa @@ -3316,7 +3358,7 @@ /types/mousetrap/ @qcz @alanhchoi /types/move-concurrently/ @mgroenhoff /types/move-file/ @BendingBender -/types/moveto/ @shermendev +/types/moveto/ @shermendev @pea3nut /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka /types/mozilla-readability/ @charlesvdv @@ -3344,6 +3386,7 @@ /types/multiplexjs/ @KamyarNazeri /types/multisort/ @CzBuCHi /types/multistream/ @mrmlnc @kenzierocks +/types/mumath/ @adamzerella /types/muri/ @jloveridge /types/murmurhash/ @atd-schubert /types/murmurhash-js/ @cvle @@ -3369,6 +3412,8 @@ /types/nats-hemera/ @vforv /types/natsort/ @mgroenhoff /types/natural/ @dmoonfire +/types/natural-compare/ @doniyor2109 +/types/natural-compare-lite/ @doniyor2109 /types/natural-sort/ @a-morales @fluggo /types/navermaps/ @ckboyjiy /types/navigation/ @grahammendick @@ -3437,14 +3482,16 @@ /types/nightwatch/ @rkavalap @schlesiger @ClaytonAstrom /types/nise/ @a-tarasyuk /types/nivo-slider/ @AndersonFriaca -/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko +/types/no-scroll/ @ZhangYiJiang +/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko @claytonkucera /types/noble-mac/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour @paambaati /types/nodal/ @charrondev -/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein -/types/node/v9/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs -/types/node/v8/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya -/types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry +/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @brunoscheufler @smac89 @tellnes @touffy @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein @j-oliveras @bhongy +/types/node/v10/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein @j-oliveras @bhongy +/types/node/v9/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs @j-oliveras @bhongy +/types/node/v8/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya @j-oliveras @bhongy +/types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry @j-oliveras /types/node/v6/ @Microsoft @DefinitelyTyped @WilcoBakker @inlined @eps1lon @Alorel @KSXGitHub @Archcry /types/node/v4/ @Microsoft @DefinitelyTyped @eps1lon @Archcry /types/node/v0/ @Microsoft @DefinitelyTyped @@ -3457,9 +3504,9 @@ /types/node-cron/ @maximelkin @burtek /types/node-dijkstra/ @nokutu /types/node-dir/ @panuhorsmalahti -/types/node-dogstatsd/ @chrisbobo +/types/node-dogstatsd/ @chrisbobo @xzyfer /types/node-emoji/ @jonestristand @styu @rimiti -/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre +/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre @kyranet /types/node-fibers/ @caryhaynie /types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 @supaiku0 @andersk /types/node-gcm/ @horiuchi @@ -3471,6 +3518,7 @@ /types/node-hue-api/ @fjmorel /types/node-int64/ @x3cion @kevin-greene-ck /types/node-ipc/ @arvitaly @gjurgens +/types/node-jose/ @nadunindunil /types/node-jsfl-runner/ @mrand01 /types/node-json-db/ @kuzn-ilya /types/node-localstorage/ @intolerance @@ -3485,6 +3533,7 @@ /types/node-redis-pubsub/ @renekeijzer /types/node-resque/ @gordey4doronin /types/node-rsa/ @alitaheri @xm @ffflorian +/types/node-sass/ @pspeter3 @chriseppstein /types/node-schedule/ @cyrilschumacher @flowpl /types/node-slack/ @tkQubo /types/node-snap7/ @heilingbrunner @@ -3523,7 +3572,6 @@ /types/nopt/ @jbondc /types/normalize-package-data/ @jdxcode /types/normalize-path/ @BendingBender -/types/normalize-url/ @odin3 @BendingBender @mathieumg /types/notie/ @mateusdemboski /types/notify/ @hellochar /types/notifyjs/ @soundTricker @NateScarlet @@ -3537,10 +3585,12 @@ /types/npm-email/ @BendingBender /types/npm-keyword/ @BendingBender /types/npm-license-crawler/ @ffflorian +/types/npm-list-author-packages/ @ffflorian /types/npm-name/ @BendingBender /types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff /types/npm-paths/ @BendingBender +/types/npm-registry-package-info/ @ffflorian /types/npm-run-path/ @BendingBender /types/npm-user/ @BendingBender /types/npm-user-packages/ @BendingBender @@ -3548,6 +3598,7 @@ /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk +/types/nssm/ @hongaar /types/number-is-nan/ @mhegazy /types/number-to-words/ @frederickfogerty /types/numeral/ @vbortone @BehindTheMath @klujanrosas @@ -3604,14 +3655,18 @@ /types/one-time/ @BendingBender /types/onesignal-cordova-plugin/ @broder /types/onetime/ @BendingBender +/types/onetime/v2/ @BendingBender /types/oniguruma/ @smhxx +/types/onionoo/ @BendingBender /types/onoff/ @marcel-ernst @Kallu609 /types/ontime/ @Hirse /types/open/ @Bartvds /types/open-editor/ @BendingBender +/types/open-graph/ @ffflorian /types/openapi-factory/ @runebaas /types/opener/ @tikurahul /types/openfin/ @chrisbarker @rdepena @whyn07m3 @licui3936 +/types/openfin/v37/ @chrisbarker @rdepena @whyn07m3 @licui3936 /types/openfin/v34/ @chrisbarker @rdepena @whyn07m3 /types/openfin/v29/ @chrisbarker @rdepena /types/openfin/v17/ @chrisbarker @@ -3659,25 +3714,19 @@ /types/p-defer/ @SamVerschueren @BendingBender /types/p-do-whilst/ @BendingBender /types/p-each-series/ @BendingBender -/types/p-event/ @BendingBender /types/p-every/ @BendingBender /types/p-forever/ @BendingBender /types/p-is-promise/ @BendingBender /types/p-lazy/ @BendingBender -/types/p-limit/ @BendingBender @LinusU /types/p-loading/ @renjfk /types/p-locate/ @BendingBender /types/p-log/ @BendingBender -/types/p-map/ @BendingBender /types/p-map-series/ @BendingBender /types/p-memoize/ @forabi /types/p-min-delay/ @BendingBender /types/p-one/ @BendingBender -/types/p-pipe/ @BendingBender /types/p-progress/ @icopp /types/p-props/ @BendingBender -/types/p-queue/ @BendingBender @evanshortiss -/types/p-queue/v2/ @BendingBender @evanshortiss /types/p-reduce/ @BendingBender /types/p-reflect/ @BendingBender /types/p-retry/ @BendingBender @@ -3685,7 +3734,6 @@ /types/p-settle/ @natesilva /types/p-some/ @BendingBender /types/p-tap/ @BendingBender -/types/p-throttle/ @BendingBender /types/p-time/ @BendingBender /types/p-timeout/ @BendingBender /types/p-times/ @BendingBender @@ -3694,7 +3742,7 @@ /types/p-wait-for/v1/ @BendingBender /types/p-waterfall/ @BendingBender /types/p-whilst/ @BendingBender -/types/p2/ @clark-stevenson +/types/p2/ @clark-stevenson @jramstedt /types/p5/ @p5-types /types/package-json/ @jinwoo @BendingBender /types/packery/ @piraveen @hanssens @@ -3716,7 +3764,7 @@ /types/parity-pmr/ @leovujanic /types/parity-poe/ @leovujanic /types/park-miller/ @BendingBender -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis @AlexandreHetu /types/parse/v1/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas /types/parse-columns/ @BendingBender /types/parse-filepath/ @BendingBender @@ -3811,6 +3859,7 @@ /types/petit-dom/ @JamesMessinger /types/pg/ @pspeter3 /types/pg/v6/ @pspeter3 +/types/pg-copy-streams/ @fluggo /types/pg-ears/ @bradleyayers /types/pg-escape/ @khell /types/pg-format/ @zopf @@ -3822,7 +3871,7 @@ /types/phantom/ @horiuchi @llRandom /types/phantomcss/ @abauzac /types/phantomjs/ @jedhunsaker @keesey -/types/phoenix/ @mciastek +/types/phoenix/ @mciastek @John-Goff @princemaple /types/phone/ @DxCx /types/phone-formatter/ @westy92 /types/phonegap/ @borisyankov @DickvdBrink @@ -3839,7 +3888,7 @@ /types/pid-from-port/ @BendingBender /types/pidusage/ @cyrilschumacher @mx601595686 /types/pify/ @samverschueren @mad-mike @c7hm4r -/types/pigpio/ @manerfan @erikma +/types/pigpio/ @manerfan @erikma @park012241 /types/pigpio-dht/ @erikma /types/pikaday/ @MidnightDesign @wake42 @mezoistvan /types/pikaday-time/ @Sayan751 @@ -3857,6 +3906,7 @@ /types/pkg-dir/ @NK-WEB-Git /types/pkg-up/ @forivall /types/pkg-versions/ @BendingBender +/types/pkgcloud/ @dantman /types/pkijs/ @microshine /types/platform/ @JakeH /types/playcanvas/ @Neoflash1979 @@ -3864,13 +3914,12 @@ /types/playmusic/ @nickp10 /types/pleasejs/ @nakakura /types/plist/ @higuri -/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm +/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm @zeroyoichihachi /types/plugapi/ @BNedry /types/plugin-error/ @rogierschouten /types/plupload/ @patrickbussmann /types/plur/ @iRoachie /types/pluralize/ @ukyo @karol-majewski -/types/png-async/ @kanreisa /types/png.js/ @ffflorian /types/pngjs/ @jason0x43 /types/pngquant-bin/ @hikoma @@ -3899,9 +3948,11 @@ /types/postcss-modules-local-by-default/ @huan086 /types/postcss-modules-resolve-imports/ @huan086 /types/postcss-modules-scope/ @huan086 +/types/postcss-nested/ @VorontsovMaxim /types/postcss-url/ @lenovouser /types/postman-collection/ @kbuzby /types/postmark/ @benbayard @jineshshah36 +/types/postmate/ @wcarson /types/pouch-redux-middleware/ @charrondev /types/pouchdb/ @AGBrown @geppy @fredgalvao /types/pouchdb-adapter-fruitdown/ @spaulg @geppy @fredgalvao @@ -3928,12 +3979,14 @@ /types/preloadjs/ @endel /types/prelude-ls/ @AyaMorisawa /types/prettier/ @ikatyang +/types/pretty/ @adamzerella /types/pretty-bytes/ @plantain-00 @danielasy /types/pretty-bytes/v4/ @plantain-00 /types/pretty-format/ @ikatyang /types/pretty-hrtime/ @BendingBender /types/pretty-ms/ @BendingBender @ocboogie @silh /types/pretty-ms/v3/ @BendingBender @ocboogie +/types/pretty-time/ @adamzerella /types/preval.macro/ @huan086 /types/printf/ @AluisioASG /types/priorityqueuejs/ @geoffreak @@ -3942,6 +3995,7 @@ /types/private-ip/ @coderslagoon /types/procfs-stats/ @cyrilschumacher /types/progress/ @sebastian-lenz +/types/progress-stream/ @mickdekkers /types/progressbar/ @atd-schubert /types/progressjs/ @zaneli /types/proj4/ @DenisCarriere @BendingBender @@ -3969,8 +4023,8 @@ /types/prompt-sync-history/ @MugeSo /types/promptly/ @danrspencer /types/prompts/ @Berkays @danielpa9708 @kamontat -/types/prop-types/ @DovydasNavickas @ferdaber -/types/proper-lockfile/ @qlonik +/types/prop-types/ @DovydasNavickas @ferdaber @eps1lon +/types/proper-lockfile/ @qlonik @LinusU /types/properties-reader/ @Goldsmith42 /types/prosemirror-collab/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-commands/ @bradleyayers @davidka @timjb @patsimm @@ -3986,6 +4040,7 @@ /types/prosemirror-schema-list/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-state/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-tables/ @superchu @eshvedai @patsimm +/types/prosemirror-test-builder/ @ifiokjr /types/prosemirror-transform/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-view/ @bradleyayers @davidka @timjb @patsimm /types/proton-native/ @khanhas @ltetzlaff @@ -4004,7 +4059,7 @@ /types/ptomasroos__react-native-multi-slider/ @Slessi /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh @ChristianBoehlke /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 /types/pulltorefreshjs/ @DanielRosenwasser @humpedli @@ -4053,7 +4108,7 @@ /types/radius/ @codeanimal /types/radix64/ @huan086 /types/raf/ @BenLorantfy -/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh +/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh @krantisinh /types/random-boolean/ @BendingBender /types/random-float/ @BendingBender /types/random-int/ @BendingBender @@ -4091,7 +4146,7 @@ /types/rc/ @DanielRosenwasser @BendingBender /types/rc-progress/ @jussikinnula /types/rc-select/ @DenisTirilis -/types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 +/types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 @nicholasmaddren @nulladdict /types/rc-switch/ @karol-majewski /types/rc-time-picker/ @Hoff97 /types/rc-tooltip/ @rhysd @ahstro @vsaarinen @@ -4102,7 +4157,7 @@ /types/rdflib/ @cenotelie /types/re-base/ @jordandrako /types/reach__router/ @kingdaro -/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Jessidhia @pshrmn @threepointone +/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Jessidhia @pshrmn @threepointone @saranshkataria /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz /types/react-adal/ @dkorolev1 /types/react-albus/ @sseppola @conradreuter @kuirak @@ -4116,10 +4171,10 @@ /types/react-aria-modal/ @forabi /types/react-autocomplete/ @lstanden /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin -/types/react-avatar-editor/ @diogocorrea @gabsprates +/types/react-avatar-editor/ @diogocorrea @gabsprates @lsenta @davidspiess /types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen @enricoboccadifuoco @lonyele /types/react-better-password/ @mhuynh1 -/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 +/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 @ldthorne /types/react-blessed/ @me /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall @jrakotoharisoa @r3nya @t49tran @bes @@ -4137,7 +4192,7 @@ /types/react-calendar-timeline/ @radziksh @acemac /types/react-cartographer/ @trevonmckay /types/react-circular-progressbar/ @lstanden -/types/react-click-outside/ @screendriver +/types/react-click-outside/ @screendriver @Ky6uk /types/react-close-on-escape/ @JamesAlias /types/react-codemirror/ @velveret @rudi-c /types/react-coinhive/ @sktbcbbs @@ -4166,15 +4221,16 @@ /types/react-daterange-picker/ @uncovertruth @MartynasZilinskas @donaldtf @vladflorescu94 /types/react-dates/ @ArturAmpilogov @NathanNZ /types/react-daum-postcode/ @Sa-ryong +/types/react-dev-utils/ @ark120202 /types/react-dnd-multi-backend/ @dawnmist @beeequeue /types/react-dnd-touch-backend/ @mleko @dawnmist @beeequeue /types/react-document-meta/ @ulrichb /types/react-document-title/ @cleverguy25 -/types/react-dom/ @MartynasZilinskas @theruther4d +/types/react-dom/ @MartynasZilinskas @theruther4d @Jessidhia /types/react-dom/v15/ @MartynasZilinskas /types/react-dom-factories/ @jgoz /types/react-dotdotdot/ @jczyzewski -/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice +/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice @ldanet /types/react-dragtastic/ @nscarcella /types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay @codeaid @jurosh @ekilah /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay @@ -4224,7 +4280,6 @@ /types/react-howler/ @maksimovicdanijel /types/react-hyperscript/ @tock203 /types/react-icon-base/ @apare @LKay -/types/react-icons/ @apare @johnnyreilly @LKay /types/react-image-crop/ @danielasy @chaaya /types/react-image-fallback/ @8enSmith /types/react-image-gallery/ @adamwpc @@ -4240,11 +4295,11 @@ /types/react-input-calendar/ @stepancar /types/react-input-mask/ @apare @dima7a14 /types/react-input-mask/v1/ @apare -/types/react-instantsearch/ @gburgett @jpowell -/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong -/types/react-instantsearch-dom/ @gburgett @jpowell -/types/react-instantsearch-native/ @gburgett @jpowell -/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 +/types/react-instantsearch/ @gburgett @jpowell @haroenv @samouss +/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong @haroenv @samouss +/types/react-instantsearch-dom/ @gburgett @jpowell @haroenv @samouss +/types/react-instantsearch-native/ @gburgett @jpowell @haroenv @samouss +/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 @anion155 /types/react-intl/v1/ @bgrieder /types/react-intl-redux/ @LKay /types/react-is/ @AviVahl @christianchown @eps1lon @@ -4256,9 +4311,11 @@ /types/react-json-tree/ @gnestor @zainafzal08 /types/react-jsonschema-form/ @iamdanfox @iplus26 @phbou72 @LucianBuzzo @sthenault @sbusch /types/react-jss/ @eps1lon @jlaw90 +/types/react-kawaii/ @ZhangYiJiang /types/react-lazyload/ @m0a /types/react-lazylog/ @benjaminRomano /types/react-leaflet/ @danzel @davschne @yuit +/types/react-leaflet/v1/ @danzel @davschne @yuit /types/react-leaflet-markercluster/ @Kimahriman /types/react-lifecycle-component/ @pixelshaded /types/react-lifecycles-compat/ @bySabi @@ -4269,6 +4326,7 @@ /types/react-mailchimp-subscribe/ @osdiab /types/react-map-gl/ @rimig @fnberta /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti +/types/react-material-ui-form-validator/ @FrankBrullo /types/react-mce/ @morphologue /types/react-mdl/ @bradzacher /types/react-measure/ @asvetliakov @marcfallows @@ -4276,9 +4334,10 @@ /types/react-mixin/ @tkqubo /types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz @jpowell /types/react-motion/ @stepancar @asvetliakov @dimitarnestorov +/types/react-motion-loop/ @j-em /types/react-motion-slider/ @asvetliakov /types/react-motion-ui-pack/ @jsonunger -/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh +/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh @nossbigg /types/react-native-android-taskdescription/ @christianchown /types/react-native-auth0/ @ascariandrea @marknelissen /types/react-native-autocomplete-input/ @ifiokjr @@ -4318,10 +4377,12 @@ /types/react-native-mauron85-background-geolocation/ @djereg /types/react-native-mixpanel/ @r3nya /types/react-native-modal-dropdown/ @echoulen +/types/react-native-modal-filter-picker/ @ywchang @nossbigg /types/react-native-modalbox/ @iRoachie /types/react-native-multi-slider/ @Slessi /types/react-native-navbar/ @ryokik /types/react-native-orientation/ @MoLow +/types/react-native-percentage-circle/ @hmajid2301 /types/react-native-permissions/ @vincentlanglet /types/react-native-photo-view/ @christianchown /types/react-native-platform-touchable/ @tngranados @@ -4338,6 +4399,7 @@ /types/react-native-sensor-manager/ @SahinVardar /types/react-native-settings-list/ @MrLuje /types/react-native-share/ @marknelissen +/types/react-native-snackbar-component/ @hmajid2301 /types/react-native-snap-carousel/ @jnbt @j-fro @gazaret @GuillaumeAmat @VitorLuizC /types/react-native-sortable-grid/ @j-fro /types/react-native-sortable-list/ @sivolobov @RookY2K @@ -4348,7 +4410,7 @@ /types/react-native-svg-uri/ @iRoachie /types/react-native-swiper/ @CaiHuan @huhuanming @mhcgrq /types/react-native-tab-navigator/ @iRoachie -/types/react-native-tab-view/ @kaoDev @iRoachie @timwangdev +/types/react-native-tab-view/ @kaoDev @iRoachie @timwangdev @geriux /types/react-native-text-input-mask/ @RodrigoAWeber /types/react-native-toast-native/ @bm-software /types/react-native-touch-id/ @huhuanming @gazaret @jinshin1013 @@ -4357,7 +4419,7 @@ /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming /types/react-native-zeroconf/ @mattapet -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus @azrosen92 @hmajid2301 /types/react-navigation/v2/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway /types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi /types/react-navigation-material-bottom-tabs/ @iRoachie @@ -4372,8 +4434,8 @@ /types/react-outside-click-handler/ @zubivan /types/react-overlays/ @aaronbeall @vitosamson @aarondancer /types/react-owl-carousel/ @tbounsiar @igorissen @KennethanCeyer -/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 -/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke +/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 @kevinrambaud +/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @kevinrambaud /types/react-paginate/v4/ @deevus @wouterhardeman @pegel03 @archy-bold /types/react-panelgroup/ @qgolsteyn /types/react-places-autocomplete/ @guilhermehubner @r3nya @ApeNox @azizhk @@ -4399,12 +4461,13 @@ /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba /types/react-relay/ @graphcool @voxmatt @alloy @npirotte @ckknight @kastermester @mattkrick /types/react-request/ @dannycochran +/types/react-resizable/ @airhorns /types/react-resize-detector/ @matthew-matvei @aMoniker @rdrgn /types/react-resolver/ @forabi /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-responsive/v1/ @asvetliakov /types/react-rnd/ @Ragg- @fsubal @zyh825 -/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith +/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith @wezleytsai /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian @nulladdict /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall @@ -4421,7 +4484,9 @@ /types/react-rte/ @jclyons52 /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas +/types/react-scroll-into-view-if-needed/ @angusfretwell @allanpope @jonathanly /types/react-scrollbar/ @stephenjelfs +/types/react-scrollspy/ @ZhangYiJiang /types/react-select/ @claasahl @jonfreedman /types/react-select/v1/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 @misantronic @darkartur @eps1lon @endurance @RCGuillaume /types/react-share/ @icopp @@ -4451,19 +4516,19 @@ /types/react-svg-inline/ @kiyopikko /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar -/types/react-swipe/ @DeividasBakanas +/types/react-swipe/ @DeividasBakanas @AAlakkad /types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi /types/react-swipeable-views/ @mxl @DeividasBakanas /types/react-syntax-highlighter/ @NoHomey @ajgamble-milner /types/react-table/ @royxue @psakalo @Havret @andys8 @Gelio /types/react-table-filter/ @gjsln -/types/react-tabs/ @danez @Equationist +/types/react-tabs/ @yu-i9 @danez @Equationist /types/react-tag-autocomplete/ @jlismore /types/react-tag-input/ @Ogglas @jankarres @matthewberryman /types/react-tagcloud/ @wassname /types/react-tagsinput/ @mykter /types/react-tap-event-plugin/ @mxl -/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz +/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz @Jessidhia /types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly /types/react-tether/ @ryprice /types/react-text-mask/ @guilhermehubner @cavarzan @needpower @@ -4491,14 +4556,14 @@ /types/react-visibility-sensor/ @JRasmusBm @gcangussu /types/react-webcam/ @squat /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger @vegtelenseg /types/react-widgets-moment/ @dawnmist -/types/react-window/ @martynaskadisa +/types/react-window/ @martynaskadisa @heyimalex /types/react-window-size/ @jakejrichards /types/react-wow/ @mikepthomas /types/react-youtube/ @kgtkr @salguerooo /types/react-youtube-embed/ @charles-salmon -/types/reactable/ @spielc +/types/reactable/ @spielc @priscila-moneo /types/reactcss/ @chrisgervang @LKay /types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @timc13 @patrickrgaffney @prabodht @georg94 /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva @@ -4513,11 +4578,11 @@ /types/readline-sync/ @jonestristand /types/readline-transform/ @dex4er /types/reapop/ @Barrokgl -/types/rebass/ @rhysd @ryee-dev @jamesmckenzie +/types/rebass/ @rhysd @ryee-dev @jamesmckenzie @gretzky @angusfretwell /types/rebass__grid/ @antonvasin @vittorio @lhache @lavoaster /types/recaptcha2/ @l-jonas /types/recase/ @18steps -/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok @RobertStigsson @kousaku-maron +/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok @RobertStigsson @kousaku-maron @iflp /types/recharts-scale/ @johnnyreilly /types/rechoir/ @BendingBender /types/recluster/ @dex4er @@ -4553,7 +4618,8 @@ /types/redux-first-router-link/ @janb87 /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk -/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik @bwlt +/types/redux-form/v7/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik /types/redux-form/v6/ @carsonf @aikoven @LKay @bancek @mshaaban088 /types/redux-form/v4/ @aikoven /types/redux-immutable/ @oizie @sebald @gavingregory @lukyth @@ -4608,6 +4674,7 @@ /types/remote-redux-devtools/ @ColinEberhardt @unindented @mamodom @colindekker /types/remove-markdown/ @RagibHasin /types/rename/ @Aankhen +/types/repeat-element/ @adamzerella /types/replace-ext/ @DeividasBakanas /types/replace-string/ @BendingBender /types/replacestream/ @dex4er @@ -4630,6 +4697,7 @@ /types/resemblejs/ @pimterry /types/reservoir/ @danvk /types/resize-img/ @higuri +/types/resize-observer-browser/ @chivesrs /types/resolve/ @marionebl @ajafff /types/resolve-cwd/ @BendingBender /types/resolve-from/ @unional @BendingBender @@ -4684,6 +4752,7 @@ /types/rocksdb/ @MeirionHughes @danwbyrne /types/roll/ @icopp /types/rolling-rate-limiter/ @l-jonas +/types/rollup-plugin-buble/ @Kocal /types/rollup-plugin-commonjs/ @eoin-obrien /types/rollup-plugin-delete/ @vladshcherbin /types/rollup-plugin-json/ @asmockler @hotell @@ -4707,6 +4776,7 @@ /types/rss/ @secondwtq /types/rsvp/ @chriskrycho /types/rsync/ @philippstucki +/types/rtlcss/ @adamzerella /types/rtree/ @oefirouz /types/run-parallel/ @mrmlnc /types/run-parallel-limit/ @mrmlnc @@ -4776,13 +4846,15 @@ /types/schema-registry/ @bonzzy /types/schwifty/ @ozum /types/scoped-http-client/ @mattvperry @rianadon -/types/screenfull/ @icholy @lionelb @joelshepherd +/types/screenfull/ @icholy @lionelb @joelshepherd @BendingBender +/types/screenfull/v3/ @icholy @lionelb @joelshepherd /types/screeps/ @MarkoSulamagi @NhanHo @bryanbecker @resir014 @Arcath @dmarcuse /types/screeps-profiler/ @ramblurr /types/script-ext-html-webpack-plugin/ @davecardwell /types/scriptjs/ @ssttevee /types/scroll-into-view/ @zivni /types/scroller/ @haskellcamargo +/types/scrollparent/ @Sintifo /types/scrollreveal/ @Davidblkx /types/scrolltofixed/ @bmdixon /types/scrypt/ @WhiteAbeLincoln @@ -4846,7 +4918,7 @@ /types/sequester/ @Strate /types/serialize-error/ @thomasthiebaud /types/serialize-javascript/ @lith-light-g @Pochodaydayup -/types/serialport/ @codefoster @apearson +/types/serialport/ @codefoster @apearson @cinderblock /types/serialport/v6/ @codefoster @apearson /types/serialport/v4/ @codefoster /types/serve-favicon/ @urossmolnik @@ -4854,7 +4926,7 @@ /types/serve-static/ @urossmolnik @LinusU /types/server/ @sant123 @iddan /types/server-destroy/ @gyszalai -/types/serverless/ @hassankhan +/types/serverless/ @hassankhan @JonathanWilbur /types/servicenow/ @bryceg /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 @ilyaztsv @@ -4866,7 +4938,7 @@ /types/sha1/ @arcdev1 /types/sha256/ @nhardy /types/shallow-equals/ @rsolomon -/types/shallowequal/ @seansfkelley @BendingBender +/types/shallowequal/ @seansfkelley @BendingBender @arndissler /types/shallowequal/v0/ @seansfkelley /types/shapefile/ @DenisCarriere @Thw0rted /types/sharedb/ @soney @@ -4882,7 +4954,7 @@ /types/shelljs/ @nikeee @voy @gkalpak @pheromonez @aldafu /types/shelljs-exec-proxy/ @qlonik /types/shimmer/ @kjin -/types/shipit/ @cyrilschumacher +/types/shipit-cli/ @cyrilschumacher /types/shipit-utils/ @cyrilschumacher /types/shopify-buy/ @openminder @straiforos @totemika /types/shorten-repo-url/ @BendingBender @@ -4954,18 +5026,19 @@ /types/slackdown/ @nju33 /types/slackify-html/ @hypexr /types/slash/ @BendingBender -/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav +/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav @jackall3n /types/slate-base64-serializer/ @YangusKhan /types/slate-html-serializer/ @YangusKhan /types/slate-irc/ @elisee /types/slate-plain-serializer/ @YangusKhan @mkiefel -/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil +/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil @jackall3n /types/sleep/ @rajarz /types/slice-ansi/ @dwieeb /types/slickgrid/ @jbaldwin /types/slideout/ @ToastHawaii /types/slimerjs/ @alexwall /types/slocket/ @BendingBender +/types/slonik/ @sebald /types/slug/ @mhegazy /types/smart-fox-server/ @ChanceM /types/smart-truncate/ @oyalhi @@ -4982,6 +5055,8 @@ /types/snoowrap/ @vitosamson @TheAppleFreak @willwull /types/snowball-stemmers/ @ryanvolum /types/snowboy/ @dolanmiu +/types/sns-validator/ @kevin68 +/types/sntp/ @adamzerella /types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io/v1/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io-client/ @progre @divillysausages @florentpoujol @@ -4998,7 +5073,7 @@ /types/socketty/ @Nax /types/sockjs/ @pmccloghrylaing /types/sockjs-client/ @vladev @arusakov @BendingBender @renjfk -/types/solidity-parser-antlr/ @LogvinovLeon @albrow +/types/solidity-parser-antlr/ @LogvinovLeon @albrow @yxliang01 /types/solr-client/ @liul85 /types/solution-center-communicator/ @dami-gg /types/sonic-boom/ @alferpal @@ -5008,7 +5083,7 @@ /types/soundmanager2/ @elton2048 /types/soupbintcp/ @jewbre /types/source-list-map/ @e-cloud -/types/source-map-support/ @Bartvds @jason0x43 +/types/source-map-support/ @Bartvds @jason0x43 @natealcedo /types/space-pen/ @vvakame /types/spark-md5/ @bastienmoulia /types/sparkly/ @BendingBender @@ -5024,13 +5099,14 @@ /types/speakingurl/ @Goldsmith42 /types/spected/ @benneq /types/spectrum/ @M-Zuber @Ailrun +/types/spellchecker/ @dalevfenton /types/split/ @marcinporebski /types/split.js/ @icholy /types/split2/ @mugeso /types/splunk-bunyan-logger/ @bricka /types/splunk-logging/ @bricka /types/spotify-api/ @skovmand -/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends +/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends @deini /types/sprintf/ @soywiz @BendingBender /types/sprintf-js/ @jasonswearingen @BendingBender @cdagli /types/sql-bricks/ @adn05 @paleo @@ -5047,6 +5123,7 @@ /types/ssh2-sftp-client/ @igrayson @ascariandrea @kartik2406 @viamuli /types/ssh2-streams/ @rbuckton /types/sshpk/ @mabels +/types/ssri/ @huan086 /types/stack-mapper/ @rogierschouten /types/stack-trace/ @exceptionless /types/stack-utils/ @BendingBender @@ -5084,14 +5161,16 @@ /types/storybook__addon-actions/ @joscha @jicjjang /types/storybook__addon-backgrounds/ @hyunseob @adhrinae /types/storybook__addon-centered/ @kiyopikko -/types/storybook__addon-info/ @mkornblum @fyrkant +/types/storybook__addon-info/ @mkornblum @fyrkant @RunningCoderLee /types/storybook__addon-jest/ @halfmatthalfcat -/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry +/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry @alanhchoi /types/storybook__addon-links/ @joscha @jessepinho /types/storybook__addon-notes/ @joscha @amacleay @MLoughry /types/storybook__addon-options/ @joscha @simonhn @amacleay @gaetanmaisse @adam187 /types/storybook__addon-storyshots/ @bradleyayers /types/storybook__addon-viewport/ @Vinnl +/types/storybook__addons/ @bmatcuk +/types/storybook__channels/ @bmatcuk /types/storybook__react/ @joscha @wapgear @dandean /types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie @ceyhuno /types/storybook__vue/ @pntgupta @@ -5133,7 +5212,7 @@ /types/strip-color/ @BendingBender /types/strip-indent/ @BendingBender /types/strip-json-comments/ @dmoonfire -/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos +/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos @saranshkataria @0xJoKe /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder @@ -5144,11 +5223,11 @@ /types/strophe/ @DavidKDeutsch /types/strophe.js/ @DavidKDeutsch /types/structured-source/ @azu -/types/styled-components/ @Igorbek @Igmat @lavoaster @Jessidhia +/types/styled-components/ @Igorbek @Igmat @lavoaster @Jessidhia @jkillian @eps1lon @flavordaaave /types/styled-components/v3/ @Igorbek @Igmat /types/styled-jsx/ @R1ZZU /types/styled-react-modal/ @Lavoaster -/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky +/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky @chrislopresto /types/styled-theming/ @ArjanJ /types/stylelint/ @alan-agius4 @filipsalpe /types/stylelint/v7/ @alan-agius4 @@ -5165,12 +5244,12 @@ /types/summernote/ @wstaelens @nusantara-cloud /types/sumo-logger/ @forabi @clementallen /types/suncalc/ @horiuchi -/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer +/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer @theQuazz /types/superagent/v2/ @varju @NicoZelaya @mxl /types/superagent-bunyan/ @bricka /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl -/types/supercluster/ @DenisCarriere +/types/supercluster/ @DenisCarriere @Manc /types/superstruct/ @edwardsnare /types/supertest/ @varju @pietu /types/supertest-as-promised/ @tkrotoff @@ -5225,7 +5304,6 @@ /types/table/ @evanshortiss @mrmlnc /types/tableau/ @protip /types/tableify/ @forivall -/types/tabris-plugin-firebase/ @eclipsesource /types/tabtab/ @vojtechhabarta @kamontat /types/tabulator/ @euginio /types/tail/ @spacejack @@ -5235,6 +5313,7 @@ /types/tar/ @SomaticIT @connor4312 /types/tar-fs/ @Umoxfo /types/tar-stream/ @glicht +/types/tarantool-driver/ @zharkov-eu /types/task-graph-runner/ @mgroenhoff /types/task-worklet/ @karol-majewski /types/tcp-ping/ @stegano @@ -5254,7 +5333,6 @@ /types/terminal-link/ @BendingBender /types/terminal-menu/ @aravindarun /types/tern/ @nkappler -/types/terser/ @JordiAnderl /types/terser-webpack-plugin/ @Danscho /types/test-console/ @roberto @guidoux @gbmoretti /types/test-listen/ @stephenmathieson @@ -5274,14 +5352,14 @@ /types/texzilla/ @m93a /types/tgfancy/ @Dabolus /types/theming/ @eps1lon -/types/theo/ @petekp +/types/theo/ @petekp @laitine /types/thepiratebay/ @jsorrell -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim +/types/three/ @gyohk @florentpoujol @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @Pro @efokschaner @PsychoSTS @apurvaojas @NotWoods @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim @saranshkataria @psuter /types/three-tds-loader/ @KonstantinLukaschenko @sschoensee /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender -/types/throttle-debounce/ @czbuchi @franklixuefei +/types/throttle-debounce/ @czbuchi @franklixuefei @oddsund /types/through/ @AndrewGaspar /types/through2/ @Bartvds @jedmao @valotas @TeamworkGuy2 @Alorel /types/through2/v0/ @Bartvds @jedmao @@ -5305,13 +5383,14 @@ /types/tiny-secp256k1/ @eduhenke /types/tiny-slider-react/ @screendriver /types/tinycolor2/ @M-Zuber @geertjansen @nvh @Ailrun -/types/tinycon/ @dwaxweiler +/types/tinycon/ @dwaxweiler @jaulz /types/tinycopy/ @vvatanabe /types/tinymce/ @martinduparc @ipoul @nicohartto /types/titanium/ @appcelerator @janvennemann /types/title/ @fa7ad /types/tldjs/ @geoffreak /types/tlds/ @ajshres +/types/tmi.js/ @wpapsco /types/tmp/ @optical @Perlmint /types/to-absolute-glob/ @ajafff /types/to-camel-case/ @j-f1 @@ -5321,6 +5400,7 @@ /types/to-title-case-gouch/ @stpettersens /types/toastr/ @borisyankov /types/tocktimer/ @evanshortiss +/types/tokenizr/ @aNickzz /types/tokgen/ @l-jonas /types/toobusy-js/ @atd-schubert @BendingBender /types/tooltipster/ @stephenlautier @pjmagee @VorobeY1326 @leonard-thieu @janhi @joeskeen @@ -5361,6 +5441,7 @@ /types/tspromise/ @soywiz /types/ttf2woff2/ @ThomasdenH /types/tunnel/ @BendingBender +/types/turndown/ @sergey-zhidkov /types/tus-js-client/ @kevhiggins @Acconut /types/tv4/ @Bartvds @psnider /types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner @@ -5370,8 +5451,8 @@ /types/twilio/ @nickiannone @ashleybrener /types/twilio-common/ @gatimus /types/twilio-video/ @minddocdev @darioblanco -/types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery -/types/twitch-ext/ @beheh +/types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery @justgoscha +/types/twitch-ext/ @beheh @FedeDR /types/twitter/ @BendingBender /types/twitter-for-web/ @chitoku-k /types/twitter-stream-channels/ @adrianbardan @@ -5458,11 +5539,15 @@ /types/urlsafe-base64/ @tkrotoff /types/usage/ @pvomhoff /types/usb/ @underscorebrody @thegecko +/types/use-persisted-state/ @karol-majewski +/types/use-set-interval/ @screendriver +/types/use-set-timeout/ @screendriver /types/user-event/ @whtsky /types/user-home/ @mhegazy /types/useragent/ @geoffreak /types/username/ @kayahr @krivachy /types/utf8/ @zelein +/types/utif/ @smajl @nkprince007 @massic80 /types/util-deprecate/ @BendingBender /types/util.promisify/ @adamvoss /types/utils-merge/ @chrootsu @@ -5496,7 +5581,7 @@ /types/vertx3-eventbus-client/ @oddeirik /types/vex-js/ @gdcohan /types/vexdb/ @MayorMonty -/types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU +/types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU @bneumann /types/vfile/ @bizen241 @rokt33r /types/vfile-location/ @ikatyang @rokt33r /types/vfile-message/ @rokt33r @@ -5530,6 +5615,7 @@ /types/vorpal/ @danwbyrne /types/vortex-web-client/ @Pro /types/voximplant-websdk/ @aylarov +/types/vue-chartkick/ @cnsmedia /types/vue-color/ @me /types/vue-markdown/ @neodon /types/vue-resource/ @kaorun343 @@ -5544,8 +5630,8 @@ /types/w3c-image-capture/ @cosium /types/w3c-permissions/ @jberube /types/w3c-screen-orientation/ @kenchris -/types/w3c-web-usb/ @larsgk -/types/wait-for-localhost/ @BendingBender +/types/w3c-web-usb/ @larsgk @thegecko +/types/wait-on/ @ifiokjr /types/waitme/ @totpero /types/wake_on_lan/ @SrTobi /types/walk/ @poppa @@ -5572,7 +5658,7 @@ /types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan @alexkvak /types/web3-eth-abi/ @LogvinovLeon /types/web3-provider-engine/ @LogvinovLeon -/types/webappsec-credential-management/ @iainmcgin +/types/webappsec-credential-management/ @iainmcgin @Hartimer /types/webassembly-js-api/ @periklis @chicoxyzzy /types/webassembly-web-api/ @jhenninger /types/webcl/ @NCARalph @@ -5593,7 +5679,7 @@ /types/webpack-config-utils/ @hotell /types/webpack-dev-middleware/ @bumbleblym @reduckted @chrisabrams /types/webpack-dev-middleware/v1/ @bumbleblym @reduckted -/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong @alan-agius4 @arturovt +/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong @alan-agius4 @arturovt @davecardwell /types/webpack-dotenv-plugin/ @kryops /types/webpack-env/ @use-strict @rhonsby /types/webpack-fail-plugin/ @deevus @@ -5610,6 +5696,7 @@ /types/webpack-stream/ @iclanton @bumbleblym /types/webpack-subresource-integrity/ @huan086 /types/webpack-validator/ @deevus +/types/webpack-watched-glob-entries-plugin/ @ChaosinaCan /types/webpackbar/ @rynclark /types/webpagetest/ @ksm2 /types/webprogbase-console-view/ @veetaha @@ -5660,10 +5747,12 @@ /types/wiring-pi/ @NoHomey /types/wnumb/ @acoreyj /types/wonder.js/ @yyc-git +/types/word-extractor/ @saboya /types/word-list-json/ @dovidm /types/word2vector/ @renekeijzer /types/wordcloud/ @joeskeen /types/words-to-numbers/ @James-Frowen +/types/wordwrap/ @ark120202 /types/workbox-sw/ @wessberg /types/workbox-webpack-plugin/ @kgroat /types/worker-threads-pool/ @BendingBender @@ -5724,7 +5813,7 @@ /types/ydn-db/ @yathit @gabrielmaldi /types/year-days/ @BendingBender /types/yeoman-assert/ @Toilal -/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 +/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 @haggen /types/yeoman-test/ @ikatyang /types/yesql/ @Sumolari /types/yn/ @BendingBender @@ -5736,6 +5825,7 @@ /types/yosay/ @armorik83 /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun @paulhobbel /types/youtube-dl/ @bsurai @moshfeu +/types/youtube-player/ @jurca /types/yui/ @giabao /types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 @robertbullen @sat0yu @dancrumb /types/z-schema/ @pgonzal From 944e5019c1cf7b3430d1f2cefad8928a7de3ae54 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Thu, 7 Mar 2019 15:09:31 -0500 Subject: [PATCH 209/265] change tsconfig --- types/dragscroll/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragscroll/tsconfig.json b/types/dragscroll/tsconfig.json index bc17d2f0c7..20e259be9e 100644 --- a/types/dragscroll/tsconfig.json +++ b/types/dragscroll/tsconfig.json @@ -14,7 +14,7 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": false + "strictFunctionTypes": true }, "files": [ "index.d.ts", From 6b5fa0f70981a50237c1a8a8f21a599a959e3be5 Mon Sep 17 00:00:00 2001 From: Vinit Sood Date: Thu, 7 Mar 2019 21:34:08 +0100 Subject: [PATCH 210/265] add definitions for ScreenOrientation and AppLoadingProps --- types/expo/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 338a1c2989..a0eb3c6237 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -16,6 +16,7 @@ // Bartosz Dotryw // Jason Killian // Satyajit Sahoo +// Vinit Sood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -200,6 +201,9 @@ export interface AppLoadingProps { /** If `startAsync` throws an error, it is caught and passed into the function provided to `onError`. */ onError?: (error: Error) => void; + + /** Whether to hide the native splash screen as soon as you unmount the AppLoading component. */ + autoHideSplash?: boolean } /** @@ -2463,7 +2467,11 @@ export namespace ScreenOrientation { const Orientation: Orientations; + /** Deprecated in favour of ScreenOrientation.allowAsync. */ function allow(orientation: keyof Orientations): void; + + /** Allow a screen orientation. You can call this function multiple times with multiple orientations to allow multiple orientations. */ + function allowAsync(orientation: keyof Orientations): void; } /** From b809f105b58d4f45d4eb1e0535faa86958df150e Mon Sep 17 00:00:00 2001 From: vinitsood Date: Thu, 7 Mar 2019 22:32:16 +0100 Subject: [PATCH 211/265] Update index.d.ts --- types/expo/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index a0eb3c6237..544db39e67 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -16,7 +16,7 @@ // Bartosz Dotryw // Jason Killian // Satyajit Sahoo -// Vinit Sood +// Vinit Sood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From e19962e533e61a8e79ea27ba3dd1958a24317bbd Mon Sep 17 00:00:00 2001 From: vinitsood Date: Thu, 7 Mar 2019 22:38:47 +0100 Subject: [PATCH 212/265] Update index.d.ts --- types/expo/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 544db39e67..2752410316 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -203,7 +203,7 @@ export interface AppLoadingProps { onError?: (error: Error) => void; /** Whether to hide the native splash screen as soon as you unmount the AppLoading component. */ - autoHideSplash?: boolean + autoHideSplash?: boolean; } /** From 12cb57ea101caa32cad33d11eb0d3acb2dd44245 Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Thu, 7 Mar 2019 21:20:00 +0100 Subject: [PATCH 213/265] refactor: Use default TSLint configuration --- types/tape-async/index.d.ts | 34 ++++----- .../tape-async/test/tape-async.async.test.ts | 8 +- .../test/tape-async.generators.test.ts | 16 ++-- types/tape-async/test/tape-async.test.ts | 36 ++++----- types/tape-async/tslint.json | 74 +------------------ 5 files changed, 43 insertions(+), 125 deletions(-) diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts index be104ec2b4..94447163db 100644 --- a/types/tape-async/index.d.ts +++ b/types/tape-async/index.d.ts @@ -9,13 +9,11 @@ import tapeSync = require("tape"); export = tape; -declare function tape(name: string, cb: tape.TestCase): void +declare function tape(name: string | tape.TestOptions, cb: tape.TestCase): void; declare function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; declare function tape(cb: tape.TestCase): void; -declare function tape(opts: tape.TestOptions, cb: tape.TestCase): void; declare namespace tape { - interface TestCase { (test: Test): void | Iterator | PromiseLike; } @@ -23,45 +21,41 @@ declare namespace tape { /** * Available opts options for the tape function. */ - interface TestOptions extends tapeSync.TestOptions { - } + type TestOptions = tapeSync.TestOptions; /** * Options for the createStream function. */ - interface StreamOptions extends tapeSync.StreamOptions { - } + type StreamOptions = tapeSync.StreamOptions; /** * Generate a new test that will be skipped over. */ - export function skip(name: string, cb: tape.TestCase): void; - export function skip(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; - export function skip(cb: tape.TestCase): void; - export function skip(opts: tape.TestOptions, cb: tape.TestCase): void; + function skip(name: string | TestOptions, cb: TestCase): void; + function skip(name: string, opts: TestOptions, cb: TestCase): void; + function skip(cb: TestCase): void; /** * The onFinish hook will get invoked when ALL tape tests have finished right before tape is about to print the test summary. */ - export function onFinish(cb: () => void): void; + function onFinish(cb: () => void): void; /** * Like test(name?, opts?, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. */ - export function only(name: string, cb: tape.TestCase): void; - export function only(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; - export function only(cb: tape.TestCase): void; - export function only(opts: tape.TestOptions, cb: tape.TestCase): void; + function only(name: string | TestOptions, cb: TestCase): void; + function only(name: string, opts: TestOptions, cb: TestCase): void; + function only(cb: TestCase): void; /** * Create a new test harness instance, which is a function like test(), but with a new pending stack and test state. */ - export function createHarness(): typeof tape; + function createHarness(): typeof tape; /** * Create a stream of output, bypassing the default output stream that writes messages to console.log(). * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. */ - export function createStream(opts?: tape.StreamOptions): NodeJS.ReadableStream; + function createStream(opts?: StreamOptions): NodeJS.ReadableStream; interface Test extends tapeSync.Test { /** @@ -69,7 +63,7 @@ declare namespace tape { * cb(st) will only fire when t finishes. * Additional tests queued up after t will not be run until all subtests finish. */ - test(name: string, cb: tape.TestCase): void; - test(name: string, opts: TestOptions, cb: tape.TestCase): void; + test(name: string, cb: TestCase): void; + test(name: string, opts: TestOptions, cb: TestCase): void; } } diff --git a/types/tape-async/test/tape-async.async.test.ts b/types/tape-async/test/tape-async.async.test.ts index bb8e226009..4a6a53792c 100644 --- a/types/tape-async/test/tape-async.async.test.ts +++ b/types/tape-async/test/tape-async.async.test.ts @@ -2,10 +2,10 @@ import tape = require("tape-async"); -var name: string; -var cb: (test: tape.Test) => Promise; -var opts: tape.TestOptions; -var t: tape.Test; +let name: string; +let cb: (test: tape.Test) => Promise; +let opts: tape.TestOptions; +let t: tape.Test; tape(cb); tape(name, cb); diff --git a/types/tape-async/test/tape-async.generators.test.ts b/types/tape-async/test/tape-async.generators.test.ts index bf279030ef..940f207b5c 100644 --- a/types/tape-async/test/tape-async.generators.test.ts +++ b/types/tape-async/test/tape-async.generators.test.ts @@ -2,17 +2,17 @@ import tape = require("tape-async"); -var name: string; -var cb: (test: tape.Test) => IterableIterator; -var opts: tape.TestOptions; -var t: tape.Test; +let name: string; +let cb: (test: tape.Test) => IterableIterator; +let opts: tape.TestOptions; +let t: tape.Test; tape(cb); tape(name, cb); tape(opts, cb); tape(name, opts, cb); -tape(name, function* (test: tape.Test): IterableIterator { +tape(name, function*(test: tape.Test): IterableIterator { t = test; }); @@ -26,12 +26,12 @@ tape.only(name, cb); tape.only(opts, cb); tape.only(name, opts, cb); -tape(name, function* (test: tape.Test): IterableIterator { - test.test(name, function* (st: tape.Test): IterableIterator { +tape(name, function*(test: tape.Test): IterableIterator { + test.test(name, function*(st: tape.Test): IterableIterator { t = st; }); - test.test(name, opts, function* (st: tape.Test): IterableIterator { + test.test(name, opts, function*(st: tape.Test): IterableIterator { t = st; }); }); diff --git a/types/tape-async/test/tape-async.test.ts b/types/tape-async/test/tape-async.test.ts index 060da063be..71e06fffdb 100644 --- a/types/tape-async/test/tape-async.test.ts +++ b/types/tape-async/test/tape-async.test.ts @@ -1,9 +1,9 @@ import tape = require("tape-async"); -var name: string; -var cb: (test: tape.Test) => void; -var opts: tape.TestOptions; -var t: tape.Test; +let name: string; +let cb: (test: tape.Test) => void; +let opts: tape.TestOptions; +let t: tape.Test; tape(cb); tape(name, cb); @@ -26,14 +26,12 @@ tape.only(name, opts, cb); tape.onFinish(() => {}); - -var sopts: tape.StreamOptions; -var rs: NodeJS.ReadableStream; +let sopts: tape.StreamOptions; +let rs: NodeJS.ReadableStream; rs = tape.createStream(); rs = tape.createStream(sopts); - -var htest: typeof tape; +let htest: typeof tape; htest = tape.createHarness(); class CustomException extends Error { @@ -42,19 +40,17 @@ class CustomException extends Error { } } - tape(name, (test: tape.Test) => { + let num: number; + let ms: number; + let value: any; + let actual: any; + let expected: any; + let err: any; + let fn = () => {}; + let msg: string; - var num: number; - var ms: number; - var value: any; - var actual: any; - var expected: any; - var err: any; - var fn = function() {}; - var msg: string; - - var exceptionExpected: RegExp | (() => void); + let exceptionExpected: RegExp | (() => void); test.plan(num); test.end(); diff --git a/types/tape-async/tslint.json b/types/tape-async/tslint.json index b5f5694bcd..f610afbb19 100644 --- a/types/tape-async/tslint.json +++ b/types/tape-async/tslint.json @@ -1,83 +1,11 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, "indent": [ true, "tabs" ], - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "prefer-const": false } } From c88363cb73a11f6611fc1a0d65cb15f83ed4c5e5 Mon Sep 17 00:00:00 2001 From: Erik Christensen Date: Thu, 7 Mar 2019 17:33:39 -0500 Subject: [PATCH 214/265] Fixed hasNext() on CommandCursor --- types/mongodb/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 3657a3a651..230f593094 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1848,9 +1848,9 @@ export type CommandCursorResult = object | null; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html */ export class CommandCursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#hasNext */ - hasNext(): Promise; + hasNext(): Promise; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#hasNext */ - hasNext(callback: MongoCallback): void; + hasNext(callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#batchSize */ batchSize(value: number): CommandCursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#clone */ From ddd5b10708299d939554766f758a248f849593ae Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Thu, 7 Mar 2019 23:45:00 +0100 Subject: [PATCH 215/265] fix: Use default dtslint configuration --- types/tape-async/index.d.ts | 2 +- .../tape-async/test/tape-async.async.test.ts | 8 +++--- .../test/tape-async.generators.test.ts | 8 +++--- types/tape-async/test/tape-async.test.ts | 26 +++++++++---------- types/tape-async/tslint.json | 4 +-- 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts index 94447163db..c3ce0801d6 100644 --- a/types/tape-async/index.d.ts +++ b/types/tape-async/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for tape-async v2.3 +// Type definitions for tape-async 2.3 // Project: https://github.com/parro-it/tape-async // Definitions by: ExE Boss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/tape-async/test/tape-async.async.test.ts b/types/tape-async/test/tape-async.async.test.ts index 4a6a53792c..64b740de28 100644 --- a/types/tape-async/test/tape-async.async.test.ts +++ b/types/tape-async/test/tape-async.async.test.ts @@ -1,10 +1,8 @@ -// TypeScript Version: 2.1 - import tape = require("tape-async"); -let name: string; -let cb: (test: tape.Test) => Promise; -let opts: tape.TestOptions; +const name: string = undefined; +const cb = async (test: tape.Test) => {}; +const opts: tape.TestOptions = {}; let t: tape.Test; tape(cb); diff --git a/types/tape-async/test/tape-async.generators.test.ts b/types/tape-async/test/tape-async.generators.test.ts index 940f207b5c..7b6cc09eb4 100644 --- a/types/tape-async/test/tape-async.generators.test.ts +++ b/types/tape-async/test/tape-async.generators.test.ts @@ -1,10 +1,8 @@ -// TypeScript Version: 2.3 - import tape = require("tape-async"); -let name: string; -let cb: (test: tape.Test) => IterableIterator; -let opts: tape.TestOptions; +const name: string = undefined; +const cb = function*(test: tape.Test): IterableIterator {}; +const opts: tape.TestOptions = {}; let t: tape.Test; tape(cb); diff --git a/types/tape-async/test/tape-async.test.ts b/types/tape-async/test/tape-async.test.ts index 71e06fffdb..c2ed921938 100644 --- a/types/tape-async/test/tape-async.test.ts +++ b/types/tape-async/test/tape-async.test.ts @@ -1,8 +1,8 @@ import tape = require("tape-async"); -let name: string; -let cb: (test: tape.Test) => void; -let opts: tape.TestOptions; +const name: string = undefined; +const cb = (test: tape.Test) => {}; +const opts: tape.TestOptions = {}; let t: tape.Test; tape(cb); @@ -26,7 +26,7 @@ tape.only(name, opts, cb); tape.onFinish(() => {}); -let sopts: tape.StreamOptions; +const sopts: tape.StreamOptions = undefined; let rs: NodeJS.ReadableStream; rs = tape.createStream(); rs = tape.createStream(sopts); @@ -41,16 +41,16 @@ class CustomException extends Error { } tape(name, (test: tape.Test) => { - let num: number; - let ms: number; - let value: any; - let actual: any; - let expected: any; - let err: any; - let fn = () => {}; - let msg: string; + const num: number = undefined; + const ms: number = undefined; + const value: any = undefined; + const actual: any = undefined; + const expected: any = undefined; + const err: any = undefined; + const fn = () => {}; + const msg: string = undefined; - let exceptionExpected: RegExp | (() => void); + const exceptionExpected: RegExp | (() => void) = undefined; test.plan(num); test.end(); diff --git a/types/tape-async/tslint.json b/types/tape-async/tslint.json index f610afbb19..a541931a86 100644 --- a/types/tape-async/tslint.json +++ b/types/tape-async/tslint.json @@ -1,11 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "dt-header": false, "indent": [ true, "tabs" - ], - "prefer-const": false + ] } } From 9e9437f1392b5859c1cb5e81d442d6692f1c161d Mon Sep 17 00:00:00 2001 From: Hitomi Hatsukaze Date: Fri, 8 Mar 2019 08:02:27 +0900 Subject: [PATCH 216/265] Add Parser to marked types --- types/marked/index.d.ts | 9 +++++++++ types/marked/marked-tests.ts | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index 818620bb5e..595a51b7b1 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -114,6 +114,15 @@ declare namespace marked { br(): string; } + class Parser { + constructor(options?: MarkedOptions); + parse(src: TokensList): string; + next(): Token; + peek(): Token | number; + parseText(): string; + tok(): string + } + class Lexer { rules: Rules; tokens: TokensList; diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index 0abfb48efb..563f78faf7 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -51,3 +51,8 @@ renderer.heading = (text, level, raw, slugger) => { const textRenderer = new marked.TextRenderer(); console.log(textRenderer.strong(text)); + +const parseTestText = "- list1\n - list1.1\n\n listend"; +const parseTestTokens: marked.TokensList = marked.lexer(parseTestText, options); +const parser = new marked.Parser() +console.log(parser.parse(parseTestTokens)); From 5749616efe06d25c30fdeecfe7d5eb1900b37e53 Mon Sep 17 00:00:00 2001 From: Steve Calvert Date: Mon, 11 Feb 2019 10:44:25 -0800 Subject: [PATCH 217/265] [ember__runloop] Adding backburner types to -private subdirectory --- types/ember__runloop/-private/backburner.d.ts | 37 ++ types/ember__runloop/ember__runloop-tests.ts | 16 + types/ember__runloop/index.d.ts | 614 +++++++++--------- types/ember__runloop/tsconfig.json | 1 + 4 files changed, 362 insertions(+), 306 deletions(-) create mode 100644 types/ember__runloop/-private/backburner.d.ts diff --git a/types/ember__runloop/-private/backburner.d.ts b/types/ember__runloop/-private/backburner.d.ts new file mode 100644 index 0000000000..98e01b230b --- /dev/null +++ b/types/ember__runloop/-private/backburner.d.ts @@ -0,0 +1,37 @@ +export interface QueueItem { + method: string; + target: object; + args: object[]; + stack: string | undefined; +} + +export interface DeferredActionQueues { + [index: string]: any; + queues: object; + schedule( + queueName: string, + target: any, + method: any, + args: any, + onceFlag: boolean, + stack: any + ): any; + flush(fromAutorun: boolean): any; +} + +export interface DebugInfo { + autorun: Error | undefined | null; + counters: object; + timers: QueueItem[]; + instanceStack: DeferredActionQueues[]; +} + +export interface Backburner { + join(...args: any[]): void; + on(...args: any[]): void; + scheduleOnce(...args: any[]): void; + schedule(queueName: string, target: object | null, method: () => void | string): void; + ensureInstance(): void; + DEBUG: boolean; + getDebugInfo(): DebugInfo; +} diff --git a/types/ember__runloop/ember__runloop-tests.ts b/types/ember__runloop/ember__runloop-tests.ts index cf9cfd7db1..37d1fc18e4 100644 --- a/types/ember__runloop/ember__runloop-tests.ts +++ b/types/ember__runloop/ember__runloop-tests.ts @@ -1,9 +1,19 @@ import { run } from '@ember/runloop'; import EmberObject from '@ember/object'; +import { Backburner, DebugInfo, QueueItem, DeferredActionQueues } from '@ember/runloop/-private/backburner'; +run; // $ExpectType RunNamespace run.queues; // $ExpectType EmberRunQueues[] const queues: string[] = run.queues; +// It will be the responsibility of each consuming package that needs access to the backburner property +// to merge the private types in the public API. +declare module '@ember/runloop' { + interface RunNamespace { + backburner: Backburner; + } +} + function testRun() { run(() => { // $ExpectType number // code to be executed within a RunLoop @@ -198,3 +208,9 @@ function testThrottle() { run.throttle(runIt, 150); run.throttle(myContext, runIt, 150); } + +function testBackburner() { + const debugInfo: DebugInfo = run.backburner.getDebugInfo(); + const queueItems: QueueItem[] = debugInfo.timers; + const deferredActionQueues: DeferredActionQueues[] = debugInfo.instanceStack; +} diff --git a/types/ember__runloop/index.d.ts b/types/ember__runloop/index.d.ts index 79b3b5973b..9f1fd6c260 100644 --- a/types/ember__runloop/index.d.ts +++ b/types/ember__runloop/index.d.ts @@ -1,320 +1,322 @@ // Type definitions for non-npm package @ember/runloop 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Frunloop // Definitions by: Mike North +// Steve Calvert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { RunMethod, EmberRunQueues } from "@ember/runloop/-private/types"; import { EmberRunTimer } from "@ember/runloop/types"; +import '@ember/runloop/-private/backburner'; -// tslint:disable-next-line:strict-export-declare-modifiers -export const run: { - /** - * Runs the passed target and method inside of a RunLoop, ensuring any - * deferred actions including bindings and views updates are flushed at the - * end. - */ - (method: (...args: any[]) => Ret): Ret; - (target: Target, method: RunMethod): Ret; - /** - * If no run-loop is present, it creates a new one. If a run loop is - * present it will queue itself to run on the existing run-loops action - * queue. - */ - join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; - join( - target: Target, - method: RunMethod, - ...args: any[] - ): Ret | undefined; - /** - * Allows you to specify which context to call the specified function in while - * adding the execution of that function to the Ember run loop. This ability - * makes this method a great way to asynchronously integrate third-party libraries - * into your Ember application. - */ - bind( - target: Target, - method: RunMethod, - ...args: any[] - ): (...args: any[]) => Ret; - /** - * Begins a new RunLoop. Any deferred actions invoked after the begin will - * be buffered until you invoke a matching call to `run.end()`. This is - * a lower-level way to use a RunLoop instead of using `run()`. - */ - begin(): void; - /** - * Ends a RunLoop. This must be called sometime after you call - * `run.begin()` to flush any deferred actions. This is a lower-level way - * to use a RunLoop instead of using `run()`. - */ - end(): void; - /** - * Adds the passed target/method and any optional arguments to the named - * queue to be executed at the end of the RunLoop. If you have not already - * started a RunLoop when calling this method one will be started for you - * automatically. - */ - schedule( - queue: EmberRunQueues, - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - schedule( - queue: EmberRunQueues, - method: (args: any[]) => any, - ...args: any[] - ): EmberRunTimer; - /** - * Invokes the passed target/method and optional arguments after a specified - * period of time. The last parameter of this method must always be a number - * of milliseconds. - */ - later(method: (...args: any[]) => any, wait: number): EmberRunTimer; - later( - target: Target, - method: RunMethod, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - wait: number - ): EmberRunTimer; - /** - * Schedule a function to run one time during the current RunLoop. This is equivalent - * to calling `scheduleOnce` with the "actions" queue. - */ - once( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Schedules a function to run one time in a given queue of the current RunLoop. - * Calling this method with the same queue/target/method combination will have - * no effect (past the initial call). - */ - scheduleOnce( - queue: EmberRunQueues, - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Schedules an item to run from within a separate run loop, after - * control has been returned to the system. This is equivalent to calling - * `run.later` with a wait time of 1ms. - */ - next( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Cancels a scheduled item. Must be a value returned by `run.later()`, - * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or - * `run.throttle()`. - */ - cancel(timer: EmberRunTimer): boolean; - /** - * Delay calling the target method until the debounce period has elapsed - * with no additional debounce calls. If `debounce` is called again before - * the specified time has elapsed, the timer is reset and the entire period - * must pass again before the target method is called. - */ - debounce( - method: (...args: any[]) => any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - /** - * Ensure that the target method is never called more frequently than - * the specified spacing period. The target method is called immediately. - */ - throttle( - method: (...args: any[]) => any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; +export interface RunNamespace { + /** + * Runs the passed target and method inside of a RunLoop, ensuring any + * deferred actions including bindings and views updates are flushed at the + * end. + */ + (method: (...args: any[]) => Ret): Ret; + (target: Target, method: RunMethod): Ret; + /** + * If no run-loop is present, it creates a new one. If a run loop is + * present it will queue itself to run on the existing run-loops action + * queue. + */ + join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; + join( + target: Target, + method: RunMethod, + ...args: any[] + ): Ret | undefined; + /** + * Allows you to specify which context to call the specified function in while + * adding the execution of that function to the Ember run loop. This ability + * makes this method a great way to asynchronously integrate third-party libraries + * into your Ember application. + */ + bind( + target: Target, + method: RunMethod, + ...args: any[] + ): (...args: any[]) => Ret; + /** + * Begins a new RunLoop. Any deferred actions invoked after the begin will + * be buffered until you invoke a matching call to `run.end()`. This is + * a lower-level way to use a RunLoop instead of using `run()`. + */ + begin(): void; + /** + * Ends a RunLoop. This must be called sometime after you call + * `run.begin()` to flush any deferred actions. This is a lower-level way + * to use a RunLoop instead of using `run()`. + */ + end(): void; + /** + * Adds the passed target/method and any optional arguments to the named + * queue to be executed at the end of the RunLoop. If you have not already + * started a RunLoop when calling this method one will be started for you + * automatically. + */ + schedule( + queue: EmberRunQueues, + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + schedule( + queue: EmberRunQueues, + method: (args: any[]) => any, + ...args: any[] + ): EmberRunTimer; + /** + * Invokes the passed target/method and optional arguments after a specified + * period of time. The last parameter of this method must always be a number + * of milliseconds. + */ + later(method: (...args: any[]) => any, wait: number): EmberRunTimer; + later( + target: Target, + method: RunMethod, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + wait: number + ): EmberRunTimer; + /** + * Schedule a function to run one time during the current RunLoop. This is equivalent + * to calling `scheduleOnce` with the "actions" queue. + */ + once( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Schedules a function to run one time in a given queue of the current RunLoop. + * Calling this method with the same queue/target/method combination will have + * no effect (past the initial call). + */ + scheduleOnce( + queue: EmberRunQueues, + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Schedules an item to run from within a separate run loop, after + * control has been returned to the system. This is equivalent to calling + * `run.later` with a wait time of 1ms. + */ + next( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Cancels a scheduled item. Must be a value returned by `run.later()`, + * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or + * `run.throttle()`. + */ + cancel(timer: EmberRunTimer): boolean; + /** + * Delay calling the target method until the debounce period has elapsed + * with no additional debounce calls. If `debounce` is called again before + * the specified time has elapsed, the timer is reset and the entire period + * must pass again before the target method is called. + */ + debounce( + method: (...args: any[]) => any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + /** + * Ensure that the target method is never called more frequently than + * the specified spacing period. The target method is called immediately. + */ + throttle( + method: (...args: any[]) => any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; - queues: EmberRunQueues[]; -}; + queues: EmberRunQueues[]; +} +export const run: RunNamespace; export const begin: typeof run.begin; export const bind: typeof run.bind; export const cancel: typeof run.cancel; diff --git a/types/ember__runloop/tsconfig.json b/types/ember__runloop/tsconfig.json index d06cb5216c..158a3d6459 100644 --- a/types/ember__runloop/tsconfig.json +++ b/types/ember__runloop/tsconfig.json @@ -28,6 +28,7 @@ "index.d.ts", "types.d.ts", "-private/types.d.ts", + "-private/backburner.d.ts", "ember__runloop-tests.ts" ] } From d1a0a77ca6c3c3033fdc4ee442c1aa872155d845 Mon Sep 17 00:00:00 2001 From: Steve Calvert Date: Thu, 21 Feb 2019 16:09:28 -0800 Subject: [PATCH 218/265] Update index.d.ts --- types/ember__runloop/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ember__runloop/index.d.ts b/types/ember__runloop/index.d.ts index 9f1fd6c260..e8d7905c8f 100644 --- a/types/ember__runloop/index.d.ts +++ b/types/ember__runloop/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for non-npm package @ember/runloop 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Frunloop // Definitions by: Mike North -// Steve Calvert +// Steve Calvert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From abfbff801feb1bf7b1769e2de518da9e6fb2a85e Mon Sep 17 00:00:00 2001 From: Mike North Date: Fri, 1 Mar 2019 11:42:23 -0800 Subject: [PATCH 219/265] [ember] remove dependency on handlebars types --- types/ember-data/tsconfig.json | 1 + types/ember-feature-flags/tsconfig.json | 1 + types/ember-mocha/tsconfig.json | 1 + types/ember-modal-dialog/tsconfig.json | 1 + types/ember-qunit/tsconfig.json | 1 + types/ember-resolver/tsconfig.json | 1 + types/ember-test-helpers/tsconfig.json | 1 + types/ember/index.d.ts | 7 +++++-- types/ember/test/ember-tests.ts | 4 ++-- types/ember/test/string.ts | 2 +- types/ember/tsconfig.json | 1 + types/ember__string/-private/handlebars.d.ts | 5 +++++ types/ember__string/ember__string-tests.ts | 4 ++-- types/ember__string/index.d.ts | 2 +- types/ember__string/tsconfig.json | 4 +++- types/ember__test-helpers/tsconfig.json | 1 + types/ember__test/tsconfig.json | 1 + 17 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 types/ember__string/-private/handlebars.d.ts diff --git a/types/ember-data/tsconfig.json b/types/ember-data/tsconfig.json index f476362aaf..aadbbe7f5f 100644 --- a/types/ember-data/tsconfig.json +++ b/types/ember-data/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-feature-flags/tsconfig.json b/types/ember-feature-flags/tsconfig.json index 957a7a00f8..dc3260af3a 100644 --- a/types/ember-feature-flags/tsconfig.json +++ b/types/ember-feature-flags/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-mocha/tsconfig.json b/types/ember-mocha/tsconfig.json index 4e9b406e2e..c6c6a09f65 100644 --- a/types/ember-mocha/tsconfig.json +++ b/types/ember-mocha/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-modal-dialog/tsconfig.json b/types/ember-modal-dialog/tsconfig.json index 0b0b6f91fb..8fc7a37808 100644 --- a/types/ember-modal-dialog/tsconfig.json +++ b/types/ember-modal-dialog/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-qunit/tsconfig.json b/types/ember-qunit/tsconfig.json index df4899b37c..92a555a59f 100644 --- a/types/ember-qunit/tsconfig.json +++ b/types/ember-qunit/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-resolver/tsconfig.json b/types/ember-resolver/tsconfig.json index bc476c5723..7263220f71 100644 --- a/types/ember-resolver/tsconfig.json +++ b/types/ember-resolver/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-test-helpers/tsconfig.json b/types/ember-test-helpers/tsconfig.json index 2e0ddf49b1..ca139535f3 100644 --- a/types/ember-test-helpers/tsconfig.json +++ b/types/ember-test-helpers/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index fbe058a643..d0f9896eb9 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -38,15 +38,17 @@ import { ComputedPropertyCallback, ObserverMethod } from '@ember/object/-private/types'; -import * as HandlebarsNamespace from 'handlebars'; + // Capitalization is intentional: this makes it much easier to re-export RSVP on // the Ember namespace. import Rsvp from 'rsvp'; + import { TemplateFactory } from 'htmlbars-inline-precompile'; import { Registry as ServiceRegistry } from '@ember/service'; import { Registry as ControllerRegistry } from '@ember/controller'; import * as EmberStringNs from '@ember/string'; +import * as EmberStringHandlebarsNs from '@ember/string/-private/handlebars'; // tslint:disable-next-line:no-duplicate-imports import * as EmberServiceNs from '@ember/service'; import * as EmberPolyfillsNs from '@ember/polyfills'; @@ -424,11 +426,12 @@ export namespace Ember { function K(): any; function createFrame(objec: any): any; function Exception(message: string): void; - const SafeString: typeof HandlebarsNamespace.SafeString; + class SafeString extends EmberStringHandlebarsNs.SafeString {} function parse(string: string): any; function print(ast: any): void; const logger: typeof Logger; function log(level: string, str: string): void; + function registerHelper(name: string, helper: any): void; } namespace String { const camelize: typeof EmberStringNs.camelize; diff --git a/types/ember/test/ember-tests.ts b/types/ember/test/ember-tests.ts index 01aaab7452..eb317c3ab1 100755 --- a/types/ember/test/ember-tests.ts +++ b/types/ember/test/ember-tests.ts @@ -92,10 +92,10 @@ App.userController = Ember.Object.create({ }), }); -Handlebars.registerHelper( +Ember.Handlebars.registerHelper( 'highlight', (property: string, options: any) => - new Handlebars.SafeString('' + 'some value' + '') + new Ember.Handlebars.SafeString('' + 'some value' + '') ); const coolView = App.CoolView.create(); diff --git a/types/ember/test/string.ts b/types/ember/test/string.ts index 4363b375f3..d812a52dd5 100644 --- a/types/ember/test/string.ts +++ b/types/ember/test/string.ts @@ -1,5 +1,5 @@ import Ember from 'ember'; -import { SafeString } from 'handlebars'; +import { SafeString } from '@ember/string/-private/handlebars'; const { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } = Ember.String; diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index be47225e72..6e494f5a03 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -36,6 +36,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember__string/-private/handlebars.d.ts b/types/ember__string/-private/handlebars.d.ts new file mode 100644 index 0000000000..8d8dce118c --- /dev/null +++ b/types/ember__string/-private/handlebars.d.ts @@ -0,0 +1,5 @@ +export class SafeString { + constructor(str: string); + toString(): string; + toHTML(): string; +} diff --git a/types/ember__string/ember__string-tests.ts b/types/ember__string/ember__string-tests.ts index 500c67546e..c6474cd266 100644 --- a/types/ember__string/ember__string-tests.ts +++ b/types/ember__string/ember__string-tests.ts @@ -1,5 +1,5 @@ import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string'; -import { SafeString } from 'handlebars'; +import { SafeString } from '@ember/string/-private/handlebars'; dasherize(); // $ExpectError dasherize('blue man group'); // $ExpectType string @@ -37,7 +37,7 @@ const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...'); htmlSafe('lorem ipsum...'); // $ExpectType SafeString const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError -function isSafeTest(a: string|Handlebars.SafeString) { +function isSafeTest(a: string | SafeString) { if (isHTMLSafe(a)) { a = a.toString(); } diff --git a/types/ember__string/index.d.ts b/types/ember__string/index.d.ts index c25da1f823..2a65c9b5df 100644 --- a/types/ember__string/index.d.ts +++ b/types/ember__string/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import { SafeString } from 'handlebars'; +import { SafeString } from "./-private/handlebars"; export function camelize(str: string): string; export function capitalize(str: string): string; diff --git a/types/ember__string/tsconfig.json b/types/ember__string/tsconfig.json index 100fad10f5..a5a7ecc944 100644 --- a/types/ember__string/tsconfig.json +++ b/types/ember__string/tsconfig.json @@ -15,13 +15,15 @@ "../" ], "paths": { - "@ember/string": ["ember__string"] + "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"] }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ + "-private/handlebars.d.ts", "index.d.ts", "ember__string-tests.ts" ] diff --git a/types/ember__test-helpers/tsconfig.json b/types/ember__test-helpers/tsconfig.json index 7b167f14d5..35638865d8 100644 --- a/types/ember__test-helpers/tsconfig.json +++ b/types/ember__test-helpers/tsconfig.json @@ -38,6 +38,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember__test/tsconfig.json b/types/ember__test/tsconfig.json index da00f05337..bb95710392 100644 --- a/types/ember__test/tsconfig.json +++ b/types/ember__test/tsconfig.json @@ -36,6 +36,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], From 18b5c68588aa8b20e1f5eeedaaa8a2fb2278b9b6 Mon Sep 17 00:00:00 2001 From: Mike North Date: Fri, 1 Mar 2019 09:17:38 -0800 Subject: [PATCH 220/265] remove trailing whitespace from @ember/runloop header --- types/ember__runloop/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ember__runloop/index.d.ts b/types/ember__runloop/index.d.ts index e8d7905c8f..9f1fd6c260 100644 --- a/types/ember__runloop/index.d.ts +++ b/types/ember__runloop/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for non-npm package @ember/runloop 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Frunloop // Definitions by: Mike North -// Steve Calvert +// Steve Calvert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From 0a0d3df286534cff491eaa570192744f6b59cb7f Mon Sep 17 00:00:00 2001 From: Hitomi Hatsukaze Date: Fri, 8 Mar 2019 08:23:15 +0900 Subject: [PATCH 221/265] missing semi --- types/marked/index.d.ts | 2 +- types/marked/marked-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index 595a51b7b1..74dfec5317 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -120,7 +120,7 @@ declare namespace marked { next(): Token; peek(): Token | number; parseText(): string; - tok(): string + tok(): string; } class Lexer { diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index 563f78faf7..2af775e397 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -54,5 +54,5 @@ console.log(textRenderer.strong(text)); const parseTestText = "- list1\n - list1.1\n\n listend"; const parseTestTokens: marked.TokensList = marked.lexer(parseTestText, options); -const parser = new marked.Parser() +const parser = new marked.Parser(); console.log(parser.parse(parseTestTokens)); From b8edb8089d64ec0342bcba907c24dd8af106a512 Mon Sep 17 00:00:00 2001 From: Martin Treurnicht Date: Thu, 7 Mar 2019 15:05:20 -0800 Subject: [PATCH 222/265] Add expo-mixpanel-analytics type definitions --- .../expo-mixpanel-analytics-tests.ts | 31 +++++++++++++++++++ types/expo-mixpanel-analytics/index.d.ts | 26 ++++++++++++++++ types/expo-mixpanel-analytics/tsconfig.json | 23 ++++++++++++++ types/expo-mixpanel-analytics/tslint.json | 1 + 4 files changed, 81 insertions(+) create mode 100644 types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts create mode 100644 types/expo-mixpanel-analytics/index.d.ts create mode 100644 types/expo-mixpanel-analytics/tsconfig.json create mode 100644 types/expo-mixpanel-analytics/tslint.json diff --git a/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts new file mode 100644 index 0000000000..50dc0dffe4 --- /dev/null +++ b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts @@ -0,0 +1,31 @@ +import ExpoMixpanelAnalytics from 'expo-mixpanel-analytics'; + +const analytics = new ExpoMixpanelAnalytics('5224da5bbbed3fdeaad0911820f1bf2x'); + +analytics.identify("13793"); + +analytics.track("Signed Up", { "Referred By": "Friend" }); + +analytics.people_set({ + $first_name: "Joe", + $last_name: "Doe", + $email: "joe.doe@example.com", + $created: "2013-04-01T13:20:00", + $phone: "4805551212", + Address: "1313 Mockingbird Lane", + Birthday: "1948-01-01" +}); + +analytics.people_set_once({ "First login date": "2013-04-01T13:20:00" }); + +analytics.people_unset([ "Days Overdue" ]); + +analytics.people_increment({ "Coins Gathered": 12 }); + +analytics.people_append({ "Power Ups": "Bubble Lead" }); + +analytics.people_union({ "Items purchased": ["socks", "shirts"] }); + +analytics.people_delete_user(); + +analytics.reset(); diff --git a/types/expo-mixpanel-analytics/index.d.ts b/types/expo-mixpanel-analytics/index.d.ts new file mode 100644 index 0000000000..6b51a15585 --- /dev/null +++ b/types/expo-mixpanel-analytics/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for expo-mixpanel-analytics 0.0 +// Project: https://github.com/codekadiya/expo-mixpanel-analytics +// Definitions by: Martin Treurnicht +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare class ExpoMixpanelAnalytics { + constructor(token: string); + identify(userId: string): void; + track(name: string, props: Props): void; + people_set(props: Props): void; + people_set_once(props: Props): void; + people_unset(keys: string[]): void; + people_increment(props: Props): void; + people_append(props: Props): void; + people_union(props: Props): void; + people_delete_user(): void; + reset(): void; + token: string; +} + +interface Props { + [key: string]: T; +} + +export default ExpoMixpanelAnalytics; diff --git a/types/expo-mixpanel-analytics/tsconfig.json b/types/expo-mixpanel-analytics/tsconfig.json new file mode 100644 index 0000000000..57ee3b6a41 --- /dev/null +++ b/types/expo-mixpanel-analytics/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "expo-mixpanel-analytics-tests.ts" + ] +} diff --git a/types/expo-mixpanel-analytics/tslint.json b/types/expo-mixpanel-analytics/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/expo-mixpanel-analytics/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f39722faf8764a95f0ff8b5cc180017f6faa9f4c Mon Sep 17 00:00:00 2001 From: a631807682 <631807682@qq.com> Date: Fri, 8 Mar 2019 10:26:59 +0800 Subject: [PATCH 223/265] feat(types/) Add type definitions for koa-log4 Add type definitions for koa-log4 --- types/koa-log4/index.d.ts | 17 +++++++++++++++++ types/koa-log4/koa-log4-tests.ts | 18 ++++++++++++++++++ types/koa-log4/package.json | 6 ++++++ types/koa-log4/tsconfig.json | 23 +++++++++++++++++++++++ types/koa-log4/tslint.json | 1 + 5 files changed, 65 insertions(+) create mode 100644 types/koa-log4/index.d.ts create mode 100644 types/koa-log4/koa-log4-tests.ts create mode 100644 types/koa-log4/package.json create mode 100644 types/koa-log4/tsconfig.json create mode 100644 types/koa-log4/tslint.json diff --git a/types/koa-log4/index.d.ts b/types/koa-log4/index.d.ts new file mode 100644 index 0000000000..e47cfc4e07 --- /dev/null +++ b/types/koa-log4/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for koa-log4 2.3 +// Project: https://github.com/dominhhai/koa-log4js#readme +// Definitions by: Cr. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import * as Koa from 'koa'; +import * as Log4js from 'log4js'; + +export function koaLogger(logger4js: Log4js.Logger, optionsOrFormat?: Options | string): Koa.Middleware; + +export interface Options { + format?: string; + level?: Log4js.Level; +} + +export * from 'log4js'; diff --git a/types/koa-log4/koa-log4-tests.ts b/types/koa-log4/koa-log4-tests.ts new file mode 100644 index 0000000000..cb8d377eb8 --- /dev/null +++ b/types/koa-log4/koa-log4-tests.ts @@ -0,0 +1,18 @@ +import Koa = require('koa'); +import KoaLog4 = require('koa-log4'); + +const DEFAULT_FORMAT = ':remote-addr - -' + + ' ":method :url HTTP/:http-version"' + + ' :status :content-length ":referrer"' + + ' ":user-agent"'; + +const DEFAULT_OPTIONS: KoaLog4.Options = { + format: DEFAULT_FORMAT, + level: KoaLog4.levels.INFO +}; + +const koaLog4Mid = KoaLog4.koaLogger(KoaLog4.getLogger(), DEFAULT_OPTIONS); + +const app = new Koa(); +app.use(koaLog4Mid); +app.listen(80); diff --git a/types/koa-log4/package.json b/types/koa-log4/package.json new file mode 100644 index 0000000000..5c070feace --- /dev/null +++ b/types/koa-log4/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "log4js": "^3.0.0" + } +} \ No newline at end of file diff --git a/types/koa-log4/tsconfig.json b/types/koa-log4/tsconfig.json new file mode 100644 index 0000000000..71abbe0755 --- /dev/null +++ b/types/koa-log4/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes":false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-log4-tests.ts" + ] +} diff --git a/types/koa-log4/tslint.json b/types/koa-log4/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/koa-log4/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a716830bc976036f403c6a8466e966236c46b54b Mon Sep 17 00:00:00 2001 From: Adam Vernon Date: Mon, 4 Mar 2019 22:16:07 -0800 Subject: [PATCH 224/265] Add type definitions for seen-js Update seen tsconfig and tests to use strict null checks --- types/seen/index.d.ts | 795 +++++++++++++++++++++++++++++++++++++++ types/seen/seen-tests.ts | 61 +++ types/seen/tsconfig.json | 24 ++ types/seen/tslint.json | 1 + 4 files changed, 881 insertions(+) create mode 100644 types/seen/index.d.ts create mode 100644 types/seen/seen-tests.ts create mode 100644 types/seen/tsconfig.json create mode 100644 types/seen/tslint.json diff --git a/types/seen/index.d.ts b/types/seen/index.d.ts new file mode 100644 index 0000000000..7e2e90b51f --- /dev/null +++ b/types/seen/index.d.ts @@ -0,0 +1,795 @@ +// Type definitions for seen 0.2 +// Project: https://github.com/themadcreator/seen +// Definitions by: Adam Vernon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.1 + +/** + * The animator class is useful for creating an animation loop. We supply pre and post events for apply animation changes between frames. + */ +export class Animator { + dispatch: Events.Dispatcher; + timestamp: number; + frameDelay: number | null; + constructor(); + animateFrame(): this; + frame(t?: boolean): this; + onAfter(handler: FrameHandler): this; + onBefore(handler: FrameHandler): this; + onFrame(handler: FrameHandler): this; + start(): this; + stop(): this; +} + +export interface FrameHandler { + (timestamp: number, deltaTimestamp: number): void; +} + +/** + * The Bounds object contains an axis-aligned bounding box. + */ +export class Bounds { + constructor(); + add(p: Point): this; + center(): Point; + contains(p: Point): boolean; + copy(): this; + depth(): number; + height(): number; + intersect(box: Bounds): this; + maxX(): number; + maxY(): number; + maxZ(): number; + minX(): number; + minY(): number; + minZ(): number; + pad(x: number, y: number, z: number): this; + reset(): this; + valid(): boolean; + width(): number; + static points(points: Point[]): Bounds; + static xywh(x: number, y: number, w: number, h: number): Bounds; + static xyzwhd(x: number, y: number, z: number, w: number, h: number, d: number): Bounds; +} + +/** + * The Camera model contains all three major components of the 3D to 2D tranformation. + * + * First, we transform object from world-space (the same space that the coordinates of surface points are in after all their transforms are applied) to camera space. Typically, this will place all + * viewable objects into a cube with coordinates: x = -1 to 1, y = -1 to 1, z = 1 to 2 + * + * Second, we apply the projection trasform to create perspective parallax and what not. + * + * Finally, we rescale to the viewport size. + * + * These three steps allow us to easily create shapes whose coordinates match up to screen coordinates in the z = 0 plane. + */ +export class Camera extends Transformable { + projection: Matrix; + defaults: { projection: Matrix }; + constructor(transform?: Matrix); +} + +export class CanvasCirclePainter extends CanvasStyler { + circle(center: { x: number, y: number }, radius: number): CanvasCirclePainter; +} + +export class CanvasLayerRenderContext extends RenderLayerContext { + constructor(ctx: CanvasRenderingContext2D); + circle(): CanvasCirclePainter; + path(): CanvasPathPainter; + rect(): CanvasRectPainter; + text(): CanvasTextPainter; +} + +export class CanvasPathPainter extends CanvasStyler { + path(points: Point[]): this; +} + +export class CanvasRectPainter extends CanvasStyler { + rect(width: number, height: number): this; +} + +export class CanvasRenderContext extends RenderContext { + el: HTMLCanvasElement; + ctx: CanvasRenderingContext2D; + constructor(elementOrId: string | HTMLElement); + layer(layer: RenderLayerContext): this; + reset(): void; +} + +export class CanvasStyler { + constructor(ctx: CanvasRenderingContext2D); + draw(style?: { stroke?: string, 'stroke-width'?: number, 'text-anchor'?: string }): this; + fill(style?: { fill?: string, 'fill-opacity'?: number, 'text-anchor'?: string }): this; +} + +export class CanvasTextPainter { + constructor(ctx: CanvasRenderingContext2D); + fillText(m: Matrix, text: string, style?: { font: string, fill?: string, 'text-anchor'?: string }): this; +} + +/** + * Color objects store RGB and Alpha values from 0 to 255. + */ +export class Color { + r: number; + g: number; + b: number; + a: number; + constructor(r?: number, g?: number, b?: number, a?: number); + addChannels(c: Color): this; + clamp(min?: number, max?: number): this; + copy(): this; + hex(): string; + minChannels(c: Color): this; + multiplyChannels(c: Color): this; + offset(n: number): this; + scale(n: number): this; + style(): string; +} + +/** + * Adds simple mouse drag eventing to a DOM element. A ‘drag’ event is emitted as the user is dragging their mouse. This is the easiest way to add mouse- look or mouse-rotate to a scene. + */ +export class Drag { + el: HTMLElement; + inertia: boolean; + dispatch: Events.Dispatcher; + defaults: { inertia: boolean }; + constructor(elementOrId: string | HTMLElement, options?: { inertia?: boolean }); + on(type: string, listener: (e: { offset: number[], offsetRelative: number[] }) => void): Events.Dispatcher; +} + +export class FillLayer extends RenderLayer { + constructor(width: number, height: number, fill: string); + render(context: RenderLayerContext): void; +} + +export class Grad { + x: number; + y: number; + z: number; + constructor(x: number, y: number, z: number); + dot(x: number, y: number, z: number): number; +} + +/** + * A class for computing mouse interia for interial scrolling + */ +export class InertialMouse { + xy: number[]; + constructor(); + damp(): this; + get(): [number, number]; + reset(): this; + update(xy: [number, number]): this; + static inertiaExtinction: number; + static inertiaMsecDelay: number; + static smoothingTimeout: number; +} + +export interface LightOptions { + point?: Point; + color?: Color; + intensity?: number; + normal?: Point; + enabled?: boolean; +} + +/** + * This model object holds the attributes and transformation of a light source. + */ +export class Light extends Transformable { + type: string; + point: Point; + color: Color; + intensity: number; + normal: Point; + enabled: boolean; + id: string; + defaults: LightOptions; + constructor(type: 'point' | 'directional' | 'ambient', options?: LightOptions); + render(): void; +} + +/** + * The LightRenderModel stores pre-computed values necessary for shading surfaces with the supplied Light. + */ +export class LightRenderModel { + colorIntensity: Color; + type: string; + intensity: number; + point: Point; + origin: Point; + normal: Point; + constructor(light: Light, transform: Matrix); +} + +export interface MaterialOptions { + color?: Color; + metallic?: boolean; + specularColor?: Color; + specularExponent?: number; + shader?: Shader; +} + +/** + * Material objects hold the attributes that desribe the color and finish of a surface. + */ +export class Material { + color: Color; + metallic: boolean; + specularColor: Color; + specularExponent: number; + shader: Shader; + defaults: MaterialOptions; + constructor(color?: Color, options?: MaterialOptions); + render(lights?: Light[], shader?: Shader, renderData?: RenderModel): Color; + static create(value?: Material | Color | string): Material; +} + +/** + * The Matrix class stores transformations in the scene. These include: (1) Camera Projection and Viewport transformations. (2) Transformations of any Transformable type object, such as Shapes or + * Models + * + * Most of the methods on Matrix are destructive, so be sure to use .copy() when you want to preserve an object’s value. + */ +export class Matrix { + m: number[]; + baked: number[]; + constructor(m?: number[]); + bake(m?: number[]): this; + copy(): this; + matrix(m: number[]): this; + multiply(b: Matrix): this; + reset(): this; + rotx(theta: number): this; + roty(theta: number): this; + rotz(theta: number): this; + scale(x?: number, y?: number, z?: number): this; + translate(x?: number, y?: number, z?: number): this; + transpose(): this; +} + +export class Mocap { + bvh: any; + constructor(bvh?: any); + createMocapModel(shapeFactory?: () => Shape): MocapModel; + static DEFAULT_SHAPE_FACTORY(joint?: any, endpoint?: Point): Shape; + static parse(source: string): Mocap; +} + +export class MocapAnimator extends Animator { + constructor(mocap: MocapModel); + renderFrame(): void; +} + +export class MocapModel { + constructor(model: Model, frames: any[], frameDelay?: number); + applyFrameTransforms(frameIndex: number): number; +} + +/** + * The object model class. It stores Shapes, Lights, and other Models as well as a transformation matrix. + * + * Notably, models are hierarchical, like a tree. This means you can isolate the transformation of groups of shapes in the scene, as well as create chains of transformations for creating, for + * example, articulated skeletons. + */ +export class Model extends Transformable { + constructor(); + add(...args: Array): this; + append(): this; + eachRenderable(lightFn: (light: Light, matrix?: Matrix) => Model, shapeFn: (item: Shape | Model, lightModels?: Model[], matrix?: Matrix) => any): void; + eachShape(f: (shape: Shape) => any): void; + remove(...args: Array): void; +} + +export interface MouseEventOptions { + dragStart?: EventListener; + drag?: EventListener; + dragEnd?: EventListener; + mouseMove?: EventListener; + mouseDown?: EventListener; + mouseUp?: EventListener; + mouseWheel?: EventListener; +} + +/** + * An event dispatcher for mouse and drag events on a single dom element. The available events are 'dragStart', 'drag', 'dragEnd', 'mouseMove', 'mouseDown', 'mouseUp', 'mouseWheel' + */ +export class MouseEvents { + el: HTMLElement; + dispatch: Events.Dispatcher; + constructor(elementOrId: string | HTMLElement, options?: MouseEventOptions); + attach(): void; + detach(): void; +} + +/** + * Parser for Wavefront .obj files + * + * Note: Wavefront .obj array indicies are 1-based. + */ +export class ObjParser { + vertices: number[][]; + faces: number[][]; + commands: { v: (v: any) => any, f: (f: any) => any }; + constructor(); + mapFacePoints(faceMap: (points: Point[]) => any): void; + parse(contents: string): void; +} + +/** + * Each Painter overrides the paint method. It uses the supplied RenderLayerContext‘s builders to create and style the geometry on screen. + */ +export class Painter { + constructor(); + paint(renderModel: RenderModel, context: RenderLayerContext): void; +} + +export class PathPainter extends Painter { } + +/** + * The Point object contains x,y,z, and w coordinates. Points support various arithmetic operations with other Points, scalars, or Matrices. + * + * Most of the methods on Point are destructive, so be sure to use .copy() when you want to preserve an object’s value. + */ +export class Point { + x: number; + y: number; + z: number; + w: number; + constructor(x?: number, y?: number, z?: number, w?: number); + add(q: Point): this; + copy(): this; + cross(q: Point): this; + divide(n: number): this; + dot(q: Point): number; + magnitude(): number; + magnitudeSquared(): number; + multiply(n: number): this; + normalize(): this; + perpendicular(): this; + round(): this; + set(p: Point): this; + subtract(q: Point): this; + transform(matrix: Matrix): this; + translate(x: number, y: number, z: number): this; +} + +/** + * A Quaterionion class for computing quaterion multiplications. This creates more natural mouse rotations. + */ +export class Quaternion { + q: Point; + constructor(); + multiply(q: Point): this; + toMatrix(): Matrix; + static axisAngle(x: number, y: number, z: number, angleRads: number): Quaternion; + static pixelsPerRadian: number; + static pointAngle(p: Point, angleRads: number): Quaternion; + static xyToTransform(x: number, y: number): Matrix; +} + +export class RenderAnimator extends Animator { } + +/** + * The RenderContext uses RenderModels produced by the scene’s render method to paint the shapes into an HTML element. Since we support both SVG and Canvas painters, the RenderContext and + * RenderLayerContext define a common interface. + */ +export class RenderContext { + layers: RenderLayerContext[]; + constructor(); + animate(): RenderAnimator; + cleanup(): void; + layer(layer: RenderLayerContext): this; + render(): this; + reset(): void; + sceneLayer(scene: Scene): this; +} + +export class RenderLayer { + constructor(); + render(context: RenderLayerContext): void; +} + +/** + * The RenderLayerContext defines the interface for producing painters that can paint various things into the current layer. + */ +export class RenderLayerContext { + constructor(); + circle(): any; + cleanup(): void; + path(): any; + rect(): any; + reset(): void; + text(): any; +} + +/** + * The RenderModel object contains the transformed and projected points as well as various data needed to shade and paint a Surface. + * + * Once initialized, the object will have a constant memory footprint down to Number primitives. Also, we compare each transform and projection to prevent unnecessary re-computation. + * + * If you need to force a re-computation, mark the surface as ‘dirty’. + */ +export class RenderModel { + constructor(surface: Surface, transform: Matrix, projection: Matrix, viewport: Matrix); + update(transform: Matrix, projection: Matrix, viewport: Matrix): void; +} + +/** + * A Scene is the main object for a view of a scene. + */ +export class Scene { + constructor(options?: SceneOptions); + defaults(): SceneOptions; + flushCache(): void; + render(): Transformable[]; +} + +export interface SceneOptions { + model?: Model; + camera?: Camera; + viewport?: Viewport; + shader?: Shader; + cullBackfaces?: boolean; + fractionalPoints?: boolean; + cache?: boolean; +} + +export class SceneLayer extends RenderLayer { + model: Model; + camera: Camera; + viewport: Viewport; + shader: Shader; + cullBackfaces: boolean; + fractionalPoints: boolean; + cache: boolean; + constructor(scene: Scene); + render(context: RenderLayerContext): void; +} + +/** + * The Shader class is the base class for all shader objects. + */ +export class Shader { + constructor(); + shade(lights: Light[], renderModel: RenderModel, material: Material): void; +} + +/** + * The Phong shader implements the Phong shading model with a diffuse, specular, and ambient term. + * + * See https://en.wikipedia.org/wiki/Phong_reflection_model for more information + */ +export class Phong extends Shader { } + +/** + * The DiffusePhong shader implements the Phong shading model with a diffuse and ambient term (no specular). + */ +export class DiffusePhong extends Shader { } + +/** + * The Ambient shader colors surfaces from ambient light only. + */ +export class Ambient extends Shader { } + +/** + * The Flat shader colors surfaces with the material color, disregarding all light sources. + */ +export class Flat extends Shader { } + +/** + * A Shape contains a collection of surface. They may create a closed 3D shape, but not necessarily. For example, a cube is a closed shape, but a patch is not. + */ +export class Shape extends Transformable { + type: string; + surfaces: Surface[]; + constructor(type: string, surfaces: Surface[]); + eachSurface(f: (s: Surface) => void): this; + fill(fill: string | Color): this; + stroke(stroke: string | Color): this; +} + +export class Simplex3D { + perm: number[]; + gradP: Grad[]; + constructor(seed?: number); + noise(x: number, y: number, z: number): number; + seed(seed: number): void; +} + +/** + * A Surface is a defined as a planar object in 3D space. These paths don’t necessarily need to be convex, but they should be non-degenerate. This library does not support shapes with holes. + */ +export class Surface { + points: Point[]; + painter: Painter; + id: string; + cullBackfaces: boolean; + dirty: boolean | null; + fillMaterial: Material; + strokeMaterial: Material; + constructor(points: Point[], painter?: Painter); + fill(fill: string | Color): this; + stroke(stroke: string | Color): this; +} + +export class SvgCirclePainter extends SvgStyler { + circle(center: Point, radius: number): this; +} + +export class SvgLayerRenderContext extends RenderLayerContext { + constructor(group: SVGGElement); + circle(): SvgCirclePainter; + path(): SvgPathPainter; + rect(): SvgRectPainter; + text(): SvgTextPainter; +} + +export class SvgPathPainter extends SvgStyler { + path(points: Point[]): this; +} + +export class SvgRectPainter extends SvgStyler { + rect(width: number, height: number): this; +} + +export class SvgRenderContext extends RenderContext { + svg: SVGSVGElement; + layers: SvgLayerRenderContext[]; + constructor(svgElementOrId: string | HTMLElement); +} + +export class SvgStyler { + constructor(elementFactory: (name: string) => HTMLElement); + clear(): this; + draw(style?: Partial): this; + fill(style?: Partial): this; +} + +export class SvgTextPainter { + constructor(elementFactory: (name: string) => HTMLElement); + fillText(m: number[], text: string, style?: Partial): void; +} + +export class TextPainter extends Painter { } + +/** + * Transformable base class extended by Shape and Model. + * + * The advantages of keeping transforms in Matrix form are (1) lazy computation of point position (2) ability combine hierarchical transformations easily (3) ability to reset transformations to an + * original state. + * + * Resetting transformations is especially useful when you want to animate interpolated values. Instead of computing the difference at each animation step, you can compute the global interpolated + * value for that time step and apply that value directly to a matrix (once it is reset). + */ +export class Transformable { + baked: number[]; + m: Matrix; + constructor(); + transform(m: Matrix): this; + bake(m?: number[]): this; + matrix(m: number[]): this; + reset(): this; + rotx(theta: number): this; + roty(theta: number): this; + rotz(theta: number): this; + scale(x?: number, y?: number, z?: number): this; + translate(x?: number, y?: number, z?: number): this; +} + +/** + * A transition object to manage to animation of shapes + */ +export class Transition { + duration: number; + defaults: { duration: number }; + constructor(options?: { duration?: number }); + firstFrame(): void; + frame(): void; + lastFrame(): void; + update(t?: number): boolean; +} + +/** + * A seen.Animator for updating seen.Transtions. We include keyframing to make sure we wait for one transition to finish before starting the next one. + */ +export class TransitionAnimator extends Animator { + dispatch: Events.Dispatcher; + timestamp: number; + frameDelay: number | null; + queue: Transition[][]; + transitions: Transition[]; + add(txn: Transition): void; + keyframe(): void; + update(t?: number): void; +} + +/** + * Adds simple mouse wheel eventing to a DOM element. A ‘zoom’ event is emitted as the user is scrolls their mouse wheel. + */ +export class Zoom { + el: HTMLElement; + speed: number; + dispatch: Events.Dispatcher; + defaults: { smooth: boolean }; + constructor(elementOrId: string | HTMLElement, options?: { smooth?: boolean }); +} + +export const Painters: { + path: PathPainter, + text: TextPainter +}; +export function C(r?: number, g?: number, b?: number, a?: number): Color; +export function CanvasContext(elementOrId: string | HTMLElement, scene?: Scene): CanvasRenderContext; + +/** + * Create a render context for the element with the specified elementId. elementId should correspond to either an SVG or Canvas element. + */ +export function Context(elementOrId: string | HTMLElement, scene?: Scene): RenderContext; + +export function M(m?: number[]): Matrix; + +export function P(x?: number, y?: number, z?: number, w?: number): Point; + +export function SvgContext(elementOrId: string | HTMLElement, scene?: Scene): SvgRenderContext; + +/** + * It is not possible exactly render text in a scene with a perspective projection because Canvas and SVG support only affine transformations. So, in order to fake it, we create an affine transform + * that approximates the linear effects of a perspective projection on an unrendered planar surface that represents the text’s shape. We can use this transform directly in the text painter to warp + * the text. + * + * This fake projection will produce unrealistic results with large strings of text that are not broken into their own shapes. + */ +export const Affine: { + INITIAL_STATE_MATRIX: number[][], + ORTHONORMAL_BASIS(): Point[], + solveForAffineTransform(points: Point[]): number[] +}; + +export const BvhParser: { + SyntaxError(message: string, expected: string, found: string, location: any): void, + parse(input: string): any +}; + +export const Colors: { + CSS_RGBA_STRING_REGEX: RegExp, + black(): Color, + gray(): Color, + hex(hex: string): Color, + hsl(h: number, s: number, l: number, a?: number): Color, + parse(str: string): Color, + randomShape(shape: Shape, sat?: number, lit?: number): void, + randomSurfaces(shape: Shape, sat?: number, lit?: number): void, + randomSurfaces2(shape: Shape, drift?: number, sat?: number, lit?: number): void, + rgb(r: number, g: number, b: number, a?: number): Color, + white(): Color +}; + +export namespace Events { +/** + * The Dispatcher class. These objects have methods that can be invoked like dispatch.eventName(). Listeners can be registered with dispatch.on('eventName.uniqueId', callback). Listeners can be + * removed with dispatch.on('eventName.uniqueId', null). Listeners can also be registered and removed with dispatch.eventName.on('name', callback). + * + * Note that only one listener with the name event name and id can be registered at once. If you to generate unique ids, you can use the seen.Util.uniqueId() method. + */ + class Dispatcher { + constructor(); + on(type: string, listener: EventListener): Dispatcher; + } + +/** + * Return a new dispatcher that creates event types using the supplied string argument list. The returned Dispatcher will have methods with the names of the event types. + */ + function dispatch(): Dispatcher; + + function Event(): void; +} + +export const Lights: { + ambient(opts?: LightOptions): Light, + directional(opts?: LightOptions): Light, + point(opts?: LightOptions): Light +}; + +/** + * A few useful Matrix objects. + */ +export const Matrices: { + flipX(): Matrix, + flipY(): Matrix, + flipZ(): Matrix, + identity(): Matrix +}; + +export const Models: { + default(): Model +}; + +/** + * A few useful Point objects. Be sure that you don’t invoke destructive methods on these objects. + */ +export const Points: { + X(): Point, + Y(): Point, + Z(): Point, + ZERO(): Point +}; + +/** + * These projection methods return a 3D to 2D Matrix transformation. Each projection assumes the camera is located at (0,0,0). + */ +export const Projections: { + ortho(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): Matrix, + perspective(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): Matrix, + perspectiveFov(fovyInDegrees?: number, front?: number): Matrix +}; + +/** + * These shading functions compute the shading for a surface. To reduce code duplication, we aggregate them in a utils object. + */ +export const ShaderUtils: { + applyAmbient(c: Color, light: Light): void, + applyDiffuse(c: Color, light: Light, lightNormal: Point, surfaceNormal: Point, material?: Material): void, + applyDiffuseAndSpecular(c: Color, light: Light, lightNormal: Point, surfaceNormal: Point, material: Material): void +}; + +export const Shaders: { + ambient(): Ambient, + diffuse(): DiffusePhong, + flat(): Flat, + phong(): Phong +}; + +/** + * Shape primitives and shape-making methods + */ +export const Shapes: { + arrow(thickness?: number, tailLength?: number, tailWidth?: number, headLength?: number, headPointiness?: number): Shape, + cube(): Shape, + custom(s: Shape): Shape, + extrude(points: Point[], offset: Point): Shape, + icosahedron(): Shape, + mapPointsToSurfaces(points: Point[], coordinateMap: number[][]): Surface[], + obj(objContents: string, cullBackfaces?: boolean): Shape, + patch(nx?: number, ny?: number): Shape, + path(points: Point[]): Shape, + pipe(point1: Point, point2: Point, radius?: number, segments?: number): Shape, + pyramid(): Shape, + rectangle(point1: Point, point2: Point): Shape, + sphere(subdivisions?: number): Shape, + tetrahedron(): Shape, + text(text: string, surfaceOptions?: Partial): Shape, + unitcube(): Shape +}; + +/** + * Utility methods + */ +export const Util: { + arraysEqual(a: T[], b: T[]): boolean, + defaults(obj: T, opts: Partial, defaults: Partial): void, + element(elementOrId: string | HTMLElement): HTMLElement, + uniqueId(prefix?: string): string +}; + +export interface Viewport { + prescale: Matrix; + postscale: Matrix; +} + +export const Viewports: { + center(width?: number, height?: number, x?: number, y?: number): Viewport, + origin(width?: number, height?: number, x?: number, y?: number): Viewport +}; + +/** + * A global window event dispatcher. Attaches listeners only if window is defined. + */ +export const WindowEvents: { + on(type: string, listener: EventListener): Events.Dispatcher; +}; diff --git a/types/seen/seen-tests.ts b/types/seen/seen-tests.ts new file mode 100644 index 0000000000..05f23905ca --- /dev/null +++ b/types/seen/seen-tests.ts @@ -0,0 +1,61 @@ +/** + * Converted to TypeScript from: http://seenjs.io/demo-noisy-sphere.html + */ + +import { Shapes, Colors, Scene, Models, Viewports, Context, Simplex3D, Drag, Quaternion, RenderContext, Shape, Point, Surface, Matrix } from 'seen'; + +const width = 900; +const height = 500; + +const shape: Shape = Shapes.sphere(2).scale(150); +Colors.randomSurfaces2(shape); + +const scene: Scene = new Scene({ + fractionalPoints: true, + cullBackfaces: false, + model: Models["default"]().add(shape), + viewport: Viewports.center(width, height) +}); + +const context: RenderContext = Context('seen-canvas', scene).render(); + +const ref: Surface[] = shape.surfaces; +const originals: Point[][] = []; +let surf: Surface; +for (let j = 0, len: number = ref.length; j < len; j++) { + surf = ref[j]; + originals.push(surf.points.map(p => { + return p.copy(); + })); + surf.fillMaterial.color.a = 150; +} + +const noiser: Simplex3D = new Simplex3D(Math.random()); + +context.animate().onBefore((t, dt) => { + let n: number; + let p: Point; + let ref2: Point[]; + const ref1: Surface[] = shape.surfaces; + for (let k = 0, len1 = ref1.length; k < len1; k++) { + surf = ref1[k]; + ref2 = surf.points; + for (let i = 0, l = 0, len2 = ref2.length; l < len2; i = ++l) { + p = ref2[i]; + n = noiser.noise(p.x, p.y, p.z + t * 1e-4); + surf.points[i] = originals[k][i].copy().multiply(1 + n / 3); + } + surf.dirty = true; + } + return shape.rotx(dt * 1e-4).rotz(-dt * 1e-4); +}).start(); + +const dragger: Drag = new Drag(document.getElementById('seen-canvas')!, { + inertia: true +}); + +dragger.on('drag.rotate', (e) => { + const xform: Matrix = Quaternion.xyToTransform(e.offsetRelative[0], e.offsetRelative[1]); + shape.transform(xform); + return context.render(); +}); diff --git a/types/seen/tsconfig.json b/types/seen/tsconfig.json new file mode 100644 index 0000000000..e56ea79e69 --- /dev/null +++ b/types/seen/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "seen-tests.ts" + ] +} diff --git a/types/seen/tslint.json b/types/seen/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/seen/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 98aed985909e030e0c02e418747c996c70b468db Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 8 Mar 2019 07:41:32 +0100 Subject: [PATCH 225/265] Remove declare global --- types/offscreencanvas/index.d.ts | 92 +++++++++++++++----------------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts index de3b3a7fe3..89e2b14df6 100644 --- a/types/offscreencanvas/index.d.ts +++ b/types/offscreencanvas/index.d.ts @@ -5,53 +5,49 @@ // TypeScript Version: 3.1 -declare global { - // https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage - interface CanvasDrawImage { - drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void; - drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; - drawImage(image: CanvasImageSource | OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, - dx: number, dy: number, dw: number, dh: number): void; - } - - // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap - function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise; - function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas, sx: number, sy: number, - sw: number, sh: number): Promise; - - // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen - interface HTMLCanvasElement extends HTMLElement { - transferControlToOffscreen(): OffscreenCanvas; - } - - // https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvasrenderingcontext2d - interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, - CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, - CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, - CanvasTextDrawingStyles, CanvasPath { - readonly canvas: OffscreenCanvas; - } - var OffscreenCanvasRenderingContext2D: { - prototype: OffscreenCanvasRenderingContext2D; - new (): OffscreenCanvasRenderingContext2D; - }; - - // https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface - interface OffscreenCanvas extends EventTarget { - width: number; - height: number; - getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings): - OffscreenCanvasRenderingContext2D | null; - getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): OffscreenCanvasRenderingContext2D - | WebGLRenderingContext | null; - transferToImageBitmap(): ImageBitmap; - convertToBlob(options?: { type?: string, quality?: number }): Promise; - } - var OffscreenCanvas: { - prototype: OffscreenCanvas; - new (width: number, height: number): OffscreenCanvas; - }; +// https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage +interface CanvasDrawImage { + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, + dx: number, dy: number, dw: number, dh: number): void; } -export { }; +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise; +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas, sx: number, sy: number, + sw: number, sh: number): Promise; + +// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen +interface HTMLCanvasElement extends HTMLElement { + transferControlToOffscreen(): OffscreenCanvas; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvasrenderingcontext2d +interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, + CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, + CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, + CanvasTextDrawingStyles, CanvasPath { + readonly canvas: OffscreenCanvas; +} +declare var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new (): OffscreenCanvasRenderingContext2D; +}; + +// https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +interface OffscreenCanvas extends EventTarget { + width: number; + height: number; + getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings): + OffscreenCanvasRenderingContext2D | null; + getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): OffscreenCanvasRenderingContext2D + | WebGLRenderingContext | null; + transferToImageBitmap(): ImageBitmap; + convertToBlob(options?: { type?: string, quality?: number }): Promise; +} +declare var OffscreenCanvas: { + prototype: OffscreenCanvas; + new (width: number, height: number): OffscreenCanvas; +}; From 1642e414cf5cedf4a8d88fe80e32257751a97f7a Mon Sep 17 00:00:00 2001 From: Shikanime Deva Date: Fri, 8 Mar 2019 11:47:15 +0100 Subject: [PATCH 226/265] Add SketchMSData wrapper --- types/sketchapp/index.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/types/sketchapp/index.d.ts b/types/sketchapp/index.d.ts index b45dcefe50..9d2f8e9ab4 100644 --- a/types/sketchapp/index.d.ts +++ b/types/sketchapp/index.d.ts @@ -17,9 +17,34 @@ type SketchMSLayerListExpandedType = 0 | 1 | 2; type SketchMSEncodedBase64BinaryPlist = string; type SketchMSNSColorArchive = SketchMSKeyValueArchive; type SketchMSLayer = SketchMSPage | SketchMSSymbolMaster; +type SketchMSUserData = SketchMSUserDocument | SketchMSUserPage; interface SketchMSNestedSymbolOverride { symbolID: string; } +interface SketchMSPreview { + source: string; + width: number; + height: number; +} +interface SketchMSUserPage { + [key: string]: { + scrollOrigin: SketchMSCurvePoint; + zoomValue: number; + }; +} +interface SketchMSUserDocument { + document: { + pageListCollapsed: number; + pageListHeight: number; + } +} +interface SketchMSData { + pages: Array; + previews: Array; + document: SketchMSDocumentData; + user: SketchMSUserData; + meta: SketchMSMetadata; +} interface SketchMSStringAttribute { _class: 'stringAttribute'; attributes: { From 727f54e853c555ff3a6ddc3d10e578274537c04d Mon Sep 17 00:00:00 2001 From: Shikanime Deva Date: Fri, 8 Mar 2019 11:47:55 +0100 Subject: [PATCH 227/265] Add SketchMSPath property on SketchMSLayer --- types/sketchapp/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/sketchapp/index.d.ts b/types/sketchapp/index.d.ts index 9d2f8e9ab4..a9505f6f49 100644 --- a/types/sketchapp/index.d.ts +++ b/types/sketchapp/index.d.ts @@ -108,8 +108,8 @@ interface SketchMSImageDataReference { } type SketchMSPointString = string; interface SketchMSPath { - _class: 'path'; - isClosed: boolean; + _class: 'path' | 'shapePath' | 'rectangle' | 'oval' | 'triangle'; + isClosed?: boolean; points: SketchMSCurvePoint[]; } interface SketchMSCurvePoint { @@ -380,6 +380,8 @@ interface SketchMSSymbolMaster { attributedString: SketchMSAttributedString; name: string; layers: SketchMSLayer[]; + points: SketchMSPath; + isClosed?: boolean; isVisible: boolean; nameIsFixed: boolean; grid: SketchMSSimpleGrid; From 072ad7ac8b3fd40bd3f23c13506f942044652fa2 Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Fri, 8 Mar 2019 13:00:14 +0000 Subject: [PATCH 228/265] is-integer: add type definitions. --- types/is-integer/index.d.ts | 8 ++++++++ types/is-integer/is-integer-tests.ts | 16 ++++++++++++++++ types/is-integer/tsconfig.json | 23 +++++++++++++++++++++++ types/is-integer/tslint.json | 1 + 4 files changed, 48 insertions(+) create mode 100644 types/is-integer/index.d.ts create mode 100644 types/is-integer/is-integer-tests.ts create mode 100644 types/is-integer/tsconfig.json create mode 100644 types/is-integer/tslint.json diff --git a/types/is-integer/index.d.ts b/types/is-integer/index.d.ts new file mode 100644 index 0000000000..46708e5068 --- /dev/null +++ b/types/is-integer/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for is-integer 1.0 +// Project: https://github.com/parshap/js-is-integer#readme +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isInteger(val: any): boolean; + +export = isInteger; diff --git a/types/is-integer/is-integer-tests.ts b/types/is-integer/is-integer-tests.ts new file mode 100644 index 0000000000..f414281fc6 --- /dev/null +++ b/types/is-integer/is-integer-tests.ts @@ -0,0 +1,16 @@ +import isInteger = require("is-integer"); + +// $ExpectType boolean +isInteger("hello"); + +// $ExpectType boolean +isInteger(4); + +// $ExpectType boolean +isInteger(4.0); + +// $ExpectType boolean +isInteger(4.1); + +// $ExpectType boolean +isInteger({}); diff --git a/types/is-integer/tsconfig.json b/types/is-integer/tsconfig.json new file mode 100644 index 0000000000..7b4310e320 --- /dev/null +++ b/types/is-integer/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-integer-tests.ts" + ] +} diff --git a/types/is-integer/tslint.json b/types/is-integer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-integer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a6b33c8499a189a8a13581ab956552d208db350f Mon Sep 17 00:00:00 2001 From: Shikanime Deva Date: Fri, 8 Mar 2019 15:24:43 +0100 Subject: [PATCH 229/265] Lint and add contributor --- types/sketchapp/index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/sketchapp/index.d.ts b/types/sketchapp/index.d.ts index a9505f6f49..79a9226508 100644 --- a/types/sketchapp/index.d.ts +++ b/types/sketchapp/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for non-npm package the SketchApp 1.0 // Project: https://github.com/xlayers/xlayers // Definitions by: Wassim Chegham +// Phetsinorath William // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped type SketchMSBorderPositionEnum = 0 | 1 | 2 | 3; @@ -36,11 +37,11 @@ interface SketchMSUserDocument { document: { pageListCollapsed: number; pageListHeight: number; - } + }; } interface SketchMSData { - pages: Array; - previews: Array; + pages: SketchMSPage[]; + previews: SketchMSPreview[]; document: SketchMSDocumentData; user: SketchMSUserData; meta: SketchMSMetadata; From 691680bcbbb447832067658dad98a4d371c2c707 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Fri, 8 Mar 2019 16:34:10 +0000 Subject: [PATCH 230/265] Update CODEOWNERS --- .github/CODEOWNERS | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5af21f27d2..d21cca9322 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -531,6 +531,7 @@ /types/cash/ @akvlko /types/casperjs/ @jedmao @urielch /types/cassandra-driver/ @Svjard @pc-jedi @michal-b-kaminski +/types/cassanknex/ @bioball /types/catbox/ @jasonswearingen @AJamesPhillips @saboya /types/catbox/v7/ @jasonswearingen @AJamesPhillips /types/catbox-memory/ @SimonSchick @@ -653,6 +654,7 @@ /types/coinlist/ @BendingBender /types/coinstring/ @mhegazy /types/collections/ @scarabedore +/types/collectionsjs/ @jaymeh /types/color/ @Airlun @jameswlane /types/color/v2/ @Airlun /types/color/v1/ @LKay @@ -1085,6 +1087,7 @@ /types/duplicate-package-checker-webpack-plugin/ @mtraynham /types/durandal/ @BlueSpire /types/dustjs-linkedin/ @mdezem +/types/dv/ @taoqf /types/dvtng-jss/ @Ptival /types/dw-bxslider-4/ @namerci /types/dwt/ @yushulx @jbh @lincoln2018 @Tom-Dynamsoft @@ -1172,7 +1175,7 @@ /types/ember__object/ @mike-north /types/ember__polyfills/ @mike-north /types/ember__routing/ @mike-north -/types/ember__runloop/ @mike-north +/types/ember__runloop/ @mike-north @scalvert /types/ember__service/ @mike-north /types/ember__string/ @mike-north /types/ember__test/ @mike-north @@ -1426,7 +1429,7 @@ /types/file-url/ @coderslagoon /types/filenamify/ @rokt33r /types/filenamify-url/ @cprecioso -/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk +/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk @ffxsam /types/fill-pdf/ @westy92 /types/filter-console/ @BendingBender /types/filter-invalid-dom-props/ @icopp @@ -1758,6 +1761,7 @@ /types/gl-react-native/ @jussikinnula /types/gl-shader/ @MathiasPaumgarten /types/gl-texture2d/ @MathiasPaumgarten +/types/gl-vec2/ @adamzerella /types/gl-vec3/ @adamzerella /types/gl-vec4/ @adamzerella /types/gldatepicker/ @qcz @@ -1974,7 +1978,7 @@ /types/hedron/ @dborysov /types/hellojs/ @PavelPZ @vuorinem @baywet /types/hellosign-embedded/ @xt0rted -/types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit +/types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit @chdanielmueller /types/heredatalens/ @denyo /types/heremaps/ @Josh-ES @denyo @fx88 /types/heroku-logger/ @kylevogt @@ -2013,10 +2017,12 @@ /types/html-tag-names/ @sandersn /types/html-tags/ @BendingBender /types/html-to-text/ @erykwarren +/types/html-truncate/ @adamzerella /types/html-void-elements/ @rhysd /types/html-webpack-plugin/ @deevus @bumbleblym @tlaziuk /types/html-webpack-template/ @bumbleblym /types/html2canvas/ @rwhepburn @tan9 @sschocke @Ristaaf +/types/html5-history/ @akashishu777 /types/html5plus/ @dcloudio /types/htmlbars-inline-precompile/ @chriskrycho /types/htmlparser2/ @staticfunction @LinusU @@ -2029,7 +2035,7 @@ /types/http-errors/ @tkrotoff @BendingBender /types/http-graceful-shutdown/ @dlee-nvisia /types/http-link-header/ @screendriver -/types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt +/types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt @jabreu610 /types/http-proxy-agent/ @mrmlnc @steprescott /types/http-proxy-middleware/ @zebMcCorkle @BendingBender /types/http-rx/ @L2jLiga @@ -2506,7 +2512,7 @@ /types/jsonrpc-serializer/ @Akim95 @many20 /types/jsonstream/ @Bartvds /types/jsontoxml/ @benstevens48 -/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod +/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod @kettil /types/jsonwebtoken-promisified/ @SomaticIT @danielheim @brikou @aneilbaboo /types/jspath/ @dex4er /types/jspdf/ @amberjs @lleios @jemerald @@ -3325,7 +3331,7 @@ /types/moment-round/ @jacobbaskin /types/moment-shortformat/ @whatasoda /types/moment-strftime2/ @dex4er -/types/moment-timezone/ @michelsalib @alanblins @asermax +/types/moment-timezone/ @michelsalib @alanblins @asermax @borys-kupar /types/money-math/ @taoqf /types/mongo-sanitize/ @CedricCazin /types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 @Manc @@ -3555,7 +3561,7 @@ /types/node-zopfli-es/ @Alorel /types/node_redis/ @borisyankov /types/nodecredstash/ @migstopheles -/types/nodegit/ @dolanmiu @tniessen +/types/nodegit/ @dolanmiu @tniessen @pvigier /types/nodemailer/ @rogierschouten @dex4er @bioball /types/nodemailer/v3/ @rogierschouten /types/nodemailer-direct-transport/ @rogierschouten @@ -3683,9 +3689,6 @@ /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem -/types/ora/ @basarat @screendriver @BendingBender @azasypkin -/types/ora/v1/ @basarat @screendriver @BendingBender @azasypkin -/types/ora/v0/ @basarat @screendriver /types/oracle__oraclejet/ @nolakara @jingxwu /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 @@ -3853,6 +3856,7 @@ /types/pegjs/ @vvakame @SrTobi @siegebell /types/pem/ @tony19 @DethAriel /types/pem-jwk/ @alessiopcc +/types/pendo-io-browser/ @aaronbeall /types/permit/ @jannikkeye /types/persona/ @Nycto /types/pet-finder-api/ @me @@ -3902,7 +3906,6 @@ /types/piwik-tracker/ @lbguilherme /types/pixelmatch/ @iamolegga /types/pixi.js/ @clark-stevenson -/types/pkg-conf/ @jorgegonzalez /types/pkg-dir/ @NK-WEB-Git /types/pkg-up/ @forivall /types/pkg-versions/ @BendingBender @@ -3920,6 +3923,7 @@ /types/plupload/ @patrickbussmann /types/plur/ @iRoachie /types/pluralize/ @ukyo @karol-majewski +/types/plurals-cldr/ @ChaosinaCan /types/png.js/ @ffflorian /types/pngjs/ @jason0x43 /types/pngquant-bin/ @hikoma @@ -4182,7 +4186,7 @@ /types/react-bootstrap-daterangepicker/ @ianks /types/react-bootstrap-table/ @flaub @alelode @UJosue10 @dawnmist @Ogglas /types/react-bootstrap-table/v2/ @flaub @alelode @UJosue10 -/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 @dalevfenton +/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 @dalevfenton @KngHawkon /types/react-breadcrumbs/ @guoyunhe /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros @@ -4467,7 +4471,7 @@ /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-responsive/v1/ @asvetliakov /types/react-rnd/ @Ragg- @fsubal @zyh825 -/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith @wezleytsai +/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith @wezleytsai @eps1lon /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian @nulladdict /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall @@ -4675,6 +4679,7 @@ /types/remove-markdown/ @RagibHasin /types/rename/ @Aankhen /types/repeat-element/ @adamzerella +/types/repeat-string/ @adamzerella /types/replace-ext/ @DeividasBakanas /types/replace-string/ @BendingBender /types/replacestream/ @dex4er @@ -4720,8 +4725,9 @@ /types/restler/ @cyrilschumacher /types/restling/ @loghorn /types/restore-cursor/ @BendingBender -/types/resumablejs/ @DanielMcAssey +/types/resumablejs/ @DanielMcAssey @Johns3n /types/rethinkdb/ @alexgorbatchev @AdrianFarmadin @kondi @hoishin +/types/retinajs/ @senjyouhara /types/retry/ @krenor @BendingBender /types/retry-as-promised/ @Raigen /types/rev-hash/ @ikatyang @@ -4909,6 +4915,7 @@ /types/semver-truncate/ @BendingBender /types/sencha_touch/ @brian428 /types/send/ @MikeJerred +/types/sendmail/ @saostad /types/seneca/ @psnider @kevynb /types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b @Antoine38660 @smff /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal @@ -5310,6 +5317,7 @@ /types/tapable/ @e-cloud @johnnyreilly /types/tapable/v0/ @e-cloud /types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty @rostrowski +/types/tape-async/ @ExE-Boss /types/tar/ @SomaticIT @connor4312 /types/tar-fs/ @Umoxfo /types/tar-stream/ @glicht @@ -5508,6 +5516,7 @@ /types/universal-analytics/ @Bartvds @DarkerTV /types/universal-cookie/ @tomi /types/unorm/ @chbrown +/types/unsplash-js/ @markupcode /types/untildify/ @BendingBender /types/unused-filename/ @BendingBender /types/unzip/ @coding2012 @@ -5585,7 +5594,7 @@ /types/vfile/ @bizen241 @rokt33r /types/vfile-location/ @ikatyang @rokt33r /types/vfile-message/ @rokt33r -/types/victory/ @asvetliakov @snerks @Havret @alredyExist @jlismore +/types/victory/ @asvetliakov @snerks @Havret @allreadyExisted @jlismore /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk @sroucheray @AkxeOne @meikidd /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 From 62a4a451c71e44984211cac4845977a5a3cc98b9 Mon Sep 17 00:00:00 2001 From: Haseeb Majid Date: Fri, 8 Mar 2019 18:36:00 +0000 Subject: [PATCH 231/265] Added Package Added new package --- types/sunrise-sunset-js/index.d.ts | 16 ++++++++++++++++ .../sunrise-sunset-js/sunrise-sunset-js-tests.ts | 4 ++++ types/sunrise-sunset-js/tsconfig.json | 16 ++++++++++++++++ types/sunrise-sunset-js/tslint.json | 1 + 4 files changed, 37 insertions(+) create mode 100644 types/sunrise-sunset-js/index.d.ts create mode 100644 types/sunrise-sunset-js/sunrise-sunset-js-tests.ts create mode 100644 types/sunrise-sunset-js/tsconfig.json create mode 100644 types/sunrise-sunset-js/tslint.json diff --git a/types/sunrise-sunset-js/index.d.ts b/types/sunrise-sunset-js/index.d.ts new file mode 100644 index 0000000000..b926ce6b50 --- /dev/null +++ b/types/sunrise-sunset-js/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for sunrise-sunset-js 2.0 +// Project: https://github.com/udivankin/sunrise-sunset +// Definitions by: Haseeb Majid +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function getSunrise( + latitude: number, + longitude: number, + date?: Date +): Date; + +export function getSunset( + latitude: number, + longitude: number, + date?: Date +): Date; diff --git a/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts b/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts new file mode 100644 index 0000000000..30fc19218a --- /dev/null +++ b/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts @@ -0,0 +1,4 @@ +import { getSunrise, getSunset } from "sunrise-sunset-js"; + +const sunset = getSunset(51.4541, -2.592); +const sunrise = getSunrise(51.1788, -1.8262, new Date("2000-06-21")); diff --git a/types/sunrise-sunset-js/tsconfig.json b/types/sunrise-sunset-js/tsconfig.json new file mode 100644 index 0000000000..4221b604c2 --- /dev/null +++ b/types/sunrise-sunset-js/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "sunrise-sunset-js-tests.ts"] +} diff --git a/types/sunrise-sunset-js/tslint.json b/types/sunrise-sunset-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sunrise-sunset-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 27a13a3f677bd4892a132f92760b1ba2f16c2101 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 8 Mar 2019 10:58:57 -0800 Subject: [PATCH 232/265] Remove outdated test --- types/victory/victory-tests.tsx | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/types/victory/victory-tests.tsx b/types/victory/victory-tests.tsx index df7e34b75b..32c9b3160d 100644 --- a/types/victory/victory-tests.tsx +++ b/types/victory/victory-tests.tsx @@ -655,19 +655,6 @@ test = ( /> ); -test = ( - (a ? 5 : 3)} - /> -); - // VictoryPie test test = ( Date: Wed, 6 Mar 2019 12:30:09 +0100 Subject: [PATCH 233/265] Added type defs for oakdex-pokedex --- types/oakdex-pokedex/index.d.ts | 349 +++++++++++++ types/oakdex-pokedex/oakdex-pokedex-tests.ts | 492 +++++++++++++++++++ types/oakdex-pokedex/tsconfig.json | 23 + types/oakdex-pokedex/tslint.json | 3 + 4 files changed, 867 insertions(+) create mode 100644 types/oakdex-pokedex/index.d.ts create mode 100644 types/oakdex-pokedex/oakdex-pokedex-tests.ts create mode 100644 types/oakdex-pokedex/tsconfig.json create mode 100644 types/oakdex-pokedex/tslint.json diff --git a/types/oakdex-pokedex/index.d.ts b/types/oakdex-pokedex/index.d.ts new file mode 100644 index 0000000000..8ca4fa709d --- /dev/null +++ b/types/oakdex-pokedex/index.d.ts @@ -0,0 +1,349 @@ +// Type definitions for oakdex-pokedex 0.4 +// Project: https://github.com/jalyna/oakdex-pokedex +// Definitions by: Jalyna Schroeder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Translations { + de: string; + en: string; + cz?: string; + dk?: string; + fr?: string; + gr?: string; + it?: string; + pl?: string; + tr?: string; + jp?: string; + es?: string; +} + +export interface PokemonEvolution { + to: string; + level?: number; + happiness?: boolean; + trade?: boolean; + level_up?: boolean; + item?: string; + hold_item?: string; + move_learned?: string; + conditions?: string[]; +} + +export interface PokemonAbility { + name: string; + hidden?: boolean; +} + +export interface StatObject { + hp: number; + atk: number; + def: number; + sp_atk: number; + sp_def: number; + speed: number; +} + +export interface MegaEvolution { + types: string[]; + ability: string; + height_us: string; + height_eu: string; + weight_us: string; + weight_eu: string; + base_stats: StatObject; + mega_stone: string; + image_suffix?: string; +} + +export interface PokemonVariation { + condition?: string; + names: Translations; + types: string[]; + height_us?: string; + height_eu?: string; + weight_us?: string; + weight_eu?: string; + base_stats?: StatObject; + pokeathlon_stats?: { + speed?: number[]; + power?: number[]; + stamina?: number[]; + skill?: number[]; + jump?: number[] + }; + abilities?: string[]; + image_suffix?: string; +} + +export interface Learnset { + move: string; + level?: number; + tm?: string; + egg_move?: boolean; + variations?: string[]; +} + +export interface MoveLearnset { + games: string[]; + learnset: Learnset[]; +} + +export interface Pokemon { + names: Translations; + categories: Translations; + national_id: number; + kanto_id: number | null; + johto_id: number | null; + hoenn_id: number | null; + sinnoh_id: number | null; + unova_id: number | null; + kalos_id: number | null; + alola_id: number | null; + ultra_alola_id: number | null; + pokedex_entries: { + [key: string]: Translations; + }; + evolution_from: string | null; + evolutions: PokemonEvolution[]; + types: string[]; + abilities: PokemonAbility[]; + gender_ratios: null | { + female: number; + male: number; + }; + catch_rate: number; + egg_groups: string[]; + hatch_time: number[]; + height_us: string; + height_eu: string; + weight_us: string; + weight_eu: string; + base_exp_yield: number; + leveling_rate: string; + ev_yield: StatObject; + color: string; + base_friendship: number; + base_stats: StatObject; + pokeathlon_stats?: { + speed?: number[]; + power?: number[]; + stamina?: number[]; + skill?: number[]; + jump?: number[]; + }; + mega_evolutions: MegaEvolution[]; + variation_names?: Translations; + variations: PokemonVariation[]; + move_learnsets: MoveLearnset[]; +} + +export interface MoveStatusCondition { + condition: string; + probability: number; +} + +export interface MoveStatModifier { + stat: string; + change_by: number; + affects_user?: boolean; +} + +export interface MoveContest { + contest: string; + condition: string; + appeal: number; + jam: number; +} + +export interface Move { + names: Translations; + index_number: number; + pp: number; + max_pp: number; + power: number; + accuracy: number; + type: string; + category: string; + priority: number; + target: string; + critical_hit: number; + pokedex_entries: { + [key: string]: Translations; + }; + contests: MoveContest[]; + makes_contact: boolean; + affected_by_protect: boolean; + affected_by_magic_coat: boolean; + affected_by_snatch: boolean; + affected_by_mirror_move: boolean; + affected_by_kings_rock: boolean; + in_battle_properties?: { + increased_critical_hit_ratio?: boolean; + status_conditions?: MoveStatusCondition[] + }; + stat_modifiers?: MoveStatModifier[]; +} + +export interface Ability { + names: Translations; + index_number: number; + descriptions: Translations; +} + +export interface PokemonType { + names: Translations; + color: string; + effectivness: { + Normal: number; + Fighting: number; + Flying: number; + Poison: number; + Ground: number; + Rock: number; + Bug: number; + Ghost: number; + Steel: number; + Fire: number; + Water: number; + Grass: number; + Electric: number; + Psychic: number; + Ice: number; + Dragon: number; + Dark: number; + Fairy: number; + }; +} + +export interface LocationPokemon { + pokemon: string; + location: string; + min_level: number; + max_level: number; + rarity: string; + games: string[]; + day_times?: string[]; + seasons?: string[]; + variation?: string; +} + +export interface Location { + names: Translations; + pokemon: LocationPokemon[]; +} + +export interface Region { + names: Translations; + locations: Location[]; +} + +export interface EggGroup { + names: Translations; +} + +export interface Generation { + names: Translations; + dex_name: string; + number: number; + games: Translations[]; +} + +export interface Nature { + names: Translations; + increased_stat: string | null; + decreased_stat: string | null; + favorite_flavor: string | null; + disliked_flavor: string | null; +} + +export interface ItemPrice { + games: string[]; + buying: number; + selling: number; +} + +export interface ItemPocket { + pocket: string; + generations: number[]; +} + +export interface ItemDescription { + translations: Translations; + games: string[]; +} + +export interface ItemPokemonChange { + field: string; + change_by_percent?: number; + revive?: boolean; + change_by?: number; + change?: string; + conditions?: string[]; +} + +export interface ItemMoveChange { + field: string; + change_by_percent?: number; + change_by?: number; + change_by_max?: number; +} + +export interface ItemEffect { + condition: string; + target: string; + triggers_evolution?: boolean; + pokemon_changes?: ItemPokemonChange[]; + move_changes?: ItemMoveChange[]; +} + +export interface Item { + names: Translations; + category: string; + descriptions: ItemDescription[]; + prices: ItemPrice[]; + pockets: ItemPocket[]; + effects: ItemEffect[]; + fling_power: number; +} + +export interface Conditions { + [key: string]: any; +} + +export function resetPokemon(): void; + +export function importPokemon(customPokemon: string[] | string | Pokemon[]): void; + +export function findPokemon(idOrName: string | number): Pokemon | null; + +export function findMove(name: string): Move | null; + +export function findAbility(name: string): Ability | null; + +export function findType(name: string): PokemonType | null; + +export function findRegion(name: string): Region | null; + +export function findEggGroup(name: string): EggGroup | null; + +export function findGeneration(name: string): Generation | null; + +export function findNature(name: string): Nature | null; + +export function findItem(name: string): Item | null; + +export function allPokemon(conditions?: Conditions): Pokemon[]; + +export function allItems(conditions?: Conditions): Item[]; + +export function allTypes(conditions?: Conditions): PokemonType[]; + +export function allAbilities(conditions?: Conditions): Ability[]; + +export function allRegions(conditions?: Conditions): Region[]; + +export function allEggGroups(conditions?: Conditions): EggGroup[]; + +export function allGenerations(conditions?: Conditions): Generation[]; + +export function allNatures(conditions?: Conditions): Nature[]; diff --git a/types/oakdex-pokedex/oakdex-pokedex-tests.ts b/types/oakdex-pokedex/oakdex-pokedex-tests.ts new file mode 100644 index 0000000000..670c348cbb --- /dev/null +++ b/types/oakdex-pokedex/oakdex-pokedex-tests.ts @@ -0,0 +1,492 @@ +import { + Pokemon, + Move, + Ability, + PokemonType, + Region, + EggGroup, + Generation, + Nature, + Item +} from 'oakdex-pokedex'; + +// Pokemon +() => { + const pikachu: Pokemon = { + names: { + fr: 'Pikachu', + de: 'Pikachu', + it: 'Pikachu', + en: 'Pikachu' + }, + national_id: 25, + types: [ + 'Electric' + ], + abilities: [ + { + name: 'Static' + }, + { + name: 'Lightning Rod', + hidden: true + } + ], + gender_ratios: { + male: 50, + female: 50 + }, + catch_rate: 190, + egg_groups: [ + 'Field', + 'Fairy' + ], + hatch_time: [ + 5355, + 5609 + ], + height_us: '1\'04"', + height_eu: '0.4 m', + weight_us: '13.2 lbs.', + weight_eu: '6.0 kg', + base_exp_yield: 105, + leveling_rate: 'Medium Fast', + ev_yield: { + hp: 0, + atk: 0, + def: 0, + sp_atk: 0, + sp_def: 0, + speed: 2 + }, + color: 'Yellow', + base_friendship: 70, + base_stats: { + hp: 35, + atk: 55, + def: 30, + sp_atk: 50, + sp_def: 40, + speed: 90 + }, + evolutions: [ + { + to: 'Raichu', + item: 'Thunderstone' + } + ], + evolution_from: 'Pichu', + alola_id: 25, + categories: { + en: 'Mouse Pokémon', + de: 'Maus' + }, + kanto_id: 25, + johto_id: 22, + hoenn_id: 163, + sinnoh_id: 104, + unova_id: null, + kalos_id: 36, + mega_evolutions: [], + variations: [ + { + names: { + fr: 'Pikachu (Pokémon partenaire)', + de: 'Pikachu (Partner-Pokémon)', + it: 'Pikachu (Pokémon compagno)', + en: 'Pikachu (Partner Pokémon)' + }, + types: [ + 'Electric' + ], + base_stats: { + hp: 45, + atk: 80, + def: 50, + sp_atk: 75, + sp_def: 60, + speed: 120 + } + } + ], + pokedex_entries: { + Red: { + en: 'When several of these Pokémon gather, their electricity could build and cause lightning storms.', + de: 'Wenn sich mehrere dieser Pokémon versammeln, kann ihre Energie Blitzgewitter erzeugen.' + }, + Blue: { + en: 'When several of these Pokémon gather, their electricity could build and cause lightning storms.', + de: 'Wenn sich mehrere dieser Pokémon versammeln, kann ihre Energie Blitzgewitter erzeugen.' + } + }, + pokeathlon_stats: { + speed: [ + 3, + 4 + ], + power: [ + 3, + 4 + ], + stamina: [ + 3, + 4 + ], + skill: [ + 3, + 4 + ], + jump: [ + 3, + 4 + ] + }, + ultra_alola_id: 32, + move_learnsets: [ + { + games: [ + 'Red', + 'Blue' + ], + learnset: [ + { + move: 'Growl', + level: 1 + }, + { + move: 'Thunder Shock', + level: 1 + }, + { + move: 'Thunder Wave', + level: 9 + }, + { + move: 'Quick Attack', + level: 16 + }, + { + move: 'Swift', + level: 26 + }, + { + move: 'Agility', + level: 33 + }, + { + move: 'Thunder', + level: 43 + }, + { + move: 'Flash', + tm: 'HM5' + }, + { + move: 'Mega Punch', + tm: 'TM1' + }, + { + move: 'Mega Kick', + tm: 'TM5' + }, + { + move: 'Toxic', + egg_move: true + } + ] + } + ] + }; +}; + +// Move +() => { + const tackle: Move = { + index_number: 33, + pp: 35, + max_pp: 56, + power: 50, + accuracy: 100, + category: 'physical', + priority: 0, + target: 'target_adjacent_single', + critical_hit: 0, + makes_contact: true, + affected_by_protect: true, + affected_by_magic_coat: false, + affected_by_snatch: false, + affected_by_mirror_move: false, + affected_by_kings_rock: true, + names: { + cz: 'Nárazový útok', + dk: 'Tackling', + fr: 'Charge', + de: 'Tackle', + gr: 'Εφόρμηση', + en: 'Tackle' + }, + type: 'Normal', + contests: [ + { + contest: 'Contests', + appeal: 4, + jam: 0, + condition: 'Tough' + }, + { + contest: 'Super Contests', + appeal: 3, + jam: 0, + condition: 'Tough' + }, + { + contest: 'Contest Spectaculars', + appeal: 4, + jam: 0, + condition: 'Tough' + } + ], + pokedex_entries: { + Gold: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + }, + Silver: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + }, + Crystal: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + } + } + }; +}; + +// Ability +() => { + const airLock: Ability = { + index_number: 76, + names: { + fr: 'Air Lock', + de: 'Klimaschutz', + it: 'Riparo', + en: 'Air Lock' + }, + descriptions: { + en: 'Eliminates the effects of weather.', + de: 'Example' + } + }; +}; + +// EggGroup +() => { + const bug: EggGroup = { + names: { + en: 'Bug', + jp: 'むし (虫) Mushi', + fr: 'Insecte', + de: 'Käfer', + it: 'Coleottero', + es: 'Bicho' + } + }; +}; + +// Generation +() => { + const gen1: Generation = { + number: 1, + dex_name: 'kanto_id', + names: { + en: 'Generation I', + de: 'Generation I' + }, + games: [ + { + en: 'Red', + de: 'Rot' + }, + { + en: 'Blue', + de: 'Blau' + }, + { + en: 'Yellow', + de: 'Gelb' + } + ] + }; +}; + +// Item +() => { + const potion: Item = { + names: { + en: 'Potion', + de: 'Trank', + fr: 'Potion', + es: 'Poción', + it: 'Pozione' + }, + category: 'Potions', + descriptions: [ + { + games: [ + 'Gold', + 'Silver', + 'Crystal' + ], + translations: { + en: 'Restores Pokémon HP by 20.', + de: 'Füllt die KP um 20 auf.' + } + } + ], + prices: [ + { + games: [ + 'Red', + 'Blue', + 'Yellow' + ], + buying: 300, + selling: 150 + }, + { + games: [ + 'Sun', + 'Moon', + 'Ultra Sun', + 'Ultra Moon' + ], + buying: 200, + selling: 100 + } + ], + pockets: [ + { + generations: [ + 1, + 2, + 3 + ], + pocket: 'Items' + }, + { + generations: [ + 4, + 5, + 6, + 7 + ], + pocket: 'Medicine' + } + ], + fling_power: 30, + effects: [ + { + condition: 'Always', + target: 'Single Pokemon', + pokemon_changes: [ + { + field: 'current_hp', + change_by: 20 + } + ] + } + ] + }; +}; + +// Nature +() => { + const bold: Nature = { + names: { + en: 'Bold', + de: 'Kühn' + }, + increased_stat: 'def', + decreased_stat: 'atk', + favorite_flavor: 'Sour', + disliked_flavor: 'Spicy' + }; +}; + +// PokemonType +() => { + const dragon: PokemonType = { + names: { + dk: 'Drage', + fr: 'Dragon', + de: 'Drache', + gr: 'Δράκου Drakou', + it: 'Drago', + pl: 'SmokSmoczy', + en: 'Dragon' + }, + effectivness: { + Normal: 1, + Fighting: 1, + Flying: 1, + Poison: 1, + Ground: 1, + Rock: 1, + Bug: 1, + Ghost: 1, + Steel: 0.5, + Fire: 1, + Water: 1, + Grass: 1, + Electric: 1, + Psychic: 1, + Ice: 1, + Dragon: 2, + Dark: 1, + Fairy: 0 + }, + color: '#6F35FC' + }; +}; + +// Region +() => { + const alola: Region = { + names: { + en: 'Alola', + fr: 'Alola', + es: 'Alola', + de: 'Alola', + it: 'Alola' + }, + locations: [ + { + names: { + en: 'Route 1', + fr: 'Abords d\'Ekaeka', + es: 'Afueras de Hauoli', + de: 'Hauholi-Stadtrand', + it: 'Periferia di Hau\'oli' + }, + pokemon: [ + { + pokemon: 'Pikipek', + location: 'Walking', + min_level: 2, + max_level: 3, + rarity: 'common', + games: [ + 'Sun', + 'Moon' + ], + day_times: [ + 'day', + 'night' + ] + } + ] + } + ] + }; +}; diff --git a/types/oakdex-pokedex/tsconfig.json b/types/oakdex-pokedex/tsconfig.json new file mode 100644 index 0000000000..0934229423 --- /dev/null +++ b/types/oakdex-pokedex/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "oakdex-pokedex-tests.ts" + ] +} diff --git a/types/oakdex-pokedex/tslint.json b/types/oakdex-pokedex/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/oakdex-pokedex/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 8ec4c20c30ccb36178cc9b400a2a0b1ac010e939 Mon Sep 17 00:00:00 2001 From: Vincent Pizzo Date: Fri, 8 Mar 2019 11:46:26 -0800 Subject: [PATCH 234/265] Remove no-duplicate-imports from lint --- types/react-csv/tslint.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/react-csv/tslint.json b/types/react-csv/tslint.json index b2ecae2fd2..310959b38e 100644 --- a/types/react-csv/tslint.json +++ b/types/react-csv/tslint.json @@ -1,7 +1,4 @@ { "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-duplicate-imports": false - } + "rules": { } } From 1b904ad0eff3ba61a81848fb4eb7afaafc4227f0 Mon Sep 17 00:00:00 2001 From: Vincent Pizzo Date: Fri, 8 Mar 2019 11:56:58 -0800 Subject: [PATCH 235/265] Combine imports into one --- types/react-csv/react-csv-tests.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/types/react-csv/react-csv-tests.tsx b/types/react-csv/react-csv-tests.tsx index a075b8161f..a099d60626 100644 --- a/types/react-csv/react-csv-tests.tsx +++ b/types/react-csv/react-csv-tests.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import { MouseEventHandler } from "react"; import { render } from "react-dom"; import { CSVLink, CSVDownload } from "react-csv"; @@ -22,16 +21,16 @@ Raed,Labes Yezzi,Min l3b `; -const syncOnClickReturn = (event: MouseEventHandler) => { +const syncOnClickReturn = (event: React.MouseEventHandler) => { window.console.log(event); return true; }; -const syncOnClickVoid = (event: MouseEventHandler) => window.console.log(event); -const asyncOnClickReturn = (event: MouseEventHandler, done: (proceed?: boolean) => void) => { +const syncOnClickVoid = (event: React.MouseEventHandler) => window.console.log(event); +const asyncOnClickReturn = (event: React.MouseEventHandler, done: (proceed?: boolean) => void) => { window.console.log(event); done(true); }; -const asyncOnClickVoid = (event: MouseEventHandler, done: (proceed?: boolean) => void) => { +const asyncOnClickVoid = (event: React.MouseEventHandler, done: (proceed?: boolean) => void) => { window.console.log(event); done(); }; From 19353307e3b509a9e408343792f5fda1695eb51a Mon Sep 17 00:00:00 2001 From: Evan Shortiss Date: Fri, 8 Mar 2019 14:48:49 -0800 Subject: [PATCH 236/265] add support for gyronorm --- types/gyronorm/gyronorm-tests.ts | 21 ++++++++ types/gyronorm/index.d.ts | 88 ++++++++++++++++++++++++++++++++ types/gyronorm/tsconfig.json | 21 ++++++++ types/gyronorm/tslint.json | 3 ++ 4 files changed, 133 insertions(+) create mode 100644 types/gyronorm/gyronorm-tests.ts create mode 100644 types/gyronorm/index.d.ts create mode 100644 types/gyronorm/tsconfig.json create mode 100644 types/gyronorm/tslint.json diff --git a/types/gyronorm/gyronorm-tests.ts b/types/gyronorm/gyronorm-tests.ts new file mode 100644 index 0000000000..d944b72bd0 --- /dev/null +++ b/types/gyronorm/gyronorm-tests.ts @@ -0,0 +1,21 @@ +import * as gyronorm from 'gyronorm'; + +const instance = new gyronorm.GyroNorm(); +const options: gyronorm.Options = { + frequency: 100 +}; + +instance.init(options) + .then(() => { + instance.startLogging((data) => { + const { message, code } = data; + }); + + instance.start((data) => { + const motion = data.dm; + const orientation = data.do; + }); + }) + .catch(() => { + // init failure + }); diff --git a/types/gyronorm/index.d.ts b/types/gyronorm/index.d.ts new file mode 100644 index 0000000000..2a1508da1f --- /dev/null +++ b/types/gyronorm/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for gyronorm 2.0 +// Project: https://github.com/dorukeker/gyronorm.js +// Definitions by: Evan Shortiss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface MotionAndOrientationPayload { + do: { + alpha: number; + beta: number; + gamma: number; + absolute: number; + }; + + dm: { + x: number; + y: number; + z: number; + + gx: number; + gy: number; + gz: number; + + alpha: number; + beta: number; + gamma: number; + }; +} + +export interface Options { + /** + * How often GyroNorm returns data (in milliseconds) + */ + frequency?: number; + + /** + * If the gravity related values to be normalized + */ + gravityNormalized?: boolean; + + /** + * Can be GyroNorm.GAME or GyroNorm.WORLD. gn.GAME returns + * orientation values with respect to the head direction of the device. + * gn.WORLD returns the orientation values with respect to the actual + * north direction of the world. + */ + orientationBase?: string; + + /** + * How many digits after the decimal point will there be in the return values + */ + decimalCount?: number; + + /** + * Function to be called to log messages from gyronorm.js + */ + logger?: LogListener; + + /** + * If set to true it will return screen adjusted values + */ + screenAdjusted?: boolean; +} + +export interface LoggerData { + code: number; + message: string; +} + +export type LogListener = (data: LoggerData) => void; + +export class GyroNorm { + constructor() + + static GAME: string; + static WORLD: string; + + static DEVICE_ORIENTATION: string; + static ACCELERATION: string; + static ACCELERATION_INCLUDING_GRAVITY: string; + static ROTATION_RATE: string; + + init(options: Options): Promise; + + start(callback: (data: MotionAndOrientationPayload) => void): void; + + startLogging(listener: LogListener): void; + stopLogging(): void; +} diff --git a/types/gyronorm/tsconfig.json b/types/gyronorm/tsconfig.json new file mode 100644 index 0000000000..3035f3607b --- /dev/null +++ b/types/gyronorm/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "gyronorm-tests.ts", + "index.d.ts" + ] +} diff --git a/types/gyronorm/tslint.json b/types/gyronorm/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/gyronorm/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 9a99eec613e4400daa406df3d025b69de000d1c2 Mon Sep 17 00:00:00 2001 From: Evan Shortiss Date: Fri, 8 Mar 2019 14:56:07 -0800 Subject: [PATCH 237/265] generate with dts --- types/gyronorm/tsconfig.json | 10 ++++++---- types/gyronorm/tslint.json | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/types/gyronorm/tsconfig.json b/types/gyronorm/tsconfig.json index 3035f3607b..8b8dedb9c0 100644 --- a/types/gyronorm/tsconfig.json +++ b/types/gyronorm/tsconfig.json @@ -7,15 +7,17 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, + "strictFunctionTypes": true, "forceConsistentCasingInFileNames": true }, "files": [ - "gyronorm-tests.ts", - "index.d.ts" + "index.d.ts", + "gyronorm-tests.ts" ] } diff --git a/types/gyronorm/tslint.json b/types/gyronorm/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/gyronorm/tslint.json +++ b/types/gyronorm/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } From c5d1aa342aa297ac2a690fb043e8bd018f97a4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Moura?= Date: Fri, 8 Mar 2019 23:36:43 +0000 Subject: [PATCH 238/265] Added my self has the contributor --- types/voucher-code-generator/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/voucher-code-generator/index.d.ts b/types/voucher-code-generator/index.d.ts index fd57466c26..7f0cd7efdc 100644 --- a/types/voucher-code-generator/index.d.ts +++ b/types/voucher-code-generator/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for voucher-code-generator 1.1 // Project: http://www.voucherify.io/ -// Definitions by: My Self +// Definitions by: João Moura // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /*~ If this module has methods, declare them as functions like so. From 71487ab2eb779bd20f5d9ce79d49f89b1160f7f6 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Sat, 9 Mar 2019 16:32:51 +0000 Subject: [PATCH 239/265] Update CODEOWNERS --- .github/CODEOWNERS | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d21cca9322..54d80df8e5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -74,6 +74,7 @@ /types/allure-js-commons/ @zaqqaz /types/almost-equal/ @cmaddalozzo /types/alt/ @Shearerbeard +/types/amap-js-api/ @breeze9527 /types/amap-js-sdk/ @agasbzj /types/amazon-cognito-auth-js/ @scottescue /types/amazon-product-api/ @MattiLehtinen @alien35 @@ -507,7 +508,6 @@ /types/callsites/ @BendingBender /types/calq/ @eirikhm /types/camaro/ @tuananh -/types/camelcase/ @samverschueren /types/camelcase-keys/ @mhegazy /types/camljs/ @andrei-markeev /types/camo/ @lucasmciruzzi @@ -701,9 +701,7 @@ /types/compute-stdev/ @mrmlnc /types/concat-stream/ @jmarianer /types/concaveman/ @DenisCarriere -/types/conf/ @SamVerschueren @BendingBender -/types/conf/v1/ @SamVerschueren @BendingBender -/types/conf/v0/ @SamVerschueren +/types/condense-whitespace/ @djcsdy /types/confidence/ @jppellerin /types/config/ @RWander @forrestbice @jndonald3 @albertovasquez /types/config-yaml/ @me @@ -722,7 +720,7 @@ /types/connect-mongo/ @Syati /types/connect-mongodb-session/ @NattapongSiri /types/connect-pg-simple/ @pasieronen -/types/connect-redis/ @xstoudi +/types/connect-redis/ @xstoudi @sbutler2901 /types/connect-slashes/ @samherrmann /types/connect-timeout/ @cyrilschumacher /types/consola/ @Jungwoo-An @@ -930,6 +928,7 @@ /types/datatables.net-select/ @szechyjs /types/date-and-time/ @danplisetsky /types/date-arithmetic/ @HeeL +/types/date-now/ @adamzerella /types/date.format.js/ @balrob /types/dateformat/ @aicest @BendingBender /types/dateformat/v1/ @aicest @@ -1071,6 +1070,7 @@ /types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer @smvilar @sulf @pablopunk @claudiopro /types/drag-timetable/ @chinkan /types/draggabilly/ @jaydubu +/types/dragscroll/ @spkellydev /types/dragster/ @zskovacs /types/dragula/ @pwelter34 @abruzzihraig /types/driftless/ @dandelany @@ -1203,7 +1203,6 @@ /types/entities/ @aliceklipper /types/env-ci/ @BendingBender /types/env-editor/ @BendingBender -/types/env-paths/ @danwbyrne /types/env-to-object/ @MugeSo /types/envify/ @tkQubo /types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell @screendriver @@ -1281,7 +1280,7 @@ /types/expired/ @BendingBender /types/expired-storage/ @intolerance /types/expirymanager/ @DanielRose -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 @vinitsood /types/expo/v31/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 /types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @@ -1290,6 +1289,7 @@ /types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger /types/expo/v23/ @KonstantinKai /types/expo-localization/ @burtek +/types/expo-mixpanel-analytics/ @martintreurnicht /types/expo__status-bar-height/ @dawnmist /types/expo__vector-icons/ @incleaf @robertying /types/express/ @borisyankov @@ -1780,7 +1780,6 @@ /types/global-tunnel-ng/ @BendingBender /types/globalize/ @gcastre @afromogli @bryanforbes /types/globalize-compiler/ @iclanton -/types/globby/ @douglasduteil @ikatyang /types/globule/ @durad /types/glue/ @garfty /types/glue/v4/ @gjednaszewski @@ -1929,6 +1928,7 @@ /types/gulp-watch/ @tkrotoff /types/gulp-zip/ @dudeofawesome /types/gun/ @Jack-Works +/types/gyronorm/ @evanshortiss /types/gzip-js/ @rhysd /types/gzip-size/ @plantain-00 @jimivdw @andrewiggins /types/gzip-size/v3/ @plantain-00 @@ -2189,6 +2189,7 @@ /types/is-glob/ @mrmlnc /types/is-hotkey/ @petester42 @kalley /types/is-installed-globally/ @BendingBender +/types/is-integer/ @djcsdy /types/is-ip/ @coderslagoon /types/is-mobile/ @LogvinovLeon /types/is-my-json-valid/ @kruncher @@ -2581,7 +2582,7 @@ /types/keymirror/ @jfahrenkrug /types/keypress.js/ @rcchen /types/keysym/ @harryshipton -/types/keytar/ @miniak @shiftkey @juturu +/types/keytar/ @miniak @shiftkey @juturu @queeniema /types/keyv/ @Arylo @BendingBender /types/keyv__mongo/ @BendingBender /types/keyv__mysql/ @BendingBender @@ -2639,6 +2640,7 @@ /types/koa-json/ @brooklyndev /types/koa-json-error/ @mudkipme /types/koa-log/ @havenchyk +/types/koa-log4/ @a631807682 /types/koa-logger/ @geoffreak @tlaziuk /types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse @@ -3081,7 +3083,6 @@ /types/lodash.zipobjectdeep/ @bczengel @chrootsu @stepancar /types/lodash.zipwith/ @bczengel @chrootsu @stepancar /types/log-symbols/ @BendingBender -/types/log-update/ @BendingBender /types/logat/ @krvikash35 /types/logform/ @DABH /types/logg/ @blittle @@ -3124,7 +3125,6 @@ /types/mailgun-js/ @sampsonjoliver @andipaetzold /types/mailparser/ @psnider @Avol-V /types/main-bower-files/ @k-kagurazaka -/types/make-dir/ @ikatyang @BendingBender /types/maker.js/ @danmarshall /types/makeup-expander/ @darkwebdev /types/makeup-floating-label/ @darkwebdev @@ -3363,7 +3363,6 @@ /types/motor-hat/ @muntyan /types/mousetrap/ @qcz @alanhchoi /types/move-concurrently/ @mgroenhoff -/types/move-file/ @BendingBender /types/moveto/ @shermendev @pea3nut /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka @@ -3617,6 +3616,7 @@ /types/nw.js/ @alirdn /types/nwmatcher/ @woutervh- /types/o.js/ @IceOnFire @bradzacher @janhommes @jcchalte +/types/oakdex-pokedex/ @jalyna /types/oauth/ @nonAlgebraic @EduardoAC /types/oauth-shim/ @BendingBender /types/oauth.js/ @nobuoka @@ -3647,13 +3647,13 @@ /types/office-js-preview/ @OfficeDev @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT /types/office-runtime/ @Zlatkovsky @mscharlock /types/offline-js/ @cgwrench +/types/offscreencanvas/ @kayahr /types/oibackoff/ @geoffreak /types/oidc-token-manager/ @rosieks /types/oja/ @buffcode /types/okta__okta-vue/ @innovation-team /types/ol/ @yairtawil /types/omggif/ @ffflorian -/types/on-change/ @BendingBender /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender /types/on-wake-up/ @ajafff @@ -3846,7 +3846,7 @@ /types/pbf/ @cschwarz /types/pbkdf2/ @timonegk /types/pdf2image/ @taoqf -/types/pdfjs-dist/ @jbaldwin +/types/pdfjs-dist/ @jbaldwin @1999 /types/pdfkit/ @erichillah /types/pdfmake/ @m1llen1um @radziksh @evolkmann /types/pdfobject/ @nielsboogaard @@ -4094,7 +4094,6 @@ /types/qs/ @RWander @leonyu @tehbelinda @zyml @artursvonda @CarlosBonetti /types/qs-middleware/ @davecardwell /types/qtip2/ @Seltzer @leonard-thieu -/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha @shssoichiro @jarrku /types/querystringify/ @ilich /types/quick-lru/ @BendingBender /types/quick-lru/v1/ @BendingBender @@ -4112,7 +4111,7 @@ /types/radius/ @codeanimal /types/radix64/ @huan086 /types/raf/ @BenLorantfy -/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh @krantisinh +/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh @krantisinh @pirix-gh /types/random-boolean/ @BendingBender /types/random-float/ @BendingBender /types/random-int/ @BendingBender @@ -4208,11 +4207,12 @@ /types/react-copy-to-clipboard/ @mabels @BernabeFelix /types/react-copy-write/ @samhh @davej /types/react-countup/ @danielbrodin -/types/react-credit-cards/ @vstrimaitis @olefrank +/types/react-credit-cards/ @vstrimaitis @olefrank @zzanol /types/react-cropper/ @stepancar /types/react-css-collapse/ @dford07 /types/react-css-modules/ @KostyaEsmukov @skirsdeda /types/react-css-transition-replace/ @LKay +/types/react-csv/ @vincentjames501 /types/react-currency-formatter/ @pastushenkoy @Jeka-Vasiliev /types/react-custom-scrollbars/ @David-LeBlanc-git @kittimiyo /types/react-custom-scrollbars/v3/ @David-LeBlanc-git @@ -4226,7 +4226,7 @@ /types/react-dates/ @ArturAmpilogov @NathanNZ /types/react-daum-postcode/ @Sa-ryong /types/react-dev-utils/ @ark120202 -/types/react-dnd-multi-backend/ @dawnmist @beeequeue +/types/react-dnd-multi-backend/ @dawnmist @beeequeue @robcodemonkey /types/react-dnd-touch-backend/ @mleko @dawnmist @beeequeue /types/react-document-meta/ @ulrichb /types/react-document-title/ @cleverguy25 @@ -4457,7 +4457,7 @@ /types/react-rangeslider/ @RichieRock /types/react-recaptcha/ @mhegazy @zzanol /types/react-reconciler/ @Methuselah96 -/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf +/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf /types/react-redux/v6/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris /types/react-redux/v5/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva /types/react-redux-epic/ @forabi @@ -4876,6 +4876,7 @@ /types/seed-random/ @l-jonas /types/seededshuffle/ @urish /types/seedrandom/ @kernhanda +/types/seen/ @admvx /types/segment-analytics/ @fongandrew /types/select2/ @borisyankov @denisname /types/select2/v3/ @borisyankov @@ -5023,7 +5024,7 @@ /types/sizzle/ @leonard-thieu /types/sjcl/ @Evgenus /types/skatejs/ @Hotell -/types/sketchapp/ @manekinekko +/types/sketchapp/ @manekinekko @shikanime /types/ski/ @AyaMorisawa /types/skin-tone/ @BendingBender /types/skyway/ @nakakura @izmhr @@ -5251,6 +5252,7 @@ /types/summernote/ @wstaelens @nusantara-cloud /types/sumo-logger/ @forabi @clementallen /types/suncalc/ @horiuchi +/types/sunrise-sunset-js/ @hmajid2301 /types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer @theQuazz /types/superagent/v2/ @varju @NicoZelaya @mxl /types/superagent-bunyan/ @bricka @@ -5313,6 +5315,7 @@ /types/tableify/ @forivall /types/tabtab/ @vojtechhabarta @kamontat /types/tabulator/ @euginio +/types/tabulator-tables/ @jojoshua /types/tail/ @spacejack /types/tapable/ @e-cloud @johnnyreilly /types/tapable/v0/ @e-cloud @@ -5440,6 +5443,7 @@ /types/trianglify/ @unindented /types/trie-prefix-tree/ @jlismore /types/trim/ @skysteve +/types/trim-newlines/ @djcsdy /types/triple-beam/ @danwbyrne /types/triplesec/ @threesquared /types/trunk8/ @niemyjski @@ -5623,6 +5627,7 @@ /types/voronoi-diagram/ @michaelneu /types/vorpal/ @danwbyrne /types/vortex-web-client/ @Pro +/types/voucher-code-generator/ @JWebCoder /types/voximplant-websdk/ @aylarov /types/vue-chartkick/ @cnsmedia /types/vue-color/ @me From a29a526c915dbf7d74b7e02a9806afbeea4f7f28 Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Sun, 10 Mar 2019 22:33:20 +0300 Subject: [PATCH 240/265] TS version back to 2.3 I tested with 3.3 and thought the comment referred to the latest compatible version. But yes, 3.3 is not a requirement. --- types/mongo-sanitize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index aedff46b0b..1c5308d55c 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vkarpov15/mongo-sanitize // Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.3 +// TypeScript Version: 2.3 declare function sanitize(v: T): T; From ac041e3704e81a56b7c12d1dd2be4d5a6e302706 Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Sun, 10 Mar 2019 23:45:18 +0300 Subject: [PATCH 241/265] Version 2.7 import foo from "foo" from CommonJS modules is only possible since TS v2.7 --- types/mongo-sanitize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 1c5308d55c..cf187384a4 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vkarpov15/mongo-sanitize // Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.7 declare function sanitize(v: T): T; From f0e6c9792866d15cf439a44717832c6f447cc3c8 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 11 Mar 2019 09:09:21 -0700 Subject: [PATCH 242/265] Add missing authors. Uncovered by dtslint 0.5.4, which now requires that definitions cannot be by "My Self", which is the default from dts-gen. --- types/axe-webdriverjs/index.d.ts | 2 +- types/basicauth-middleware/index.d.ts | 2 +- types/bip32/index.d.ts | 2 +- types/braft-editor/index.d.ts | 2 +- types/cli-progress/index.d.ts | 2 +- types/config-yaml/index.d.ts | 2 +- types/jsreport-html-to-xlsx/index.d.ts | 2 +- types/jsreport-html-to-xlsx/v1/index.d.ts | 2 +- types/permit/index.d.ts | 2 +- types/pet-finder-api/index.d.ts | 2 +- types/provinces/index.d.ts | 2 +- types/react-blessed/index.d.ts | 2 +- types/react-native-tab-navigator/index.d.ts | 2 +- types/require-directory/index.d.ts | 2 +- types/urlencode/index.d.ts | 2 +- types/vue-color/index.d.ts | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 3c8ae27249..c3bf23f788 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for axe-webdriverjs 2.0 // Project: https://github.com/dequelabs/axe-webdriverjs#readme -// Definitions by: My Self +// Definitions by: Joshua Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/basicauth-middleware/index.d.ts b/types/basicauth-middleware/index.d.ts index 21e3a27ad8..38aedd850b 100644 --- a/types/basicauth-middleware/index.d.ts +++ b/types/basicauth-middleware/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for basicauth-middleware 3.1 // Project: https://github.com/nchaulet/basicauth-middleware -// Definitions by: My Self +// Definitions by: Nicolas Chaulet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/bip32/index.d.ts b/types/bip32/index.d.ts index c536f741af..e76deef810 100644 --- a/types/bip32/index.d.ts +++ b/types/bip32/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for bip32 1.0 // Project: https://github.com/bitcoinjs/bip32#readme -// Definitions by: My Self +// Definitions by: eduhenke // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/braft-editor/index.d.ts b/types/braft-editor/index.d.ts index 62f339a41b..0edeb34b2c 100644 --- a/types/braft-editor/index.d.ts +++ b/types/braft-editor/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for braft-editor 1.9 // Project: https://github.com/margox/braft#readme -// Definitions by: My Self +// Definitions by: Jonny Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/cli-progress/index.d.ts b/types/cli-progress/index.d.ts index 3ac9dfe8a3..4c2c516d37 100644 --- a/types/cli-progress/index.d.ts +++ b/types/cli-progress/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for cli-progress 1.8 // Project: https://github.com/AndiDittrich/Node.CLI-Progress -// Definitions by: My Self +// Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/config-yaml/index.d.ts b/types/config-yaml/index.d.ts index 6f2be7957b..2b4e07628d 100644 --- a/types/config-yaml/index.d.ts +++ b/types/config-yaml/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for config-yaml 1.1 // Project: https://github.com/neolao/config-yaml#readme -// Definitions by: My Self +// Definitions by: Arylo Yeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/jsreport-html-to-xlsx/index.d.ts b/types/jsreport-html-to-xlsx/index.d.ts index 83ac765c1f..85850dcbe7 100644 --- a/types/jsreport-html-to-xlsx/index.d.ts +++ b/types/jsreport-html-to-xlsx/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jsreport-html-to-xlsx 2.0 // Project: https://github.com/jsreport/jsreport-html-to-xlsx -// Definitions by: My Self +// Definitions by: Tao Quifeng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/jsreport-html-to-xlsx/v1/index.d.ts b/types/jsreport-html-to-xlsx/v1/index.d.ts index 84b37480aa..8801d637a2 100644 --- a/types/jsreport-html-to-xlsx/v1/index.d.ts +++ b/types/jsreport-html-to-xlsx/v1/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jsreport-html-to-xlsx 1.4 // Project: https://github.com/jsreport/jsreport-html-to-xlsx -// Definitions by: My Self +// Definitions by: Tao Quifeng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/permit/index.d.ts b/types/permit/index.d.ts index b0c2db9b42..961aee845b 100644 --- a/types/permit/index.d.ts +++ b/types/permit/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for permit 0.2 // Project: https://github.com/ianstormtaylor/permit#readme -// Definitions by: My Self +// Definitions by: Jannik Keye // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pet-finder-api/index.d.ts b/types/pet-finder-api/index.d.ts index e438bda1c2..39855aab1a 100644 --- a/types/pet-finder-api/index.d.ts +++ b/types/pet-finder-api/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for pet-finder-api 1.0 // Project: https://github.com/drlukeangel/Pet-Finder-API-Javascript-Library -// Definitions by: My Self +// Definitions by: ncipollina // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare function petFinder(api_key: string, api_secret: string, options?: any): petFinder.PetFinder; diff --git a/types/provinces/index.d.ts b/types/provinces/index.d.ts index 2601d14da4..17d59ee03d 100644 --- a/types/provinces/index.d.ts +++ b/types/provinces/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for provinces 1.11 // Project: https://github.com/substack/provinces -// Definitions by: My Self +// Definitions by: William Lohan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare global { diff --git a/types/react-blessed/index.d.ts b/types/react-blessed/index.d.ts index 33c9fe2790..46d0e7e495 100644 --- a/types/react-blessed/index.d.ts +++ b/types/react-blessed/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-blessed 0.3 // Project: https://github.com/yomguithereal/react-blessed#readme -// Definitions by: My Self +// Definitions by: Century Guo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-native-tab-navigator/index.d.ts b/types/react-native-tab-navigator/index.d.ts index 1586b7279a..7ee7a52cf2 100644 --- a/types/react-native-tab-navigator/index.d.ts +++ b/types/react-native-tab-navigator/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-native-tab-navigator 0.3 // Project: https://github.com/exponentjs/react-native-tab-navigator#readme -// Definitions by: My Self +// Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/require-directory/index.d.ts b/types/require-directory/index.d.ts index bd2b520865..5d45f66f00 100644 --- a/types/require-directory/index.d.ts +++ b/types/require-directory/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for require-directory 2.1 // Project: https://github.com/troygoode/node-require-directory/ -// Definitions by: My Self +// Definitions by: Ihor Chulinda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 /// diff --git a/types/urlencode/index.d.ts b/types/urlencode/index.d.ts index 451626cb79..a32e7bea25 100644 --- a/types/urlencode/index.d.ts +++ b/types/urlencode/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for urlencode 1.1 // Project: https://github.com/node-modules/urlencode -// Definitions by: My Self +// Definitions by: kimcoder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface charsetParam { diff --git a/types/vue-color/index.d.ts b/types/vue-color/index.d.ts index 758d823589..0d59b5965e 100644 --- a/types/vue-color/index.d.ts +++ b/types/vue-color/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for vue-color 2.4 // Project: https://github.com/xiaokaike/vue-color#readme -// Definitions by: My Self +// Definitions by: Clément Flodrops // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 From d3bd440fbd8329b6e42d003ede04f6115cd1ca1a Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 11 Mar 2019 19:49:48 +0200 Subject: [PATCH 243/265] @types/chart.js: changed getElementAtEvent to single array object (#33765) --- types/chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index c601631280..8da7ed0814 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -33,7 +33,7 @@ declare class Chart { clear: () => {}; toBase64Image: () => string; generateLegend: () => {}; - getElementAtEvent: (e: any) => {}; + getElementAtEvent: (e: any) => [{}]; getElementsAtEvent: (e: any) => Array<{}>; getDatasetAtEvent: (e: any) => Array<{}>; getDatasetMeta: (index: number) => Meta; From 5070350d6003b440a8aca2241bfb5a15064e62a1 Mon Sep 17 00:00:00 2001 From: Sine Date: Mon, 11 Mar 2019 13:52:11 -0400 Subject: [PATCH 244/265] Relaxed React.ComponentType-extending definitions (#33729) --- types/storybook__addon-info/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index 6adc628c31..ed0f9a78d3 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -20,10 +20,10 @@ export interface Options { header?: boolean; inline?: boolean; source?: boolean; - propTables?: React.ComponentType[] | false; - propTablesExclude?: React.ComponentType[]; + propTables?: Array> | false; + propTablesExclude?: Array>; styles?: object; - components?: { [key: string]: React.ComponentType }; + components?: { [key: string]: React.ComponentType }; marksyConf?: object; maxPropsIntoLine?: number; maxPropObjectKeys?: number; From d4d4d3a2fac22cc68b9cd5a6a3c4d7575c51f5c9 Mon Sep 17 00:00:00 2001 From: Zhang Yi Jiang Date: Tue, 12 Mar 2019 01:53:12 +0800 Subject: [PATCH 245/265] Update React Leaflet with viewport, VideoOverlay, backport whenReady and DivOverlay (#33679) * Add onviewportchange map props * Backport viewport related changes * Backport DivOverlay * Add whenReady prop * Add VideoOverlay component * Fic version number * Fix viewport events * Update Map instance viewport methods * Add example code as tests * Fix lint --- types/react-leaflet/index.d.ts | 19 ++++- types/react-leaflet/react-leaflet-tests.tsx | 37 +++++----- types/react-leaflet/v1/index.d.ts | 52 ++++++++++++-- .../react-leaflet/v1/react-leaflet-tests.tsx | 71 +++++++++++++++++++ 4 files changed, 154 insertions(+), 25 deletions(-) diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index 04fe17a04f..0b997341ce 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -146,6 +146,8 @@ export interface MapProps extends MapEvents, Leaflet.MapOptions, Leaflet.LocateO useFlyTo?: boolean; viewport?: Viewport; whenReady?: () => void; + onViewportChange?: (viewport: Viewport) => void; + onViewportChanged?: (viewport: Viewport) => void; } export class Map

extends MapEvented { @@ -155,8 +157,8 @@ export class Map

void; - onViewportChanged: (viewport: Viewport | null) => void; + onViewportChange: () => void; + onViewportChanged: () => void; bindContainer(container: HTMLDivElement | null | undefined): void; shouldUpdateCenter(next: Leaflet.LatLngExpression, prev: Leaflet.LatLngExpression): boolean; shouldUpdateBounds(next: Leaflet.LatLngBoundsExpression, prev: Leaflet.LatLngBoundsExpression): boolean; @@ -276,6 +278,19 @@ export class ImageOverlay

extends MapLayer { + createLeafletElement(props: P): E; + updateLeafletElement(fromProps: P, toProps: P): void; +} + export class LayerGroup

extends MapLayer { createLeafletElement(props: P): E; } diff --git a/types/react-leaflet/react-leaflet-tests.tsx b/types/react-leaflet/react-leaflet-tests.tsx index 5d1fc2ce7e..2d7a6b1078 100644 --- a/types/react-leaflet/react-leaflet-tests.tsx +++ b/types/react-leaflet/react-leaflet-tests.tsx @@ -634,17 +634,18 @@ export class VectorLayersExample extends Component { } // viewport.js - -const viewportCenter: [number, number] = [51.505, -0.09]; - -const DEFAULT_VIEWPORT = { - center: viewportCenter, - zoom: 13 +const DEFAULT_VIEWPORT: Viewport = { + center: [51.505, -0.09], + zoom: 13, }; -export class ViewportExample extends Component { +interface ViewportExampleState { + viewport: Viewport; +} + +class ViewportExample extends Component { state = { - viewport: DEFAULT_VIEWPORT + viewport: DEFAULT_VIEWPORT, }; onClickReset = () => { @@ -657,15 +658,15 @@ export class ViewportExample extends Component - - + + + ); } } @@ -811,4 +812,4 @@ class CustomPolygon extends Path { ); } } -const leafletComponent = withLeaflet(CustomPolygon); +const leafletComponent = withLeaflet(CustomPolygon); diff --git a/types/react-leaflet/v1/index.d.ts b/types/react-leaflet/v1/index.d.ts index c362a1f23c..ac35e98a72 100644 --- a/types/react-leaflet/v1/index.d.ts +++ b/types/react-leaflet/v1/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-leaflet 1.1 +// Type definitions for react-leaflet 1.9 // Project: https://github.com/PaulLeCam/react-leaflet // Definitions by: Dave Leaver , David Schneider , Yui T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,6 +12,11 @@ import * as React from 'react'; export type Children = React.ReactNode | React.ReactNode[]; +export interface Viewport { + center: [number, number] | null | undefined; + zoom: number | null | undefined; +} + export interface MapEvents { onclick?(event: Leaflet.LeafletMouseEvent): void; ondblclick?(event: Leaflet.LeafletMouseEvent): void; @@ -140,18 +145,42 @@ export interface MapProps extends MapEvents, Leaflet.MapOptions, Leaflet.LocateO minZoom?: number; style?: React.CSSProperties; useFlyTo?: boolean; + viewport?: Viewport; + whenReady?: () => void; zoom?: number; + onViewportChange?: (viewport: Viewport) => void; + onViewportChanged?: (viewport: Viewport) => void; } export class Map

extends MapComponent { className?: string; container: HTMLDivElement; + viewport: Viewport; getChildContext(): { layerContainer: E, map: E }; createLeafletElement(props: P): E; updateLeafletElement(fromProps: P, toProps: P): void; bindContainer(container: HTMLDivElement): void; shouldUpdateCenter(next: Leaflet.LatLngExpression, prev: Leaflet.LatLngExpression): boolean; shouldUpdateBounds(next: Leaflet.LatLngBoundsExpression, prev: Leaflet.LatLngBoundsExpression): boolean; + onViewportChange: () => void; + onViewportChanged: () => void; +} + +export interface DivOverlayProps extends Leaflet.DivOverlayOptions { + children: Children; + onClose?: () => void; + onOpen?: () => void; +} + +export interface DivOverlayTypes extends Leaflet.Evented { + isOpen: () => boolean; + update: () => void; +} + +export class DivOverlay

extends MapComponent { + onClose: () => void; + onOpen: () => void; + onRender: () => void; } export interface PaneProps { @@ -213,6 +242,19 @@ export class ImageOverlay

extends MapLayer { + getChildContext(): { popupContainer: E }; +} + export interface LayerGroupProps { children?: Children; } @@ -284,10 +326,10 @@ export interface RectangleProps extends PathEvents, Leaflet.PolylineOptions { } export class Rectangle

extends Path { } -export interface PopupProps extends Leaflet.PopupOptions { - children?: Children; +export interface PopupProps extends DivOverlayProps, Leaflet.PopupOptions { position?: Leaflet.LatLngExpression; } + export class Popup

extends MapComponent { onPopupOpen(arg: { popup: E }): void; onPopupClose(arg: { popup: E }): void; @@ -295,9 +337,9 @@ export class Popup

extends MapComponent { onTooltipOpen(arg: { tooltip: E }): void; onTooltipClose(arg: { tooltip: E }): void; diff --git a/types/react-leaflet/v1/react-leaflet-tests.tsx b/types/react-leaflet/v1/react-leaflet-tests.tsx index fe9825c465..cc461d1097 100644 --- a/types/react-leaflet/v1/react-leaflet-tests.tsx +++ b/types/react-leaflet/v1/react-leaflet-tests.tsx @@ -24,6 +24,8 @@ import { Rectangle, TileLayer, Tooltip, + Viewport, + VideoOverlay, WMSTileLayer, ZoomControl } from 'react-leaflet'; @@ -628,6 +630,75 @@ export class VectorLayersExample extends Component { } } +// viewport.js +const DEFAULT_VIEWPORT: Viewport = { + center: [51.505, -0.09], + zoom: 13, +}; + +interface ViewportExampleState { + viewport: Viewport; +} + +export class ViewportExample extends Component { + state = { + viewport: DEFAULT_VIEWPORT, + }; + + onClickReset = () => { + this.setState({ viewport: DEFAULT_VIEWPORT }); + } + + onViewportChanged = (viewport: Viewport) => { + this.setState({ viewport }); + } + + render() { + return ( + + + + ); + } +} + +// video-overlay.js +interface VideoOverlayExampleState { + play: boolean; +} + +export class VideoOverlayExample extends Component { + state = { + play: true, + }; + + onTogglePlay = () => { + this.setState({ play: !this.state.play }); + } + + render() { + return ( + + + + + ); + } +} + // wms-tile-layer.js interface WMSTileLayerExampleState { lat: number; From 15238ee4236a963a32897ae47e7e8cb1c0147a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20H=C3=A4nninen?= Date: Mon, 11 Mar 2019 19:54:42 +0200 Subject: [PATCH 246/265] (kue) Enable the use of the three-parameter ProcessCallback (#33720) * Enable the use of the three-parameter ProcessCallback * Add test for workerctx in the process callback --- types/kue/index.d.ts | 14 ++++++++++++-- types/kue/kue-tests.ts | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/types/kue/index.d.ts b/types/kue/index.d.ts index 9153039ff0..f6aa357e66 100644 --- a/types/kue/index.d.ts +++ b/types/kue/index.d.ts @@ -33,7 +33,8 @@ export declare class Queue extends events.EventEmitter { checkActiveJobTtl(ttlOptions: Object): void; watchStuckJobs(ms: number): void; setting(name: string, fn: Function): Queue; - process(type: string, n?: number | ProcessCallback, fn?: ProcessCallback): void; + process(type: string, fn?: ProcessCallback): void; + process(type: string, n: number, fn?: ProcessCallback): void; shutdown(timeout: number, fn: Function): Queue; shutdown(timeout: number, type: string, fn: Function): Queue; types(fn: Function): Queue; @@ -63,7 +64,9 @@ interface Priorities { export type DoneCallback = (err?: any, result?: any) => void; export type JobCallback = (err?: any, job?: Job) => void; -export type ProcessCallback = (job: Job, cb: DoneCallback) => void; +export type ProcessCallback = + | ((job: Job, cb: DoneCallback) => void) + | ((job: Job, ctx: WorkerCtx, cb: DoneCallback) => void); export declare class Job extends events.EventEmitter { public id: number; @@ -144,6 +147,13 @@ declare class Worker extends events.EventEmitter { resume(): boolean; } +interface WorkerCtx { + pause(fn?: DoneCallback): void; + pause(timeout: number, fn?: DoneCallback): void; + resume(): void; + shutdown(): void; +} + interface Redis { configureFactory(options: Object, queue: Queue): void; createClient(): redisClientFactory.RedisClient; diff --git a/types/kue/kue-tests.ts b/types/kue/kue-tests.ts index 9234101e05..552bca1ddf 100644 --- a/types/kue/kue-tests.ts +++ b/types/kue/kue-tests.ts @@ -79,6 +79,14 @@ var processCb = function(job: kue.Job, done: kue.DoneCallback) { jobs.process('video conversion', 1, processCb); jobs.process('video conversion', processCb); +// Use of WorkerCtx, https://github.com/Automattic/kue#pause-processing +jobs.process('email', function(job, ctx, done) { + ctx.pause(5000, function (err) { + console.log('Worker is paused...'); + setTimeout(function() { ctx.resume(); }, 10000); + }); +}); + function convertFrame(i: number, fn: Function) { setTimeout(() => fn(null, Math.random()), Math.random() * 50); } From 06618cf2979dfaec7a6b00af79038ab854f1a50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Baumeyer=20K=C3=A9vin?= Date: Mon, 11 Mar 2019 18:55:07 +0100 Subject: [PATCH 247/265] Remove chai-http as it bundle its own type since v4.2.0 (#33722) --- notNeededPackages.json | 18 ++-- types/chai-http/chai-http-tests.ts | 141 ----------------------------- types/chai-http/index.d.ts | 78 ---------------- types/chai-http/tsconfig.json | 24 ----- types/chai-http/tslint.json | 1 - 5 files changed, 12 insertions(+), 250 deletions(-) delete mode 100644 types/chai-http/chai-http-tests.ts delete mode 100644 types/chai-http/index.d.ts delete mode 100644 types/chai-http/tsconfig.json delete mode 100644 types/chai-http/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 24f1f0e0e0..7638e7304a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -228,6 +228,12 @@ "sourceRepoURL": "https://github.com/interactivethings/catalog", "asOfVersion": "3.5.0" }, + { + "libraryName": "chai-http", + "typingsPackageName": "chai-http", + "sourceRepoURL": "https://github.com/chaijs/chai-http", + "asOfVersion": "4.2.0" + }, { "libraryName": "chalk", "typingsPackageName": "chalk", @@ -1176,12 +1182,6 @@ "sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme", "asOfVersion": "2.15.0" }, - { - "libraryName": "png-async", - "typingsPackageName": "png-async", - "sourceRepoURL": "https://github.com/kanreisa/node-png-async", - "asOfVersion": "0.9.4" - }, { "libraryName": "node-waves", "typingsPackageName": "node-waves", @@ -1344,6 +1344,12 @@ "sourceRepoURL": "http://plottablejs.org/", "asOfVersion": "3.7.0" }, + { + "libraryName": "png-async", + "typingsPackageName": "png-async", + "sourceRepoURL": "https://github.com/kanreisa/node-png-async", + "asOfVersion": "0.9.4" + }, { "libraryName": "poly2tri.js", "typingsPackageName": "poly2tri", diff --git a/types/chai-http/chai-http-tests.ts b/types/chai-http/chai-http-tests.ts deleted file mode 100644 index 37a4df794e..0000000000 --- a/types/chai-http/chai-http-tests.ts +++ /dev/null @@ -1,141 +0,0 @@ -import fs = require('fs'); -import http = require('http'); -import chai = require('chai'); -import ChaiHttp = require('chai-http'); -import when = require('when'); - -chai.use(ChaiHttp); - -// ReSharper disable WrongExpressionStatement - -// Add promise support if this does not exist natively. -if (!global.Promise) { - chai.request.addPromises(when.promise); -} - -declare const app: http.Server; - -chai.request(app).get('/'); -chai.request('http://localhost:8080').get('/'); - -chai.request(app) - .put('/user/me') - .set('X-API-Key', 'foobar') - .send({ password: '123', confirmPassword: '123' }); - -chai.request(app) - .post('/user/me') - .field('_method', 'put') - .field('password', '123') - .field('confirmPassword', '123'); - -chai.request(app) - .post('/user/avatar') - .attach('imageField', fs.readFileSync('avatar.png'), 'avatar.png'); - -chai.request(app) - .get('/protected') - .auth('user', 'pass'); - -// HTTPS request, from: https://github.com/visionmedia/superagent/commit/6158efbf42cb93d77c1a70887284be783dd7dabe -const ca = fs.readFileSync('ca.cert.pem'); -const key = fs.readFileSync('key.pem'); -const cert = fs.readFileSync('cert.pem'); -const callback = (err: any, res: ChaiHttp.Response) => {}; - -chai.request(app) - .post('/secure') - .ca(ca) - .key(key) - .cert(cert) - .end(callback); - -const pfx = fs.readFileSync('cert.pfx'); -chai.request(app) - .post('/secure') - .pfx(pfx) - .end(callback); - -chai.request(app) - .get('/search') - .query({ name: 'foo', limit: 10 }); - -chai.request(app) - .get('/download') - .buffer() - .parse((res, cb) => { - let data = ''; - res.setEncoding('binary'); - res.on('data', (chunk: any) => { data += chunk; }); - res.on('end', () => { cb(undefined, new Buffer(data, 'binary')); }); - }); - -chai.request(app) - .put('/user/me') - .send({ passsword: '123', confirmPassword: '123' }) - .end((err: any, res: ChaiHttp.Response) => { - chai.expect(err).to.be.null; - chai.expect(res).to.have.status(200); - }); - -chai.request(app) - .put('/user/me') - .send({ passsword: '123', confirmPassword: '123' }) - .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)) - .catch((err: any) => { throw err; }); - -chai.request(app) - .keepOpen() - .close((err: any) => { throw err; }); - -const agent = chai.request.agent(app); - -agent - .post('/session') - .send({ username: 'me', password: '123' }) - .then((res: ChaiHttp.Response) => { - chai.expect(res).to.have.cookie('sessionid'); - // The `agent` now has the sessionid cookie saved, and will send it - // back to the server in the next request: - return agent.get('/user/me') - .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)); - }); - -agent.close((err: any) => { throw err; }); - -function test1() { - const req = chai.request(app).get('/'); - req.then((res: ChaiHttp.Response) => { - chai.expect(res).to.have.status(200); - chai.expect(res).to.have.header('content-type', 'text/plain'); - chai.expect(res).to.have.header('content-type', /^text/); - chai.expect(res).to.have.headers; - chai.expect('127.0.0.1').to.be.an.ip; - chai.expect(res).to.be.json; - chai.expect(res).to.be.html; - chai.expect(res).to.be.text; - chai.expect(res).to.redirect; - chai.expect(res).to.redirectTo('http://example.com'); - chai.expect(res).to.have.param('orderby'); - chai.expect(res).to.have.param('orderby', 'date'); - chai.expect(res).to.not.have.param('limit'); - chai.expect(req).to.have.cookie('session_id'); - chai.expect(req).to.have.cookie('session_id', '1234'); - chai.expect(req).to.not.have.cookie('PHPSESSID'); - chai.expect(res).to.have.cookie('session_id'); - chai.expect(res).to.have.cookie('session_id', '1234'); - chai.expect(res).to.not.have.cookie('PHPSESSID'); - chai.expect(res.body).to.have.property('version', '4.0.0'); - chai.expect(res.text).to.equal(''); - }, (err: any) => { - throw err; - }); -} - -when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure')); - -Promise.resolve(1) - .then(val => chai.request(app).get(`/user/${val}`)) - .then(res => { - chai.expect(res).to.have.status(200); - }); diff --git a/types/chai-http/index.d.ts b/types/chai-http/index.d.ts deleted file mode 100644 index de3caa13e7..0000000000 --- a/types/chai-http/index.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Type definitions for chai-http 3.0 -// Project: https://github.com/chaijs/chai-http -// Definitions by: Wim Looman -// Liam Jones -// Federico Caselli -// Bas Luksenburg -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// -/// - -import * as request from 'superagent'; - -declare global { - namespace Chai { - interface ChaiStatic { - request: ChaiHttpRequest; - } - - interface ChaiHttpRequest { - (server: any): ChaiHttp.Agent; - agent(server: any): ChaiHttp.Agent; - addPromises(promiseConstructor: any): void; - } - - interface Assertion { - status(code: number): Assertion; - header(key: string, value?: string | RegExp): Assertion; - headers: Assertion; - json: Assertion; - text: Assertion; - html: Assertion; - redirect: Assertion; - redirectTo(location: string): Assertion; - param(key: string, value?: string): Assertion; - cookie(key: string, value?: string): Assertion; - } - - interface TypeComparison { - ip: Assertion; - } - } - - namespace ChaiHttp { - interface Promise { - then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise; - } - - interface Response { - body: any; - type: string; - status: number; - text: string; - setEncoding(encoding: string): void; - on(event: string, fn: (...args: any[]) => void): void; - } - - interface Agent { - get(url: string, callback?: (err: any, res: Response) => void): request.Request; - post(url: string, callback?: (err: any, res: Response) => void): request.Request; - put(url: string, callback?: (err: any, res: Response) => void): request.Request; - head(url: string, callback?: (err: any, res: Response) => void): request.Request; - del(url: string, callback?: (err: any, res: Response) => void): request.Request; - options(url: string, callback?: (err: any, res: Response) => void): request.Request; - patch(url: string, callback?: (err: any, res: Response) => void): request.Request; - keepOpen(): Agent; - close(callback?: (err: any) => void): Agent; - } - - interface TypeComparison { - ip: any; - } - } -} - -declare function chaiHttp(chai: any, utils: any): void; -export = chaiHttp; diff --git a/types/chai-http/tsconfig.json b/types/chai-http/tsconfig.json deleted file mode 100644 index 45d92cf188..0000000000 --- a/types/chai-http/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "chai-http-tests.ts" - ] -} \ No newline at end of file diff --git a/types/chai-http/tslint.json b/types/chai-http/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/chai-http/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 607a0d0b4f270032698eb42907d54a456002b752 Mon Sep 17 00:00:00 2001 From: TMTron Date: Mon, 11 Mar 2019 18:55:36 +0100 Subject: [PATCH 248/265] DataZoom.Slider: fillColor must be fillerColor (#33733) --- types/echarts/index.d.ts | 1 + types/echarts/options/data-zoom.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index 5d40c148f6..873060c5f4 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -6,6 +6,7 @@ // Ovilia // Roman // Bilal +// TMTron // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/echarts/options/data-zoom.d.ts b/types/echarts/options/data-zoom.d.ts index 2ed18582ef..fa57f73a14 100644 --- a/types/echarts/options/data-zoom.d.ts +++ b/types/echarts/options/data-zoom.d.ts @@ -66,7 +66,7 @@ declare namespace echarts { show?: boolean; backgroundColor?: string; dataBackground?: object; - fillColor?: string; + fillerColor?: string; borderColor?: string; handleIcon?: string; handleSize?: number; From 0783a54bfa8b5711b9f9b6cb9e89ab946079ab98 Mon Sep 17 00:00:00 2001 From: H Date: Tue, 12 Mar 2019 02:56:27 +0900 Subject: [PATCH 249/265] @types/vue-select: Fix VueSelectProps interface property (#33735) * fix and add VueSelectProps interface property. * fix missing semi --- types/vue-select/index.d.ts | 12 ++++++++++-- types/vue-select/vue-select-tests.ts | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index ff8767e189..e022fb65ea 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vue-select 2.4 +// Type definitions for vue-select 2.5 // Project: https://github.com/sagalbot/vue-select#readme // Definitions by: Ilia Beliaev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,6 +14,7 @@ export interface VueSelectProps { value: any; options: any[]; disabled: boolean; + clearable: boolean; maxHeight: string; searchable: boolean; multiple: boolean; @@ -22,17 +23,24 @@ export interface VueSelectProps { clearSearchOnSelect: boolean; closeOnSelect: boolean; label: string; + autocomplete: string; + index: string | null; getOptionLabel: (option: any) => string; - onChange: OptionConsumer; + onChange: (val: any) => void; + onInput: (val: any) => void; + onTab: () => void; taggable: boolean; tabindex: number | null; pushTags: boolean; filterable: boolean; + filterBy: (option: any, label: string, search: string) => boolean; + filter: (options: any[], search: string) => boolean; createOption: (option: any) => any; resetOnOptionsChange: boolean; noDrop: boolean; inputId: string | null; dir: string; + selectOnTab: boolean; } export interface VueSelectData { diff --git a/types/vue-select/vue-select-tests.ts b/types/vue-select/vue-select-tests.ts index 8fea33b2dc..6d4b61b2a8 100644 --- a/types/vue-select/vue-select-tests.ts +++ b/types/vue-select/vue-select-tests.ts @@ -31,8 +31,18 @@ new Vue({ optionToOption(option: any) { return option; }, + onValChange(val: any) { + }, + onVoidTab() { + }, onSearch(search: string, loading: (b: boolean) => void) { loading(true); + }, + optionFilterBy(option: any, label: string, search: string) { + return true; + }, + optionsFilter(options: any[], search: string) { + return true; } }, template: ` @@ -40,6 +50,7 @@ new Vue({ :value="value" :options="options" disable="false" + clearable="true" maxHeight="200" searchable="true" multiple="false" @@ -48,16 +59,23 @@ new Vue({ clearSearchOnSelect="false" :closeOnSelect="false" label="name" + autocomplete="off" + :index="null" :getOptionLabel="getOptionLabel" - :onChange="optionConsumer" + :onChange="onValChange" + :onInput="onValChange" + :onTab="onVoidTab" :taggable="true" :tabindex="null" pushTags="false" + :filterBy="optionFilterBy" + :filter="optionsFilter" :createOption="optionToOption" resetOnOptionsChange="false" noDrop="true" :inputId="null" dir="someDir" + selectOnTab="false" @search="onSearch" @input="optionConsumer"> From cb392e576faacccd6c573c9984a7d3e03d7cc6ac Mon Sep 17 00:00:00 2001 From: Benjamin Humphrey Date: Tue, 12 Mar 2019 04:57:46 +1100 Subject: [PATCH 250/265] Remove type definitions for zapier-platform-core (#33757) --- notNeededPackages.json | 6 + types/zapier-platform-core/index.d.ts | 119 ------------------ types/zapier-platform-core/tsconfig.json | 23 ---- types/zapier-platform-core/tslint.json | 1 - .../zapier-platform-core-tests.ts | 100 --------------- 5 files changed, 6 insertions(+), 243 deletions(-) delete mode 100644 types/zapier-platform-core/index.d.ts delete mode 100644 types/zapier-platform-core/tsconfig.json delete mode 100644 types/zapier-platform-core/tslint.json delete mode 100644 types/zapier-platform-core/zapier-platform-core-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 7638e7304a..bd141916cf 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -2040,6 +2040,12 @@ "sourceRepoURL": "none", "asOfVersion": "2.1.0" }, + { + "libraryName": "zapier-platform-core", + "typingsPackageName": "zapier-platform-core", + "sourceRepoURL": "https://github.com/zapier/zapier-platform-core", + "asOfVersion": "6.1.0" + }, { "libraryName": "zetapush-js", "typingsPackageName": "zetapush-js", diff --git a/types/zapier-platform-core/index.d.ts b/types/zapier-platform-core/index.d.ts deleted file mode 100644 index ec9f3de919..0000000000 --- a/types/zapier-platform-core/index.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -// Type definitions for zapier-platform-core 3.1 -// Project: https://github.com/zapier/zapier-platform-core, https://zapier.com -// Definitions by: Bradley Ayers -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -/// - -import * as http from "http"; - -export function createAppHandler(appRawOrPath: object | string): (event: any, context: any, callback: any) => void; -export function createAppTester(appRawOrPath: object | string): Promise; -export function integrationTestHandler(event: any, context: any, callback: any): any; -export const version: string; - -export interface HttpRequestOptions { - url?: string; - method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH" | "PUT"; - body?: string | Buffer | NodeJS.ReadableStream | object | null; - headers?: { [name: string]: string }; - json?: object | any[] | null; - params?: object; - form?: object | null; - raw?: boolean; - redirect?: "manual" | "error" | "follow"; - follow?: number; - compress?: boolean; - agent?: http.Agent | null; - timeout?: number; - size?: number; -} - -export interface HttpResponse { - status: number; - content: string | Buffer; - json: object | undefined | Promise; - body?: NodeJS.ReadableStream; - headers: { [key: string]: string }; - getHeader(key: string): string | undefined; - throwForStatus(): void; - request: HttpRequestOptions; -} - -export class HaltedError extends Error {} -export class ExpiredAuthError extends Error {} -export class RefreshAuthError extends Error {} - -export interface Z { - request(options: HttpRequestOptions): Promise; - request(url: string, options?: HttpRequestOptions): Promise; - JSON: typeof JSON; - console: Console; - hash(alg: string, data: string): any; - errors: { - RefreshAuthError: { - new (message?: string): HaltedError; - new (message?: string): ExpiredAuthError; - new (message?: string): RefreshAuthError; - }; - }; - stashFile: (promise: Promise, knownLength?: number | string, filename?: string, contentType?: string) => Promise; - dehydrate: (callback: (z: Z, bundle: Bundle) => any, inputData: T) => string; -} - -export interface AuthData { - access_token: string; - refresh_token?: string; -} - -export interface Bundle { - authData: AuthData; - inputData: InputData; -} - -export interface AuthorizeUrlBundle { - inputData: InputData; -} - -export interface GetAccessTokenBundle { - inputData: InputData & { - code: string; - }; -} - -export interface RefreshAccessTokenBundle { - inputData: InputData; - authData: AuthData; -} - -export interface OAuth2Authentication { - type: "oauth2"; - connectionLabel: string; - oauth2Config: { - authorizeUrl: - | string - | (( - z: Z, - bundle: AuthorizeUrlBundle - ) => string | Promise) - | HttpRequestOptions; - getAccessToken: - | (( - z: Z, - bundle: GetAccessTokenBundle - ) => AuthData | Promise) - | HttpRequestOptions; - refreshAccessToken?: - | (( - z: Z, - bundle: RefreshAccessTokenBundle - ) => AuthData | Promise) - | HttpRequestOptions; - autoRefresh: boolean; - scope?: string; - }; - test: - | ((z: Z, bundle: Bundle) => boolean | Promise) - | { url: string }; -} diff --git a/types/zapier-platform-core/tsconfig.json b/types/zapier-platform-core/tsconfig.json deleted file mode 100644 index c197914893..0000000000 --- a/types/zapier-platform-core/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "zapier-platform-core-tests.ts" - ] -} \ No newline at end of file diff --git a/types/zapier-platform-core/tslint.json b/types/zapier-platform-core/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/zapier-platform-core/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/zapier-platform-core/zapier-platform-core-tests.ts b/types/zapier-platform-core/zapier-platform-core-tests.ts deleted file mode 100644 index 6c6c490edd..0000000000 --- a/types/zapier-platform-core/zapier-platform-core-tests.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as zapier from "zapier-platform-core"; - -const BASE_URL = "http://example.com"; -const OAUTH2_CLIENT_ID = "12345"; -const OAUTH2_CLIENT_SECRET = "abcdef"; - -const authentication: zapier.OAuth2Authentication = { - type: "oauth2", - connectionLabel: "User account", - oauth2Config: { - authorizeUrl: `${BASE_URL}/oauth2/authorize`, - - getAccessToken: async (z, bundle) => { - const response = await z.request(`${BASE_URL}/oauth2/access`, { - method: "POST", - body: { - code: bundle.inputData.code, - client_id: OAUTH2_CLIENT_ID, - client_secret: OAUTH2_CLIENT_SECRET, - grant_type: "authorization_code" - } - }); - - if (response.status !== 200) { - throw new Error( - "Unable to fetch access token: " + response.content - ); - } - - if (typeof response.content !== "string") { - throw new Error( - `Unable to response content, expected string but got ${typeof response.content}.` - ); - } - - const result = z.JSON.parse(response.content); - return { - access_token: result.access_token, - refresh_token: result.refresh_token - }; - }, - - refreshAccessToken: async (z, bundle) => { - if (!bundle.authData.refresh_token) { - throw new Error( - "Required `bundle.authData.refresh_token` field missing." - ); - } - - const response = await z.request(`${BASE_URL}/oauth2/refresh`, { - method: "POST", - body: { - refresh_token: bundle.authData.refresh_token, - client_id: OAUTH2_CLIENT_ID, - client_secret: OAUTH2_CLIENT_SECRET, - grant_type: "refresh_token" - } - }); - - if (response.status !== 200) { - throw new Error( - "Unable to fetch access token: " + response.content - ); - } - - if (typeof response.content !== "string") { - throw new Error( - `Unable to response content, expected string but got ${typeof response.content}.` - ); - } - - const result = z.JSON.parse(response.content); - return { - access_token: result.access_token, - refresh_token: bundle.authData.refresh_token - }; - }, - - autoRefresh: true, - - scope: "read,write" - }, - - test: async z => { - const response = await z.request(`${BASE_URL}/oauth2/test`); - - if (response.status === 401) { - throw new Error("The access token you supplied is not valid"); - } - - return true; - } -}; - -zapier.version; - -const testCreateAppTester = async () => { - const zapierApp = {}; - const appTester = await zapier.createAppTester(zapierApp); -}; From 5e9a081b548887ae1dd24db41fa49d3d71869bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20S=C3=A4mskar?= Date: Mon, 11 Mar 2019 18:58:09 +0100 Subject: [PATCH 251/265] Add definitions for Expo SplashScreen (#33766) --- types/expo/expo-tests.tsx | 6 ++++++ types/expo/index.d.ts | 9 +++++++++ types/expo/v30/expo-tests.tsx | 8 +++++++- types/expo/v30/index.d.ts | 9 +++++++++ types/expo/v31/expo-tests.tsx | 6 ++++++ types/expo/v31/index.d.ts | 9 +++++++++ 6 files changed, 46 insertions(+), 1 deletion(-) diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index ab34955ce2..c113b22576 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -49,6 +49,7 @@ import { registerRootComponent, ScreenOrientation, SecureStore, + SplashScreen, Svg, Updates } from 'expo'; @@ -1295,3 +1296,8 @@ async () => { response13.forEach((_: Contacts.Container) => _); }; // #endregion + +// #region SplashScreen +SplashScreen.hide(); +SplashScreen.preventAutoHide(); +// #endregion diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 2752410316..4ca39cd202 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -17,6 +17,7 @@ // Jason Killian // Satyajit Sahoo // Vinit Sood +// Mattias Sämskar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -2545,6 +2546,14 @@ export namespace Speech { function resume(): void; } +/** + * SplashScreen + */ +export namespace SplashScreen { + function hide(): void; + function preventAutoHide(): void; +} + /** * SQLite */ diff --git a/types/expo/v30/expo-tests.tsx b/types/expo/v30/expo-tests.tsx index 61467bd5d1..2d2b58c08f 100644 --- a/types/expo/v30/expo-tests.tsx +++ b/types/expo/v30/expo-tests.tsx @@ -41,7 +41,8 @@ import { Updates, MediaLibrary, Haptic, - Constants + Constants, + SplashScreen } from 'expo'; const reverseGeocode: Promise = Location.reverseGeocodeAsync({ @@ -951,3 +952,8 @@ async () => { const userAgent: string = await Constants.getWebViewUserAgentAsync(); }; // #endregion + +// #region SplashScreen +SplashScreen.hide(); +SplashScreen.preventAutoHide(); +// #endregion diff --git a/types/expo/v30/index.d.ts b/types/expo/v30/index.d.ts index f1b318414e..e6712b78ce 100644 --- a/types/expo/v30/index.d.ts +++ b/types/expo/v30/index.d.ts @@ -11,6 +11,7 @@ // Tina Roh // Nathan Phillip Brink // Martin Olsson +// Mattias Sämskar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -1996,6 +1997,14 @@ export namespace Speech { function resume(): void; } +/** + * SplashScreen + */ +export namespace SplashScreen { + function hide(): void; + function preventAutoHide(): void; +} + /** * SQLite */ diff --git a/types/expo/v31/expo-tests.tsx b/types/expo/v31/expo-tests.tsx index 10045e57e6..c03764f56f 100644 --- a/types/expo/v31/expo-tests.tsx +++ b/types/expo/v31/expo-tests.tsx @@ -48,6 +48,7 @@ import { registerRootComponent, ScreenOrientation, SecureStore, + SplashScreen, Svg, Updates } from 'expo'; @@ -1261,3 +1262,8 @@ async () => { response13.forEach((_: Contacts.Container) => _); }; // #endregion + +// #region SplashScreen +SplashScreen.hide(); +SplashScreen.preventAutoHide(); +// #endregion diff --git a/types/expo/v31/index.d.ts b/types/expo/v31/index.d.ts index a3ce2caced..5b64de88e7 100644 --- a/types/expo/v31/index.d.ts +++ b/types/expo/v31/index.d.ts @@ -16,6 +16,7 @@ // Bartosz Dotryw // Jason Killian // Satyajit Sahoo +// Mattias Sämskar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -2455,6 +2456,14 @@ export namespace Speech { function resume(): void; } +/** + * SplashScreen + */ +export namespace SplashScreen { + function hide(): void; + function preventAutoHide(): void; +} + /** * SQLite */ From e91bf8fbad8467e7e5d3cd0357b55eba21c9e4c3 Mon Sep 17 00:00:00 2001 From: Dominik Strebinger Date: Mon, 11 Mar 2019 18:58:32 +0100 Subject: [PATCH 252/265] Update VueScrollTo Options (#33615) --- types/vue-scrollto/index.d.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/types/vue-scrollto/index.d.ts b/types/vue-scrollto/index.d.ts index 47371283d9..e020d29533 100644 --- a/types/vue-scrollto/index.d.ts +++ b/types/vue-scrollto/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vue-scrollto 2.7 +// Type definitions for vue-scrollto 2.14 // Project: https://github.com/rigor789/vue-scrollto#readme // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -19,13 +19,19 @@ declare namespace VueScrollTo { easing?: string; // The offset that should be applied when scrolling. Default: 0 offset?: number; + // Indicates if scrolling should be performed, even if the scroll target is already in view. Default: true + force?: boolean; // Indicates if user can cancel the scroll or not. Default: true cancelable?: boolean; - // A callback function that should be called when scrolling has ended. Default: noop - onDone?: (() => void) | false; + // A callback function that should be called when scrolling has started. Receives the target element as a + // parameter. Default: noop + onStart?: ((element: Element) => void) | false; + // A callback function that should be called when scrolling has ended. Receives the target element as a + // parameter. Default: noop + onDone?: ((element: Element) => void) | false; // A callback function that should be called when scrolling has been aborted by the user (user scrolled, clicked - // etc.). Default: noop - onCancel?: (() => void) | false; + // etc.). Receives the abort event and the target element as parameters. Default: noop + onCancel?: ((event: Event, element: Element) => void) | false; // Whether or not we want scrolling on the x axis. Default: true x?: boolean; // Whether or not we want scrolling on the y axis. Default: true From a3528daaf0b06c5ed3864bf4c28a0c438fd374a3 Mon Sep 17 00:00:00 2001 From: Borys Kupar Date: Mon, 11 Mar 2019 19:00:47 +0100 Subject: [PATCH 253/265] [moment-timezone] Fixed moment-timezone/moment-timezone import, rearranged exports (#33714) --- types/moment-timezone/index.d.ts | 61 +--------------------- types/moment-timezone/moment-timezone.d.ts | 55 +++++++++++++++++++ types/moment-timezone/tsconfig.json | 1 - 3 files changed, 56 insertions(+), 61 deletions(-) diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index 9d365f01b4..8824a165d6 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -6,65 +6,6 @@ // Borys Kupar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import moment = require('moment'); +import moment = require('./moment-timezone'); -// require("moment-timezone") === require("moment") export = moment; - -declare module "moment" { - interface MomentZone { - name: string; - abbrs: string[]; - untils: number[]; - offsets: number[]; - population: number; - - abbr(timestamp: number): string; - offset(timestamp: number): number; - utcOffset(timestamp: number): number; - parse(timestamp: number): number; - } - - interface MomentTimezone { - (): moment.Moment; - (timezone: string): moment.Moment; - (date: number, timezone: string): moment.Moment; - (date: number[], timezone: string): moment.Moment; - (date: string, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; - (date: Date, timezone: string): moment.Moment; - (date: moment.Moment, timezone: string): moment.Moment; - (date: any, timezone: string): moment.Moment; - - zone(timezone: string): MomentZone | null; - - add(packedZoneString: string): void; - add(packedZoneString: string[]): void; - - link(packedLinkString: string): void; - link(packedLinkString: string[]): void; - - load(data: { - version: string; - links: string[]; - zones: string[]; - }): void; - - names(): string[]; - guess(ignoreCache?: boolean): string; - - setDefault(timezone?: string): MomentTimezone; - } - - interface Moment { - tz(): string | undefined; - tz(timezone: string, keepLocalTime?: boolean): moment.Moment; - zoneAbbr(): string; - zoneName(): string; - } - - const tz: MomentTimezone; -} diff --git a/types/moment-timezone/moment-timezone.d.ts b/types/moment-timezone/moment-timezone.d.ts index 4f06f7e4f1..71da391ffa 100644 --- a/types/moment-timezone/moment-timezone.d.ts +++ b/types/moment-timezone/moment-timezone.d.ts @@ -1,3 +1,58 @@ import moment = require('moment'); +// require("moment-timezone") === require("moment") export = moment; + +declare module 'moment' { + interface MomentZone { + name: string; + abbrs: string[]; + untils: number[]; + offsets: number[]; + population: number; + + abbr(timestamp: number): string; + offset(timestamp: number): number; + utcOffset(timestamp: number): number; + parse(timestamp: number): number; + } + + interface MomentTimezone { + (): moment.Moment; + (timezone: string): moment.Moment; + (date: number, timezone: string): moment.Moment; + (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; + (date: Date, timezone: string): moment.Moment; + (date: moment.Moment, timezone: string): moment.Moment; + (date: any, timezone: string): moment.Moment; + + zone(timezone: string): MomentZone | null; + + add(packedZoneString: string): void; + add(packedZoneString: string[]): void; + + link(packedLinkString: string): void; + link(packedLinkString: string[]): void; + + load(data: { version: string; links: string[]; zones: string[] }): void; + + names(): string[]; + guess(ignoreCache?: boolean): string; + + setDefault(timezone?: string): MomentTimezone; + } + + interface Moment { + tz(): string | undefined; + tz(timezone: string, keepLocalTime?: boolean): moment.Moment; + zoneAbbr(): string; + zoneName(): string; + } + + const tz: MomentTimezone; +} diff --git a/types/moment-timezone/tsconfig.json b/types/moment-timezone/tsconfig.json index 55ec6cf7bb..5b29fa3ff5 100644 --- a/types/moment-timezone/tsconfig.json +++ b/types/moment-timezone/tsconfig.json @@ -18,7 +18,6 @@ }, "files": [ "index.d.ts", - "moment-timezone.d.ts", "moment-timezone-tests.ts" ] } From d0af366f23c592c7976e564e94bc3bc13c9bece7 Mon Sep 17 00:00:00 2001 From: Piotr <37638629+tanfonto@users.noreply.github.com> Date: Mon, 11 Mar 2019 19:03:34 +0100 Subject: [PATCH 254/265] clone-deep npm package typings (#33750) * clone-deep types * inlined InstanceClone --- types/clone-deep/clone-deep-tests.ts | 16 ++++++++++++++++ types/clone-deep/index.d.ts | 10 ++++++++++ types/clone-deep/tsconfig.json | 17 +++++++++++++++++ types/clone-deep/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/clone-deep/clone-deep-tests.ts create mode 100644 types/clone-deep/index.d.ts create mode 100644 types/clone-deep/tsconfig.json create mode 100644 types/clone-deep/tslint.json diff --git a/types/clone-deep/clone-deep-tests.ts b/types/clone-deep/clone-deep-tests.ts new file mode 100644 index 0000000000..0e99c6fbb2 --- /dev/null +++ b/types/clone-deep/clone-deep-tests.ts @@ -0,0 +1,16 @@ +import cloneDeep from 'clone-deep'; + +cloneDeep(Object.create(null)); // $ExpectType object +cloneDeep({}); // $ExpectType object +cloneDeep({}); // $ExpectType {} +cloneDeep(new Array()); // $ExpectType any[] +cloneDeep([]); // $ExpectType any[] +cloneDeep(42); // $ExpectType number +cloneDeep('clone'); // $ExpectType string +cloneDeep({}, true); // $ExpectType object +cloneDeep({}, true); // $ExpectType {} +cloneDeep(42, true); // $ExpectType number +cloneDeep({}, _ => ({})); // $ExpectType object +cloneDeep({}, _ => ({})); // $ExpectType {} +cloneDeep({}, _ => 42); // $ExpectError +cloneDeep(42, _ => ({})); // $ExpectError diff --git a/types/clone-deep/index.d.ts b/types/clone-deep/index.d.ts new file mode 100644 index 0000000000..0ca60e6180 --- /dev/null +++ b/types/clone-deep/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for clone-deep 4.0 +// Project: https://github.com/jonschlinkert/clone-deep +// Definitions by: Tanfonto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +export default function cloneDeep( + val: T, + instanceClone?: true | ((val: T) => T) +): T; diff --git a/types/clone-deep/tsconfig.json b/types/clone-deep/tsconfig.json new file mode 100644 index 0000000000..d584681520 --- /dev/null +++ b/types/clone-deep/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "clone-deep-tests.ts"] +} diff --git a/types/clone-deep/tslint.json b/types/clone-deep/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/clone-deep/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 25e3419e81455377253ee4d569294bcf52438731 Mon Sep 17 00:00:00 2001 From: Claas Ahlrichs Date: Mon, 11 Mar 2019 19:06:05 +0100 Subject: [PATCH 255/265] new package: protocol-buffers-schema (#33745) * bootstraped folder structure for "protocol-buffers-schema" * npx prettier --write .\types\protocol-buffers-schema\** * drafted types for protocol-buffers-schema * moved types into dedicated file * added "strictFunctionTypes"-flag * drafted index.d.ts * added missing files to tsconfig * npx prettier --write .\types\protocol-buffers-schema\** * added "node" to types in tsconfig * removed redundant "export" keywords * added reference to node type(s) * added test case --- types/protocol-buffers-schema/index.d.ts | 17 ++++ types/protocol-buffers-schema/parse.d.ts | 9 +++ .../protocol-buffers-schema-tests.ts | 21 +++++ types/protocol-buffers-schema/stringify.d.ts | 5 ++ types/protocol-buffers-schema/tokenize.d.ts | 5 ++ types/protocol-buffers-schema/tsconfig.json | 23 ++++++ types/protocol-buffers-schema/tslint.json | 1 + types/protocol-buffers-schema/types.d.ts | 81 +++++++++++++++++++ 8 files changed, 162 insertions(+) create mode 100644 types/protocol-buffers-schema/index.d.ts create mode 100644 types/protocol-buffers-schema/parse.d.ts create mode 100644 types/protocol-buffers-schema/protocol-buffers-schema-tests.ts create mode 100644 types/protocol-buffers-schema/stringify.d.ts create mode 100644 types/protocol-buffers-schema/tokenize.d.ts create mode 100644 types/protocol-buffers-schema/tsconfig.json create mode 100644 types/protocol-buffers-schema/tslint.json create mode 100644 types/protocol-buffers-schema/types.d.ts diff --git a/types/protocol-buffers-schema/index.d.ts b/types/protocol-buffers-schema/index.d.ts new file mode 100644 index 0000000000..2d80831cf1 --- /dev/null +++ b/types/protocol-buffers-schema/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for protocol-buffers-schema 3.3 +// Project: https://github.com/mafintosh/protocol-buffers-schema +// Definitions by: Claas Ahlrichs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +/// + +import { Schema } from "./types"; +declare namespace parse { + function parse(buffer: string | Buffer): Schema; + function stringify(schema: Schema): string; +} + +declare function parse(buffer: string | Buffer): Schema; + +export = parse; diff --git a/types/protocol-buffers-schema/parse.d.ts b/types/protocol-buffers-schema/parse.d.ts new file mode 100644 index 0000000000..3bf80fa1cf --- /dev/null +++ b/types/protocol-buffers-schema/parse.d.ts @@ -0,0 +1,9 @@ +import { Schema } from "./types"; +declare namespace parse { + function parse(buffer: string | Buffer): Schema; + function stringify(schema: Schema): string; +} + +declare function parse(buffer: string | Buffer): Schema; + +export = parse; diff --git a/types/protocol-buffers-schema/protocol-buffers-schema-tests.ts b/types/protocol-buffers-schema/protocol-buffers-schema-tests.ts new file mode 100644 index 0000000000..7b68e9bab0 --- /dev/null +++ b/types/protocol-buffers-schema/protocol-buffers-schema-tests.ts @@ -0,0 +1,21 @@ +import schema from "protocol-buffers-schema"; + +const proto = `syntax = "proto2"; + +message Point { + required int32 x = 1; + required int32 y=2; + optional string label = 3; +} + +message Line { + required Point start = 1; + required Point end = 2; + optional string label = 3; +}`; + +// pass a buffer or string to schema.parse +const sch = schema.parse(proto); + +// will print out the schema as a javascript object +console.log(sch); diff --git a/types/protocol-buffers-schema/stringify.d.ts b/types/protocol-buffers-schema/stringify.d.ts new file mode 100644 index 0000000000..708a4ff394 --- /dev/null +++ b/types/protocol-buffers-schema/stringify.d.ts @@ -0,0 +1,5 @@ +import { Schema } from "./types"; + +declare function stringify(schema: Schema): string; + +export = stringify; diff --git a/types/protocol-buffers-schema/tokenize.d.ts b/types/protocol-buffers-schema/tokenize.d.ts new file mode 100644 index 0000000000..dfe51a143c --- /dev/null +++ b/types/protocol-buffers-schema/tokenize.d.ts @@ -0,0 +1,5 @@ +import { Schema } from "./types"; + +declare function tokenize(schema: Schema): string[]; + +export = tokenize; diff --git a/types/protocol-buffers-schema/tsconfig.json b/types/protocol-buffers-schema/tsconfig.json new file mode 100644 index 0000000000..76e4087db4 --- /dev/null +++ b/types/protocol-buffers-schema/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "parse.d.ts", + "stringify.d.ts", + "tokenize.d.ts", + "protocol-buffers-schema-tests.ts" + ] +} diff --git a/types/protocol-buffers-schema/tslint.json b/types/protocol-buffers-schema/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/protocol-buffers-schema/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/protocol-buffers-schema/types.d.ts b/types/protocol-buffers-schema/types.d.ts new file mode 100644 index 0000000000..12a0a3bdf5 --- /dev/null +++ b/types/protocol-buffers-schema/types.d.ts @@ -0,0 +1,81 @@ +export interface Option { + [key: string]: string | boolean; +} + +export interface Options { + [key: string]: string | boolean | Option | Option[]; +} + +export interface Enum { + name: string; + values: { + [key: string]: { + value: number; + options: Options; + }; + }; + options: Options; +} + +export interface FieldOptions { + [key: string]: string; +} + +export interface Field { + name: string; + type: string; + tag: number; + map: { + from: string; + to: string; + }; + oneof: null | string; + required: boolean; + repeated: boolean; + options: FieldOptions; +} + +export interface Message { + name: string; + enums: Enum[]; + extends: Extend[]; + extensions: Extension[]; + messages: Message[]; + fields: Field[]; +} + +export interface Extend { + name: string; + message: Message; +} + +export interface Extension { + from: number; + to: number; +} + +export interface Service { + name: string; + methods: Method[]; + options: Options; +} + +export interface Method { + name: string; + input_type: string; + output_type: string; + client_streaming: boolean; + server_streaming: boolean; + options: Options; +} + +export interface Schema { + syntax: number; + package: null | string; + imports: string[]; + enums: Enum[]; + messages: Message[]; + options: Options; + extends: Extend[]; + service?: Service[]; +} From 8146f412637c087eebb61dcf83b257cd3631abbf Mon Sep 17 00:00:00 2001 From: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Date: Mon, 11 Mar 2019 11:06:53 -0700 Subject: [PATCH 256/265] Add type definitions for css-modules-loader-core (#33744) --- .../css-modules-loader-core-tests.ts | 24 +++++++++ types/css-modules-loader-core/index.d.ts | 50 +++++++++++++++++++ types/css-modules-loader-core/package.json | 6 +++ types/css-modules-loader-core/tsconfig.json | 24 +++++++++ types/css-modules-loader-core/tslint.json | 1 + 5 files changed, 105 insertions(+) create mode 100644 types/css-modules-loader-core/css-modules-loader-core-tests.ts create mode 100644 types/css-modules-loader-core/index.d.ts create mode 100644 types/css-modules-loader-core/package.json create mode 100644 types/css-modules-loader-core/tsconfig.json create mode 100644 types/css-modules-loader-core/tslint.json diff --git a/types/css-modules-loader-core/css-modules-loader-core-tests.ts b/types/css-modules-loader-core/css-modules-loader-core-tests.ts new file mode 100644 index 0000000000..d8fe2966d7 --- /dev/null +++ b/types/css-modules-loader-core/css-modules-loader-core-tests.ts @@ -0,0 +1,24 @@ +/// + +import Core, { Source } from "css-modules-loader-core"; + +const core = new Core(); +const emptyPlugins = new Core([]); +const withPlugins = new Core([ + Core.values, + Core.localByDefault, + Core.extractImports, + Core.scope +]); +const withDefaultPlugins = new Core(Core.defaultPlugins); + +// $ExpectError +const noArray = new Core(Core.values); + +// Validating the source can be anything that has toString() defined +const bufferSource: Source = new Buffer("str"); + +core.load("str").then(({ injectableSource, exportTokens }) => { + const str: string = injectableSource; + exportTokens["key"] = "value"; +}); diff --git a/types/css-modules-loader-core/index.d.ts b/types/css-modules-loader-core/index.d.ts new file mode 100644 index 0000000000..d7bd533ac1 --- /dev/null +++ b/types/css-modules-loader-core/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for css-modules-loader-core 1.1 +// Project: https://github.com/css-modules/css-modules-loader-core +// Definitions by: Spencer Miskoviak +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +import { Plugin } from "postcss"; + +declare namespace Core { + type Source = + | string + | { + toString(): string; + }; + + type PathFetcher = ( + file: string, + relativeTo: string, + depTrace: string + ) => void; + + interface ExportTokens { + [index: string]: string; + } + + interface Result { + injectableSource: string; + exportTokens: ExportTokens; + } +} + +declare class Core { + static values: Plugin<{}>; + static localByDefault: Plugin<{}>; + static extractImports: Plugin<{}>; + static scope: Plugin<{}>; + static defaultPlugins: Array>; + + constructor(plugins?: Array>); + + load( + source: Core.Source, + sourcePath?: string, + trace?: string, + pathFetcher?: Core.PathFetcher + ): Promise; +} + +export = Core; +export as namespace Core; diff --git a/types/css-modules-loader-core/package.json b/types/css-modules-loader-core/package.json new file mode 100644 index 0000000000..06a694067a --- /dev/null +++ b/types/css-modules-loader-core/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "postcss": "7.x.x" + } +} diff --git a/types/css-modules-loader-core/tsconfig.json b/types/css-modules-loader-core/tsconfig.json new file mode 100644 index 0000000000..a4b15a0258 --- /dev/null +++ b/types/css-modules-loader-core/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "css-modules-loader-core-tests.ts" + ] +} diff --git a/types/css-modules-loader-core/tslint.json b/types/css-modules-loader-core/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/css-modules-loader-core/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3db0bee205f0f14af38b7899ba44ed5aa4c38b5e Mon Sep 17 00:00:00 2001 From: samuel kwok Date: Tue, 12 Mar 2019 03:14:05 +0900 Subject: [PATCH 257/265] Copy ramda commonjs package type declaration file (#33334) --- types/ramda/index.d.ts | 246 +++++++++++++++++++ types/ramda/src/F.d.ts | 2 + types/ramda/src/T.d.ts | 2 + types/ramda/src/add.d.ts | 2 + types/ramda/src/addIndex.d.ts | 2 + types/ramda/src/adjust.d.ts | 2 + types/ramda/src/all.d.ts | 2 + types/ramda/src/allPass.d.ts | 2 + types/ramda/src/always.d.ts | 2 + types/ramda/src/and.d.ts | 2 + types/ramda/src/any.d.ts | 2 + types/ramda/src/anyPass.d.ts | 2 + types/ramda/src/ap.d.ts | 2 + types/ramda/src/aperture.d.ts | 2 + types/ramda/src/append.d.ts | 2 + types/ramda/src/apply.d.ts | 2 + types/ramda/src/applySpec.d.ts | 2 + types/ramda/src/applyTo.d.ts | 2 + types/ramda/src/ascend.d.ts | 2 + types/ramda/src/assoc.d.ts | 2 + types/ramda/src/assocPath.d.ts | 2 + types/ramda/src/binary.d.ts | 2 + types/ramda/src/bind.d.ts | 2 + types/ramda/src/both.d.ts | 2 + types/ramda/src/call.d.ts | 2 + types/ramda/src/chain.d.ts | 2 + types/ramda/src/clamp.d.ts | 2 + types/ramda/src/clone.d.ts | 2 + types/ramda/src/comparator.d.ts | 2 + types/ramda/src/complement.d.ts | 2 + types/ramda/src/compose.d.ts | 2 + types/ramda/src/composeK.d.ts | 2 + types/ramda/src/composeP.d.ts | 2 + types/ramda/src/concat.d.ts | 2 + types/ramda/src/cond.d.ts | 2 + types/ramda/src/construct.d.ts | 2 + types/ramda/src/constructN.d.ts | 2 + types/ramda/src/contains.d.ts | 2 + types/ramda/src/converge.d.ts | 2 + types/ramda/src/countBy.d.ts | 2 + types/ramda/src/curry.d.ts | 2 + types/ramda/src/curryN.d.ts | 2 + types/ramda/src/dec.d.ts | 2 + types/ramda/src/defaultTo.d.ts | 2 + types/ramda/src/descend.d.ts | 2 + types/ramda/src/difference.d.ts | 2 + types/ramda/src/differenceWith.d.ts | 2 + types/ramda/src/dissoc.d.ts | 2 + types/ramda/src/dissocPath.d.ts | 2 + types/ramda/src/divide.d.ts | 2 + types/ramda/src/drop.d.ts | 2 + types/ramda/src/dropLast.d.ts | 2 + types/ramda/src/dropLastWhile.d.ts | 2 + types/ramda/src/either.d.ts | 2 + types/ramda/src/empty.d.ts | 2 + types/ramda/src/endsWith.d.ts | 2 + types/ramda/src/eqBy.d.ts | 2 + types/ramda/src/eqProps.d.ts | 2 + types/ramda/src/equals.d.ts | 2 + types/ramda/src/evolve.d.ts | 2 + types/ramda/src/filter.d.ts | 2 + types/ramda/src/find.d.ts | 2 + types/ramda/src/findIndex.d.ts | 2 + types/ramda/src/findLast.d.ts | 2 + types/ramda/src/findLastIndex.d.ts | 2 + types/ramda/src/flatten.d.ts | 2 + types/ramda/src/flip.d.ts | 2 + types/ramda/src/forEach.d.ts | 2 + types/ramda/src/forEachObjIndexed.d.ts | 2 + types/ramda/src/fromPairs.d.ts | 2 + types/ramda/src/groupBy.d.ts | 2 + types/ramda/src/groupWith.d.ts | 2 + types/ramda/src/gt.d.ts | 2 + types/ramda/src/gte.d.ts | 2 + types/ramda/src/has.d.ts | 2 + types/ramda/src/hasIn.d.ts | 2 + types/ramda/src/head.d.ts | 2 + types/ramda/src/identical.d.ts | 2 + types/ramda/src/identity.d.ts | 2 + types/ramda/src/ifElse.d.ts | 2 + types/ramda/src/inc.d.ts | 2 + types/ramda/src/includes.d.ts | 2 + types/ramda/src/indexBy.d.ts | 2 + types/ramda/src/indexOf.d.ts | 2 + types/ramda/src/init.d.ts | 2 + types/ramda/src/innerJoin.d.ts | 2 + types/ramda/src/insert.d.ts | 2 + types/ramda/src/insertAll.d.ts | 2 + types/ramda/src/intersection.d.ts | 2 + types/ramda/src/intersectionWith.d.ts | 2 + types/ramda/src/intersperse.d.ts | 2 + types/ramda/src/into.d.ts | 2 + types/ramda/src/invert.d.ts | 2 + types/ramda/src/invertObj.d.ts | 2 + types/ramda/src/invoker.d.ts | 2 + types/ramda/src/is.d.ts | 2 + types/ramda/src/isArrayLike.d.ts | 2 + types/ramda/src/isEmpty.d.ts | 2 + types/ramda/src/isNaN.d.ts | 2 + types/ramda/src/isNil.d.ts | 2 + types/ramda/src/join.d.ts | 2 + types/ramda/src/juxt.d.ts | 2 + types/ramda/src/keys.d.ts | 2 + types/ramda/src/keysIn.d.ts | 2 + types/ramda/src/last.d.ts | 2 + types/ramda/src/lastIndexOf.d.ts | 2 + types/ramda/src/length.d.ts | 2 + types/ramda/src/lens.d.ts | 2 + types/ramda/src/lensIndex.d.ts | 2 + types/ramda/src/lensPath.d.ts | 2 + types/ramda/src/lensProp.d.ts | 2 + types/ramda/src/lift.d.ts | 2 + types/ramda/src/lt.d.ts | 2 + types/ramda/src/lte.d.ts | 2 + types/ramda/src/map.d.ts | 2 + types/ramda/src/mapAccum.d.ts | 2 + types/ramda/src/mapAccumRight.d.ts | 2 + types/ramda/src/mapObjIndexed.d.ts | 2 + types/ramda/src/match.d.ts | 2 + types/ramda/src/mathMod.d.ts | 2 + types/ramda/src/max.d.ts | 2 + types/ramda/src/maxBy.d.ts | 2 + types/ramda/src/mean.d.ts | 2 + types/ramda/src/median.d.ts | 2 + types/ramda/src/memoize.d.ts | 2 + types/ramda/src/memoizeWith.d.ts | 2 + types/ramda/src/merge.d.ts | 2 + types/ramda/src/mergeAll.d.ts | 2 + types/ramda/src/mergeDeepLeft.d.ts | 2 + types/ramda/src/mergeDeepRight.d.ts | 2 + types/ramda/src/mergeDeepWith.d.ts | 2 + types/ramda/src/mergeDeepWithKey.d.ts | 2 + types/ramda/src/mergeWith.d.ts | 2 + types/ramda/src/mergeWithKey.d.ts | 2 + types/ramda/src/min.d.ts | 2 + types/ramda/src/minBy.d.ts | 2 + types/ramda/src/modulo.d.ts | 2 + types/ramda/src/move.d.ts | 2 + types/ramda/src/multiply.d.ts | 2 + types/ramda/src/nAry.d.ts | 2 + types/ramda/src/negate.d.ts | 2 + types/ramda/src/none.d.ts | 2 + types/ramda/src/not.d.ts | 2 + types/ramda/src/nth.d.ts | 2 + types/ramda/src/nthArg.d.ts | 2 + types/ramda/src/objOf.d.ts | 2 + types/ramda/src/of.d.ts | 2 + types/ramda/src/omit.d.ts | 2 + types/ramda/src/once.d.ts | 2 + types/ramda/src/or.d.ts | 2 + types/ramda/src/over.d.ts | 2 + types/ramda/src/pair.d.ts | 2 + types/ramda/src/partial.d.ts | 2 + types/ramda/src/partialRight.d.ts | 2 + types/ramda/src/partition.d.ts | 2 + types/ramda/src/path.d.ts | 2 + types/ramda/src/pathEq.d.ts | 2 + types/ramda/src/pathOr.d.ts | 2 + types/ramda/src/pathSatisfies.d.ts | 2 + types/ramda/src/pick.d.ts | 2 + types/ramda/src/pickAll.d.ts | 2 + types/ramda/src/pickBy.d.ts | 2 + types/ramda/src/pipe.d.ts | 2 + types/ramda/src/pipeK.d.ts | 2 + types/ramda/src/pipeP.d.ts | 2 + types/ramda/src/pluck.d.ts | 2 + types/ramda/src/prepend.d.ts | 2 + types/ramda/src/product.d.ts | 2 + types/ramda/src/project.d.ts | 2 + types/ramda/src/prop.d.ts | 2 + types/ramda/src/propEq.d.ts | 2 + types/ramda/src/propIs.d.ts | 2 + types/ramda/src/propOr.d.ts | 2 + types/ramda/src/propSatisfies.d.ts | 2 + types/ramda/src/props.d.ts | 2 + types/ramda/src/range.d.ts | 2 + types/ramda/src/reduce.d.ts | 2 + types/ramda/src/reduceBy.d.ts | 2 + types/ramda/src/reduceRight.d.ts | 2 + types/ramda/src/reduceWhile.d.ts | 2 + types/ramda/src/reduced.d.ts | 2 + types/ramda/src/reject.d.ts | 2 + types/ramda/src/remove.d.ts | 2 + types/ramda/src/repeat.d.ts | 2 + types/ramda/src/replace.d.ts | 2 + types/ramda/src/reverse.d.ts | 2 + types/ramda/src/scan.d.ts | 2 + types/ramda/src/set.d.ts | 2 + types/ramda/src/slice.d.ts | 2 + types/ramda/src/sort.d.ts | 2 + types/ramda/src/sortBy.d.ts | 2 + types/ramda/src/sortWith.d.ts | 2 + types/ramda/src/split.d.ts | 2 + types/ramda/src/splitAt.d.ts | 2 + types/ramda/src/splitEvery.d.ts | 2 + types/ramda/src/splitWhen.d.ts | 2 + types/ramda/src/startsWith.d.ts | 2 + types/ramda/src/subtract.d.ts | 2 + types/ramda/src/sum.d.ts | 2 + types/ramda/src/symmetricDifference.d.ts | 2 + types/ramda/src/symmetricDifferenceWith.d.ts | 2 + types/ramda/src/tail.d.ts | 2 + types/ramda/src/take.d.ts | 2 + types/ramda/src/takeLast.d.ts | 2 + types/ramda/src/takeLastWhile.d.ts | 2 + types/ramda/src/takeWhile.d.ts | 2 + types/ramda/src/tap.d.ts | 2 + types/ramda/src/test.d.ts | 2 + types/ramda/src/times.d.ts | 2 + types/ramda/src/toLower.d.ts | 2 + types/ramda/src/toPairs.d.ts | 2 + types/ramda/src/toPairsIn.d.ts | 2 + types/ramda/src/toString.d.ts | 2 + types/ramda/src/toUpper.d.ts | 2 + types/ramda/src/transduce.d.ts | 2 + types/ramda/src/transpose.d.ts | 2 + types/ramda/src/traverse.d.ts | 2 + types/ramda/src/trim.d.ts | 2 + types/ramda/src/tryCatch.d.ts | 2 + types/ramda/src/type.d.ts | 2 + types/ramda/src/unapply.d.ts | 2 + types/ramda/src/unary.d.ts | 2 + types/ramda/src/uncurryN.d.ts | 2 + types/ramda/src/unfold.d.ts | 2 + types/ramda/src/union.d.ts | 2 + types/ramda/src/unionWith.d.ts | 2 + types/ramda/src/uniq.d.ts | 2 + types/ramda/src/uniqBy.d.ts | 2 + types/ramda/src/uniqWith.d.ts | 2 + types/ramda/src/unless.d.ts | 2 + types/ramda/src/unnest.d.ts | 2 + types/ramda/src/until.d.ts | 2 + types/ramda/src/update.d.ts | 2 + types/ramda/src/useWith.d.ts | 2 + types/ramda/src/values.d.ts | 2 + types/ramda/src/valuesIn.d.ts | 2 + types/ramda/src/view.d.ts | 2 + types/ramda/src/when.d.ts | 2 + types/ramda/src/where.d.ts | 2 + types/ramda/src/whereEq.d.ts | 2 + types/ramda/src/without.d.ts | 2 + types/ramda/src/wrap.d.ts | 2 + types/ramda/src/xprod.d.ts | 2 + types/ramda/src/zip.d.ts | 2 + types/ramda/src/zipObj.d.ts | 2 + types/ramda/src/zipWith.d.ts | 2 + 246 files changed, 736 insertions(+) create mode 100644 types/ramda/src/F.d.ts create mode 100644 types/ramda/src/T.d.ts create mode 100644 types/ramda/src/add.d.ts create mode 100644 types/ramda/src/addIndex.d.ts create mode 100644 types/ramda/src/adjust.d.ts create mode 100644 types/ramda/src/all.d.ts create mode 100644 types/ramda/src/allPass.d.ts create mode 100644 types/ramda/src/always.d.ts create mode 100644 types/ramda/src/and.d.ts create mode 100644 types/ramda/src/any.d.ts create mode 100644 types/ramda/src/anyPass.d.ts create mode 100644 types/ramda/src/ap.d.ts create mode 100644 types/ramda/src/aperture.d.ts create mode 100644 types/ramda/src/append.d.ts create mode 100644 types/ramda/src/apply.d.ts create mode 100644 types/ramda/src/applySpec.d.ts create mode 100644 types/ramda/src/applyTo.d.ts create mode 100644 types/ramda/src/ascend.d.ts create mode 100644 types/ramda/src/assoc.d.ts create mode 100644 types/ramda/src/assocPath.d.ts create mode 100644 types/ramda/src/binary.d.ts create mode 100644 types/ramda/src/bind.d.ts create mode 100644 types/ramda/src/both.d.ts create mode 100644 types/ramda/src/call.d.ts create mode 100644 types/ramda/src/chain.d.ts create mode 100644 types/ramda/src/clamp.d.ts create mode 100644 types/ramda/src/clone.d.ts create mode 100644 types/ramda/src/comparator.d.ts create mode 100644 types/ramda/src/complement.d.ts create mode 100644 types/ramda/src/compose.d.ts create mode 100644 types/ramda/src/composeK.d.ts create mode 100644 types/ramda/src/composeP.d.ts create mode 100644 types/ramda/src/concat.d.ts create mode 100644 types/ramda/src/cond.d.ts create mode 100644 types/ramda/src/construct.d.ts create mode 100644 types/ramda/src/constructN.d.ts create mode 100644 types/ramda/src/contains.d.ts create mode 100644 types/ramda/src/converge.d.ts create mode 100644 types/ramda/src/countBy.d.ts create mode 100644 types/ramda/src/curry.d.ts create mode 100644 types/ramda/src/curryN.d.ts create mode 100644 types/ramda/src/dec.d.ts create mode 100644 types/ramda/src/defaultTo.d.ts create mode 100644 types/ramda/src/descend.d.ts create mode 100644 types/ramda/src/difference.d.ts create mode 100644 types/ramda/src/differenceWith.d.ts create mode 100644 types/ramda/src/dissoc.d.ts create mode 100644 types/ramda/src/dissocPath.d.ts create mode 100644 types/ramda/src/divide.d.ts create mode 100644 types/ramda/src/drop.d.ts create mode 100644 types/ramda/src/dropLast.d.ts create mode 100644 types/ramda/src/dropLastWhile.d.ts create mode 100644 types/ramda/src/either.d.ts create mode 100644 types/ramda/src/empty.d.ts create mode 100644 types/ramda/src/endsWith.d.ts create mode 100644 types/ramda/src/eqBy.d.ts create mode 100644 types/ramda/src/eqProps.d.ts create mode 100644 types/ramda/src/equals.d.ts create mode 100644 types/ramda/src/evolve.d.ts create mode 100644 types/ramda/src/filter.d.ts create mode 100644 types/ramda/src/find.d.ts create mode 100644 types/ramda/src/findIndex.d.ts create mode 100644 types/ramda/src/findLast.d.ts create mode 100644 types/ramda/src/findLastIndex.d.ts create mode 100644 types/ramda/src/flatten.d.ts create mode 100644 types/ramda/src/flip.d.ts create mode 100644 types/ramda/src/forEach.d.ts create mode 100644 types/ramda/src/forEachObjIndexed.d.ts create mode 100644 types/ramda/src/fromPairs.d.ts create mode 100644 types/ramda/src/groupBy.d.ts create mode 100644 types/ramda/src/groupWith.d.ts create mode 100644 types/ramda/src/gt.d.ts create mode 100644 types/ramda/src/gte.d.ts create mode 100644 types/ramda/src/has.d.ts create mode 100644 types/ramda/src/hasIn.d.ts create mode 100644 types/ramda/src/head.d.ts create mode 100644 types/ramda/src/identical.d.ts create mode 100644 types/ramda/src/identity.d.ts create mode 100644 types/ramda/src/ifElse.d.ts create mode 100644 types/ramda/src/inc.d.ts create mode 100644 types/ramda/src/includes.d.ts create mode 100644 types/ramda/src/indexBy.d.ts create mode 100644 types/ramda/src/indexOf.d.ts create mode 100644 types/ramda/src/init.d.ts create mode 100644 types/ramda/src/innerJoin.d.ts create mode 100644 types/ramda/src/insert.d.ts create mode 100644 types/ramda/src/insertAll.d.ts create mode 100644 types/ramda/src/intersection.d.ts create mode 100644 types/ramda/src/intersectionWith.d.ts create mode 100644 types/ramda/src/intersperse.d.ts create mode 100644 types/ramda/src/into.d.ts create mode 100644 types/ramda/src/invert.d.ts create mode 100644 types/ramda/src/invertObj.d.ts create mode 100644 types/ramda/src/invoker.d.ts create mode 100644 types/ramda/src/is.d.ts create mode 100644 types/ramda/src/isArrayLike.d.ts create mode 100644 types/ramda/src/isEmpty.d.ts create mode 100644 types/ramda/src/isNaN.d.ts create mode 100644 types/ramda/src/isNil.d.ts create mode 100644 types/ramda/src/join.d.ts create mode 100644 types/ramda/src/juxt.d.ts create mode 100644 types/ramda/src/keys.d.ts create mode 100644 types/ramda/src/keysIn.d.ts create mode 100644 types/ramda/src/last.d.ts create mode 100644 types/ramda/src/lastIndexOf.d.ts create mode 100644 types/ramda/src/length.d.ts create mode 100644 types/ramda/src/lens.d.ts create mode 100644 types/ramda/src/lensIndex.d.ts create mode 100644 types/ramda/src/lensPath.d.ts create mode 100644 types/ramda/src/lensProp.d.ts create mode 100644 types/ramda/src/lift.d.ts create mode 100644 types/ramda/src/lt.d.ts create mode 100644 types/ramda/src/lte.d.ts create mode 100644 types/ramda/src/map.d.ts create mode 100644 types/ramda/src/mapAccum.d.ts create mode 100644 types/ramda/src/mapAccumRight.d.ts create mode 100644 types/ramda/src/mapObjIndexed.d.ts create mode 100644 types/ramda/src/match.d.ts create mode 100644 types/ramda/src/mathMod.d.ts create mode 100644 types/ramda/src/max.d.ts create mode 100644 types/ramda/src/maxBy.d.ts create mode 100644 types/ramda/src/mean.d.ts create mode 100644 types/ramda/src/median.d.ts create mode 100644 types/ramda/src/memoize.d.ts create mode 100644 types/ramda/src/memoizeWith.d.ts create mode 100644 types/ramda/src/merge.d.ts create mode 100644 types/ramda/src/mergeAll.d.ts create mode 100644 types/ramda/src/mergeDeepLeft.d.ts create mode 100644 types/ramda/src/mergeDeepRight.d.ts create mode 100644 types/ramda/src/mergeDeepWith.d.ts create mode 100644 types/ramda/src/mergeDeepWithKey.d.ts create mode 100644 types/ramda/src/mergeWith.d.ts create mode 100644 types/ramda/src/mergeWithKey.d.ts create mode 100644 types/ramda/src/min.d.ts create mode 100644 types/ramda/src/minBy.d.ts create mode 100644 types/ramda/src/modulo.d.ts create mode 100644 types/ramda/src/move.d.ts create mode 100644 types/ramda/src/multiply.d.ts create mode 100644 types/ramda/src/nAry.d.ts create mode 100644 types/ramda/src/negate.d.ts create mode 100644 types/ramda/src/none.d.ts create mode 100644 types/ramda/src/not.d.ts create mode 100644 types/ramda/src/nth.d.ts create mode 100644 types/ramda/src/nthArg.d.ts create mode 100644 types/ramda/src/objOf.d.ts create mode 100644 types/ramda/src/of.d.ts create mode 100644 types/ramda/src/omit.d.ts create mode 100644 types/ramda/src/once.d.ts create mode 100644 types/ramda/src/or.d.ts create mode 100644 types/ramda/src/over.d.ts create mode 100644 types/ramda/src/pair.d.ts create mode 100644 types/ramda/src/partial.d.ts create mode 100644 types/ramda/src/partialRight.d.ts create mode 100644 types/ramda/src/partition.d.ts create mode 100644 types/ramda/src/path.d.ts create mode 100644 types/ramda/src/pathEq.d.ts create mode 100644 types/ramda/src/pathOr.d.ts create mode 100644 types/ramda/src/pathSatisfies.d.ts create mode 100644 types/ramda/src/pick.d.ts create mode 100644 types/ramda/src/pickAll.d.ts create mode 100644 types/ramda/src/pickBy.d.ts create mode 100644 types/ramda/src/pipe.d.ts create mode 100644 types/ramda/src/pipeK.d.ts create mode 100644 types/ramda/src/pipeP.d.ts create mode 100644 types/ramda/src/pluck.d.ts create mode 100644 types/ramda/src/prepend.d.ts create mode 100644 types/ramda/src/product.d.ts create mode 100644 types/ramda/src/project.d.ts create mode 100644 types/ramda/src/prop.d.ts create mode 100644 types/ramda/src/propEq.d.ts create mode 100644 types/ramda/src/propIs.d.ts create mode 100644 types/ramda/src/propOr.d.ts create mode 100644 types/ramda/src/propSatisfies.d.ts create mode 100644 types/ramda/src/props.d.ts create mode 100644 types/ramda/src/range.d.ts create mode 100644 types/ramda/src/reduce.d.ts create mode 100644 types/ramda/src/reduceBy.d.ts create mode 100644 types/ramda/src/reduceRight.d.ts create mode 100644 types/ramda/src/reduceWhile.d.ts create mode 100644 types/ramda/src/reduced.d.ts create mode 100644 types/ramda/src/reject.d.ts create mode 100644 types/ramda/src/remove.d.ts create mode 100644 types/ramda/src/repeat.d.ts create mode 100644 types/ramda/src/replace.d.ts create mode 100644 types/ramda/src/reverse.d.ts create mode 100644 types/ramda/src/scan.d.ts create mode 100644 types/ramda/src/set.d.ts create mode 100644 types/ramda/src/slice.d.ts create mode 100644 types/ramda/src/sort.d.ts create mode 100644 types/ramda/src/sortBy.d.ts create mode 100644 types/ramda/src/sortWith.d.ts create mode 100644 types/ramda/src/split.d.ts create mode 100644 types/ramda/src/splitAt.d.ts create mode 100644 types/ramda/src/splitEvery.d.ts create mode 100644 types/ramda/src/splitWhen.d.ts create mode 100644 types/ramda/src/startsWith.d.ts create mode 100644 types/ramda/src/subtract.d.ts create mode 100644 types/ramda/src/sum.d.ts create mode 100644 types/ramda/src/symmetricDifference.d.ts create mode 100644 types/ramda/src/symmetricDifferenceWith.d.ts create mode 100644 types/ramda/src/tail.d.ts create mode 100644 types/ramda/src/take.d.ts create mode 100644 types/ramda/src/takeLast.d.ts create mode 100644 types/ramda/src/takeLastWhile.d.ts create mode 100644 types/ramda/src/takeWhile.d.ts create mode 100644 types/ramda/src/tap.d.ts create mode 100644 types/ramda/src/test.d.ts create mode 100644 types/ramda/src/times.d.ts create mode 100644 types/ramda/src/toLower.d.ts create mode 100644 types/ramda/src/toPairs.d.ts create mode 100644 types/ramda/src/toPairsIn.d.ts create mode 100644 types/ramda/src/toString.d.ts create mode 100644 types/ramda/src/toUpper.d.ts create mode 100644 types/ramda/src/transduce.d.ts create mode 100644 types/ramda/src/transpose.d.ts create mode 100644 types/ramda/src/traverse.d.ts create mode 100644 types/ramda/src/trim.d.ts create mode 100644 types/ramda/src/tryCatch.d.ts create mode 100644 types/ramda/src/type.d.ts create mode 100644 types/ramda/src/unapply.d.ts create mode 100644 types/ramda/src/unary.d.ts create mode 100644 types/ramda/src/uncurryN.d.ts create mode 100644 types/ramda/src/unfold.d.ts create mode 100644 types/ramda/src/union.d.ts create mode 100644 types/ramda/src/unionWith.d.ts create mode 100644 types/ramda/src/uniq.d.ts create mode 100644 types/ramda/src/uniqBy.d.ts create mode 100644 types/ramda/src/uniqWith.d.ts create mode 100644 types/ramda/src/unless.d.ts create mode 100644 types/ramda/src/unnest.d.ts create mode 100644 types/ramda/src/until.d.ts create mode 100644 types/ramda/src/update.d.ts create mode 100644 types/ramda/src/useWith.d.ts create mode 100644 types/ramda/src/values.d.ts create mode 100644 types/ramda/src/valuesIn.d.ts create mode 100644 types/ramda/src/view.d.ts create mode 100644 types/ramda/src/when.d.ts create mode 100644 types/ramda/src/where.d.ts create mode 100644 types/ramda/src/whereEq.d.ts create mode 100644 types/ramda/src/without.d.ts create mode 100644 types/ramda/src/wrap.d.ts create mode 100644 types/ramda/src/xprod.d.ts create mode 100644 types/ramda/src/zip.d.ts create mode 100644 types/ramda/src/zipObj.d.ts create mode 100644 types/ramda/src/zipWith.d.ts diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index e0313e5957..2124c0b928 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -278,6 +278,252 @@ /// /// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + declare let R: R.Static; declare namespace R { diff --git a/types/ramda/src/F.d.ts b/types/ramda/src/F.d.ts new file mode 100644 index 0000000000..bdc0d570d9 --- /dev/null +++ b/types/ramda/src/F.d.ts @@ -0,0 +1,2 @@ +import { F } from '../index'; +export default F; diff --git a/types/ramda/src/T.d.ts b/types/ramda/src/T.d.ts new file mode 100644 index 0000000000..634808e684 --- /dev/null +++ b/types/ramda/src/T.d.ts @@ -0,0 +1,2 @@ +import { T } from '../index'; +export default T; diff --git a/types/ramda/src/add.d.ts b/types/ramda/src/add.d.ts new file mode 100644 index 0000000000..b7b3ee887c --- /dev/null +++ b/types/ramda/src/add.d.ts @@ -0,0 +1,2 @@ +import { add } from '../index'; +export default add; diff --git a/types/ramda/src/addIndex.d.ts b/types/ramda/src/addIndex.d.ts new file mode 100644 index 0000000000..9f27967dcb --- /dev/null +++ b/types/ramda/src/addIndex.d.ts @@ -0,0 +1,2 @@ +import { addIndex } from '../index'; +export default addIndex; diff --git a/types/ramda/src/adjust.d.ts b/types/ramda/src/adjust.d.ts new file mode 100644 index 0000000000..22b65ec38e --- /dev/null +++ b/types/ramda/src/adjust.d.ts @@ -0,0 +1,2 @@ +import { adjust } from '../index'; +export default adjust; diff --git a/types/ramda/src/all.d.ts b/types/ramda/src/all.d.ts new file mode 100644 index 0000000000..a2f6d934f9 --- /dev/null +++ b/types/ramda/src/all.d.ts @@ -0,0 +1,2 @@ +import { all } from '../index'; +export default all; diff --git a/types/ramda/src/allPass.d.ts b/types/ramda/src/allPass.d.ts new file mode 100644 index 0000000000..d44ac20e9d --- /dev/null +++ b/types/ramda/src/allPass.d.ts @@ -0,0 +1,2 @@ +import { allPass } from '../index'; +export default allPass; diff --git a/types/ramda/src/always.d.ts b/types/ramda/src/always.d.ts new file mode 100644 index 0000000000..aadc94983b --- /dev/null +++ b/types/ramda/src/always.d.ts @@ -0,0 +1,2 @@ +import { always } from '../index'; +export default always; diff --git a/types/ramda/src/and.d.ts b/types/ramda/src/and.d.ts new file mode 100644 index 0000000000..3d505f6ec3 --- /dev/null +++ b/types/ramda/src/and.d.ts @@ -0,0 +1,2 @@ +import { and } from '../index'; +export default and; diff --git a/types/ramda/src/any.d.ts b/types/ramda/src/any.d.ts new file mode 100644 index 0000000000..1e77e505e9 --- /dev/null +++ b/types/ramda/src/any.d.ts @@ -0,0 +1,2 @@ +import { any } from '../index'; +export default any; diff --git a/types/ramda/src/anyPass.d.ts b/types/ramda/src/anyPass.d.ts new file mode 100644 index 0000000000..d8e7fc8f0d --- /dev/null +++ b/types/ramda/src/anyPass.d.ts @@ -0,0 +1,2 @@ +import { anyPass } from '../index'; +export default anyPass; diff --git a/types/ramda/src/ap.d.ts b/types/ramda/src/ap.d.ts new file mode 100644 index 0000000000..5bf98d7fbd --- /dev/null +++ b/types/ramda/src/ap.d.ts @@ -0,0 +1,2 @@ +import { ap } from '../index'; +export default ap; diff --git a/types/ramda/src/aperture.d.ts b/types/ramda/src/aperture.d.ts new file mode 100644 index 0000000000..7536b091b8 --- /dev/null +++ b/types/ramda/src/aperture.d.ts @@ -0,0 +1,2 @@ +import { aperture } from '../index'; +export default aperture; diff --git a/types/ramda/src/append.d.ts b/types/ramda/src/append.d.ts new file mode 100644 index 0000000000..88a4e7cde2 --- /dev/null +++ b/types/ramda/src/append.d.ts @@ -0,0 +1,2 @@ +import { append } from '../index'; +export default append; diff --git a/types/ramda/src/apply.d.ts b/types/ramda/src/apply.d.ts new file mode 100644 index 0000000000..53d90689ed --- /dev/null +++ b/types/ramda/src/apply.d.ts @@ -0,0 +1,2 @@ +import { apply } from '../index'; +export default apply; diff --git a/types/ramda/src/applySpec.d.ts b/types/ramda/src/applySpec.d.ts new file mode 100644 index 0000000000..57e5b8018c --- /dev/null +++ b/types/ramda/src/applySpec.d.ts @@ -0,0 +1,2 @@ +import { applySpec } from '../index'; +export default applySpec; diff --git a/types/ramda/src/applyTo.d.ts b/types/ramda/src/applyTo.d.ts new file mode 100644 index 0000000000..30869542db --- /dev/null +++ b/types/ramda/src/applyTo.d.ts @@ -0,0 +1,2 @@ +import { applyTo } from '../index'; +export default applyTo; diff --git a/types/ramda/src/ascend.d.ts b/types/ramda/src/ascend.d.ts new file mode 100644 index 0000000000..e4c4e1199b --- /dev/null +++ b/types/ramda/src/ascend.d.ts @@ -0,0 +1,2 @@ +import { ascend } from '../index'; +export default ascend; diff --git a/types/ramda/src/assoc.d.ts b/types/ramda/src/assoc.d.ts new file mode 100644 index 0000000000..5acc97a0aa --- /dev/null +++ b/types/ramda/src/assoc.d.ts @@ -0,0 +1,2 @@ +import { assoc } from '../index'; +export default assoc; diff --git a/types/ramda/src/assocPath.d.ts b/types/ramda/src/assocPath.d.ts new file mode 100644 index 0000000000..040671bf38 --- /dev/null +++ b/types/ramda/src/assocPath.d.ts @@ -0,0 +1,2 @@ +import { assocPath } from '../index'; +export default assocPath; diff --git a/types/ramda/src/binary.d.ts b/types/ramda/src/binary.d.ts new file mode 100644 index 0000000000..259cb96e82 --- /dev/null +++ b/types/ramda/src/binary.d.ts @@ -0,0 +1,2 @@ +import { binary } from '../index'; +export default binary; diff --git a/types/ramda/src/bind.d.ts b/types/ramda/src/bind.d.ts new file mode 100644 index 0000000000..fe108f09a7 --- /dev/null +++ b/types/ramda/src/bind.d.ts @@ -0,0 +1,2 @@ +import { bind } from '../index'; +export default bind; diff --git a/types/ramda/src/both.d.ts b/types/ramda/src/both.d.ts new file mode 100644 index 0000000000..8061154cdd --- /dev/null +++ b/types/ramda/src/both.d.ts @@ -0,0 +1,2 @@ +import { both } from '../index'; +export default both; diff --git a/types/ramda/src/call.d.ts b/types/ramda/src/call.d.ts new file mode 100644 index 0000000000..35b6fda88c --- /dev/null +++ b/types/ramda/src/call.d.ts @@ -0,0 +1,2 @@ +import { call } from '../index'; +export default call; diff --git a/types/ramda/src/chain.d.ts b/types/ramda/src/chain.d.ts new file mode 100644 index 0000000000..53aafe210a --- /dev/null +++ b/types/ramda/src/chain.d.ts @@ -0,0 +1,2 @@ +import { chain } from '../index'; +export default chain; diff --git a/types/ramda/src/clamp.d.ts b/types/ramda/src/clamp.d.ts new file mode 100644 index 0000000000..1376643cbf --- /dev/null +++ b/types/ramda/src/clamp.d.ts @@ -0,0 +1,2 @@ +import { clamp } from '../index'; +export default clamp; diff --git a/types/ramda/src/clone.d.ts b/types/ramda/src/clone.d.ts new file mode 100644 index 0000000000..b95f842554 --- /dev/null +++ b/types/ramda/src/clone.d.ts @@ -0,0 +1,2 @@ +import { clone } from '../index'; +export default clone; diff --git a/types/ramda/src/comparator.d.ts b/types/ramda/src/comparator.d.ts new file mode 100644 index 0000000000..34023dea00 --- /dev/null +++ b/types/ramda/src/comparator.d.ts @@ -0,0 +1,2 @@ +import { comparator } from '../index'; +export default comparator; diff --git a/types/ramda/src/complement.d.ts b/types/ramda/src/complement.d.ts new file mode 100644 index 0000000000..b5d31fee50 --- /dev/null +++ b/types/ramda/src/complement.d.ts @@ -0,0 +1,2 @@ +import { complement } from '../index'; +export default complement; diff --git a/types/ramda/src/compose.d.ts b/types/ramda/src/compose.d.ts new file mode 100644 index 0000000000..dca4578840 --- /dev/null +++ b/types/ramda/src/compose.d.ts @@ -0,0 +1,2 @@ +import { compose } from '../index'; +export default compose; diff --git a/types/ramda/src/composeK.d.ts b/types/ramda/src/composeK.d.ts new file mode 100644 index 0000000000..646005a0b6 --- /dev/null +++ b/types/ramda/src/composeK.d.ts @@ -0,0 +1,2 @@ +import { composeK } from '../index'; +export default composeK; diff --git a/types/ramda/src/composeP.d.ts b/types/ramda/src/composeP.d.ts new file mode 100644 index 0000000000..ca0a96fb25 --- /dev/null +++ b/types/ramda/src/composeP.d.ts @@ -0,0 +1,2 @@ +import { composeP } from '../index'; +export default composeP; diff --git a/types/ramda/src/concat.d.ts b/types/ramda/src/concat.d.ts new file mode 100644 index 0000000000..9ae333cf95 --- /dev/null +++ b/types/ramda/src/concat.d.ts @@ -0,0 +1,2 @@ +import { concat } from '../index'; +export default concat; diff --git a/types/ramda/src/cond.d.ts b/types/ramda/src/cond.d.ts new file mode 100644 index 0000000000..0ab4930b0e --- /dev/null +++ b/types/ramda/src/cond.d.ts @@ -0,0 +1,2 @@ +import { cond } from '../index'; +export default cond; diff --git a/types/ramda/src/construct.d.ts b/types/ramda/src/construct.d.ts new file mode 100644 index 0000000000..736871cb61 --- /dev/null +++ b/types/ramda/src/construct.d.ts @@ -0,0 +1,2 @@ +import { construct } from '../index'; +export default construct; diff --git a/types/ramda/src/constructN.d.ts b/types/ramda/src/constructN.d.ts new file mode 100644 index 0000000000..d9efc76cf3 --- /dev/null +++ b/types/ramda/src/constructN.d.ts @@ -0,0 +1,2 @@ +import { constructN } from '../index'; +export default constructN; diff --git a/types/ramda/src/contains.d.ts b/types/ramda/src/contains.d.ts new file mode 100644 index 0000000000..d193bc6109 --- /dev/null +++ b/types/ramda/src/contains.d.ts @@ -0,0 +1,2 @@ +import { contains } from '../index'; +export default contains; diff --git a/types/ramda/src/converge.d.ts b/types/ramda/src/converge.d.ts new file mode 100644 index 0000000000..181c0bd7e9 --- /dev/null +++ b/types/ramda/src/converge.d.ts @@ -0,0 +1,2 @@ +import { converge } from '../index'; +export default converge; diff --git a/types/ramda/src/countBy.d.ts b/types/ramda/src/countBy.d.ts new file mode 100644 index 0000000000..03d46e23f0 --- /dev/null +++ b/types/ramda/src/countBy.d.ts @@ -0,0 +1,2 @@ +import { countBy } from '../index'; +export default countBy; diff --git a/types/ramda/src/curry.d.ts b/types/ramda/src/curry.d.ts new file mode 100644 index 0000000000..0d94abf560 --- /dev/null +++ b/types/ramda/src/curry.d.ts @@ -0,0 +1,2 @@ +import { curry } from '../index'; +export default curry; diff --git a/types/ramda/src/curryN.d.ts b/types/ramda/src/curryN.d.ts new file mode 100644 index 0000000000..dca634c3b8 --- /dev/null +++ b/types/ramda/src/curryN.d.ts @@ -0,0 +1,2 @@ +import { curryN } from '../index'; +export default curryN; diff --git a/types/ramda/src/dec.d.ts b/types/ramda/src/dec.d.ts new file mode 100644 index 0000000000..605681f0d8 --- /dev/null +++ b/types/ramda/src/dec.d.ts @@ -0,0 +1,2 @@ +import { dec } from '../index'; +export default dec; diff --git a/types/ramda/src/defaultTo.d.ts b/types/ramda/src/defaultTo.d.ts new file mode 100644 index 0000000000..9c61199544 --- /dev/null +++ b/types/ramda/src/defaultTo.d.ts @@ -0,0 +1,2 @@ +import { defaultTo } from '../index'; +export default defaultTo; diff --git a/types/ramda/src/descend.d.ts b/types/ramda/src/descend.d.ts new file mode 100644 index 0000000000..d0ff2b6d54 --- /dev/null +++ b/types/ramda/src/descend.d.ts @@ -0,0 +1,2 @@ +import { descend } from '../index'; +export default descend; diff --git a/types/ramda/src/difference.d.ts b/types/ramda/src/difference.d.ts new file mode 100644 index 0000000000..1ef0096735 --- /dev/null +++ b/types/ramda/src/difference.d.ts @@ -0,0 +1,2 @@ +import { difference } from '../index'; +export default difference; diff --git a/types/ramda/src/differenceWith.d.ts b/types/ramda/src/differenceWith.d.ts new file mode 100644 index 0000000000..5a2366f6e0 --- /dev/null +++ b/types/ramda/src/differenceWith.d.ts @@ -0,0 +1,2 @@ +import { differenceWith } from '../index'; +export default differenceWith; diff --git a/types/ramda/src/dissoc.d.ts b/types/ramda/src/dissoc.d.ts new file mode 100644 index 0000000000..0ed3e2def9 --- /dev/null +++ b/types/ramda/src/dissoc.d.ts @@ -0,0 +1,2 @@ +import { dissoc } from '../index'; +export default dissoc; diff --git a/types/ramda/src/dissocPath.d.ts b/types/ramda/src/dissocPath.d.ts new file mode 100644 index 0000000000..83c705d80f --- /dev/null +++ b/types/ramda/src/dissocPath.d.ts @@ -0,0 +1,2 @@ +import { dissocPath } from '../index'; +export default dissocPath; diff --git a/types/ramda/src/divide.d.ts b/types/ramda/src/divide.d.ts new file mode 100644 index 0000000000..45c27a4d21 --- /dev/null +++ b/types/ramda/src/divide.d.ts @@ -0,0 +1,2 @@ +import { divide } from '../index'; +export default divide; diff --git a/types/ramda/src/drop.d.ts b/types/ramda/src/drop.d.ts new file mode 100644 index 0000000000..fb89bef7f0 --- /dev/null +++ b/types/ramda/src/drop.d.ts @@ -0,0 +1,2 @@ +import { drop } from '../index'; +export default drop; diff --git a/types/ramda/src/dropLast.d.ts b/types/ramda/src/dropLast.d.ts new file mode 100644 index 0000000000..2402f890f1 --- /dev/null +++ b/types/ramda/src/dropLast.d.ts @@ -0,0 +1,2 @@ +import { dropLast } from '../index'; +export default dropLast; diff --git a/types/ramda/src/dropLastWhile.d.ts b/types/ramda/src/dropLastWhile.d.ts new file mode 100644 index 0000000000..82950dd98b --- /dev/null +++ b/types/ramda/src/dropLastWhile.d.ts @@ -0,0 +1,2 @@ +import { dropLastWhile } from '../index'; +export default dropLastWhile; diff --git a/types/ramda/src/either.d.ts b/types/ramda/src/either.d.ts new file mode 100644 index 0000000000..130f0c4e7f --- /dev/null +++ b/types/ramda/src/either.d.ts @@ -0,0 +1,2 @@ +import { either } from '../index'; +export default either; diff --git a/types/ramda/src/empty.d.ts b/types/ramda/src/empty.d.ts new file mode 100644 index 0000000000..2cb6e8fade --- /dev/null +++ b/types/ramda/src/empty.d.ts @@ -0,0 +1,2 @@ +import { empty } from '../index'; +export default empty; diff --git a/types/ramda/src/endsWith.d.ts b/types/ramda/src/endsWith.d.ts new file mode 100644 index 0000000000..f23a961bbc --- /dev/null +++ b/types/ramda/src/endsWith.d.ts @@ -0,0 +1,2 @@ +import { endsWith } from '../index'; +export default endsWith; diff --git a/types/ramda/src/eqBy.d.ts b/types/ramda/src/eqBy.d.ts new file mode 100644 index 0000000000..3ed508587a --- /dev/null +++ b/types/ramda/src/eqBy.d.ts @@ -0,0 +1,2 @@ +import { eqBy } from '../index'; +export default eqBy; diff --git a/types/ramda/src/eqProps.d.ts b/types/ramda/src/eqProps.d.ts new file mode 100644 index 0000000000..e33b163311 --- /dev/null +++ b/types/ramda/src/eqProps.d.ts @@ -0,0 +1,2 @@ +import { eqProps } from '../index'; +export default eqProps; diff --git a/types/ramda/src/equals.d.ts b/types/ramda/src/equals.d.ts new file mode 100644 index 0000000000..6d4c8050e1 --- /dev/null +++ b/types/ramda/src/equals.d.ts @@ -0,0 +1,2 @@ +import { equals } from '../index'; +export default equals; diff --git a/types/ramda/src/evolve.d.ts b/types/ramda/src/evolve.d.ts new file mode 100644 index 0000000000..21ec9896a3 --- /dev/null +++ b/types/ramda/src/evolve.d.ts @@ -0,0 +1,2 @@ +import { evolve } from '../index'; +export default evolve; diff --git a/types/ramda/src/filter.d.ts b/types/ramda/src/filter.d.ts new file mode 100644 index 0000000000..a4f7133638 --- /dev/null +++ b/types/ramda/src/filter.d.ts @@ -0,0 +1,2 @@ +import { filter } from '../index'; +export default filter; diff --git a/types/ramda/src/find.d.ts b/types/ramda/src/find.d.ts new file mode 100644 index 0000000000..a8c2905bed --- /dev/null +++ b/types/ramda/src/find.d.ts @@ -0,0 +1,2 @@ +import { find } from '../index'; +export default find; diff --git a/types/ramda/src/findIndex.d.ts b/types/ramda/src/findIndex.d.ts new file mode 100644 index 0000000000..88c14e28fc --- /dev/null +++ b/types/ramda/src/findIndex.d.ts @@ -0,0 +1,2 @@ +import { findIndex } from '../index'; +export default findIndex; diff --git a/types/ramda/src/findLast.d.ts b/types/ramda/src/findLast.d.ts new file mode 100644 index 0000000000..3d8ad5c7fa --- /dev/null +++ b/types/ramda/src/findLast.d.ts @@ -0,0 +1,2 @@ +import { findLast } from '../index'; +export default findLast; diff --git a/types/ramda/src/findLastIndex.d.ts b/types/ramda/src/findLastIndex.d.ts new file mode 100644 index 0000000000..ae1edaeb14 --- /dev/null +++ b/types/ramda/src/findLastIndex.d.ts @@ -0,0 +1,2 @@ +import { findLastIndex } from '../index'; +export default findLastIndex; diff --git a/types/ramda/src/flatten.d.ts b/types/ramda/src/flatten.d.ts new file mode 100644 index 0000000000..75a19402dc --- /dev/null +++ b/types/ramda/src/flatten.d.ts @@ -0,0 +1,2 @@ +import { flatten } from '../index'; +export default flatten; diff --git a/types/ramda/src/flip.d.ts b/types/ramda/src/flip.d.ts new file mode 100644 index 0000000000..164e607f33 --- /dev/null +++ b/types/ramda/src/flip.d.ts @@ -0,0 +1,2 @@ +import { flip } from '../index'; +export default flip; diff --git a/types/ramda/src/forEach.d.ts b/types/ramda/src/forEach.d.ts new file mode 100644 index 0000000000..c5f7a57837 --- /dev/null +++ b/types/ramda/src/forEach.d.ts @@ -0,0 +1,2 @@ +import { forEach } from '../index'; +export default forEach; diff --git a/types/ramda/src/forEachObjIndexed.d.ts b/types/ramda/src/forEachObjIndexed.d.ts new file mode 100644 index 0000000000..a098026381 --- /dev/null +++ b/types/ramda/src/forEachObjIndexed.d.ts @@ -0,0 +1,2 @@ +import { forEachObjIndexed } from '../index'; +export default forEachObjIndexed; diff --git a/types/ramda/src/fromPairs.d.ts b/types/ramda/src/fromPairs.d.ts new file mode 100644 index 0000000000..0cb1778350 --- /dev/null +++ b/types/ramda/src/fromPairs.d.ts @@ -0,0 +1,2 @@ +import { fromPairs } from '../index'; +export default fromPairs; diff --git a/types/ramda/src/groupBy.d.ts b/types/ramda/src/groupBy.d.ts new file mode 100644 index 0000000000..af2b32083b --- /dev/null +++ b/types/ramda/src/groupBy.d.ts @@ -0,0 +1,2 @@ +import { groupBy } from '../index'; +export default groupBy; diff --git a/types/ramda/src/groupWith.d.ts b/types/ramda/src/groupWith.d.ts new file mode 100644 index 0000000000..f9dca6c16b --- /dev/null +++ b/types/ramda/src/groupWith.d.ts @@ -0,0 +1,2 @@ +import { groupWith } from '../index'; +export default groupWith; diff --git a/types/ramda/src/gt.d.ts b/types/ramda/src/gt.d.ts new file mode 100644 index 0000000000..4cdb70d336 --- /dev/null +++ b/types/ramda/src/gt.d.ts @@ -0,0 +1,2 @@ +import { gt } from '../index'; +export default gt; diff --git a/types/ramda/src/gte.d.ts b/types/ramda/src/gte.d.ts new file mode 100644 index 0000000000..2b878eabc6 --- /dev/null +++ b/types/ramda/src/gte.d.ts @@ -0,0 +1,2 @@ +import { gte } from '../index'; +export default gte; diff --git a/types/ramda/src/has.d.ts b/types/ramda/src/has.d.ts new file mode 100644 index 0000000000..88c79bfdb0 --- /dev/null +++ b/types/ramda/src/has.d.ts @@ -0,0 +1,2 @@ +import { has } from '../index'; +export default has; diff --git a/types/ramda/src/hasIn.d.ts b/types/ramda/src/hasIn.d.ts new file mode 100644 index 0000000000..4cad709e64 --- /dev/null +++ b/types/ramda/src/hasIn.d.ts @@ -0,0 +1,2 @@ +import { hasIn } from '../index'; +export default hasIn; diff --git a/types/ramda/src/head.d.ts b/types/ramda/src/head.d.ts new file mode 100644 index 0000000000..bb1f3dd7b9 --- /dev/null +++ b/types/ramda/src/head.d.ts @@ -0,0 +1,2 @@ +import { head } from '../index'; +export default head; diff --git a/types/ramda/src/identical.d.ts b/types/ramda/src/identical.d.ts new file mode 100644 index 0000000000..6f2ccf4f94 --- /dev/null +++ b/types/ramda/src/identical.d.ts @@ -0,0 +1,2 @@ +import { identical } from '../index'; +export default identical; diff --git a/types/ramda/src/identity.d.ts b/types/ramda/src/identity.d.ts new file mode 100644 index 0000000000..ba0936116e --- /dev/null +++ b/types/ramda/src/identity.d.ts @@ -0,0 +1,2 @@ +import { identity } from '../index'; +export default identity; diff --git a/types/ramda/src/ifElse.d.ts b/types/ramda/src/ifElse.d.ts new file mode 100644 index 0000000000..46674829d7 --- /dev/null +++ b/types/ramda/src/ifElse.d.ts @@ -0,0 +1,2 @@ +import { ifElse } from '../index'; +export default ifElse; diff --git a/types/ramda/src/inc.d.ts b/types/ramda/src/inc.d.ts new file mode 100644 index 0000000000..c173b2dd8e --- /dev/null +++ b/types/ramda/src/inc.d.ts @@ -0,0 +1,2 @@ +import { inc } from '../index'; +export default inc; diff --git a/types/ramda/src/includes.d.ts b/types/ramda/src/includes.d.ts new file mode 100644 index 0000000000..b6b04d949f --- /dev/null +++ b/types/ramda/src/includes.d.ts @@ -0,0 +1,2 @@ +import { includes } from '../index'; +export default includes; diff --git a/types/ramda/src/indexBy.d.ts b/types/ramda/src/indexBy.d.ts new file mode 100644 index 0000000000..93b29ec7cd --- /dev/null +++ b/types/ramda/src/indexBy.d.ts @@ -0,0 +1,2 @@ +import { indexBy } from '../index'; +export default indexBy; diff --git a/types/ramda/src/indexOf.d.ts b/types/ramda/src/indexOf.d.ts new file mode 100644 index 0000000000..22aa4b44db --- /dev/null +++ b/types/ramda/src/indexOf.d.ts @@ -0,0 +1,2 @@ +import { indexOf } from '../index'; +export default indexOf; diff --git a/types/ramda/src/init.d.ts b/types/ramda/src/init.d.ts new file mode 100644 index 0000000000..03849db7b0 --- /dev/null +++ b/types/ramda/src/init.d.ts @@ -0,0 +1,2 @@ +import { init } from '../index'; +export default init; diff --git a/types/ramda/src/innerJoin.d.ts b/types/ramda/src/innerJoin.d.ts new file mode 100644 index 0000000000..de01332837 --- /dev/null +++ b/types/ramda/src/innerJoin.d.ts @@ -0,0 +1,2 @@ +import { innerJoin } from '../index'; +export default innerJoin; diff --git a/types/ramda/src/insert.d.ts b/types/ramda/src/insert.d.ts new file mode 100644 index 0000000000..3fdde857fa --- /dev/null +++ b/types/ramda/src/insert.d.ts @@ -0,0 +1,2 @@ +import { insert } from '../index'; +export default insert; diff --git a/types/ramda/src/insertAll.d.ts b/types/ramda/src/insertAll.d.ts new file mode 100644 index 0000000000..a9fd784995 --- /dev/null +++ b/types/ramda/src/insertAll.d.ts @@ -0,0 +1,2 @@ +import { insertAll } from '../index'; +export default insertAll; diff --git a/types/ramda/src/intersection.d.ts b/types/ramda/src/intersection.d.ts new file mode 100644 index 0000000000..1ec1aadbe4 --- /dev/null +++ b/types/ramda/src/intersection.d.ts @@ -0,0 +1,2 @@ +import { intersection } from '../index'; +export default intersection; diff --git a/types/ramda/src/intersectionWith.d.ts b/types/ramda/src/intersectionWith.d.ts new file mode 100644 index 0000000000..773c36acbe --- /dev/null +++ b/types/ramda/src/intersectionWith.d.ts @@ -0,0 +1,2 @@ +import { intersectionWith } from '../index'; +export default intersectionWith; diff --git a/types/ramda/src/intersperse.d.ts b/types/ramda/src/intersperse.d.ts new file mode 100644 index 0000000000..b4420de34a --- /dev/null +++ b/types/ramda/src/intersperse.d.ts @@ -0,0 +1,2 @@ +import { intersperse } from '../index'; +export default intersperse; diff --git a/types/ramda/src/into.d.ts b/types/ramda/src/into.d.ts new file mode 100644 index 0000000000..3daa53afdd --- /dev/null +++ b/types/ramda/src/into.d.ts @@ -0,0 +1,2 @@ +import { into } from '../index'; +export default into; diff --git a/types/ramda/src/invert.d.ts b/types/ramda/src/invert.d.ts new file mode 100644 index 0000000000..825773f5dc --- /dev/null +++ b/types/ramda/src/invert.d.ts @@ -0,0 +1,2 @@ +import { invert } from '../index'; +export default invert; diff --git a/types/ramda/src/invertObj.d.ts b/types/ramda/src/invertObj.d.ts new file mode 100644 index 0000000000..8fd0f1fe7d --- /dev/null +++ b/types/ramda/src/invertObj.d.ts @@ -0,0 +1,2 @@ +import { invertObj } from '../index'; +export default invertObj; diff --git a/types/ramda/src/invoker.d.ts b/types/ramda/src/invoker.d.ts new file mode 100644 index 0000000000..1930a78917 --- /dev/null +++ b/types/ramda/src/invoker.d.ts @@ -0,0 +1,2 @@ +import { invoker } from '../index'; +export default invoker; diff --git a/types/ramda/src/is.d.ts b/types/ramda/src/is.d.ts new file mode 100644 index 0000000000..262d14160d --- /dev/null +++ b/types/ramda/src/is.d.ts @@ -0,0 +1,2 @@ +import { is } from '../index'; +export default is; diff --git a/types/ramda/src/isArrayLike.d.ts b/types/ramda/src/isArrayLike.d.ts new file mode 100644 index 0000000000..04aa464805 --- /dev/null +++ b/types/ramda/src/isArrayLike.d.ts @@ -0,0 +1,2 @@ +import { isArrayLike } from '../index'; +export default isArrayLike; diff --git a/types/ramda/src/isEmpty.d.ts b/types/ramda/src/isEmpty.d.ts new file mode 100644 index 0000000000..bea7bb8d08 --- /dev/null +++ b/types/ramda/src/isEmpty.d.ts @@ -0,0 +1,2 @@ +import { isEmpty } from '../index'; +export default isEmpty; diff --git a/types/ramda/src/isNaN.d.ts b/types/ramda/src/isNaN.d.ts new file mode 100644 index 0000000000..5dbe28177a --- /dev/null +++ b/types/ramda/src/isNaN.d.ts @@ -0,0 +1,2 @@ +import { isNaN } from '../index'; +export default isNaN; diff --git a/types/ramda/src/isNil.d.ts b/types/ramda/src/isNil.d.ts new file mode 100644 index 0000000000..bce78e7c70 --- /dev/null +++ b/types/ramda/src/isNil.d.ts @@ -0,0 +1,2 @@ +import { isNil } from '../index'; +export default isNil; diff --git a/types/ramda/src/join.d.ts b/types/ramda/src/join.d.ts new file mode 100644 index 0000000000..7505b7e769 --- /dev/null +++ b/types/ramda/src/join.d.ts @@ -0,0 +1,2 @@ +import { join } from '../index'; +export default join; diff --git a/types/ramda/src/juxt.d.ts b/types/ramda/src/juxt.d.ts new file mode 100644 index 0000000000..23e342f53d --- /dev/null +++ b/types/ramda/src/juxt.d.ts @@ -0,0 +1,2 @@ +import { juxt } from '../index'; +export default juxt; diff --git a/types/ramda/src/keys.d.ts b/types/ramda/src/keys.d.ts new file mode 100644 index 0000000000..b44e894b7a --- /dev/null +++ b/types/ramda/src/keys.d.ts @@ -0,0 +1,2 @@ +import { keys } from '../index'; +export default keys; diff --git a/types/ramda/src/keysIn.d.ts b/types/ramda/src/keysIn.d.ts new file mode 100644 index 0000000000..a54fb92a6d --- /dev/null +++ b/types/ramda/src/keysIn.d.ts @@ -0,0 +1,2 @@ +import { keysIn } from '../index'; +export default keysIn; diff --git a/types/ramda/src/last.d.ts b/types/ramda/src/last.d.ts new file mode 100644 index 0000000000..f8ea740735 --- /dev/null +++ b/types/ramda/src/last.d.ts @@ -0,0 +1,2 @@ +import { last } from '../index'; +export default last; diff --git a/types/ramda/src/lastIndexOf.d.ts b/types/ramda/src/lastIndexOf.d.ts new file mode 100644 index 0000000000..c34fe55a03 --- /dev/null +++ b/types/ramda/src/lastIndexOf.d.ts @@ -0,0 +1,2 @@ +import { lastIndexOf } from '../index'; +export default lastIndexOf; diff --git a/types/ramda/src/length.d.ts b/types/ramda/src/length.d.ts new file mode 100644 index 0000000000..7ef1d90dd5 --- /dev/null +++ b/types/ramda/src/length.d.ts @@ -0,0 +1,2 @@ +import { length } from '../index'; +export default length; diff --git a/types/ramda/src/lens.d.ts b/types/ramda/src/lens.d.ts new file mode 100644 index 0000000000..03688e0c4f --- /dev/null +++ b/types/ramda/src/lens.d.ts @@ -0,0 +1,2 @@ +import { lens } from '../index'; +export default lens; diff --git a/types/ramda/src/lensIndex.d.ts b/types/ramda/src/lensIndex.d.ts new file mode 100644 index 0000000000..d85cd88c2f --- /dev/null +++ b/types/ramda/src/lensIndex.d.ts @@ -0,0 +1,2 @@ +import { lensIndex } from '../index'; +export default lensIndex; diff --git a/types/ramda/src/lensPath.d.ts b/types/ramda/src/lensPath.d.ts new file mode 100644 index 0000000000..67b60fbf3c --- /dev/null +++ b/types/ramda/src/lensPath.d.ts @@ -0,0 +1,2 @@ +import { lensPath } from '../index'; +export default lensPath; diff --git a/types/ramda/src/lensProp.d.ts b/types/ramda/src/lensProp.d.ts new file mode 100644 index 0000000000..fc8db9e32d --- /dev/null +++ b/types/ramda/src/lensProp.d.ts @@ -0,0 +1,2 @@ +import { lensProp } from '../index'; +export default lensProp; diff --git a/types/ramda/src/lift.d.ts b/types/ramda/src/lift.d.ts new file mode 100644 index 0000000000..73e4cba184 --- /dev/null +++ b/types/ramda/src/lift.d.ts @@ -0,0 +1,2 @@ +import { lift } from '../index'; +export default lift; diff --git a/types/ramda/src/lt.d.ts b/types/ramda/src/lt.d.ts new file mode 100644 index 0000000000..71360d1c43 --- /dev/null +++ b/types/ramda/src/lt.d.ts @@ -0,0 +1,2 @@ +import { lt } from '../index'; +export default lt; diff --git a/types/ramda/src/lte.d.ts b/types/ramda/src/lte.d.ts new file mode 100644 index 0000000000..980ef22037 --- /dev/null +++ b/types/ramda/src/lte.d.ts @@ -0,0 +1,2 @@ +import { lte } from '../index'; +export default lte; diff --git a/types/ramda/src/map.d.ts b/types/ramda/src/map.d.ts new file mode 100644 index 0000000000..6883cb62f6 --- /dev/null +++ b/types/ramda/src/map.d.ts @@ -0,0 +1,2 @@ +import { map } from '../index'; +export default map; diff --git a/types/ramda/src/mapAccum.d.ts b/types/ramda/src/mapAccum.d.ts new file mode 100644 index 0000000000..356c715787 --- /dev/null +++ b/types/ramda/src/mapAccum.d.ts @@ -0,0 +1,2 @@ +import { mapAccum } from '../index'; +export default mapAccum; diff --git a/types/ramda/src/mapAccumRight.d.ts b/types/ramda/src/mapAccumRight.d.ts new file mode 100644 index 0000000000..817e73bb97 --- /dev/null +++ b/types/ramda/src/mapAccumRight.d.ts @@ -0,0 +1,2 @@ +import { mapAccumRight } from '../index'; +export default mapAccumRight; diff --git a/types/ramda/src/mapObjIndexed.d.ts b/types/ramda/src/mapObjIndexed.d.ts new file mode 100644 index 0000000000..3ef1eca52d --- /dev/null +++ b/types/ramda/src/mapObjIndexed.d.ts @@ -0,0 +1,2 @@ +import { mapObjIndexed } from '../index'; +export default mapObjIndexed; diff --git a/types/ramda/src/match.d.ts b/types/ramda/src/match.d.ts new file mode 100644 index 0000000000..a24f0bd6d0 --- /dev/null +++ b/types/ramda/src/match.d.ts @@ -0,0 +1,2 @@ +import { match } from '../index'; +export default match; diff --git a/types/ramda/src/mathMod.d.ts b/types/ramda/src/mathMod.d.ts new file mode 100644 index 0000000000..0b0205c822 --- /dev/null +++ b/types/ramda/src/mathMod.d.ts @@ -0,0 +1,2 @@ +import { mathMod } from '../index'; +export default mathMod; diff --git a/types/ramda/src/max.d.ts b/types/ramda/src/max.d.ts new file mode 100644 index 0000000000..fcb09338c0 --- /dev/null +++ b/types/ramda/src/max.d.ts @@ -0,0 +1,2 @@ +import { max } from '../index'; +export default max; diff --git a/types/ramda/src/maxBy.d.ts b/types/ramda/src/maxBy.d.ts new file mode 100644 index 0000000000..4d00e7e572 --- /dev/null +++ b/types/ramda/src/maxBy.d.ts @@ -0,0 +1,2 @@ +import { maxBy } from '../index'; +export default maxBy; diff --git a/types/ramda/src/mean.d.ts b/types/ramda/src/mean.d.ts new file mode 100644 index 0000000000..8babcc3374 --- /dev/null +++ b/types/ramda/src/mean.d.ts @@ -0,0 +1,2 @@ +import { mean } from '../index'; +export default mean; diff --git a/types/ramda/src/median.d.ts b/types/ramda/src/median.d.ts new file mode 100644 index 0000000000..f7386692ff --- /dev/null +++ b/types/ramda/src/median.d.ts @@ -0,0 +1,2 @@ +import { median } from '../index'; +export default median; diff --git a/types/ramda/src/memoize.d.ts b/types/ramda/src/memoize.d.ts new file mode 100644 index 0000000000..a32d4d0016 --- /dev/null +++ b/types/ramda/src/memoize.d.ts @@ -0,0 +1,2 @@ +import { memoize } from '../index'; +export default memoize; diff --git a/types/ramda/src/memoizeWith.d.ts b/types/ramda/src/memoizeWith.d.ts new file mode 100644 index 0000000000..8eb2abd416 --- /dev/null +++ b/types/ramda/src/memoizeWith.d.ts @@ -0,0 +1,2 @@ +import { memoizeWith } from '../index'; +export default memoizeWith; diff --git a/types/ramda/src/merge.d.ts b/types/ramda/src/merge.d.ts new file mode 100644 index 0000000000..9786c2b611 --- /dev/null +++ b/types/ramda/src/merge.d.ts @@ -0,0 +1,2 @@ +import { merge } from '../index'; +export default merge; diff --git a/types/ramda/src/mergeAll.d.ts b/types/ramda/src/mergeAll.d.ts new file mode 100644 index 0000000000..8bb141f82f --- /dev/null +++ b/types/ramda/src/mergeAll.d.ts @@ -0,0 +1,2 @@ +import { mergeAll } from '../index'; +export default mergeAll; diff --git a/types/ramda/src/mergeDeepLeft.d.ts b/types/ramda/src/mergeDeepLeft.d.ts new file mode 100644 index 0000000000..332df578d3 --- /dev/null +++ b/types/ramda/src/mergeDeepLeft.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepLeft } from '../index'; +export default mergeDeepLeft; diff --git a/types/ramda/src/mergeDeepRight.d.ts b/types/ramda/src/mergeDeepRight.d.ts new file mode 100644 index 0000000000..c589924ca5 --- /dev/null +++ b/types/ramda/src/mergeDeepRight.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepRight } from '../index'; +export default mergeDeepRight; diff --git a/types/ramda/src/mergeDeepWith.d.ts b/types/ramda/src/mergeDeepWith.d.ts new file mode 100644 index 0000000000..cd5523b224 --- /dev/null +++ b/types/ramda/src/mergeDeepWith.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepWith } from '../index'; +export default mergeDeepWith; diff --git a/types/ramda/src/mergeDeepWithKey.d.ts b/types/ramda/src/mergeDeepWithKey.d.ts new file mode 100644 index 0000000000..70f6ace1db --- /dev/null +++ b/types/ramda/src/mergeDeepWithKey.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepWithKey } from '../index'; +export default mergeDeepWithKey; diff --git a/types/ramda/src/mergeWith.d.ts b/types/ramda/src/mergeWith.d.ts new file mode 100644 index 0000000000..0270c71977 --- /dev/null +++ b/types/ramda/src/mergeWith.d.ts @@ -0,0 +1,2 @@ +import { mergeWith } from '../index'; +export default mergeWith; diff --git a/types/ramda/src/mergeWithKey.d.ts b/types/ramda/src/mergeWithKey.d.ts new file mode 100644 index 0000000000..b32e625cfc --- /dev/null +++ b/types/ramda/src/mergeWithKey.d.ts @@ -0,0 +1,2 @@ +import { mergeWithKey } from '../index'; +export default mergeWithKey; diff --git a/types/ramda/src/min.d.ts b/types/ramda/src/min.d.ts new file mode 100644 index 0000000000..af0dca8faa --- /dev/null +++ b/types/ramda/src/min.d.ts @@ -0,0 +1,2 @@ +import { min } from '../index'; +export default min; diff --git a/types/ramda/src/minBy.d.ts b/types/ramda/src/minBy.d.ts new file mode 100644 index 0000000000..14377eea93 --- /dev/null +++ b/types/ramda/src/minBy.d.ts @@ -0,0 +1,2 @@ +import { minBy } from '../index'; +export default minBy; diff --git a/types/ramda/src/modulo.d.ts b/types/ramda/src/modulo.d.ts new file mode 100644 index 0000000000..4c32f3ce8f --- /dev/null +++ b/types/ramda/src/modulo.d.ts @@ -0,0 +1,2 @@ +import { modulo } from '../index'; +export default modulo; diff --git a/types/ramda/src/move.d.ts b/types/ramda/src/move.d.ts new file mode 100644 index 0000000000..3df4ee626e --- /dev/null +++ b/types/ramda/src/move.d.ts @@ -0,0 +1,2 @@ +import { move } from '../index'; +export default move; diff --git a/types/ramda/src/multiply.d.ts b/types/ramda/src/multiply.d.ts new file mode 100644 index 0000000000..56d3a59380 --- /dev/null +++ b/types/ramda/src/multiply.d.ts @@ -0,0 +1,2 @@ +import { multiply } from '../index'; +export default multiply; diff --git a/types/ramda/src/nAry.d.ts b/types/ramda/src/nAry.d.ts new file mode 100644 index 0000000000..a9bce85047 --- /dev/null +++ b/types/ramda/src/nAry.d.ts @@ -0,0 +1,2 @@ +import { nAry } from '../index'; +export default nAry; diff --git a/types/ramda/src/negate.d.ts b/types/ramda/src/negate.d.ts new file mode 100644 index 0000000000..8410d94a22 --- /dev/null +++ b/types/ramda/src/negate.d.ts @@ -0,0 +1,2 @@ +import { negate } from '../index'; +export default negate; diff --git a/types/ramda/src/none.d.ts b/types/ramda/src/none.d.ts new file mode 100644 index 0000000000..6c545e7261 --- /dev/null +++ b/types/ramda/src/none.d.ts @@ -0,0 +1,2 @@ +import { none } from '../index'; +export default none; diff --git a/types/ramda/src/not.d.ts b/types/ramda/src/not.d.ts new file mode 100644 index 0000000000..10c4c56cfc --- /dev/null +++ b/types/ramda/src/not.d.ts @@ -0,0 +1,2 @@ +import { not } from '../index'; +export default not; diff --git a/types/ramda/src/nth.d.ts b/types/ramda/src/nth.d.ts new file mode 100644 index 0000000000..b5cef1993a --- /dev/null +++ b/types/ramda/src/nth.d.ts @@ -0,0 +1,2 @@ +import { nth } from '../index'; +export default nth; diff --git a/types/ramda/src/nthArg.d.ts b/types/ramda/src/nthArg.d.ts new file mode 100644 index 0000000000..5d61bb24f6 --- /dev/null +++ b/types/ramda/src/nthArg.d.ts @@ -0,0 +1,2 @@ +import { nthArg } from '../index'; +export default nthArg; diff --git a/types/ramda/src/objOf.d.ts b/types/ramda/src/objOf.d.ts new file mode 100644 index 0000000000..0a2b7c3075 --- /dev/null +++ b/types/ramda/src/objOf.d.ts @@ -0,0 +1,2 @@ +import { objOf } from '../index'; +export default objOf; diff --git a/types/ramda/src/of.d.ts b/types/ramda/src/of.d.ts new file mode 100644 index 0000000000..252569b5e6 --- /dev/null +++ b/types/ramda/src/of.d.ts @@ -0,0 +1,2 @@ +import { of } from '../index'; +export default of; diff --git a/types/ramda/src/omit.d.ts b/types/ramda/src/omit.d.ts new file mode 100644 index 0000000000..e7e9f796e9 --- /dev/null +++ b/types/ramda/src/omit.d.ts @@ -0,0 +1,2 @@ +import { omit } from '../index'; +export default omit; diff --git a/types/ramda/src/once.d.ts b/types/ramda/src/once.d.ts new file mode 100644 index 0000000000..f49febf008 --- /dev/null +++ b/types/ramda/src/once.d.ts @@ -0,0 +1,2 @@ +import { once } from '../index'; +export default once; diff --git a/types/ramda/src/or.d.ts b/types/ramda/src/or.d.ts new file mode 100644 index 0000000000..933ca7b2d2 --- /dev/null +++ b/types/ramda/src/or.d.ts @@ -0,0 +1,2 @@ +import { or } from '../index'; +export default or; diff --git a/types/ramda/src/over.d.ts b/types/ramda/src/over.d.ts new file mode 100644 index 0000000000..deee3577da --- /dev/null +++ b/types/ramda/src/over.d.ts @@ -0,0 +1,2 @@ +import { over } from '../index'; +export default over; diff --git a/types/ramda/src/pair.d.ts b/types/ramda/src/pair.d.ts new file mode 100644 index 0000000000..2a1cea9de0 --- /dev/null +++ b/types/ramda/src/pair.d.ts @@ -0,0 +1,2 @@ +import { pair } from '../index'; +export default pair; diff --git a/types/ramda/src/partial.d.ts b/types/ramda/src/partial.d.ts new file mode 100644 index 0000000000..acbb16bac3 --- /dev/null +++ b/types/ramda/src/partial.d.ts @@ -0,0 +1,2 @@ +import { partial } from '../index'; +export default partial; diff --git a/types/ramda/src/partialRight.d.ts b/types/ramda/src/partialRight.d.ts new file mode 100644 index 0000000000..5b3bb4b0fa --- /dev/null +++ b/types/ramda/src/partialRight.d.ts @@ -0,0 +1,2 @@ +import { partialRight } from '../index'; +export default partialRight; diff --git a/types/ramda/src/partition.d.ts b/types/ramda/src/partition.d.ts new file mode 100644 index 0000000000..28086418d7 --- /dev/null +++ b/types/ramda/src/partition.d.ts @@ -0,0 +1,2 @@ +import { partition } from '../index'; +export default partition; diff --git a/types/ramda/src/path.d.ts b/types/ramda/src/path.d.ts new file mode 100644 index 0000000000..edf4fa57b0 --- /dev/null +++ b/types/ramda/src/path.d.ts @@ -0,0 +1,2 @@ +import { path } from '../index'; +export default path; diff --git a/types/ramda/src/pathEq.d.ts b/types/ramda/src/pathEq.d.ts new file mode 100644 index 0000000000..27856ca3bc --- /dev/null +++ b/types/ramda/src/pathEq.d.ts @@ -0,0 +1,2 @@ +import { pathEq } from '../index'; +export default pathEq; diff --git a/types/ramda/src/pathOr.d.ts b/types/ramda/src/pathOr.d.ts new file mode 100644 index 0000000000..1af55adc0c --- /dev/null +++ b/types/ramda/src/pathOr.d.ts @@ -0,0 +1,2 @@ +import { pathOr } from '../index'; +export default pathOr; diff --git a/types/ramda/src/pathSatisfies.d.ts b/types/ramda/src/pathSatisfies.d.ts new file mode 100644 index 0000000000..e2493400a2 --- /dev/null +++ b/types/ramda/src/pathSatisfies.d.ts @@ -0,0 +1,2 @@ +import { pathSatisfies } from '../index'; +export default pathSatisfies; diff --git a/types/ramda/src/pick.d.ts b/types/ramda/src/pick.d.ts new file mode 100644 index 0000000000..67b2477a48 --- /dev/null +++ b/types/ramda/src/pick.d.ts @@ -0,0 +1,2 @@ +import { pick } from '../index'; +export default pick; diff --git a/types/ramda/src/pickAll.d.ts b/types/ramda/src/pickAll.d.ts new file mode 100644 index 0000000000..d7e7719077 --- /dev/null +++ b/types/ramda/src/pickAll.d.ts @@ -0,0 +1,2 @@ +import { pickAll } from '../index'; +export default pickAll; diff --git a/types/ramda/src/pickBy.d.ts b/types/ramda/src/pickBy.d.ts new file mode 100644 index 0000000000..4a047dc4ab --- /dev/null +++ b/types/ramda/src/pickBy.d.ts @@ -0,0 +1,2 @@ +import { pickBy } from '../index'; +export default pickBy; diff --git a/types/ramda/src/pipe.d.ts b/types/ramda/src/pipe.d.ts new file mode 100644 index 0000000000..ef1d61098b --- /dev/null +++ b/types/ramda/src/pipe.d.ts @@ -0,0 +1,2 @@ +import { pipe } from '../index'; +export default pipe; diff --git a/types/ramda/src/pipeK.d.ts b/types/ramda/src/pipeK.d.ts new file mode 100644 index 0000000000..bca50e6fff --- /dev/null +++ b/types/ramda/src/pipeK.d.ts @@ -0,0 +1,2 @@ +import { pipeK } from '../index'; +export default pipeK; diff --git a/types/ramda/src/pipeP.d.ts b/types/ramda/src/pipeP.d.ts new file mode 100644 index 0000000000..c69b96d23c --- /dev/null +++ b/types/ramda/src/pipeP.d.ts @@ -0,0 +1,2 @@ +import { pipeP } from '../index'; +export default pipeP; diff --git a/types/ramda/src/pluck.d.ts b/types/ramda/src/pluck.d.ts new file mode 100644 index 0000000000..8bdb4ccbe4 --- /dev/null +++ b/types/ramda/src/pluck.d.ts @@ -0,0 +1,2 @@ +import { pluck } from '../index'; +export default pluck; diff --git a/types/ramda/src/prepend.d.ts b/types/ramda/src/prepend.d.ts new file mode 100644 index 0000000000..9d3fde51b4 --- /dev/null +++ b/types/ramda/src/prepend.d.ts @@ -0,0 +1,2 @@ +import { prepend } from '../index'; +export default prepend; diff --git a/types/ramda/src/product.d.ts b/types/ramda/src/product.d.ts new file mode 100644 index 0000000000..32aed3c0ee --- /dev/null +++ b/types/ramda/src/product.d.ts @@ -0,0 +1,2 @@ +import { product } from '../index'; +export default product; diff --git a/types/ramda/src/project.d.ts b/types/ramda/src/project.d.ts new file mode 100644 index 0000000000..4c1b11c6ed --- /dev/null +++ b/types/ramda/src/project.d.ts @@ -0,0 +1,2 @@ +import { project } from '../index'; +export default project; diff --git a/types/ramda/src/prop.d.ts b/types/ramda/src/prop.d.ts new file mode 100644 index 0000000000..c990b9aca5 --- /dev/null +++ b/types/ramda/src/prop.d.ts @@ -0,0 +1,2 @@ +import { prop } from '../index'; +export default prop; diff --git a/types/ramda/src/propEq.d.ts b/types/ramda/src/propEq.d.ts new file mode 100644 index 0000000000..1e04cb564c --- /dev/null +++ b/types/ramda/src/propEq.d.ts @@ -0,0 +1,2 @@ +import { propEq } from '../index'; +export default propEq; diff --git a/types/ramda/src/propIs.d.ts b/types/ramda/src/propIs.d.ts new file mode 100644 index 0000000000..1be4e6bd04 --- /dev/null +++ b/types/ramda/src/propIs.d.ts @@ -0,0 +1,2 @@ +import { propIs } from '../index'; +export default propIs; diff --git a/types/ramda/src/propOr.d.ts b/types/ramda/src/propOr.d.ts new file mode 100644 index 0000000000..2935d077be --- /dev/null +++ b/types/ramda/src/propOr.d.ts @@ -0,0 +1,2 @@ +import { propOr } from '../index'; +export default propOr; diff --git a/types/ramda/src/propSatisfies.d.ts b/types/ramda/src/propSatisfies.d.ts new file mode 100644 index 0000000000..1b4ff52788 --- /dev/null +++ b/types/ramda/src/propSatisfies.d.ts @@ -0,0 +1,2 @@ +import { propSatisfies } from '../index'; +export default propSatisfies; diff --git a/types/ramda/src/props.d.ts b/types/ramda/src/props.d.ts new file mode 100644 index 0000000000..b856c60b00 --- /dev/null +++ b/types/ramda/src/props.d.ts @@ -0,0 +1,2 @@ +import { props } from '../index'; +export default props; diff --git a/types/ramda/src/range.d.ts b/types/ramda/src/range.d.ts new file mode 100644 index 0000000000..a507ebe4a9 --- /dev/null +++ b/types/ramda/src/range.d.ts @@ -0,0 +1,2 @@ +import { range } from '../index'; +export default range; diff --git a/types/ramda/src/reduce.d.ts b/types/ramda/src/reduce.d.ts new file mode 100644 index 0000000000..eb3b427d00 --- /dev/null +++ b/types/ramda/src/reduce.d.ts @@ -0,0 +1,2 @@ +import { reduce } from '../index'; +export default reduce; diff --git a/types/ramda/src/reduceBy.d.ts b/types/ramda/src/reduceBy.d.ts new file mode 100644 index 0000000000..655c96ef18 --- /dev/null +++ b/types/ramda/src/reduceBy.d.ts @@ -0,0 +1,2 @@ +import { reduceBy } from '../index'; +export default reduceBy; diff --git a/types/ramda/src/reduceRight.d.ts b/types/ramda/src/reduceRight.d.ts new file mode 100644 index 0000000000..3e72f7c309 --- /dev/null +++ b/types/ramda/src/reduceRight.d.ts @@ -0,0 +1,2 @@ +import { reduceRight } from '../index'; +export default reduceRight; diff --git a/types/ramda/src/reduceWhile.d.ts b/types/ramda/src/reduceWhile.d.ts new file mode 100644 index 0000000000..aaa836d38d --- /dev/null +++ b/types/ramda/src/reduceWhile.d.ts @@ -0,0 +1,2 @@ +import { reduceWhile } from '../index'; +export default reduceWhile; diff --git a/types/ramda/src/reduced.d.ts b/types/ramda/src/reduced.d.ts new file mode 100644 index 0000000000..f36739bbe2 --- /dev/null +++ b/types/ramda/src/reduced.d.ts @@ -0,0 +1,2 @@ +import { reduced } from '../index'; +export default reduced; diff --git a/types/ramda/src/reject.d.ts b/types/ramda/src/reject.d.ts new file mode 100644 index 0000000000..600c706f68 --- /dev/null +++ b/types/ramda/src/reject.d.ts @@ -0,0 +1,2 @@ +import { reject } from '../index'; +export default reject; diff --git a/types/ramda/src/remove.d.ts b/types/ramda/src/remove.d.ts new file mode 100644 index 0000000000..023edada47 --- /dev/null +++ b/types/ramda/src/remove.d.ts @@ -0,0 +1,2 @@ +import { remove } from '../index'; +export default remove; diff --git a/types/ramda/src/repeat.d.ts b/types/ramda/src/repeat.d.ts new file mode 100644 index 0000000000..3d8218a1a4 --- /dev/null +++ b/types/ramda/src/repeat.d.ts @@ -0,0 +1,2 @@ +import { repeat } from '../index'; +export default repeat; diff --git a/types/ramda/src/replace.d.ts b/types/ramda/src/replace.d.ts new file mode 100644 index 0000000000..dc735ab2cf --- /dev/null +++ b/types/ramda/src/replace.d.ts @@ -0,0 +1,2 @@ +import { replace } from '../index'; +export default replace; diff --git a/types/ramda/src/reverse.d.ts b/types/ramda/src/reverse.d.ts new file mode 100644 index 0000000000..2d1b2d9390 --- /dev/null +++ b/types/ramda/src/reverse.d.ts @@ -0,0 +1,2 @@ +import { reverse } from '../index'; +export default reverse; diff --git a/types/ramda/src/scan.d.ts b/types/ramda/src/scan.d.ts new file mode 100644 index 0000000000..8971cff9b7 --- /dev/null +++ b/types/ramda/src/scan.d.ts @@ -0,0 +1,2 @@ +import { scan } from '../index'; +export default scan; diff --git a/types/ramda/src/set.d.ts b/types/ramda/src/set.d.ts new file mode 100644 index 0000000000..5023a0b854 --- /dev/null +++ b/types/ramda/src/set.d.ts @@ -0,0 +1,2 @@ +import { set } from '../index'; +export default set; diff --git a/types/ramda/src/slice.d.ts b/types/ramda/src/slice.d.ts new file mode 100644 index 0000000000..6fdc54e59b --- /dev/null +++ b/types/ramda/src/slice.d.ts @@ -0,0 +1,2 @@ +import { slice } from '../index'; +export default slice; diff --git a/types/ramda/src/sort.d.ts b/types/ramda/src/sort.d.ts new file mode 100644 index 0000000000..9f4977e5c5 --- /dev/null +++ b/types/ramda/src/sort.d.ts @@ -0,0 +1,2 @@ +import { sort } from '../index'; +export default sort; diff --git a/types/ramda/src/sortBy.d.ts b/types/ramda/src/sortBy.d.ts new file mode 100644 index 0000000000..ff4eec72f4 --- /dev/null +++ b/types/ramda/src/sortBy.d.ts @@ -0,0 +1,2 @@ +import { sortBy } from '../index'; +export default sortBy; diff --git a/types/ramda/src/sortWith.d.ts b/types/ramda/src/sortWith.d.ts new file mode 100644 index 0000000000..e8e386a2fd --- /dev/null +++ b/types/ramda/src/sortWith.d.ts @@ -0,0 +1,2 @@ +import { sortWith } from '../index'; +export default sortWith; diff --git a/types/ramda/src/split.d.ts b/types/ramda/src/split.d.ts new file mode 100644 index 0000000000..c89a30372b --- /dev/null +++ b/types/ramda/src/split.d.ts @@ -0,0 +1,2 @@ +import { split } from '../index'; +export default split; diff --git a/types/ramda/src/splitAt.d.ts b/types/ramda/src/splitAt.d.ts new file mode 100644 index 0000000000..2f505a21e3 --- /dev/null +++ b/types/ramda/src/splitAt.d.ts @@ -0,0 +1,2 @@ +import { splitAt } from '../index'; +export default splitAt; diff --git a/types/ramda/src/splitEvery.d.ts b/types/ramda/src/splitEvery.d.ts new file mode 100644 index 0000000000..21329e9593 --- /dev/null +++ b/types/ramda/src/splitEvery.d.ts @@ -0,0 +1,2 @@ +import { splitEvery } from '../index'; +export default splitEvery; diff --git a/types/ramda/src/splitWhen.d.ts b/types/ramda/src/splitWhen.d.ts new file mode 100644 index 0000000000..fad94d5bfa --- /dev/null +++ b/types/ramda/src/splitWhen.d.ts @@ -0,0 +1,2 @@ +import { splitWhen } from '../index'; +export default splitWhen; diff --git a/types/ramda/src/startsWith.d.ts b/types/ramda/src/startsWith.d.ts new file mode 100644 index 0000000000..88811ae146 --- /dev/null +++ b/types/ramda/src/startsWith.d.ts @@ -0,0 +1,2 @@ +import { startsWith } from '../index'; +export default startsWith; diff --git a/types/ramda/src/subtract.d.ts b/types/ramda/src/subtract.d.ts new file mode 100644 index 0000000000..2bac6a6c9f --- /dev/null +++ b/types/ramda/src/subtract.d.ts @@ -0,0 +1,2 @@ +import { subtract } from '../index'; +export default subtract; diff --git a/types/ramda/src/sum.d.ts b/types/ramda/src/sum.d.ts new file mode 100644 index 0000000000..5aad66d4e2 --- /dev/null +++ b/types/ramda/src/sum.d.ts @@ -0,0 +1,2 @@ +import { sum } from '../index'; +export default sum; diff --git a/types/ramda/src/symmetricDifference.d.ts b/types/ramda/src/symmetricDifference.d.ts new file mode 100644 index 0000000000..d11802d977 --- /dev/null +++ b/types/ramda/src/symmetricDifference.d.ts @@ -0,0 +1,2 @@ +import { symmetricDifference } from '../index'; +export default symmetricDifference; diff --git a/types/ramda/src/symmetricDifferenceWith.d.ts b/types/ramda/src/symmetricDifferenceWith.d.ts new file mode 100644 index 0000000000..9ee8a2b855 --- /dev/null +++ b/types/ramda/src/symmetricDifferenceWith.d.ts @@ -0,0 +1,2 @@ +import { symmetricDifferenceWith } from '../index'; +export default symmetricDifferenceWith; diff --git a/types/ramda/src/tail.d.ts b/types/ramda/src/tail.d.ts new file mode 100644 index 0000000000..5a949add56 --- /dev/null +++ b/types/ramda/src/tail.d.ts @@ -0,0 +1,2 @@ +import { tail } from '../index'; +export default tail; diff --git a/types/ramda/src/take.d.ts b/types/ramda/src/take.d.ts new file mode 100644 index 0000000000..35806f3171 --- /dev/null +++ b/types/ramda/src/take.d.ts @@ -0,0 +1,2 @@ +import { take } from '../index'; +export default take; diff --git a/types/ramda/src/takeLast.d.ts b/types/ramda/src/takeLast.d.ts new file mode 100644 index 0000000000..145934b186 --- /dev/null +++ b/types/ramda/src/takeLast.d.ts @@ -0,0 +1,2 @@ +import { takeLast } from '../index'; +export default takeLast; diff --git a/types/ramda/src/takeLastWhile.d.ts b/types/ramda/src/takeLastWhile.d.ts new file mode 100644 index 0000000000..0d6f344445 --- /dev/null +++ b/types/ramda/src/takeLastWhile.d.ts @@ -0,0 +1,2 @@ +import { takeLastWhile } from '../index'; +export default takeLastWhile; diff --git a/types/ramda/src/takeWhile.d.ts b/types/ramda/src/takeWhile.d.ts new file mode 100644 index 0000000000..c3f71dd0fd --- /dev/null +++ b/types/ramda/src/takeWhile.d.ts @@ -0,0 +1,2 @@ +import { takeWhile } from '../index'; +export default takeWhile; diff --git a/types/ramda/src/tap.d.ts b/types/ramda/src/tap.d.ts new file mode 100644 index 0000000000..329108173e --- /dev/null +++ b/types/ramda/src/tap.d.ts @@ -0,0 +1,2 @@ +import { tap } from '../index'; +export default tap; diff --git a/types/ramda/src/test.d.ts b/types/ramda/src/test.d.ts new file mode 100644 index 0000000000..64a6289599 --- /dev/null +++ b/types/ramda/src/test.d.ts @@ -0,0 +1,2 @@ +import { test } from '../index'; +export default test; diff --git a/types/ramda/src/times.d.ts b/types/ramda/src/times.d.ts new file mode 100644 index 0000000000..141c101e23 --- /dev/null +++ b/types/ramda/src/times.d.ts @@ -0,0 +1,2 @@ +import { times } from '../index'; +export default times; diff --git a/types/ramda/src/toLower.d.ts b/types/ramda/src/toLower.d.ts new file mode 100644 index 0000000000..4086a90f75 --- /dev/null +++ b/types/ramda/src/toLower.d.ts @@ -0,0 +1,2 @@ +import { toLower } from '../index'; +export default toLower; diff --git a/types/ramda/src/toPairs.d.ts b/types/ramda/src/toPairs.d.ts new file mode 100644 index 0000000000..5a6d3b24c2 --- /dev/null +++ b/types/ramda/src/toPairs.d.ts @@ -0,0 +1,2 @@ +import { toPairs } from '../index'; +export default toPairs; diff --git a/types/ramda/src/toPairsIn.d.ts b/types/ramda/src/toPairsIn.d.ts new file mode 100644 index 0000000000..70a879e200 --- /dev/null +++ b/types/ramda/src/toPairsIn.d.ts @@ -0,0 +1,2 @@ +import { toPairsIn } from '../index'; +export default toPairsIn; diff --git a/types/ramda/src/toString.d.ts b/types/ramda/src/toString.d.ts new file mode 100644 index 0000000000..c731b264be --- /dev/null +++ b/types/ramda/src/toString.d.ts @@ -0,0 +1,2 @@ +import { toString } from '../index'; +export default toString; diff --git a/types/ramda/src/toUpper.d.ts b/types/ramda/src/toUpper.d.ts new file mode 100644 index 0000000000..0a91bccfed --- /dev/null +++ b/types/ramda/src/toUpper.d.ts @@ -0,0 +1,2 @@ +import { toUpper } from '../index'; +export default toUpper; diff --git a/types/ramda/src/transduce.d.ts b/types/ramda/src/transduce.d.ts new file mode 100644 index 0000000000..de33a7380c --- /dev/null +++ b/types/ramda/src/transduce.d.ts @@ -0,0 +1,2 @@ +import { transduce } from '../index'; +export default transduce; diff --git a/types/ramda/src/transpose.d.ts b/types/ramda/src/transpose.d.ts new file mode 100644 index 0000000000..8ed6535fb2 --- /dev/null +++ b/types/ramda/src/transpose.d.ts @@ -0,0 +1,2 @@ +import { transpose } from '../index'; +export default transpose; diff --git a/types/ramda/src/traverse.d.ts b/types/ramda/src/traverse.d.ts new file mode 100644 index 0000000000..cb4fdc0b1e --- /dev/null +++ b/types/ramda/src/traverse.d.ts @@ -0,0 +1,2 @@ +import { traverse } from '../index'; +export default traverse; diff --git a/types/ramda/src/trim.d.ts b/types/ramda/src/trim.d.ts new file mode 100644 index 0000000000..f0000b80bb --- /dev/null +++ b/types/ramda/src/trim.d.ts @@ -0,0 +1,2 @@ +import { trim } from '../index'; +export default trim; diff --git a/types/ramda/src/tryCatch.d.ts b/types/ramda/src/tryCatch.d.ts new file mode 100644 index 0000000000..3c9edd9f79 --- /dev/null +++ b/types/ramda/src/tryCatch.d.ts @@ -0,0 +1,2 @@ +import { tryCatch } from '../index'; +export default tryCatch; diff --git a/types/ramda/src/type.d.ts b/types/ramda/src/type.d.ts new file mode 100644 index 0000000000..de115bb279 --- /dev/null +++ b/types/ramda/src/type.d.ts @@ -0,0 +1,2 @@ +import { type } from '../index'; +export default type; diff --git a/types/ramda/src/unapply.d.ts b/types/ramda/src/unapply.d.ts new file mode 100644 index 0000000000..7ad4b767e0 --- /dev/null +++ b/types/ramda/src/unapply.d.ts @@ -0,0 +1,2 @@ +import { unapply } from '../index'; +export default unapply; diff --git a/types/ramda/src/unary.d.ts b/types/ramda/src/unary.d.ts new file mode 100644 index 0000000000..c022aec354 --- /dev/null +++ b/types/ramda/src/unary.d.ts @@ -0,0 +1,2 @@ +import { unary } from '../index'; +export default unary; diff --git a/types/ramda/src/uncurryN.d.ts b/types/ramda/src/uncurryN.d.ts new file mode 100644 index 0000000000..b6962cc979 --- /dev/null +++ b/types/ramda/src/uncurryN.d.ts @@ -0,0 +1,2 @@ +import { uncurryN } from '../index'; +export default uncurryN; diff --git a/types/ramda/src/unfold.d.ts b/types/ramda/src/unfold.d.ts new file mode 100644 index 0000000000..2ebaff6fe5 --- /dev/null +++ b/types/ramda/src/unfold.d.ts @@ -0,0 +1,2 @@ +import { unfold } from '../index'; +export default unfold; diff --git a/types/ramda/src/union.d.ts b/types/ramda/src/union.d.ts new file mode 100644 index 0000000000..9fac243b43 --- /dev/null +++ b/types/ramda/src/union.d.ts @@ -0,0 +1,2 @@ +import { union } from '../index'; +export default union; diff --git a/types/ramda/src/unionWith.d.ts b/types/ramda/src/unionWith.d.ts new file mode 100644 index 0000000000..8bf20a51b7 --- /dev/null +++ b/types/ramda/src/unionWith.d.ts @@ -0,0 +1,2 @@ +import { unionWith } from '../index'; +export default unionWith; diff --git a/types/ramda/src/uniq.d.ts b/types/ramda/src/uniq.d.ts new file mode 100644 index 0000000000..be0a00aef0 --- /dev/null +++ b/types/ramda/src/uniq.d.ts @@ -0,0 +1,2 @@ +import { uniq } from '../index'; +export default uniq; diff --git a/types/ramda/src/uniqBy.d.ts b/types/ramda/src/uniqBy.d.ts new file mode 100644 index 0000000000..f85de9e4e0 --- /dev/null +++ b/types/ramda/src/uniqBy.d.ts @@ -0,0 +1,2 @@ +import { uniqBy } from '../index'; +export default uniqBy; diff --git a/types/ramda/src/uniqWith.d.ts b/types/ramda/src/uniqWith.d.ts new file mode 100644 index 0000000000..42442bffc3 --- /dev/null +++ b/types/ramda/src/uniqWith.d.ts @@ -0,0 +1,2 @@ +import { uniqWith } from '../index'; +export default uniqWith; diff --git a/types/ramda/src/unless.d.ts b/types/ramda/src/unless.d.ts new file mode 100644 index 0000000000..3727700625 --- /dev/null +++ b/types/ramda/src/unless.d.ts @@ -0,0 +1,2 @@ +import { unless } from '../index'; +export default unless; diff --git a/types/ramda/src/unnest.d.ts b/types/ramda/src/unnest.d.ts new file mode 100644 index 0000000000..ccbb4be0e8 --- /dev/null +++ b/types/ramda/src/unnest.d.ts @@ -0,0 +1,2 @@ +import { unnest } from '../index'; +export default unnest; diff --git a/types/ramda/src/until.d.ts b/types/ramda/src/until.d.ts new file mode 100644 index 0000000000..ab26247fea --- /dev/null +++ b/types/ramda/src/until.d.ts @@ -0,0 +1,2 @@ +import { until } from '../index'; +export default until; diff --git a/types/ramda/src/update.d.ts b/types/ramda/src/update.d.ts new file mode 100644 index 0000000000..c3eba99c72 --- /dev/null +++ b/types/ramda/src/update.d.ts @@ -0,0 +1,2 @@ +import { update } from '../index'; +export default update; diff --git a/types/ramda/src/useWith.d.ts b/types/ramda/src/useWith.d.ts new file mode 100644 index 0000000000..0d1f54e80f --- /dev/null +++ b/types/ramda/src/useWith.d.ts @@ -0,0 +1,2 @@ +import { useWith } from '../index'; +export default useWith; diff --git a/types/ramda/src/values.d.ts b/types/ramda/src/values.d.ts new file mode 100644 index 0000000000..8664d8cc67 --- /dev/null +++ b/types/ramda/src/values.d.ts @@ -0,0 +1,2 @@ +import { values } from '../index'; +export default values; diff --git a/types/ramda/src/valuesIn.d.ts b/types/ramda/src/valuesIn.d.ts new file mode 100644 index 0000000000..d80b32fc67 --- /dev/null +++ b/types/ramda/src/valuesIn.d.ts @@ -0,0 +1,2 @@ +import { valuesIn } from '../index'; +export default valuesIn; diff --git a/types/ramda/src/view.d.ts b/types/ramda/src/view.d.ts new file mode 100644 index 0000000000..3c11fa0ae9 --- /dev/null +++ b/types/ramda/src/view.d.ts @@ -0,0 +1,2 @@ +import { view } from '../index'; +export default view; diff --git a/types/ramda/src/when.d.ts b/types/ramda/src/when.d.ts new file mode 100644 index 0000000000..57de7e19a7 --- /dev/null +++ b/types/ramda/src/when.d.ts @@ -0,0 +1,2 @@ +import { when } from '../index'; +export default when; diff --git a/types/ramda/src/where.d.ts b/types/ramda/src/where.d.ts new file mode 100644 index 0000000000..4c49c2dc25 --- /dev/null +++ b/types/ramda/src/where.d.ts @@ -0,0 +1,2 @@ +import { where } from '../index'; +export default where; diff --git a/types/ramda/src/whereEq.d.ts b/types/ramda/src/whereEq.d.ts new file mode 100644 index 0000000000..4bdffa1d24 --- /dev/null +++ b/types/ramda/src/whereEq.d.ts @@ -0,0 +1,2 @@ +import { whereEq } from '../index'; +export default whereEq; diff --git a/types/ramda/src/without.d.ts b/types/ramda/src/without.d.ts new file mode 100644 index 0000000000..be9b8584ed --- /dev/null +++ b/types/ramda/src/without.d.ts @@ -0,0 +1,2 @@ +import { without } from '../index'; +export default without; diff --git a/types/ramda/src/wrap.d.ts b/types/ramda/src/wrap.d.ts new file mode 100644 index 0000000000..a855106989 --- /dev/null +++ b/types/ramda/src/wrap.d.ts @@ -0,0 +1,2 @@ +import { wrap } from '../index'; +export default wrap; diff --git a/types/ramda/src/xprod.d.ts b/types/ramda/src/xprod.d.ts new file mode 100644 index 0000000000..2e3fd865ea --- /dev/null +++ b/types/ramda/src/xprod.d.ts @@ -0,0 +1,2 @@ +import { xprod } from '../index'; +export default xprod; diff --git a/types/ramda/src/zip.d.ts b/types/ramda/src/zip.d.ts new file mode 100644 index 0000000000..609fe7bb29 --- /dev/null +++ b/types/ramda/src/zip.d.ts @@ -0,0 +1,2 @@ +import { zip } from '../index'; +export default zip; diff --git a/types/ramda/src/zipObj.d.ts b/types/ramda/src/zipObj.d.ts new file mode 100644 index 0000000000..dcc28311bc --- /dev/null +++ b/types/ramda/src/zipObj.d.ts @@ -0,0 +1,2 @@ +import { zipObj } from '../index'; +export default zipObj; diff --git a/types/ramda/src/zipWith.d.ts b/types/ramda/src/zipWith.d.ts new file mode 100644 index 0000000000..df6890c369 --- /dev/null +++ b/types/ramda/src/zipWith.d.ts @@ -0,0 +1,2 @@ +import { zipWith } from '../index'; +export default zipWith; From d959efd3fe9de8df8403c12145e71a9b159982e7 Mon Sep 17 00:00:00 2001 From: Lorenzo Rapetti Date: Mon, 11 Mar 2019 19:24:18 +0100 Subject: [PATCH 258/265] [@types/node-notifier] Update typings (#33419) * Update node-notifier typings * Add typings for NotificationCallback --- types/node-notifier/index.d.ts | 111 ++++++++++++++++----- types/node-notifier/node-notifier-tests.ts | 49 +++++---- 2 files changed, 116 insertions(+), 44 deletions(-) diff --git a/types/node-notifier/index.d.ts b/types/node-notifier/index.d.ts index dad13583b9..7846a9b246 100644 --- a/types/node-notifier/index.d.ts +++ b/types/node-notifier/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for node-notifier +// Type definitions for node-notifier 5.4.0 // Project: https://github.com/mikaelbr/node-notifier // Definitions by: Qubo +// Lorenzo Rapetti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -14,12 +15,30 @@ declare module "node-notifier" { namespace nodeNotifier { interface NodeNotifier extends NodeJS.EventEmitter { + notify( + notification?: NotificationCenter.Notification, + callback?: NotificationCallback + ): NotificationCenter; + notify( + notification?: WindowsToaster.Notification, + callback?: NotificationCallback + ): WindowsToaster; + notify( + notification?: WindowsBalloon.Notification, + callback?: NotificationCallback + ): WindowsBalloon; + notify( + notification?: NotifySend.Notification, + callback?: NotificationCallback + ): NotifySend; + notify(notification?: Growl.Notification, callback?: NotificationCallback): Growl; notify(notification?: Notification, callback?: NotificationCallback): NodeNotifier; - NotificationCenter: NotificationCenter; - NotifySend: NotifySend; - WindowsToaster: WindowsToaster; - WindowsBalloon: WindowsBalloon; - Growl: Growl; + notify(notification?: string, callback?: NotificationCallback): NodeNotifier; + NotificationCenter: typeof NotificationCenter; + NotifySend: typeof NotifySend; + WindowsToaster: typeof WindowsToaster; + WindowsBalloon: typeof WindowsBalloon; + Growl: typeof Growl; } interface Notification { @@ -27,15 +46,25 @@ declare module "node-notifier" { message?: string; /** Absolute path (not balloons) */ icon?: string; - /** Only Notification Center or Windows Toasters */ - sound?: boolean; /** Wait with callback until user action is taken on notification */ wait?: boolean; } - interface NotificationCallback { - (err: any, response: any): any; - } + interface NotificationMetadata { + activationType?: string; + activationAt?: string; + deliveredAt?: string; + activationValue?: string; + activationValueIndex?: string; + } + + interface NotificationCallback { + ( + err: Error | null, + response: string, + metadata?: NotificationMetadata, + ): void; + } interface Option { withFallback?: boolean; @@ -58,11 +87,31 @@ declare module "node-notifier/notifiers/notificationcenter" { namespace NotificationCenter { interface Notification extends notifier.Notification { + /** + * Case Sensitive string for location of sound file, or use one of macOS' native sounds. + */ + sound?: boolean | string; subtitle?: string; /** Attach image? (Absolute path) */ contentImage?: string; /** URL to open on click */ open?: string; + /** + * The amount of seconds before the notification closes. + * Takes precedence over wait if both are defined. + */ + timeout?: number; + /** Label for cancel button */ + closeLabel?: string; + /** Action label or list of labels in case of dropdown. */ + actions?: string | string[]; + /** Label to be used if there are multiple actions */ + dropdownLabel?: string; + /** + * If notification should take input. + * Value passed as third argument in callback and event emitter. + */ + reply?: boolean; } } @@ -101,7 +150,27 @@ declare module "node-notifier/notifiers/toaster" { class WindowsToaster { constructor(option?: notifier.Option); - notify(notification?: notifier.Notification, callback?: notifier.NotificationCallback): WindowsToaster; + notify(notification?: WindowsToaster.Notification, callback?: notifier.NotificationCallback): WindowsToaster; + } + + namespace WindowsToaster { + interface Notification extends notifier.Notification { + /** + * Defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx + */ + sound?: boolean | string; + /** ID to use for closing notification. */ + id?: number; + /** App.ID and app Name. Defaults to no value, causing SnoreToast text to be visible. */ + appID?: string; + /** Refer to previously created notification to close. */ + remove?: number; + /** + * Creates a shortcut in the start menu which point to the + * executable , appID used for the notifications. + */ + install?: string; + } } export = WindowsToaster; @@ -122,19 +191,13 @@ declare module "node-notifier/notifiers/growl" { port?: number; } - interface Notification { - title?: string; - message?: string; - /** Absolute path (not balloons) */ - icon?: string; - /** Wait with callback until user action is taken on notification */ - wait?: boolean; + interface Notification extends notifier.Notification { /** whether or not to sticky the notification (defaults to false) */ - sticky?: boolean; + sticky?: boolean; /** type of notification to use (defaults to the first registered type) */ - label: string; + label?: string; /** the priority of the notification from lowest (-2) to highest (2) */ - priority: number; + priority?: number; } } @@ -153,12 +216,12 @@ declare module "node-notifier/notifiers/balloon" { interface Notification { title?: string; message?: string; - /** Only Notification Center or Windows Toasters */ - sound?: boolean; /** How long to show balloons in ms */ time?: number; /** Wait with callback until user action is taken on notification */ wait?: boolean; + /** The notification type */ + type?: 'info' | 'warn' | 'error'; } } diff --git a/types/node-notifier/node-notifier-tests.ts b/types/node-notifier/node-notifier-tests.ts index 7e6ce74c14..6162196c86 100644 --- a/types/node-notifier/node-notifier-tests.ts +++ b/types/node-notifier/node-notifier-tests.ts @@ -4,6 +4,8 @@ import notifier = require('node-notifier'); import * as path from 'path'; +notifier.notify(); +notifier.notify('Hello there'); notifier.notify({ title: 'My awesome title', message: 'Hello from node, Mr. User!', @@ -22,8 +24,8 @@ notifier.on('timeout', function (notifierObject: any, options: any) { // Happens if `wait: true` and notification closes }); -const options = { }; +const options = { }; import NotificationCenter = require('node-notifier/notifiers/notificationcenter'); new NotificationCenter(options).notify(); @@ -41,35 +43,38 @@ import WindowsBalloon = require('node-notifier/notifiers/balloon'); new WindowsBalloon(options).notify(); -var nn = require('node-notifier'); - -new nn.NotificationCenter(options).notify(); -new nn.NotifySend(options).notify(); -new nn.WindowsToaster(options).notify(options); -new nn.WindowsBalloon(options).notify(options); -new nn.Growl(options).notify(options); +new notifier.NotificationCenter(options).notify(); +new notifier.NotifySend(options).notify(); +new notifier.WindowsToaster(options).notify(options); +new notifier.WindowsBalloon(options).notify(options); +new notifier.Growl(options).notify(options); // // All notification options with their defaults: // -var NotificationCenter2 = require('node-notifier').NotificationCenter; +const NotificationCenter2 = notifier.NotificationCenter; -var notifier2 = new NotificationCenter2({ +const notifier2 = new NotificationCenter2({ withFallback: false, // use Growl if <= 10.8? customPath: void 0 // Relative path if you want to use your fork of terminal-notifier }); notifier2.notify({ - 'title': void 0, - 'subtitle': void 0, - 'message': void 0, - 'sound': false, // Case Sensitive string of sound file (see below) - 'icon': 'Terminal Icon', // Set icon? (Absolute path to image) - 'contentImage': void 0, // Attach image? (Absolute path) - 'open': void 0, // URL to open on click - 'wait': false // if wait for notification to end + title: void 0, + subtitle: void 0, + message: void 0, + sound: false, // Case Sensitive string of sound file (see below) + icon: 'Terminal Icon', // Set icon? (Absolute path to image) + contentImage: void 0, // Attach image? (Absolute path) + open: void 0, // URL to open on click + wait: false, // if wait for notification to end + actions: ['Action 1', 'Action 2'], + closeLabel: 'Close', + dropdownLabel: 'Dropdown', + reply: true, + timeout: 10 }, function(error: any, response: any) { console.log(response); }); @@ -78,9 +83,9 @@ notifier2.notify({ // Usage WindowsToaster // -var WindowsToaster2 = require('node-notifier').WindowsToaster; +const WindowsToaster2 = notifier.WindowsToaster; -var notifier3 = new WindowsToaster2({ +const notifier3 = new WindowsToaster2({ withFallback: false, // Fallback to Growl or Balloons? customPath: void 0 // Relative path if you want to use your fork of toast.exe }); @@ -91,6 +96,10 @@ notifier3.notify({ icon: void 0, // absolute path to an icon sound: false, // true | false. wait: false, // if wait for notification to end + appID: '', + id: 1, + install: '/', + remove: 1 }, function(error: any, response: any) { console.log(response); }); From 9f755db629c3643106386afb2f87853fbe25726b Mon Sep 17 00:00:00 2001 From: Roman Nuritdinov Date: Mon, 11 Mar 2019 20:26:32 +0200 Subject: [PATCH 259/265] Allow `null` value for some props of `react-datepicker` (#33585) --- types/react-datepicker/index.d.ts | 9 +++++---- types/react-datepicker/react-datepicker-tests.tsx | 8 ++++++++ types/react-datepicker/tsconfig.json | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index ce7ebcfab9..c957411347 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -9,6 +9,7 @@ // Sean Kelley // Justin Grant // Jake Boone +// Roman Nuritdinov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -41,7 +42,7 @@ export interface ReactDatePickerProps { disabled?: boolean; disabledKeyboardNavigation?: boolean; dropdownMode?: 'scroll' | 'select'; - endDate?: Date; + endDate?: Date | null; excludeDates?: Date[]; excludeTimes?: Date[]; filterDate?(date: Date): boolean; @@ -57,9 +58,9 @@ export interface ReactDatePickerProps { inline?: boolean; isClearable?: boolean; locale?: string; - maxDate?: Date; + maxDate?: Date | null; maxTime?: Date; - minDate?: Date; + minDate?: Date | null; minTime?: Date; monthsShown?: number; name?: string; @@ -112,7 +113,7 @@ export interface ReactDatePickerProps { showTimeSelectOnly?: boolean; showWeekNumbers?: boolean; showYearDropdown?: boolean; - startDate?: Date; + startDate?: Date | null; startOpen?: boolean; tabIndex?: number; timeCaption?: string; diff --git a/types/react-datepicker/react-datepicker-tests.tsx b/types/react-datepicker/react-datepicker-tests.tsx index 9486d043eb..1188f53763 100644 --- a/types/react-datepicker/react-datepicker-tests.tsx +++ b/types/react-datepicker/react-datepicker-tests.tsx @@ -121,6 +121,14 @@ const defaultLocale = getDefaultLocale(); ; + null} +/>; + function handleRef(ref: DatePicker | null) { if (ref) { ref.setBlur(); diff --git a/types/react-datepicker/tsconfig.json b/types/react-datepicker/tsconfig.json index 39a236a343..a52b1ad104 100644 --- a/types/react-datepicker/tsconfig.json +++ b/types/react-datepicker/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": false, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -22,4 +22,4 @@ "index.d.ts", "react-datepicker-tests.tsx" ] -} \ No newline at end of file +} From a03ef191027bf0219a332605215bed9097272fda Mon Sep 17 00:00:00 2001 From: Emily Marigold Klassen Date: Mon, 11 Mar 2019 11:27:26 -0700 Subject: [PATCH 260/265] Use export assignment for caseless (#33633) --- types/caseless/caseless-tests.ts | 22 ++++++++-------- types/caseless/index.d.ts | 45 +++++++++++++++++--------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/types/caseless/caseless-tests.ts b/types/caseless/caseless-tests.ts index 57eaae605e..39f6277350 100644 --- a/types/caseless/caseless-tests.ts +++ b/types/caseless/caseless-tests.ts @@ -1,9 +1,9 @@ -import caseless, { Caseless, httpify, Httpified } from "caseless"; +import caseless = require("caseless"); -new Caseless(); // $ExpectError +new caseless.Caseless(); // $ExpectError // tslint:disable-next-line: prefer-const -let c1: Caseless; +let c1: caseless.Caseless; caseless(); // $ExpectType Caseless caseless({}); // $ExpectType Caseless @@ -30,16 +30,16 @@ c2.swap(10); // $ExpectError c2.del('foo'); // $ExpectType boolean -httpify(null, {}); // $ExpectError -httpify(1, {}); // $ExpectError -httpify("2", {}); // $ExpectError -httpify({}, null); // $ExpectError -httpify({}, 1); // $ExpectError -httpify({}, "2"); // $ExpectError +caseless.httpify(null, {}); // $ExpectError +caseless.httpify(1, {}); // $ExpectError +caseless.httpify("2", {}); // $ExpectError +caseless.httpify({}, null); // $ExpectError +caseless.httpify({}, 1); // $ExpectError +caseless.httpify({}, "2"); // $ExpectError -httpify({}, {}); // $ExpectType Caseless +caseless.httpify({}, {}); // $ExpectType Caseless -const request: Httpified = {}; // $ExpectError +const request: caseless.Httpified = {}; // $ExpectError request.setHeader({}); // $ExpectType void request.setHeader('foo', 'bar'); // $ExpectType string | false diff --git a/types/caseless/index.d.ts b/types/caseless/index.d.ts index 9b19f8a150..3955664993 100644 --- a/types/caseless/index.d.ts +++ b/types/caseless/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mikeal/caseless // Definitions by: downace // Matt R. Wilson +// Emily Klassen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -9,26 +10,28 @@ type KeyType = string; type ValueType = any; type RawDict = object; -export interface Caseless { - set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; - set(dict: RawDict): void; - has(name: KeyType): KeyType | false; - get(name: KeyType): ValueType | undefined; - swap(name: KeyType): void; - del(name: KeyType): boolean; +declare function caseless(dict?: RawDict): caseless.Caseless; + +declare namespace caseless { + function httpify(resp: object, headers: RawDict): Caseless; + + interface Caseless { + set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; + set(dict: RawDict): void; + has(name: KeyType): KeyType | false; + get(name: KeyType): ValueType | undefined; + swap(name: KeyType): void; + del(name: KeyType): boolean; + } + + interface Httpified { + headers: RawDict; + setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; + setHeader(dict: RawDict): void; + hasHeader(name: KeyType): KeyType | false; + getHeader(name: KeyType): ValueType | undefined; + removeHeader(name: KeyType): boolean; + } } -export interface Httpified { - headers: RawDict; - setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; - setHeader(dict: RawDict): void; - hasHeader(name: KeyType): KeyType | false; - getHeader(name: KeyType): ValueType | undefined; - removeHeader(name: KeyType): boolean; -} - -export function httpify(resp: object, headers: RawDict): Caseless; - -declare function caseless(dict?: RawDict): Caseless; - -export default caseless; +export = caseless; From 771847f9bf265bdfc672588d257d613bfef8f33b Mon Sep 17 00:00:00 2001 From: nickroberts Date: Mon, 11 Mar 2019 14:36:27 -0400 Subject: [PATCH 261/265] :sparkles: Add get / set and other Cluster properties / methods (#33655) --- types/ioredis/index.d.ts | 10 ++++++++++ types/ioredis/ioredis-tests.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 99c99dcf04..869dc364c9 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -875,10 +875,20 @@ declare namespace IORedis { type NodeRole = 'master' | 'slave' | 'all'; + type CallbackFunction = (err?: NodeJS.ErrnoException | null, result?: T) => void; + interface Cluster extends NodeJS.EventEmitter, Commander { connect(callback: () => void): Promise; disconnect(): void; nodes(role?: NodeRole): Redis[]; + quit(callback?: CallbackFunction<'OK'>): Promise<'OK'>; + get(key: KeyType, callback: (err: Error, res: string | null) => void): void; + get(key: KeyType): Promise; + set(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + set(key: KeyType, value: any, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void; } interface ClusterStatic extends NodeJS.EventEmitter, Commander { diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index f3cafe1f18..57ee06a5f3 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -226,3 +226,32 @@ cluster.nodes().map(node => { .exec() .then(result => console.log(result)); }); +cluster.set('foo', 'bar'); +cluster.get('foo', (err, result) => { + if (err) { + console.error(err); + } + console.log(result); +}); +cluster.get('foo') + .then(result => console.log(result)) + .catch(reason => console.error(reason)); +cluster.connect(() => { + console.log('connect'); +}) +.then(result => console.log(result)) +.then(reason => console.error(reason)); +cluster.disconnect(); +cluster.quit(result => { + console.log(result); +}); +const getBuiltinCommandsResult = cluster.getBuiltinCommands(); +console.log(getBuiltinCommandsResult); +const createBuiltinCommandResult = cluster.createBuiltinCommand('createBuiltinCommand'); +console.log(createBuiltinCommandResult); +const defineCommandResult = cluster.defineCommand('defineCommand', { + numberOfKeys: 1, + lua: 'lua' +}); +console.log(defineCommandResult); +cluster.sendCommand(); From 804ead1f523ee862bd3820447c45bcd8951a29ce Mon Sep 17 00:00:00 2001 From: slikts Date: Mon, 11 Mar 2019 20:38:58 +0200 Subject: [PATCH 262/265] Make exported props non-nullable (#33649) --- types/react-table/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 6aad7c3c8c..c0c2a8fc25 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -51,12 +51,12 @@ export interface SortingRule { } export interface TableProps extends - Partial, - Partial, - Partial, - Partial, - Partial, - Partial { + TextProps, + ComponentDecoratorProps, + ControlledStateCallbackProps, + PivotingProps, + ControlledStateOverrideProps, + ComponentProps { /** Default: [] */ data: D[]; From f685467def932fc58448f9a6b72a94837ef61211 Mon Sep 17 00:00:00 2001 From: Thomas Levy Date: Mon, 11 Mar 2019 11:41:19 -0700 Subject: [PATCH 263/265] add support for getInstance method on react-onclickoutside refs (#33606) --- types/react-onclickoutside/index.d.ts | 29 ++++++++++++++++--- .../react-onclickoutside-tests.tsx | 10 +++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/types/react-onclickoutside/index.d.ts b/types/react-onclickoutside/index.d.ts index fd31f35869..02fd4eebe4 100644 --- a/types/react-onclickoutside/index.d.ts +++ b/types/react-onclickoutside/index.d.ts @@ -2,11 +2,14 @@ // Project: https://github.com/Pomax/react-onclickoutside // Definitions by: Karol Janyst // Boris Sergeyev +// Thomas Levy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from "react"; +export {}; + export interface HandleClickOutside { handleClickOutside: React.MouseEventHandler; } @@ -38,7 +41,25 @@ export interface ClickOutComponentClass

extends React.ComponentClass

{ export type OnClickOutProps

= WithoutInjectedClickOutProps

& AdditionalProps; -export default function OnClickOut

( - component: ComponentConstructor

| ClickOutComponentClass

, - config?: ConfigObject -): React.ComponentClass>; +interface WrapperClass { + new (): WrapperInstance; +} + +interface WrapperInstance + extends React.Component>> { + getInstance(): C extends typeof React.Component ? InstanceType : never; +} + +type PropsOf = T extends ( + props: infer P, + context?: any +) => React.ReactElement | null // Try to infer for SFCs + ? P + : T extends new (props: infer P, context?: any) => React.Component // Otherwise try to infer for classes + ? P + : never; + +export default function OnClickOut< + C extends ComponentConstructor

| ClickOutComponentClass

, + P = PropsOf +>(component: C, config?: ConfigObject): WrapperClass; diff --git a/types/react-onclickoutside/react-onclickoutside-tests.tsx b/types/react-onclickoutside/react-onclickoutside-tests.tsx index e7ee43e30d..21732498e8 100644 --- a/types/react-onclickoutside/react-onclickoutside-tests.tsx +++ b/types/react-onclickoutside/react-onclickoutside-tests.tsx @@ -48,6 +48,10 @@ class TestComponent extends React.Component<{ disableOnClickOutside(): void; ena console.log('this.handleClickOutside'); } + logProps = () => { + console.log(this.props); + } + render() { this.props.disableOnClickOutside(); this.props.enableOnClickOutside(); @@ -58,12 +62,18 @@ class TestComponent extends React.Component<{ disableOnClickOutside(): void; ena } const WrappedComponent = onClickOutside(TestComponent); +const wrappedComponentRef: React.RefObject> = React.createRef(); render( , document.getElementById("main") ); + +if (wrappedComponentRef.current) { + wrappedComponentRef.current.getInstance().logProps(); +} From 9dedb3f3a5af1411b76272a9e9ce07f068343556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pudil?= Date: Mon, 11 Mar 2019 19:41:51 +0100 Subject: [PATCH 264/265] Fix addContextToolbar predicate type (#33609) --- types/tinymce/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index e50feb0b5d..eba9bc29bf 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -394,7 +394,7 @@ export class Editor extends util.Observable { addCommand(name: string, callback: (ui: boolean, value: {}) => boolean, scope?: {}): void; - addContextToolbar(predicate: () => boolean, items: string): void; + addContextToolbar(predicate: ((el: Node) => boolean) | string, items: string): void; addMenuItem(name: string, settings: {}): void; From ec1e3312130c9fb607bb74915722ab23139ec62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Mon, 11 Mar 2019 14:42:13 -0400 Subject: [PATCH 265/265] @storybook/addon-a11y: Deprecate checkA11y in favor of withA11y (#33627) See https://github.com/storybooks/storybook/blob/f2b625bab05720c4c323af3e612e7d03adbd3b92/addons/a11y/src/index.js#L66-L70 and https://github.com/storybooks/storybook/blob/next/MIGRATION.md#addon-a11y-uses-parameters-decorator-renamed. --- types/storybook__addon-a11y/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/storybook__addon-a11y/index.d.ts b/types/storybook__addon-a11y/index.d.ts index 7e7ac3b89e..fa82d44867 100644 --- a/types/storybook__addon-a11y/index.d.ts +++ b/types/storybook__addon-a11y/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @storybook/addon-a11y 3.3 +// Type definitions for @storybook/addon-a11y 5.0 // Project: https://github.com/storybooks/storybook // Definitions by: HyunSeob // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,4 +6,5 @@ import { StoryDecorator } from '@storybook/react'; -export const checkA11y: StoryDecorator; +export const checkA11y: StoryDecorator; // Deprecated +export const withA11y: StoryDecorator;