From f25a05789881db96e80abd6ec133100bb2cf6d7a Mon Sep 17 00:00:00 2001 From: Christoph Spielmann Date: Thu, 20 Jul 2017 23:36:18 +0200 Subject: [PATCH 001/254] Add typings for Reactable 0.14. Not complete but the stuff provided by the typings have been tested/used quite extensively by myself during the development of ReactPlayer! --- types/reactable/index.d.ts | 60 +++++++++++++++++++++++++++++++++++ types/reactable/tsconfig.json | 23 ++++++++++++++ types/reactable/tslint.json | 1 + 3 files changed, 84 insertions(+) create mode 100644 types/reactable/index.d.ts create mode 100644 types/reactable/tsconfig.json create mode 100644 types/reactable/tslint.json diff --git a/types/reactable/index.d.ts b/types/reactable/index.d.ts new file mode 100644 index 0000000000..4509d421c1 --- /dev/null +++ b/types/reactable/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for reactable 0.14 +// Project: https://github.com/glittershark/reactable +// Definitions by: Christoph Spielmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from 'react'; + +export interface KeyLabelObject { + key: string; + label: string; +} + +export type ColumnsType = string | KeyLabelObject; + +export type FilterMethodType = (text: string) => void; + +export interface TableComponentProperties { + data?: T[]; + className?: string; + columns?: ColumnsType[]; + id?: string; + sortable?: string[]; + filterable?: string[]; + filterBy?: string; + onFilter?: FilterMethodType; +} + +export interface ThProperties { + column: string; + className?: string; +} + +export interface TrProperties { + data?: T; + className?: string; +} + +export interface TdProperties { + column: string; + value?: any; + data?: any; +} + +export class Table extends React.Component, {}> { +} + +export class Thead extends React.Component<{}, {}> { +} + +export class Th extends React.Component { +} + +export class Tr extends React.Component, {}> { +} + +export class Td extends React.Component { +} + +export class Tfoot extends React.Component<{}, {}> { +} diff --git a/types/reactable/tsconfig.json b/types/reactable/tsconfig.json new file mode 100644 index 0000000000..619dd0b8bf --- /dev/null +++ b/types/reactable/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, + "jsx": "react" + }, + "files": [ + "index.d.ts" + ] +} diff --git a/types/reactable/tslint.json b/types/reactable/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/reactable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 7c3257b794726e53e5f0da2b32dc89d29ee168a2 Mon Sep 17 00:00:00 2001 From: Christoph Spielmann Date: Sat, 22 Jul 2017 16:17:17 +0200 Subject: [PATCH 002/254] Add two tests (very simple one and a quite sophisticated one which contains all the components i created typings for...) --- types/reactable/reactable-tests.tsx | 82 +++++++++++++++++++++++++++++ types/reactable/tsconfig.json | 3 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 types/reactable/reactable-tests.tsx diff --git a/types/reactable/reactable-tests.tsx b/types/reactable/reactable-tests.tsx new file mode 100644 index 0000000000..91d80c27ef --- /dev/null +++ b/types/reactable/reactable-tests.tsx @@ -0,0 +1,82 @@ +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import * as Reactable from "reactable"; + +interface Person { + name: string; + age: number; +} + +type PersonTable = new () => Reactable.Table; +const PersonTable = Reactable.Table as PersonTable; + +type PersonTableHeader = new () => Reactable.Thead; +const PersonTableHeader = Reactable.Thead as PersonTableHeader; + +type PersonTableTh = new () => Reactable.Th; +const PersonTableTh = Reactable.Th as PersonTableTh; + +type PersonRow = new () => Reactable.Tr; +const PersonRow = Reactable.Tr as PersonRow; + +type PersonTableTd = new () => Reactable.Td; +const PersonTableTd = Reactable.Td as PersonTableTd; + +type PersonTableTfoot = new () => Reactable.Tfoot; +const PersonTableTfoot = Reactable.Tfoot as PersonTableTfoot; + +let data = [ + { + name: "Christoph Spielmann", + age: 36 + } +]; + +export class TestComponent extends React.Component<{}, {}> { + render(): JSX.Element { + return ; + } +} + +export class FullblownReactableTestComponent extends React.Component<{}, {}> { + render(): JSX.Element { + let displayedColumns = ["name"]; + // custom table Th-elements + let columns: JSX.Element[] = []; + for (let colName of displayedColumns) { + columns.push( + + {colName} + + ); + } + let rows: JSX.Element[] = []; + for (let d of data) { + let tds: JSX.Element[] = []; + displayedColumns.forEach(col => tds.push( + +

d[col]

+
+ )); + rows.push( + + {tds} + + ); + } + return ( + + + {columns} + + {rows} + + + footer cell1 + footer cell2 + + + + ); + } +} diff --git a/types/reactable/tsconfig.json b/types/reactable/tsconfig.json index 619dd0b8bf..c3300f0e32 100644 --- a/types/reactable/tsconfig.json +++ b/types/reactable/tsconfig.json @@ -18,6 +18,7 @@ "jsx": "react" }, "files": [ - "index.d.ts" + "index.d.ts", + "reactable-tests.tsx" ] } From b5103106a8b1bd037dcf8a0870d21134f9dd70de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Rosin=CC=81ski?= Date: Sun, 30 Jul 2017 10:07:56 +0200 Subject: [PATCH 003/254] Add node-geocoded definition. --- types/node-geocoder/index.d.ts | 92 ++++++++++++++++++++++ types/node-geocoder/node-geocoder-tests.ts | 54 +++++++++++++ types/node-geocoder/tsconfig.json | 22 ++++++ types/node-geocoder/tslint.json | 1 + 4 files changed, 169 insertions(+) create mode 100644 types/node-geocoder/index.d.ts create mode 100644 types/node-geocoder/node-geocoder-tests.ts create mode 100644 types/node-geocoder/tsconfig.json create mode 100644 types/node-geocoder/tslint.json diff --git a/types/node-geocoder/index.d.ts b/types/node-geocoder/index.d.ts new file mode 100644 index 0000000000..f94f20d724 --- /dev/null +++ b/types/node-geocoder/index.d.ts @@ -0,0 +1,92 @@ +// Type definitions for node-geocoder 3.19 +// Project: https://github.com/nchaulet/node-geocoder#readme +// Definitions by: Krzysztof Rosinski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace node_geocoder { + type Providers = + 'google' | 'here' | 'freegeoip' | + 'datasciencetoolkit' | 'openstreetmap' | + 'locationiq' | 'mapquest' | 'openmapquest' | + 'agol' | 'tomtom' | 'nominatimmapquest' | + 'opencage' | 'smartyStreet' | 'geocodio' | + 'yandex' | 'teleport' | 'opendatafrance' | + 'pickpoint'; + + interface Options { + provider: Providers; + httpAdapter?: 'https' | 'http' | 'request'; + clientId?: string; + apiKey?: string; + language?: string; + region?: string; + appId?: string; + appCode?: string; + politicalView?: string; + country?: string; + state?: string; + host?: string; + email?: string; + client_id?: string; + client_secret?: string; + auth_id?: string; + auth_token?: string; + timeout?: number; + formatterPattern?: string; + formatter?: any; + } + + interface Location { + lat: number; + lon: number; + } + + interface Entry { + formattedAddress?: string; + latitude?: number; + longitude?: number; + extra?: { + googlePlaceId?: string; + confidence?: number; + }; + administrativeLevels?: { + level1long?: string; + level1short?: string; + level2long?: string; + level2short?: string; + }; + city?: string; + streetName?: string; + streetNumber?: string; + country?: string; + countryCode?: string; + zipcode?: string; + provider?: string; + } + + interface Query { + address?: string; + country?: string; + countryCode?: string; + zipcode?: string; + minConfidence?: number; + limit?: number; + } + + interface BatchResult { + error: any; + value: Entry[]; + } + + class Geocoder { + geocode(query: string | Query, cb?: (err: any, data: Entry[]) => void): Promise; + batchGeocode(queries: string[] | Query[], cb?: (err: any, data: BatchResult[]) => void): Promise; + reverse(loc: Location, cb?: (err: any, data: Entry[]) => void): Promise; + } +} + +declare function node_geocoder(options: node_geocoder.Options): node_geocoder.Geocoder; + +export = node_geocoder; diff --git a/types/node-geocoder/node-geocoder-tests.ts b/types/node-geocoder/node-geocoder-tests.ts new file mode 100644 index 0000000000..33ed4b3036 --- /dev/null +++ b/types/node-geocoder/node-geocoder-tests.ts @@ -0,0 +1,54 @@ +import * as NodeGeocoder from 'node-geocoder'; + +const geocoder = NodeGeocoder({ + provider: 'google', + httpAdapter: 'https', +}); + +let results: NodeGeocoder.Entry[] | undefined; + +geocoder.geocode('Poland').then((entries) => { + results = entries; +}).then(() => { + if (results) { + console.log(JSON.stringify(results, null, 2)); + } +}); + +geocoder.geocode('Poland', (err: any, entries: NodeGeocoder.Entry[]) => { + console.log(JSON.stringify(entries, null, 2)); +}); + +const query: NodeGeocoder.Query = { address: 'Poland' }; + +geocoder.geocode(query).then((entries) => { + console.log(JSON.stringify(entries, null, 2)); +}); + +geocoder.geocode(query, (err: any, entries: NodeGeocoder.Entry[]) => { + console.log(JSON.stringify(entries, null, 2)); +}); + +geocoder.batchGeocode([ 'Kraków', 'Warszawa' ]).then((entries) => { + if (entries.length !== 2) { + return; + } + + const k = entries[0]; + if (!k.error) { + console.log(JSON.stringify(k.value, null, 2)); + } + + const w = entries[1]; + if (!w.error) { + console.log(JSON.stringify(w.value, null, 2)); + } +}); + +geocoder.reverse({ lat: 50.06465, lon: 19.9449799 }).then((entries) => { + console.log(JSON.stringify(entries, null, 2)); +}); + +geocoder.reverse({ lat: 50.06465, lon: 19.9449799 }).then((entries) => { + console.log(JSON.stringify(entries, null, 2)); +}); diff --git a/types/node-geocoder/tsconfig.json b/types/node-geocoder/tsconfig.json new file mode 100644 index 0000000000..cf586a416c --- /dev/null +++ b/types/node-geocoder/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", + "node-geocoder-tests.ts" + ] +} diff --git a/types/node-geocoder/tslint.json b/types/node-geocoder/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-geocoder/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0a8ccb501efcee421cc8acfe02c3ee13eca28b1c Mon Sep 17 00:00:00 2001 From: bglee Date: Tue, 1 Aug 2017 19:47:10 +0900 Subject: [PATCH 004/254] update validator --- types/validator/index.d.ts | 6 +++--- types/validator/validator-tests.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 74bf331ed6..d0749b48bb 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -6,7 +6,7 @@ declare namespace ValidatorJS { type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" + type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" interface ValidatorStatic { @@ -132,7 +132,7 @@ declare namespace ValidatorJS { // check if the string is a mobile phone number, (locale is one of // ['ar-DZ', 'ar-SA', 'ar-SY', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-GB', 'en-HK', // 'en-IN', 'en-NZ', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'hu-HU', - // 'it-IT', 'ja-JP', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', + // 'it-IT', 'ja-JP', 'ko-KR', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', // 'vi-VN', 'zh-CN', 'zh-TW']). isMobilePhone(str: string, locale: MobilePhoneLocale): boolean; @@ -218,7 +218,7 @@ declare namespace ValidatorJS { whitelist(input: string, chars: string): string; toString(input: any | any[]): string; - + version: string; // ************** diff --git a/types/validator/validator-tests.ts b/types/validator/validator-tests.ts index 48621f1acd..2cd3657b74 100644 --- a/types/validator/validator-tests.ts +++ b/types/validator/validator-tests.ts @@ -451,6 +451,7 @@ let any: any; result = validator.isMobilePhone('sample', 'hu-HU'); result = validator.isMobilePhone('sample', 'it-IT'); result = validator.isMobilePhone('sample', 'ja-JP'); + result = validator.isMobilePhone('sample', 'ko-KR'); result = validator.isMobilePhone('sample', 'ms-MY'); result = validator.isMobilePhone('sample', 'nb-NO'); result = validator.isMobilePhone('sample', 'nn-NO'); From 28d1c5dfdf4589a36e779c86ffb660007d8e9bdf Mon Sep 17 00:00:00 2001 From: bglee Date: Tue, 1 Aug 2017 19:52:31 +0900 Subject: [PATCH 005/254] add ko-KR to MobilePhoneLocale --- types/validator/index.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 685ad12d63..ed0aa87a88 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -1,12 +1,17 @@ // Type definitions for validator.js v6.2 // Project: https://github.com/chriso/validator.js -// Definitions by: tgfjt , Ilya Mochalov , Ayman Nedjmeddine , Louy Alakkad , Kacper Polak +// Definitions by: tgfjt +// Ilya Mochalov +// Ayman Nedjmeddine +// Louy Alakkad +// Kacper Polak +// Bonggyun Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ValidatorJS { type AlphaLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "hu-HU" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; type AlphanumericLocale = "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-QA" | "ar-QM" | "ar-SA" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-YE" | "cs-CZ" | "de-DE" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "en-ZM" | "es-ES" | "fr-FR" | "fr-BE" | "hu-HU" | "nl-BE" | "nl-NL" | "pl-PL" | "pt-BR" | "pt-PT" | "ru-RU" | "sr-RS" | "sr-RS@latin" | "tr-TR"; - type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" | "any"; + type MobilePhoneLocale = "ar-DZ" | "ar-SA" | "ar-SY" | "cs-CZ" | "de-DE" | "da-DK" | "el-GR" | "en-AU" | "en-GB" | "en-HK" | "en-IN" | "en-NZ" | "en-US" | "en-CA" | "en-ZA" | "en-ZM" | "es-ES" | "fi-FI" | "fr-FR" | "hu-HU" | "it-IT" | "ja-JP" | "ko-KR" | "ms-MY" | "nb-NO" | "nn-NO" | "pl-PL" | "pt-PT" | "ru-RU" | "sr-RS" | "tr-TR" | "vi-VN" | "zh-CN" | "zh-TW" | "any"; interface ValidatorStatic { From 8fa64b11d0a85f8a3620f590b3b9c2aaeed0509e Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Tue, 1 Aug 2017 15:24:02 +0100 Subject: [PATCH 006/254] Ramda - Curry intersection --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 5ff9a54fce..7344c2c3a4 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -754,6 +754,7 @@ declare namespace R { * Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists. */ intersection(list1: T[], list2: T[]): T[]; + intersection(list1: T[]): (list2: T[]) => T[]; /** * Combines two lists into a set (i.e. no duplicates) composed of those diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index f6afc8d29d..2a4b27056b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2241,3 +2241,6 @@ class Why { R.intersperse(0, [1, 2]); // => [1, 0, 2] R.intersperse(0, [1]); // => [1] }; + +R.intersection([1, 2, 3], [2, 3, 3, 4]) // => [2, 3] +R.intersection([1, 2, 3])([2, 3, 3, 4]) // => [2, 3] From a200a487912077b81655b2f5809ef0120db7fa3c Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Thu, 3 Aug 2017 08:57:06 +0100 Subject: [PATCH 007/254] Update ramda-tests.ts --- types/ramda/ramda-tests.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 2a4b27056b..13dce0469b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2242,5 +2242,7 @@ class Why { R.intersperse(0, [1]); // => [1] }; -R.intersection([1, 2, 3], [2, 3, 3, 4]) // => [2, 3] -R.intersection([1, 2, 3])([2, 3, 3, 4]) // => [2, 3] +() => { + R.intersection([1, 2, 3], [2, 3, 3, 4]); // => [2, 3] + R.intersection([1, 2, 3])([2, 3, 3, 4]); // => [2, 3] +} From 48b91777a1c5c18f6cca3c5c88827a6b1ceec7a7 Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Thu, 3 Aug 2017 12:45:40 +0100 Subject: [PATCH 008/254] Update ramda-tests.ts --- types/ramda/ramda-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 13dce0469b..d1e2c09d00 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2245,4 +2245,4 @@ class Why { () => { R.intersection([1, 2, 3], [2, 3, 3, 4]); // => [2, 3] R.intersection([1, 2, 3])([2, 3, 3, 4]); // => [2, 3] -} +}; From 111e622626df202450a1134f407390a2c49ac7f4 Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Fri, 4 Aug 2017 13:49:34 +0100 Subject: [PATCH 009/254] Update restify server interface --- types/restify/index.d.ts | 6 ++++++ types/restify/restify-tests.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index b711a9cddf..e32433cb01 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -305,6 +305,12 @@ export interface Server extends http.Server { /** Once listen() is called, this will be filled in with where the server is running. */ url: string; + + /** Node server instance */ + server: http.Server; + + /** Router instance */ + router: Router; } export interface RouterOptions { diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 6427fb7869..a1992bb830 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -1,6 +1,7 @@ import * as restify from "restify"; import * as url from "url"; import * as Logger from "bunyan"; +import * as http from "http"; let server = new restify.Server(); @@ -115,6 +116,8 @@ server.name = ""; server.versions = [""]; server.acceptable = ["test"]; server.url = ""; +server.server = new http.Server(); +server.router = new restify.Router({}); server.address().port; server.address().family; From fece0e0e6b46241e066062deb23771a23b19319e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 09:08:47 -0400 Subject: [PATCH 010/254] RSVP: switch to `export =` with `allowSyntheticDefaultExports`. --- types/rsvp/index.d.ts | 299 ++++++++++++++++++++------------------- types/rsvp/tsconfig.json | 5 +- 2 files changed, 153 insertions(+), 151 deletions(-) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index c0a7dc8b07..5372bdd7d5 100644 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -14,98 +14,98 @@ // Credit for that file goes to: Barrie Nemetchek , Andrew Gaspar , John Reilly declare namespace RSVP { - type Resolution = (value: T) => U | Thenable; - type Rejection = (error: C) => D | Thenable; + type Resolution = (value: T) => U | Thenable; + type Rejection = (error: C) => D | Thenable; - interface Thenable { - then(label?: string): Thenable; - then(onFulfillment: Resolution, label?: string): Thenable; - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Thenable; - } + interface Thenable { + then(label?: string): Thenable; + then(onFulfillment: Resolution, label?: string): Thenable; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Thenable; + } - interface Catchable { - catch(label?: string): Catchable; - catch(onRejection: (error: C) => D, label?: string): Catchable; - } + interface Catchable { + catch(label?: string): Catchable; + catch(onRejection: (error: C) => D, label?: string): Catchable; + } - interface Deferred { - promise: Promise; - resolve(value: T): void; - reject(reason: C): void; - } + interface Deferred { + promise: Promise; + resolve(value: T): void; + reject(reason: C): void; + } - type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; - interface IPromiseState { - state: PromiseStates; - value: T; - reason: C; - } + type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; + interface IPromiseState { + state: PromiseStates; + value: T; + reason: C; + } - class Resolved implements IPromiseState { - state: 'fulfilled'; - value: T; - reason: never; - } + class Resolved implements IPromiseState { + state: 'fulfilled'; + value: T; + reason: never; + } - class Rejected implements IPromiseState { - state: 'rejected'; - value: never; - reason: C; - } + class Rejected implements IPromiseState { + state: 'rejected'; + value: never; + reason: C; + } - class Pending implements IPromiseState { - state: 'pending'; - value: never; - reason: never; - } + class Pending implements IPromiseState { + state: 'pending'; + value: never; + reason: never; + } - type PromiseState = Resolved | Rejected | Pending; + type PromiseState = Resolved | Rejected | Pending; - type PromiseHash = { [P in keyof T]: Thenable | T[P] }; + type PromiseHash = { [P in keyof T]: Thenable | T[P] }; - type SettledHash = { [P in keyof T]: PromiseState }; + type SettledHash = { [P in keyof T]: PromiseState }; - interface InstrumentEvent { - guid: string; // guid of promise. Must be globally unique, not just within the implementation - childGuid: string; // child of child promise (for chained via `then`) - eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] - detail: any; // fulfillment value or rejection reason, if applicable - label: string; // label passed to promise's constructor - timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now - } + interface InstrumentEvent { + guid: string; // guid of promise. Must be globally unique, not just within the implementation + childGuid: string; // child of child promise (for chained via `then`) + eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] + detail: any; // fulfillment value or rejection reason, if applicable + label: string; // label passed to promise's constructor + timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now + } - interface ObjectWithEventMixins { - on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - on(eventName: 'error', errorHandler: (reason: any) => void): void; - on(eventName: string, callback: (value: any) => void): void; - off(eventName: string, callback?: (value: any) => void): void; - trigger(eventName: string, options?: any, label?: string): void; - } + interface ObjectWithEventMixins { + on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + on(eventName: 'error', errorHandler: (reason: any) => void): void; + on(eventName: string, callback: (value: any) => void): void; + off(eventName: string, callback?: (value: any) => void): void; + trigger(eventName: string, options?: any, label?: string): void; + } - class Promise implements Thenable, Catchable { - /** + class Promise implements Thenable, Catchable { + /** * If you call resolve in the body of the callback passed to the constructor, * your promise is fulfilled with result object passed to resolve. * If you call reject your promise is rejected with the object passed to reject. * For consistency and debugging (eg stack traces), obj should be an instanceof Error. * Any errors thrown in the constructor callback will be implicitly passed to reject(). */ - constructor( - callback: ( - resolve: (result?: T | Thenable) => void, - reject: (error: C | Thenable) => void - ) => void, - label?: string - ); + constructor( + callback: ( + resolve: (result?: T | Thenable) => void, + reject: (error: C | Thenable) => void + ) => void, + label?: string + ); - /** + /** * onFulfillment is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. * Both are optional, if either/both are omitted the next onFulfillment/onRejected in the chain is called. * Both callbacks have a single parameter , the fulfillment value or rejection reason. @@ -116,31 +116,31 @@ declare namespace RSVP { * @param onRejected called when/if "promise" rejects * @param label useful for tooling */ - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Promise; - then(onFulfillment: Resolution, label?: string): Promise; - then(label?: string): Promise; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Promise; + then(onFulfillment: Resolution, label?: string): Promise; + then(label?: string): Promise; - /** + /** * Sugar for promise.then(undefined, onRejected) */ - catch(label?: string): Promise; - catch(onRejection: Rejection, label?: string): Promise; + catch(label?: string): Promise; + catch(onRejection: Rejection, label?: string): Promise; - finally(finallyCallback: Function): Promise; + finally(finallyCallback: Function): Promise; - /** + /** * `RSVP.Promise.all` accepts an array of promises, and returns a new promise which * is fulfilled with an array of fulfillment values for the passed promises, or * rejected with the reason of the first passed promise to be rejected. It casts all * elements of the passed iterable to promises as it runs this algorithm. */ - static all(promises: Thenable[], label?: string): Promise; + static all(promises: Thenable[], label?: string): Promise; - /** + /** * `RSVP.Promise.race` returns a new promise which is settled in the same way as the * first passed promise to settle. * @@ -150,67 +150,67 @@ declare namespace RSVP { * become rejected before the other promises became fulfilled, the returned * promise will become rejected. */ - static race(promises: Promise[]): Promise; + static race(promises: Promise[]): Promise; - /** + /** * Returns a promise that will become resolved with the passed `value` */ - static resolve(value: T, label?: string): Promise; + static resolve(value: T, label?: string): Promise; - /** + /** * Deprecated in favor of resolve */ - static cast(value: T, label?: string): Promise; + static cast(value: T, label?: string): Promise; - /** + /** * Returns a promise rejected with the passed `reason`. */ - static reject(reason: C): Promise; - } + static reject(reason: C): Promise; + } - export namespace EventTarget { - /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ - function mixin(object: object): ObjectWithEventMixins; + export namespace EventTarget { + /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ + function mixin(object: object): ObjectWithEventMixins; - /** Registers a callback to be executed when `eventName` is triggered */ - function on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - function on(eventName: 'error', errorHandler: (reason: any) => void): void; - function on(eventName: string, callback: (value: any) => void): void; + /** Registers a callback to be executed when `eventName` is triggered */ + function on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + function on(eventName: 'error', errorHandler: (reason: any) => void): void; + function on(eventName: string, callback: (value: any) => void): void; - /** + /** * You can use `off` to stop firing a particular callback for an event. * * If you don't pass a `callback` argument to `off`, ALL callbacks for the * event will not be executed when the event fires. */ - function off(eventName: string, callback?: (value: any) => void): void; + function off(eventName: string, callback?: (value: any) => void): void; - /** + /** * Use `trigger` to fire custom events. * * You can also pass a value as a second argument to `trigger` that will be * passed as an argument to all event listeners for the event */ - function trigger(eventName: string, options?: any, label?: string): void; - } + function trigger(eventName: string, options?: any, label?: string): void; + } - export function configure( - configName: 'instrument' | 'instrument-with-stack', - shouldInstrument: boolean - ): void; - export function configure(configName: string, value: any): void; + export function configure( + configName: 'instrument' | 'instrument-with-stack', + shouldInstrument: boolean + ): void; + export function configure(configName: string, value: any): void; - /** + /** * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. * the array passed to all can be a mixture of promise-like objects and other objects. * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. */ - export function all(promises: Thenable[]): Promise; + export function all(promises: Thenable[]): Promise; - /** + /** * `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array * for its `promises` argument. * @@ -223,9 +223,9 @@ declare namespace RSVP { * If any of the `promises` given to `RSVP.hash` are rejected, the first promise * that is rejected will be given as the reason to the rejection handler. */ - export function hash(promises: PromiseHash): Promise; + export function hash(promises: PromiseHash): Promise; - /** + /** * `RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called * meaning that as soon as any promise resolves its value will be passed to `mapFn`. * `RSVP.map` returns a promise that will become fulfilled with the result of running @@ -235,21 +235,21 @@ declare namespace RSVP { * that is rejected will be given as an argument to the returned promise's * rejection handler. */ - export function map( - promises: Thenable[], - mapFn: (item: T) => U, - label?: string - ): Promise; + export function map( + promises: Thenable[], + mapFn: (item: T) => U, + label?: string + ): Promise; - /** + /** * `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing * a fail-fast method, it waits until all the promises have returned and * shows you all the results. This is useful if you want to handle multiple * promises' failure states together as a set. */ - export function allSettled(promises: Thenable[]): Promise[], C>; + export function allSettled(promises: Thenable[]): Promise[], C>; - /** + /** * `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object * instead of an array for its `promises` argument. * @@ -259,14 +259,14 @@ declare namespace RSVP { * with their states and values/reasons. This is useful if you want to * handle multiple promises' failure states together as a set. */ - export function hashSettled(promises: PromiseHash): Promise, C>; + export function hashSettled(promises: PromiseHash): Promise, C>; - /** + /** * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. */ - function race(promises: Promise[]): Promise; + function race(promises: Promise[]): Promise; - /** + /** * `RSVP.denodeify` takes a "node-style" function and returns a function that * will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the * browser when you'd prefer to use promises over using callbacks. For example, @@ -324,12 +324,12 @@ declare namespace RSVP { * }); * ``` */ - export function denodeify( - nodeFunction: Function, - options: boolean | string[] - ): (...args: A[]) => Promise; + export function denodeify( + nodeFunction: Function, + options: boolean | string[] + ): (...args: A[]) => Promise; - /** + /** * `RSVP.defer` returns an object similar to jQuery's `$.Deferred`. * `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s * interface. New code should use the `RSVP.Promise` constructor instead. @@ -339,32 +339,32 @@ declare namespace RSVP { * * reject - a function that causes the `promise` property on this object to become rejected * * resolve - a function that causes the `promise` property on this object to become fulfilled. */ - export function defer(label?: string): Deferred; + export function defer(label?: string): Deferred; - /** + /** * `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. */ - export function reject(reason: C): Promise; + export function reject(reason: C): Promise; - /** + /** * `RSVP.Promise.resolve` returns a promise that will become resolved with the * passed `value`. */ - export function resolve(value: T): Promise; + export function resolve(value: T): Promise; - /** + /** * `RSVP.filter` is similar to JavaScript's native `filter` method, except that it * waits for all promises to become fulfilled before running the `filterFn` on * each item in given to `promises`. `RSVP.filter` returns a promise that will * become fulfilled with the result of running `filterFn` on the values the * promises become fulfilled with. */ - export function filter( - promises: Thenable[], - filterFn: (value: T) => boolean | Promise - ): Promise; + export function filter( + promises: Thenable[], + filterFn: (value: T) => boolean | Promise + ): Promise; - /** + /** * `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event * loop in order to aid debugging. * @@ -376,7 +376,8 @@ declare namespace RSVP { * or domain/cause uncaught exception in Node. `rethrow` will also throw the * error again so the error can be handled by the promise per the spec. */ - export function rethrow(reason: C): void; + export function rethrow(reason: C): void; } -export default RSVP; +// export default RSVP; +export = RSVP; diff --git a/types/rsvp/tsconfig.json b/types/rsvp/tsconfig.json index 58c8e605be..fee17b279a 100644 --- a/types/rsvp/tsconfig.json +++ b/types/rsvp/tsconfig.json @@ -13,10 +13,11 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", "rsvp-tests.ts" ] -} \ No newline at end of file +} From 0196f2468ea3f38b96afe01e77fd7980710c8ac2 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 09:18:16 -0400 Subject: [PATCH 011/254] Update RSVP dependencies to allow synthetic imports. --- types/ember-testing-helpers/tsconfig.json | 3 ++- types/ember/tsconfig.json | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/ember-testing-helpers/tsconfig.json b/types/ember-testing-helpers/tsconfig.json index aaf474ecba..cd7634bd25 100644 --- a/types/ember-testing-helpers/tsconfig.json +++ b/types/ember-testing-helpers/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index d2f27dfec9..fbc4052a08 100644 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -14,10 +14,11 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", "ember-tests.ts" ] -} \ No newline at end of file +} From 6ecbed72420aa10dac76a64db6ced41e217f645b Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 09:19:55 -0400 Subject: [PATCH 012/254] Fix spacing in RSVP (thanks, Prettier). --- types/rsvp/index.d.ts | 296 +++++++++++++++++++++--------------------- 1 file changed, 148 insertions(+), 148 deletions(-) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index 5372bdd7d5..1aa764d785 100644 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -14,98 +14,98 @@ // Credit for that file goes to: Barrie Nemetchek , Andrew Gaspar , John Reilly declare namespace RSVP { - type Resolution = (value: T) => U | Thenable; - type Rejection = (error: C) => D | Thenable; + type Resolution = (value: T) => U | Thenable; + type Rejection = (error: C) => D | Thenable; - interface Thenable { - then(label?: string): Thenable; - then(onFulfillment: Resolution, label?: string): Thenable; - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Thenable; - } + interface Thenable { + then(label?: string): Thenable; + then(onFulfillment: Resolution, label?: string): Thenable; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Thenable; + } - interface Catchable { - catch(label?: string): Catchable; - catch(onRejection: (error: C) => D, label?: string): Catchable; - } + interface Catchable { + catch(label?: string): Catchable; + catch(onRejection: (error: C) => D, label?: string): Catchable; + } - interface Deferred { - promise: Promise; - resolve(value: T): void; - reject(reason: C): void; - } + interface Deferred { + promise: Promise; + resolve(value: T): void; + reject(reason: C): void; + } - type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; - interface IPromiseState { - state: PromiseStates; - value: T; - reason: C; - } + type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; + interface IPromiseState { + state: PromiseStates; + value: T; + reason: C; + } - class Resolved implements IPromiseState { - state: 'fulfilled'; - value: T; - reason: never; - } + class Resolved implements IPromiseState { + state: 'fulfilled'; + value: T; + reason: never; + } - class Rejected implements IPromiseState { - state: 'rejected'; - value: never; - reason: C; - } + class Rejected implements IPromiseState { + state: 'rejected'; + value: never; + reason: C; + } - class Pending implements IPromiseState { - state: 'pending'; - value: never; - reason: never; - } + class Pending implements IPromiseState { + state: 'pending'; + value: never; + reason: never; + } - type PromiseState = Resolved | Rejected | Pending; + type PromiseState = Resolved | Rejected | Pending; - type PromiseHash = { [P in keyof T]: Thenable | T[P] }; + type PromiseHash = { [P in keyof T]: Thenable | T[P] }; - type SettledHash = { [P in keyof T]: PromiseState }; + type SettledHash = { [P in keyof T]: PromiseState }; - interface InstrumentEvent { - guid: string; // guid of promise. Must be globally unique, not just within the implementation - childGuid: string; // child of child promise (for chained via `then`) - eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] - detail: any; // fulfillment value or rejection reason, if applicable - label: string; // label passed to promise's constructor - timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now - } + interface InstrumentEvent { + guid: string; // guid of promise. Must be globally unique, not just within the implementation + childGuid: string; // child of child promise (for chained via `then`) + eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] + detail: any; // fulfillment value or rejection reason, if applicable + label: string; // label passed to promise's constructor + timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now + } - interface ObjectWithEventMixins { - on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - on(eventName: 'error', errorHandler: (reason: any) => void): void; - on(eventName: string, callback: (value: any) => void): void; - off(eventName: string, callback?: (value: any) => void): void; - trigger(eventName: string, options?: any, label?: string): void; - } + interface ObjectWithEventMixins { + on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + on(eventName: 'error', errorHandler: (reason: any) => void): void; + on(eventName: string, callback: (value: any) => void): void; + off(eventName: string, callback?: (value: any) => void): void; + trigger(eventName: string, options?: any, label?: string): void; + } - class Promise implements Thenable, Catchable { - /** + class Promise implements Thenable, Catchable { + /** * If you call resolve in the body of the callback passed to the constructor, * your promise is fulfilled with result object passed to resolve. * If you call reject your promise is rejected with the object passed to reject. * For consistency and debugging (eg stack traces), obj should be an instanceof Error. * Any errors thrown in the constructor callback will be implicitly passed to reject(). */ - constructor( - callback: ( - resolve: (result?: T | Thenable) => void, - reject: (error: C | Thenable) => void - ) => void, - label?: string - ); + constructor( + callback: ( + resolve: (result?: T | Thenable) => void, + reject: (error: C | Thenable) => void + ) => void, + label?: string + ); - /** + /** * onFulfillment is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. * Both are optional, if either/both are omitted the next onFulfillment/onRejected in the chain is called. * Both callbacks have a single parameter , the fulfillment value or rejection reason. @@ -116,31 +116,31 @@ declare namespace RSVP { * @param onRejected called when/if "promise" rejects * @param label useful for tooling */ - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Promise; - then(onFulfillment: Resolution, label?: string): Promise; - then(label?: string): Promise; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Promise; + then(onFulfillment: Resolution, label?: string): Promise; + then(label?: string): Promise; - /** + /** * Sugar for promise.then(undefined, onRejected) */ - catch(label?: string): Promise; - catch(onRejection: Rejection, label?: string): Promise; + catch(label?: string): Promise; + catch(onRejection: Rejection, label?: string): Promise; - finally(finallyCallback: Function): Promise; + finally(finallyCallback: Function): Promise; - /** + /** * `RSVP.Promise.all` accepts an array of promises, and returns a new promise which * is fulfilled with an array of fulfillment values for the passed promises, or * rejected with the reason of the first passed promise to be rejected. It casts all * elements of the passed iterable to promises as it runs this algorithm. */ - static all(promises: Thenable[], label?: string): Promise; + static all(promises: Thenable[], label?: string): Promise; - /** + /** * `RSVP.Promise.race` returns a new promise which is settled in the same way as the * first passed promise to settle. * @@ -150,67 +150,67 @@ declare namespace RSVP { * become rejected before the other promises became fulfilled, the returned * promise will become rejected. */ - static race(promises: Promise[]): Promise; + static race(promises: Promise[]): Promise; - /** + /** * Returns a promise that will become resolved with the passed `value` */ - static resolve(value: T, label?: string): Promise; + static resolve(value: T, label?: string): Promise; - /** + /** * Deprecated in favor of resolve */ - static cast(value: T, label?: string): Promise; + static cast(value: T, label?: string): Promise; - /** + /** * Returns a promise rejected with the passed `reason`. */ - static reject(reason: C): Promise; - } + static reject(reason: C): Promise; + } - export namespace EventTarget { - /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ - function mixin(object: object): ObjectWithEventMixins; + export namespace EventTarget { + /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ + function mixin(object: object): ObjectWithEventMixins; - /** Registers a callback to be executed when `eventName` is triggered */ - function on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - function on(eventName: 'error', errorHandler: (reason: any) => void): void; - function on(eventName: string, callback: (value: any) => void): void; + /** Registers a callback to be executed when `eventName` is triggered */ + function on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + function on(eventName: 'error', errorHandler: (reason: any) => void): void; + function on(eventName: string, callback: (value: any) => void): void; - /** + /** * You can use `off` to stop firing a particular callback for an event. * * If you don't pass a `callback` argument to `off`, ALL callbacks for the * event will not be executed when the event fires. */ - function off(eventName: string, callback?: (value: any) => void): void; + function off(eventName: string, callback?: (value: any) => void): void; - /** + /** * Use `trigger` to fire custom events. * * You can also pass a value as a second argument to `trigger` that will be * passed as an argument to all event listeners for the event */ - function trigger(eventName: string, options?: any, label?: string): void; - } + function trigger(eventName: string, options?: any, label?: string): void; + } - export function configure( - configName: 'instrument' | 'instrument-with-stack', - shouldInstrument: boolean - ): void; - export function configure(configName: string, value: any): void; + export function configure( + configName: 'instrument' | 'instrument-with-stack', + shouldInstrument: boolean + ): void; + export function configure(configName: string, value: any): void; - /** + /** * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. * the array passed to all can be a mixture of promise-like objects and other objects. * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. */ - export function all(promises: Thenable[]): Promise; + export function all(promises: Thenable[]): Promise; - /** + /** * `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array * for its `promises` argument. * @@ -223,9 +223,9 @@ declare namespace RSVP { * If any of the `promises` given to `RSVP.hash` are rejected, the first promise * that is rejected will be given as the reason to the rejection handler. */ - export function hash(promises: PromiseHash): Promise; + export function hash(promises: PromiseHash): Promise; - /** + /** * `RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called * meaning that as soon as any promise resolves its value will be passed to `mapFn`. * `RSVP.map` returns a promise that will become fulfilled with the result of running @@ -235,21 +235,21 @@ declare namespace RSVP { * that is rejected will be given as an argument to the returned promise's * rejection handler. */ - export function map( - promises: Thenable[], - mapFn: (item: T) => U, - label?: string - ): Promise; + export function map( + promises: Thenable[], + mapFn: (item: T) => U, + label?: string + ): Promise; - /** + /** * `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing * a fail-fast method, it waits until all the promises have returned and * shows you all the results. This is useful if you want to handle multiple * promises' failure states together as a set. */ - export function allSettled(promises: Thenable[]): Promise[], C>; + export function allSettled(promises: Thenable[]): Promise[], C>; - /** + /** * `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object * instead of an array for its `promises` argument. * @@ -259,14 +259,14 @@ declare namespace RSVP { * with their states and values/reasons. This is useful if you want to * handle multiple promises' failure states together as a set. */ - export function hashSettled(promises: PromiseHash): Promise, C>; + export function hashSettled(promises: PromiseHash): Promise, C>; - /** + /** * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. */ - function race(promises: Promise[]): Promise; + function race(promises: Promise[]): Promise; - /** + /** * `RSVP.denodeify` takes a "node-style" function and returns a function that * will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the * browser when you'd prefer to use promises over using callbacks. For example, @@ -324,12 +324,12 @@ declare namespace RSVP { * }); * ``` */ - export function denodeify( - nodeFunction: Function, - options: boolean | string[] - ): (...args: A[]) => Promise; + export function denodeify( + nodeFunction: Function, + options: boolean | string[] + ): (...args: A[]) => Promise; - /** + /** * `RSVP.defer` returns an object similar to jQuery's `$.Deferred`. * `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s * interface. New code should use the `RSVP.Promise` constructor instead. @@ -339,32 +339,32 @@ declare namespace RSVP { * * reject - a function that causes the `promise` property on this object to become rejected * * resolve - a function that causes the `promise` property on this object to become fulfilled. */ - export function defer(label?: string): Deferred; + export function defer(label?: string): Deferred; - /** + /** * `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. */ - export function reject(reason: C): Promise; + export function reject(reason: C): Promise; - /** + /** * `RSVP.Promise.resolve` returns a promise that will become resolved with the * passed `value`. */ - export function resolve(value: T): Promise; + export function resolve(value: T): Promise; - /** + /** * `RSVP.filter` is similar to JavaScript's native `filter` method, except that it * waits for all promises to become fulfilled before running the `filterFn` on * each item in given to `promises`. `RSVP.filter` returns a promise that will * become fulfilled with the result of running `filterFn` on the values the * promises become fulfilled with. */ - export function filter( - promises: Thenable[], - filterFn: (value: T) => boolean | Promise - ): Promise; + export function filter( + promises: Thenable[], + filterFn: (value: T) => boolean | Promise + ): Promise; - /** + /** * `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event * loop in order to aid debugging. * @@ -376,7 +376,7 @@ declare namespace RSVP { * or domain/cause uncaught exception in Node. `rethrow` will also throw the * error again so the error can be handled by the promise per the spec. */ - export function rethrow(reason: C): void; + export function rethrow(reason: C): void; } // export default RSVP; From c1bbbe3c691c07c6017c11ecf7bf6c12a357fb0a Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 18:08:42 -0400 Subject: [PATCH 013/254] Use `import =` for RSVP tests; drop corresponding tsconfig setting. --- types/rsvp/index.d.ts | 1 - types/rsvp/rsvp-tests.ts | 2 +- types/rsvp/tsconfig.json | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index 1aa764d785..8f2fdfee04 100644 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -379,5 +379,4 @@ declare namespace RSVP { export function rethrow(reason: C): void; } -// export default RSVP; export = RSVP; diff --git a/types/rsvp/rsvp-tests.ts b/types/rsvp/rsvp-tests.ts index 519947dcc7..aec0acfede 100644 --- a/types/rsvp/rsvp-tests.ts +++ b/types/rsvp/rsvp-tests.ts @@ -1,4 +1,4 @@ -import RSVP from 'rsvp'; +import RSVP = require('rsvp'); let promise1: RSVP.Promise = RSVP.Promise.resolve(1); let promise1a: RSVP.Promise = RSVP.resolve(1); diff --git a/types/rsvp/tsconfig.json b/types/rsvp/tsconfig.json index fee17b279a..4eb44a2f7d 100644 --- a/types/rsvp/tsconfig.json +++ b/types/rsvp/tsconfig.json @@ -13,8 +13,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "allowSyntheticDefaultImports": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 2ff76c2755156481894f7db78a7fa539b2aa3112 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 14 Aug 2017 14:06:21 -0700 Subject: [PATCH 014/254] Remove `--allowSyntheticDefaultImports` --- types/ember-testing-helpers/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/ember-testing-helpers/tsconfig.json b/types/ember-testing-helpers/tsconfig.json index cd7634bd25..aaf474ecba 100644 --- a/types/ember-testing-helpers/tsconfig.json +++ b/types/ember-testing-helpers/tsconfig.json @@ -14,8 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "allowSyntheticDefaultImports": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 43a1348b9146b0c6130a37f28d019eb2924ad9a3 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 14 Aug 2017 14:06:48 -0700 Subject: [PATCH 015/254] Remove `--allowSyntheticDefaultImports` --- types/ember/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index fbc4052a08..b73838d20e 100644 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -14,8 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "allowSyntheticDefaultImports": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 2afaa6002052bdefe394723253639b26c894222f Mon Sep 17 00:00:00 2001 From: David Ng Date: Sun, 20 Aug 2017 22:43:51 +0800 Subject: [PATCH 016/254] [passport-jwt] Add missing function Add fromAuthHeaderAsBearerToken on ExtractJwt --- types/passport-jwt/index.d.ts | 1 + types/passport-jwt/passport-jwt-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/passport-jwt/index.d.ts b/types/passport-jwt/index.d.ts index 207f0ad945..3703966672 100644 --- a/types/passport-jwt/index.d.ts +++ b/types/passport-jwt/index.d.ts @@ -45,4 +45,5 @@ export declare namespace ExtractJwt { export function fromAuthHeaderWithScheme(auth_scheme: string): JwtFromRequestFunction; export function fromAuthHeader(): JwtFromRequestFunction; export function fromExtractors(extractors: JwtFromRequestFunction[]): JwtFromRequestFunction; + export function fromAuthHeaderAsBearerToken(): JwtFromRequestFunction; } diff --git a/types/passport-jwt/passport-jwt-tests.ts b/types/passport-jwt/passport-jwt-tests.ts index 024a06cfef..f7c5e093e4 100644 --- a/types/passport-jwt/passport-jwt-tests.ts +++ b/types/passport-jwt/passport-jwt-tests.ts @@ -32,6 +32,7 @@ opts.jwtFromRequest = ExtractJwt.fromBodyField('field_name'); opts.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('param_name'); opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('param_name'); opts.jwtFromRequest = ExtractJwt.fromExtractors([ExtractJwt.fromHeader('x-api-key'), ExtractJwt.fromBodyField('field_name'), ExtractJwt.fromUrlQueryParameter('param_name')]); +opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken(); opts.jwtFromRequest = (req: Request) => { return req.query.token; }; opts.secretOrKey = new Buffer('secret'); From 7f052224f53ae050d9f4d0f196cac9575d2dfd11 Mon Sep 17 00:00:00 2001 From: David Ng Date: Sun, 20 Aug 2017 22:50:58 +0800 Subject: [PATCH 017/254] Add myname to comment --- types/passport-jwt/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/passport-jwt/index.d.ts b/types/passport-jwt/index.d.ts index 3703966672..9bc14618d1 100644 --- a/types/passport-jwt/index.d.ts +++ b/types/passport-jwt/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/themikenicholson/passport-jwt // Definitions by: TANAKA Koichi // Alex Young +// David Ng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Strategy as PassportStrategy } from 'passport-strategy'; From 79b75d36db4fb9e55e5c8d7432d7dbd6ddeb4414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondrej=20Slint=C3=A1k?= Date: Mon, 21 Aug 2017 17:01:36 +0200 Subject: [PATCH 018/254] Add missing Request.flash function overload in connect-flash --- types/connect-flash/connect-flash-tests.ts | 1 + types/connect-flash/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/connect-flash/connect-flash-tests.ts b/types/connect-flash/connect-flash-tests.ts index 0f22c0cdd5..2b75c4ed77 100644 --- a/types/connect-flash/connect-flash-tests.ts +++ b/types/connect-flash/connect-flash-tests.ts @@ -13,4 +13,5 @@ app.use(flash({ app.use(function(req: Express.Request, res: Express.Response, next: Function) { req.flash('Message'); req.flash('info', 'Message'); + req.flash(); }); diff --git a/types/connect-flash/index.d.ts b/types/connect-flash/index.d.ts index edee056b1a..cb7d460623 100644 --- a/types/connect-flash/index.d.ts +++ b/types/connect-flash/index.d.ts @@ -7,6 +7,7 @@ declare namespace Express { export interface Request { + flash(): { [key: string]: string[] }; flash(message: string): any; flash(event: string, message: string): any; } From e4e15a3228bac51a6729b5ea3714f377ca2844c2 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 21 Aug 2017 13:18:11 -0700 Subject: [PATCH 019/254] redux-actions: Fix tests --- types/redux-actions/redux-actions-tests.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/redux-actions/redux-actions-tests.ts b/types/redux-actions/redux-actions-tests.ts index 48beb4b0cc..46760e6159 100644 --- a/types/redux-actions/redux-actions-tests.ts +++ b/types/redux-actions/redux-actions-tests.ts @@ -134,10 +134,12 @@ ReduxActions.handleAction(act3, (state, action) => { return { hello: action.payload.s }; }, {hello: 'greetings'}); -ReduxActions.handleAction(ReduxActions.combineActions(act1, act3, act2), (state, action) => {}, 0); +ReduxActions.handleAction(ReduxActions.combineActions(act1, act3, act2), (state, action) => state + 1, 0); ReduxActions.handleActions({ - [ReduxActions.combineActions(act1, act3, act2)](state, action) {} + [ReduxActions.combineActions(act1, act3, act2)](state, action) { + return state + 1; + } }, 0); /* can't do this until it lands in 2.2, HKTs From 909568d60f78693c96739b4d13a4de6f75077f07 Mon Sep 17 00:00:00 2001 From: Gene Lilik Date: Tue, 22 Aug 2017 00:35:26 +0300 Subject: [PATCH 020/254] Added two definitions which were missed by author --- types/react-scrollbar/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-scrollbar/index.d.ts b/types/react-scrollbar/index.d.ts index f8ddee07c9..9f73a0be51 100644 --- a/types/react-scrollbar/index.d.ts +++ b/types/react-scrollbar/index.d.ts @@ -25,6 +25,8 @@ declare module "react-scrollbar" { smoothScrolling?: boolean minScrollSize?: number, swapWheelAxes?: boolean + stopScrollPropagation?: boolean, + focusableTabIndex?: number } class ScrollArea extends React.Component {} From 288dd9b3099ee9b8f92dd41e7eaf29d943122dd9 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 22 Aug 2017 16:59:17 +0300 Subject: [PATCH 021/254] Add validation rules --- types/graphql/index.d.ts | 31 +++++ types/graphql/validation/index.d.ts | 130 ++++++++++++++++++ .../rules/ArgumentsOfCorrectType.d.ts | 9 ++ .../rules/DefaultValuesOfCorrectType.d.ts | 9 ++ .../validation/rules/FieldsOnCorrectType.d.ts | 9 ++ .../rules/FragmentsOnCompositeTypes.d.ts | 10 ++ .../validation/rules/KnownArgumentNames.d.ts | 9 ++ .../validation/rules/KnownDirectives.d.ts | 9 ++ .../validation/rules/KnownFragmentNames.d.ts | 9 ++ .../validation/rules/KnownTypeNames.d.ts | 9 ++ .../rules/LoneAnonymousOperation.d.ts | 9 ++ .../validation/rules/NoFragmentCycles.d.ts | 3 + .../rules/NoUndefinedVariables.d.ts | 9 ++ .../validation/rules/NoUnusedFragments.d.ts | 9 ++ .../validation/rules/NoUnusedVariables.d.ts | 9 ++ .../rules/OverlappingFieldsCanBeMerged.d.ts | 10 ++ .../rules/PossibleFragmentSpreads.d.ts | 10 ++ .../rules/ProvidedNonNullArguments.d.ts | 9 ++ .../graphql/validation/rules/ScalarLeafs.d.ts | 9 ++ .../rules/SingleFieldSubscriptions.d.ts | 8 ++ .../validation/rules/UniqueArgumentNames.d.ts | 9 ++ .../rules/UniqueDirectivesPerLocation.d.ts | 9 ++ .../validation/rules/UniqueFragmentNames.d.ts | 8 ++ .../rules/UniqueInputFieldNames.d.ts | 9 ++ .../rules/UniqueOperationNames.d.ts | 8 ++ .../validation/rules/UniqueVariableNames.d.ts | 8 ++ .../rules/VariablesAreInputTypes.d.ts | 9 ++ .../rules/VariablesInAllowedPosition.d.ts | 6 + 28 files changed, 385 insertions(+) create mode 100644 types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts create mode 100644 types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts create mode 100644 types/graphql/validation/rules/FieldsOnCorrectType.d.ts create mode 100644 types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts create mode 100644 types/graphql/validation/rules/KnownArgumentNames.d.ts create mode 100644 types/graphql/validation/rules/KnownDirectives.d.ts create mode 100644 types/graphql/validation/rules/KnownFragmentNames.d.ts create mode 100644 types/graphql/validation/rules/KnownTypeNames.d.ts create mode 100644 types/graphql/validation/rules/LoneAnonymousOperation.d.ts create mode 100644 types/graphql/validation/rules/NoFragmentCycles.d.ts create mode 100644 types/graphql/validation/rules/NoUndefinedVariables.d.ts create mode 100644 types/graphql/validation/rules/NoUnusedFragments.d.ts create mode 100644 types/graphql/validation/rules/NoUnusedVariables.d.ts create mode 100644 types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts create mode 100644 types/graphql/validation/rules/PossibleFragmentSpreads.d.ts create mode 100644 types/graphql/validation/rules/ProvidedNonNullArguments.d.ts create mode 100644 types/graphql/validation/rules/ScalarLeafs.d.ts create mode 100644 types/graphql/validation/rules/SingleFieldSubscriptions.d.ts create mode 100644 types/graphql/validation/rules/UniqueArgumentNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts create mode 100644 types/graphql/validation/rules/UniqueFragmentNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueInputFieldNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueOperationNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueVariableNames.d.ts create mode 100644 types/graphql/validation/rules/VariablesAreInputTypes.d.ts create mode 100644 types/graphql/validation/rules/VariablesInAllowedPosition.d.ts diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 971ae5945b..ee1a95c059 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -6,6 +6,7 @@ // Firede // Kepennar // Mikhail Novikov +// Ivan Goncharov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -34,7 +35,37 @@ export { export { validate, ValidationContext, + + // All validation rules in the GraphQL Specification. specifiedRules, + + // Individual validation rules. + ArgumentsOfCorrectTypeRule, + DefaultValuesOfCorrectTypeRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedNonNullArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, } from './validation'; // Create and format GraphQL errors. diff --git a/types/graphql/validation/index.d.ts b/types/graphql/validation/index.d.ts index a3ebc6a208..7f897fe78d 100644 --- a/types/graphql/validation/index.d.ts +++ b/types/graphql/validation/index.d.ts @@ -1,2 +1,132 @@ export { validate, ValidationContext } from './validate'; export { specifiedRules } from './specifiedRules'; + +// Spec Section: "Argument Values Type Correctness" +export { + ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule +} from './rules/ArgumentsOfCorrectType'; + +// Spec Section: "Variable Default Values Are Correctly Typed" +export { + DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule +} from './rules/DefaultValuesOfCorrectType'; + +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +export { + FieldsOnCorrectType as FieldsOnCorrectTypeRule +} from './rules/FieldsOnCorrectType'; + +// Spec Section: "Fragments on Composite Types" +export { + FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule +} from './rules/FragmentsOnCompositeTypes'; + +// Spec Section: "Argument Names" +export { + KnownArgumentNames as KnownArgumentNamesRule +} from './rules/KnownArgumentNames'; + +// Spec Section: "Directives Are Defined" +export { + KnownDirectives as KnownDirectivesRule +} from './rules/KnownDirectives'; + +// Spec Section: "Fragment spread target defined" +export { + KnownFragmentNames as KnownFragmentNamesRule +} from './rules/KnownFragmentNames'; + +// Spec Section: "Fragment Spread Type Existence" +export { + KnownTypeNames as KnownTypeNamesRule +} from './rules/KnownTypeNames'; + +// Spec Section: "Lone Anonymous Operation" +export { + LoneAnonymousOperation as LoneAnonymousOperationRule +} from './rules/LoneAnonymousOperation'; + +// Spec Section: "Fragments must not form cycles" +export { + NoFragmentCycles as NoFragmentCyclesRule +} from './rules/NoFragmentCycles'; + +// Spec Section: "All Variable Used Defined" +export { + NoUndefinedVariables as NoUndefinedVariablesRule +} from './rules/NoUndefinedVariables'; + +// Spec Section: "Fragments must be used" +export { + NoUnusedFragments as NoUnusedFragmentsRule +} from './rules/NoUnusedFragments'; + +// Spec Section: "All Variables Used" +export { + NoUnusedVariables as NoUnusedVariablesRule +} from './rules/NoUnusedVariables'; + +// Spec Section: "Field Selection Merging" +export { + OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule +} from './rules/OverlappingFieldsCanBeMerged'; + +// Spec Section: "Fragment spread is possible" +export { + PossibleFragmentSpreads as PossibleFragmentSpreadsRule +} from './rules/PossibleFragmentSpreads'; + +// Spec Section: "Argument Optionality" +export { + ProvidedNonNullArguments as ProvidedNonNullArgumentsRule +} from './rules/ProvidedNonNullArguments'; + +// Spec Section: "Leaf Field Selections" +export { + ScalarLeafs as ScalarLeafsRule +} from './rules/ScalarLeafs'; + +// Spec Section: "Subscriptions with Single Root Field" +export { + SingleFieldSubscriptions as SingleFieldSubscriptionsRule +} from './rules/SingleFieldSubscriptions'; + +// Spec Section: "Argument Uniqueness" +export { + UniqueArgumentNames as UniqueArgumentNamesRule +} from './rules/UniqueArgumentNames'; + +// Spec Section: "Directives Are Unique Per Location" +export { + UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule +} from './rules/UniqueDirectivesPerLocation'; + +// Spec Section: "Fragment Name Uniqueness" +export { + UniqueFragmentNames as UniqueFragmentNamesRule +} from './rules/UniqueFragmentNames'; + +// Spec Section: "Input Object Field Uniqueness" +export { + UniqueInputFieldNames as UniqueInputFieldNamesRule +} from './rules/UniqueInputFieldNames'; + +// Spec Section: "Operation Name Uniqueness" +export { + UniqueOperationNames as UniqueOperationNamesRule +} from './rules/UniqueOperationNames'; + +// Spec Section: "Variable Uniqueness" +export { + UniqueVariableNames as UniqueVariableNamesRule +} from './rules/UniqueVariableNames'; + +// Spec Section: "Variables are Input Types" +export { + VariablesAreInputTypes as VariablesAreInputTypesRule +} from './rules/VariablesAreInputTypes'; + +// Spec Section: "All Variable Usages Are Allowed" +export { + VariablesInAllowedPosition as VariablesInAllowedPositionRule +} from './rules/VariablesInAllowedPosition'; diff --git a/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts new file mode 100644 index 0000000000..f7247d0a9c --- /dev/null +++ b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Argument values of correct type + * + * A GraphQL document is only valid if all field argument literal values are + * of the type expected by their position. + */ +export function ArgumentsOfCorrectType(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts new file mode 100644 index 0000000000..88b3a824f2 --- /dev/null +++ b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Variable default values of correct type + * + * A GraphQL document is only valid if all variable default values are of the + * type expected by their definition. + */ +export function DefaultValuesOfCorrectType(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/FieldsOnCorrectType.d.ts b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts new file mode 100644 index 0000000000..19609b2b65 --- /dev/null +++ b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + */ +export function FieldsOnCorrectType(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts new file mode 100644 index 0000000000..d6fffd4337 --- /dev/null +++ b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts @@ -0,0 +1,10 @@ +import { ValidationContext } from '../index'; + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + */ +export function FragmentsOnCompositeTypes(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownArgumentNames.d.ts b/types/graphql/validation/rules/KnownArgumentNames.d.ts new file mode 100644 index 0000000000..4477b62a75 --- /dev/null +++ b/types/graphql/validation/rules/KnownArgumentNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + */ +export function KnownArgumentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownDirectives.d.ts b/types/graphql/validation/rules/KnownDirectives.d.ts new file mode 100644 index 0000000000..68c6acf549 --- /dev/null +++ b/types/graphql/validation/rules/KnownDirectives.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + */ +export function KnownDirectives(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownFragmentNames.d.ts b/types/graphql/validation/rules/KnownFragmentNames.d.ts new file mode 100644 index 0000000000..b904f22d89 --- /dev/null +++ b/types/graphql/validation/rules/KnownFragmentNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + */ +export function KnownFragmentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownTypeNames.d.ts b/types/graphql/validation/rules/KnownTypeNames.d.ts new file mode 100644 index 0000000000..48b15318da --- /dev/null +++ b/types/graphql/validation/rules/KnownTypeNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + */ +export function KnownTypeNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/LoneAnonymousOperation.d.ts b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts new file mode 100644 index 0000000000..4ce6abcba9 --- /dev/null +++ b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + */ +export function LoneAnonymousOperation(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoFragmentCycles.d.ts b/types/graphql/validation/rules/NoFragmentCycles.d.ts new file mode 100644 index 0000000000..fed5982fc8 --- /dev/null +++ b/types/graphql/validation/rules/NoFragmentCycles.d.ts @@ -0,0 +1,3 @@ +import { ValidationContext } from '../index'; + +export function NoFragmentCycles(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUndefinedVariables.d.ts b/types/graphql/validation/rules/NoUndefinedVariables.d.ts new file mode 100644 index 0000000000..51d30b8fd1 --- /dev/null +++ b/types/graphql/validation/rules/NoUndefinedVariables.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + */ +export function NoUndefinedVariables(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUnusedFragments.d.ts b/types/graphql/validation/rules/NoUnusedFragments.d.ts new file mode 100644 index 0000000000..7f4d431299 --- /dev/null +++ b/types/graphql/validation/rules/NoUnusedFragments.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + */ +export function NoUnusedFragments(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUnusedVariables.d.ts b/types/graphql/validation/rules/NoUnusedVariables.d.ts new file mode 100644 index 0000000000..6eb2d984aa --- /dev/null +++ b/types/graphql/validation/rules/NoUnusedVariables.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + */ +export function NoUnusedVariables(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts new file mode 100644 index 0000000000..f21edbd2cb --- /dev/null +++ b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts @@ -0,0 +1,10 @@ +import { ValidationContext } from '../index'; + +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + */ +export function OverlappingFieldsCanBeMerged(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts new file mode 100644 index 0000000000..8defb47721 --- /dev/null +++ b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts @@ -0,0 +1,10 @@ +import { ValidationContext } from '../index'; + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export function PossibleFragmentSpreads(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts new file mode 100644 index 0000000000..4d5334b9fb --- /dev/null +++ b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null) field arguments + * have been provided. + */ +export function ProvidedNonNullArguments(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/ScalarLeafs.d.ts b/types/graphql/validation/rules/ScalarLeafs.d.ts new file mode 100644 index 0000000000..afdc575671 --- /dev/null +++ b/types/graphql/validation/rules/ScalarLeafs.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export function ScalarLeafs(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts new file mode 100644 index 0000000000..01a2654a16 --- /dev/null +++ b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Subscriptions must only include one field. + * + * A GraphQL subscription is valid only if it contains a single root field. + */ +export function SingleFieldSubscriptions(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueArgumentNames.d.ts b/types/graphql/validation/rules/UniqueArgumentNames.d.ts new file mode 100644 index 0000000000..8cc166d07a --- /dev/null +++ b/types/graphql/validation/rules/UniqueArgumentNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + */ +export function UniqueArgumentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts new file mode 100644 index 0000000000..70ea02cd9c --- /dev/null +++ b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all directives at a given location + * are uniquely named. + */ +export function UniqueDirectivesPerLocation(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueFragmentNames.d.ts b/types/graphql/validation/rules/UniqueFragmentNames.d.ts new file mode 100644 index 0000000000..c505968f6a --- /dev/null +++ b/types/graphql/validation/rules/UniqueFragmentNames.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + */ +export function UniqueFragmentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueInputFieldNames.d.ts b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts new file mode 100644 index 0000000000..cebd71b79b --- /dev/null +++ b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + */ +export function UniqueInputFieldNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueOperationNames.d.ts b/types/graphql/validation/rules/UniqueOperationNames.d.ts new file mode 100644 index 0000000000..5b12cc0eed --- /dev/null +++ b/types/graphql/validation/rules/UniqueOperationNames.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + */ +export function UniqueOperationNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueVariableNames.d.ts b/types/graphql/validation/rules/UniqueVariableNames.d.ts new file mode 100644 index 0000000000..ef8712fbc1 --- /dev/null +++ b/types/graphql/validation/rules/UniqueVariableNames.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export function UniqueVariableNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/VariablesAreInputTypes.d.ts b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts new file mode 100644 index 0000000000..df079e52f9 --- /dev/null +++ b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + */ +export function VariablesAreInputTypes(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts new file mode 100644 index 0000000000..6d3e513876 --- /dev/null +++ b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts @@ -0,0 +1,6 @@ +import { ValidationContext } from '../index'; + +/** + * Variables passed to field arguments conform to type + */ +export function VariablesInAllowedPosition(context: ValidationContext): any; From 69c11462646390c8a61f15c33ee80232e76e0a77 Mon Sep 17 00:00:00 2001 From: Peter Scott Date: Wed, 23 Aug 2017 14:34:45 +0100 Subject: [PATCH 022/254] esprima v4.0.0 --- types/esprima/esprima-tests.ts | 26 ++++++++++++++++++--- types/esprima/index.d.ts | 42 +++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/types/esprima/esprima-tests.ts b/types/esprima/esprima-tests.ts index 60b54e0679..a315d0569d 100644 --- a/types/esprima/esprima-tests.ts +++ b/types/esprima/esprima-tests.ts @@ -8,12 +8,32 @@ var string: string; // esprima string = esprima.version; -program = esprima.parse('code'); -program = esprima.parse('code', {range: true}); -program = esprima.parse('import * as code from "code"', {sourceType: 'module'}) + +// Parse Module & Parse Script +program = esprima.parseScript('answer = 42'); +program = esprima.parseModule('import { sqrt } from "math.js"'); + +// Parsing Options +program = esprima.parseScript('var el= ${product}', { jsx: true }); +program = esprima.parseScript('if (x) function y() {}'); +program = esprima.parseScript('"use strict"; with (x) {}', { tolerant: true }); +program = esprima.parseScript('answer = 42', { range: true }); +program = esprima.parseScript('answer = 42', { range: true }); +program = esprima.parseScript('const answer = 42', { tokens: true }); +program = esprima.parseScript('answer = 42 // TODO: why', { comment: true }); +program = esprima.parseScript('answer = 42 // TODO: why', { comment: true, range: true }); + +// Tokenizing token = esprima.tokenize('code')[0]; token = esprima.tokenize('code', {range: true})[0]; +// Syntax Delegate +esprima.parseScript('answer = 42', {}, function (node) { + if (node.type === esprima.Syntax.VariableDeclaration) { + + } +}); + // Token string = token.type; string = token.value; diff --git a/types/esprima/index.d.ts b/types/esprima/index.d.ts index 2d5f933cad..34311cb96e 100644 --- a/types/esprima/index.d.ts +++ b/types/esprima/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Esprima v2.1.0 +// Type definitions for Esprima v4.0.0 // Project: http://esprima.org -// Definitions by: teppeis , RReverser +// Definitions by: teppeis , RReverser , peter-scott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -13,34 +13,39 @@ declare namespace esprima { const version: string; - function parse(code: string, options?: Options, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; - function tokenize(code: string, options?: Options): Array; + function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; + function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; + function tokenize(input: string, config?: TokenizeOptions): Array; interface Token { type: string; value: string; } - interface Options { - loc?: boolean; + interface ParseOptions { + jsx?: boolean, range?: boolean; - raw?: boolean; + loc?: boolean; + tolerant?: boolean; tokens?: boolean; comment?: boolean; - attachComment?: boolean; - tolerant?: boolean; - source?: boolean; - sourceType?: 'script' | 'module'; + } + + interface TokenizeOptions { + range?: boolean; + loc?: boolean; + comment?: boolean; } const Syntax: { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', ArrayExpression: 'ArrayExpression', ArrayPattern: 'ArrayPattern', ArrowFunctionExpression: 'ArrowFunctionExpression', - BlockStatement: 'BlockStatement', + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + AwaitExpression: 'AwaitExpression', BinaryExpression: 'BinaryExpression', + BlockStatement: 'BlockStatement', BreakStatement: 'BreakStatement', CallExpression: 'CallExpression', CatchClause: 'CatchClause', @@ -49,27 +54,28 @@ declare namespace esprima { ClassExpression: 'ClassExpression', ConditionalExpression: 'ConditionalExpression', ContinueStatement: 'ContinueStatement', - DoWhileStatement: 'DoWhileStatement', DebuggerStatement: 'DebuggerStatement', + DoWhileStatement: 'DoWhileStatement', EmptyStatement: 'EmptyStatement', ExportAllDeclaration: 'ExportAllDeclaration', ExportDefaultDeclaration: 'ExportDefaultDeclaration', ExportNamedDeclaration: 'ExportNamedDeclaration', ExportSpecifier: 'ExportSpecifier', ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForOfStatement: 'ForOfStatement', ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + ForStatement: 'ForStatement', FunctionDeclaration: 'FunctionDeclaration', FunctionExpression: 'FunctionExpression', Identifier: 'Identifier', IfStatement: 'IfStatement', + Import: 'Import', ImportDeclaration: 'ImportDeclaration', ImportDefaultSpecifier: 'ImportDefaultSpecifier', ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', LabeledStatement: 'LabeledStatement', + Literal: 'Literal', LogicalExpression: 'LogicalExpression', MemberExpression: 'MemberExpression', MetaProperty: 'MetaProperty', From cfca4c1fdc4613fdd76cb77b4989e8f8b2f071f4 Mon Sep 17 00:00:00 2001 From: Peter Scott Date: Wed, 23 Aug 2017 15:06:23 +0100 Subject: [PATCH 023/254] esprima 4.0 with linting --- types/esprima/esprima-tests.ts | 20 ++-- types/esprima/index.d.ts | 194 ++++++++++++++++----------------- types/esprima/tslint.json | 3 + 3 files changed, 104 insertions(+), 113 deletions(-) create mode 100644 types/esprima/tslint.json diff --git a/types/esprima/esprima-tests.ts b/types/esprima/esprima-tests.ts index a315d0569d..c7a9b796c6 100644 --- a/types/esprima/esprima-tests.ts +++ b/types/esprima/esprima-tests.ts @@ -1,10 +1,9 @@ import esprima = require('esprima'); import * as ESTree from 'estree'; -var token: esprima.Token; -var comment: ESTree.Comment; -var program: ESTree.Program; -var string: string; +let token: esprima.Token; +let program: ESTree.Program; +let string: string; // esprima string = esprima.version; @@ -14,7 +13,8 @@ program = esprima.parseScript('answer = 42'); program = esprima.parseModule('import { sqrt } from "math.js"'); // Parsing Options -program = esprima.parseScript('var el= ${product}', { jsx: true }); +const title = 'Hello World!'; +program = esprima.parseScript(`var el= ${title}`, { jsx: true }); program = esprima.parseScript('if (x) function y() {}'); program = esprima.parseScript('"use strict"; with (x) {}', { tolerant: true }); program = esprima.parseScript('answer = 42', { range: true }); @@ -28,9 +28,8 @@ token = esprima.tokenize('code')[0]; token = esprima.tokenize('code', {range: true})[0]; // Syntax Delegate -esprima.parseScript('answer = 42', {}, function (node) { +esprima.parseScript('answer = 42', {}, (node) => { if (node.type === esprima.Syntax.VariableDeclaration) { - } }); @@ -38,11 +37,8 @@ esprima.parseScript('answer = 42', {}, function (node) { string = token.type; string = token.value; -// Comment -string = comment.value; - // Type narrowing -var node: ESTree.Node; -if(node.type === esprima.Syntax.IfStatement){ +const node: ESTree.Node = program.body[0]; +if (node.type === esprima.Syntax.IfStatement) { node.consequent = node; } diff --git a/types/esprima/index.d.ts b/types/esprima/index.d.ts index 34311cb96e..627d72df73 100644 --- a/types/esprima/index.d.ts +++ b/types/esprima/index.d.ts @@ -1,110 +1,102 @@ -// Type definitions for Esprima v4.0.0 +// Type definitions for Esprima 4.0 // Project: http://esprima.org // Definitions by: teppeis , RReverser , peter-scott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - -export = esprima; -export as namespace esprima; import * as ESTree from 'estree'; -declare namespace esprima { +export const version: string; - const version: string; - - function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; - function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; - function tokenize(input: string, config?: TokenizeOptions): Array; - - interface Token { - type: string; - value: string; - } - - interface ParseOptions { - jsx?: boolean, - range?: boolean; - loc?: boolean; - tolerant?: boolean; - tokens?: boolean; - comment?: boolean; - } - - interface TokenizeOptions { - range?: boolean; - loc?: boolean; - comment?: boolean; - } - - const Syntax: { - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - AwaitExpression: 'AwaitExpression', - BinaryExpression: 'BinaryExpression', - BlockStatement: 'BlockStatement', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DebuggerStatement: 'DebuggerStatement', - DoWhileStatement: 'DoWhileStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForInStatement: 'ForInStatement', - ForOfStatement: 'ForOfStatement', - ForStatement: 'ForStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - Identifier: 'Identifier', - IfStatement: 'IfStatement', - Import: 'Import', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - LabeledStatement: 'LabeledStatement', - Literal: 'Literal', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchCase: 'SwitchCase', - SwitchStatement: 'SwitchStatement', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; +export function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; +export function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program; +export function tokenize(input: string, config?: TokenizeOptions): Token[]; +export interface Token { + type: string; + value: string; } + +export interface ParseOptions { + jsx?: boolean; + range?: boolean; + loc?: boolean; + tolerant?: boolean; + tokens?: boolean; + comment?: boolean; +} + +export interface TokenizeOptions { + range?: boolean; + loc?: boolean; + comment?: boolean; +} + +export const Syntax: { + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + AwaitExpression: 'AwaitExpression', + BinaryExpression: 'BinaryExpression', + BlockStatement: 'BlockStatement', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + ForStatement: 'ForStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Import: 'Import', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + LabeledStatement: 'LabeledStatement', + Literal: 'Literal', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' +}; diff --git a/types/esprima/tslint.json b/types/esprima/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/esprima/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 1ed313ea9b2f7874217dfcf3edee8a8a1d646bce Mon Sep 17 00:00:00 2001 From: Peter Scott Date: Wed, 23 Aug 2017 15:21:35 +0100 Subject: [PATCH 024/254] corrected ESPrima API reference in static-eval-tests --- types/static-eval/static-eval-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/static-eval/static-eval-tests.ts b/types/static-eval/static-eval-tests.ts index bfe30f723f..10899086b1 100644 --- a/types/static-eval/static-eval-tests.ts +++ b/types/static-eval/static-eval-tests.ts @@ -2,7 +2,7 @@ import evaluate = require('static-eval'); import esprima = require('esprima'); import * as ESTree from 'estree'; -var parse = esprima.parse; +var parse = esprima.parseScript; var src = '[1,2,3+4*10+n,foo(3+5),obj[""+"x"].y]'; From d0e48fb748255caa4b1065ee8d55b8b54c263172 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 19:42:25 +0300 Subject: [PATCH 025/254] added jquery.filterTable --- types/jquery.filtertable/index.d.ts | 144 ++++++++++++++++++ .../jquery.filtertable-tests.ts | 16 ++ types/jquery.filtertable/tsconfig.json | 23 +++ 3 files changed, 183 insertions(+) create mode 100644 types/jquery.filtertable/index.d.ts create mode 100644 types/jquery.filtertable/jquery.filtertable-tests.ts create mode 100644 types/jquery.filtertable/tsconfig.json diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts new file mode 100644 index 0000000000..138c2dfc43 --- /dev/null +++ b/types/jquery.filtertable/index.d.ts @@ -0,0 +1,144 @@ +/// +// Type definitions for jquery.filterTable v1.5.7 +// Project: https://github.com/sunnywalker/jQuery.FilterTable +// Definitions by: TotPeRo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace FilterTable { + + interface FilterTableOptions { + /** + * Makes the filter input field autofocused (not recommended for accessibility reasons) + * Default: 'false' + */ + autofocus?: boolean; + /** + * Callback function after a filter is performed. + * Default: 'null' + * @param term filter term (string) + * @param table table being filtered (jQuery object) + * @returns {void} + */ + callback?: (term, table) => void; + /** + * Class applied to the main filter input container + * Default: 'filter-table' + */ + containerClass?: string; + /** + * Tag name of the main filter input container + * Default: 'p' + */ + containerTag?: string; + /** + * Controls whether the table's tfoot(s) will be hidden when the table is filtered + * Default: 'false' + */ + hideTFootOnFilter?: boolean; + /** + * Class applied to cells containing the filter term + * Default: 'alt' + */ + highlightClass?: string; + /** + * Ignore these columns (0-indexed) when filtering + * Default: '[]' + */ + ignoreColumns?: number[]; + /** + * Use this selector to find the filter input instead of creating a new one (only works if selector returns a single element) + * Default: 'null' + */ + inputSelector?: string; + /** + * Name attribute of the filter input field + * Default: 'filter-table' + */ + inputName?: string; + /** + * Tag name of the filter input itself + * Default: 'search' + */ + inputType?: string; + /** + * Text to precede the filter input + * Default: 'Filter:' + */ + label?: string; + /** + * Filter only when at least this number of characters are in the filter input field + * Default: '1' + */ + minChars?: number; + /** + * Only show the filter on tables with this number of rows or more + * Default: '8' + */ + minRows?: number; + /** + * HTML5 placeholder text for the filter input + * Default: 'search this table' + */ + placeholder?: string; + /** + * Trap the return key in the filter input field to prevent form submission + * Default: 'true' + */ + preventReturnKey?: boolean; + /** + * List of clickable phrases to quick fill the search + * Default: '[]' + */ + quickList?: string[]; + /** + * Class of each quick list item + * Default: 'quick' + */ + quickListClass?: string; + /** + * Label for the clear filtering quick list item (or none if blank) + * Default: '' + */ + quickListClear?: string; + /** + * Tag name surrounding quick list items (e.g., ul) + * Default: '' + */ + quickListGroupTag?: string; + /** + * Tag name of each quick list item (e.g., a or li) + * Default: 'a' + */ + quickListTag?: string; // "a" | "li" + /** + * Class applied to visible rows + * Default: 'visible' + */ + visibleClass?: string; + } + + interface FilterTableStatic { + + /** + * init with default options + * @returns {JQuery} + */ + (): JQuery; + + /** + * init with custom options + * @param options + * @returns {JQuery} + */ + (options: FilterTableOptions): JQuery; + } +} + +interface JQuery { + + /** + * if this code appears after your tables; otherwise, include it in your document.ready() code. + * $('table').filterTable() + */ + filterTable: FilterTable.FilterTableStatic; +} diff --git a/types/jquery.filtertable/jquery.filtertable-tests.ts b/types/jquery.filtertable/jquery.filtertable-tests.ts new file mode 100644 index 0000000000..adfbe853fe --- /dev/null +++ b/types/jquery.filtertable/jquery.filtertable-tests.ts @@ -0,0 +1,16 @@ +//import $ = require('jquery'); + +$(() => { + // examples from http://sunnywalker.github.io/jQuery.FilterTable/ + + $('table').filterTable(); + + $('table').filterTable({ quickList: ['class', 'tag'] }); + + $('table').filterTable({ + callback(term, table) { + table.find('tr').removeClass('striped').filter(':visible:even').addClass('striped'); + } + }); + +}); \ No newline at end of file diff --git a/types/jquery.filtertable/tsconfig.json b/types/jquery.filtertable/tsconfig.json new file mode 100644 index 0000000000..2560a6e1cc --- /dev/null +++ b/types/jquery.filtertable/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery.filtertable-tests.ts" + ] +} \ No newline at end of file From 7651949914b0f202c361835883371ac38012b245 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 19:44:22 +0300 Subject: [PATCH 026/254] added waitMe --- types/waitMe/index.d.ts | 128 +++++++++++++++++++++++++++++++++++ types/waitMe/tsconfig.json | 22 ++++++ types/waitMe/waitMe-tests.ts | 31 +++++++++ 3 files changed, 181 insertions(+) create mode 100644 types/waitMe/index.d.ts create mode 100644 types/waitMe/tsconfig.json create mode 100644 types/waitMe/waitMe-tests.ts diff --git a/types/waitMe/index.d.ts b/types/waitMe/index.d.ts new file mode 100644 index 0000000000..0ca53dd8a6 --- /dev/null +++ b/types/waitMe/index.d.ts @@ -0,0 +1,128 @@ +/// +// Type definitions for waitMe 1.18 +// Project: https://github.com/vadimsva/waitMe +// Definitions by: TotPeRo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace WaitMe { + + interface WaitMeOptions { + /** + * animation effect (string). + * Use: 'bounce' - default + * | none + * | rotateplane + * | stretch + * | orbit + * | roundBounce + * | win8 + * | win8_linear + * | ios + * | facebook + * | rotation + * | timer + * | pulse + * | progressBar + * | bouncePulse + * | img + */ + effect?: "none" + | "bounce" + | "rotateplane" + | "stretch" + | "orbit" + | "roundBounce" + | "win8" + | "win8_linear" + | "ios" + | "facebook" + | "rotation" + | "timer" + | "pulse" + | "progressBar" + | "bouncePulse" + | "img"; + /** + * place text under the effect (string). + * Use: 'text'. + */ + text?: string; + /** + * background for container (string). + * Use: 'rgba(255,255,255,0.7)'. You can use color and image. + */ + bg?: string; + /** + * color for background animation and text (string, array). + * Use: '#000', ['','',...] - you can use multicolor for effect + */ + color?: string | string[]; + /** + * set max size for elem animation (string). + * Use: 40. By default, use empty string. + */ + maxSize?: number | string; + /** + * change text position (string). + * Use: 'vertical' - default, 'horizontal'. + */ + textPos?: "vertical" | "horizontal"; + /** + * change font size (string). + * Use: '18px'. By default, use empty string. + */ + fontSize?: string; + /** + * url to image (string). + * Use: 'url'. By default, use empty string. Use with effect: 'img'. + */ + source?: string; + /** + * code execution after closed (function). + * Use: function(){ //your code here... } or ()=>{ //your code here... } + * @returns {void} + */ + onClose?: () => void; + } + + interface WaitMeStatic { + + /** + * init with default options + * @returns {JQuery} + */ + (): JQuery; + + /** + * init with custom options + * @param method + * @returns {JQuery} + */ + (method: WaitMeOptions): JQuery; + + /** + * for close waitMe. + * Use: $(container).waitMe("hide"); + * @param hide + * @returns {JQuery} + */ + (hide: "hide"): JQuery; + } +} + +interface JQuery { + + /** + * $(container).waitMe({param1 : value1, param2 : value2, ...}); + */ + waitMe: WaitMe.WaitMeStatic; + + /** + * execution after closed. + * Use: $('.waitMe').on('close', function() {}); + * @param event + * @param handler + * @returns {this} + */ + on(event: "close", handler: () => void): this; +} diff --git a/types/waitMe/tsconfig.json b/types/waitMe/tsconfig.json new file mode 100644 index 0000000000..6f1ae44591 --- /dev/null +++ b/types/waitMe/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "waitMe-tests.ts" + ] +} \ No newline at end of file diff --git a/types/waitMe/waitMe-tests.ts b/types/waitMe/waitMe-tests.ts new file mode 100644 index 0000000000..45d6bea745 --- /dev/null +++ b/types/waitMe/waitMe-tests.ts @@ -0,0 +1,31 @@ +//import $ = require('jquery'); + +$(() => { + // examples from http://vadimsva.github.io/waitMe/ + + $("#container").waitMe(); + + $('#container').waitMe({}); + + $("#container").waitMe({ effect: "none", text: "" }); + + $('#container').waitMe({ + effect: 'bounce', + text: '', + bg: 'rgba(255, 255, 255, 0.7)', + color: "#000", + maxSize: '', + textPos: 'vertical', + fontSize: '', + source: '' + }); + + $('#container').waitMe() + .on('close', (e) => { + //console.log(e); + }); + + $("asdsa").waitMe("hide"); + + +}); \ No newline at end of file From 49ee079ed6665829a79ccebd21d4ad93d7379469 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:05:07 +0300 Subject: [PATCH 027/254] add tslint --- types/waitMe/tsconfig.json | 3 ++- types/waitMe/tslint.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 types/waitMe/tslint.json diff --git a/types/waitMe/tsconfig.json b/types/waitMe/tsconfig.json index 6f1ae44591..1ebcce27a2 100644 --- a/types/waitMe/tsconfig.json +++ b/types/waitMe/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/waitMe/tslint.json b/types/waitMe/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/waitMe/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From f05281df48f1d27b0c9c61e112233e3e4e8b5b74 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:08:01 +0300 Subject: [PATCH 028/254] added tslint --- types/jquery.filtertable/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/jquery.filtertable/tslint.json diff --git a/types/jquery.filtertable/tslint.json b/types/jquery.filtertable/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/jquery.filtertable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From f0e0ef286c5bd3ff4101f5286bc777efade342d8 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:48:01 +0300 Subject: [PATCH 029/254] Update jquery.filtertable-tests.ts --- types/jquery.filtertable/jquery.filtertable-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/jquery.filtertable/jquery.filtertable-tests.ts b/types/jquery.filtertable/jquery.filtertable-tests.ts index adfbe853fe..a74a6ee030 100644 --- a/types/jquery.filtertable/jquery.filtertable-tests.ts +++ b/types/jquery.filtertable/jquery.filtertable-tests.ts @@ -1,4 +1,4 @@ -//import $ = require('jquery'); +//import $ = require('jquery'); $(() => { // examples from http://sunnywalker.github.io/jQuery.FilterTable/ @@ -12,5 +12,4 @@ $(() => { table.find('tr').removeClass('striped').filter(':visible:even').addClass('striped'); } }); - -}); \ No newline at end of file +}); From 2fe68cc10e5e57c84ee716652c9db7223c4c299f Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:48:34 +0300 Subject: [PATCH 030/254] Update index.d.ts --- types/jquery.filtertable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index 138c2dfc43..e33e34b9a5 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -1,4 +1,4 @@ -/// +/// // Type definitions for jquery.filterTable v1.5.7 // Project: https://github.com/sunnywalker/jQuery.FilterTable // Definitions by: TotPeRo From 3cfabcd2f098df0c3a14fb73aabc2432f67f24f8 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:49:57 +0300 Subject: [PATCH 031/254] Update waitMe-tests.ts --- types/waitMe/waitMe-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/waitMe/waitMe-tests.ts b/types/waitMe/waitMe-tests.ts index 45d6bea745..ecb39f843a 100644 --- a/types/waitMe/waitMe-tests.ts +++ b/types/waitMe/waitMe-tests.ts @@ -1,4 +1,4 @@ -//import $ = require('jquery'); +//import $ = require('jquery'); $(() => { // examples from http://vadimsva.github.io/waitMe/ @@ -27,5 +27,4 @@ $(() => { $("asdsa").waitMe("hide"); - -}); \ No newline at end of file +}); From f4ee5830eba2cd6b84c6274ddf4298254719f2df Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:56:26 +0300 Subject: [PATCH 032/254] Update waitMe-tests.ts --- types/waitMe/waitMe-tests.ts | 41 +++++++++++++++--------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/types/waitMe/waitMe-tests.ts b/types/waitMe/waitMe-tests.ts index ecb39f843a..64e691d705 100644 --- a/types/waitMe/waitMe-tests.ts +++ b/types/waitMe/waitMe-tests.ts @@ -1,30 +1,23 @@ -//import $ = require('jquery'); + $("#container").waitMe(); -$(() => { - // examples from http://vadimsva.github.io/waitMe/ +$('#container').waitMe({}); - $("#container").waitMe(); +$("#container").waitMe({ effect: "none", text: "" }); - $('#container').waitMe({}); +$('#container').waitMe({ + effect: 'bounce', + text: '', + bg: 'rgba(255, 255, 255, 0.7)', + color: "#000", + maxSize: '', + textPos: 'vertical', + fontSize: '', + source: '' +}); - $("#container").waitMe({ effect: "none", text: "" }); - - $('#container').waitMe({ - effect: 'bounce', - text: '', - bg: 'rgba(255, 255, 255, 0.7)', - color: "#000", - maxSize: '', - textPos: 'vertical', - fontSize: '', - source: '' +$('#container').waitMe() + .on('close', (e) => { + //console.log(e); }); - $('#container').waitMe() - .on('close', (e) => { - //console.log(e); - }); - - $("asdsa").waitMe("hide"); - -}); +$("asdsa").waitMe("hide"); From 48f6739665d38d32134f248c7c36adb541d966c6 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:56:44 +0300 Subject: [PATCH 033/254] Update waitMe-tests.ts --- types/waitMe/waitMe-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/waitMe/waitMe-tests.ts b/types/waitMe/waitMe-tests.ts index 64e691d705..9a47ddd882 100644 --- a/types/waitMe/waitMe-tests.ts +++ b/types/waitMe/waitMe-tests.ts @@ -20,4 +20,4 @@ $('#container').waitMe() //console.log(e); }); -$("asdsa").waitMe("hide"); +$("#container").waitMe("hide"); From 1b82d8c952235cb1fa4cd82c40f1a7e5e0c63562 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:57:34 +0300 Subject: [PATCH 034/254] Update jquery.filtertable-tests.ts --- .../jquery.filtertable-tests.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/types/jquery.filtertable/jquery.filtertable-tests.ts b/types/jquery.filtertable/jquery.filtertable-tests.ts index a74a6ee030..74858f9283 100644 --- a/types/jquery.filtertable/jquery.filtertable-tests.ts +++ b/types/jquery.filtertable/jquery.filtertable-tests.ts @@ -1,15 +1,11 @@ -//import $ = require('jquery'); +// examples from http://sunnywalker.github.io/jQuery.FilterTable/ -$(() => { - // examples from http://sunnywalker.github.io/jQuery.FilterTable/ +$('table').filterTable(); - $('table').filterTable(); +$('table').filterTable({ quickList: ['class', 'tag'] }); - $('table').filterTable({ quickList: ['class', 'tag'] }); - - $('table').filterTable({ - callback(term, table) { - table.find('tr').removeClass('striped').filter(':visible:even').addClass('striped'); - } - }); +$('table').filterTable({ + callback(term, table) { + table.find('tr').removeClass('striped').filter(':visible:even').addClass('striped'); + } }); From dd9348b42a5bdfd1c82726334b62602441aeae7d Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:59:09 +0300 Subject: [PATCH 035/254] Update waitMe-tests.ts --- types/waitMe/waitMe-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/waitMe/waitMe-tests.ts b/types/waitMe/waitMe-tests.ts index 9a47ddd882..9963e54dc2 100644 --- a/types/waitMe/waitMe-tests.ts +++ b/types/waitMe/waitMe-tests.ts @@ -1,4 +1,4 @@ - $("#container").waitMe(); +$("#container").waitMe(); $('#container').waitMe({}); From c9c16571b25c0eaf3d5ee5352b1184a279881e68 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Wed, 23 Aug 2017 20:59:38 +0300 Subject: [PATCH 036/254] Update jquery.filtertable-tests.ts --- types/jquery.filtertable/jquery.filtertable-tests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/jquery.filtertable/jquery.filtertable-tests.ts b/types/jquery.filtertable/jquery.filtertable-tests.ts index 74858f9283..d6290f491f 100644 --- a/types/jquery.filtertable/jquery.filtertable-tests.ts +++ b/types/jquery.filtertable/jquery.filtertable-tests.ts @@ -1,5 +1,3 @@ -// examples from http://sunnywalker.github.io/jQuery.FilterTable/ - $('table').filterTable(); $('table').filterTable({ quickList: ['class', 'tag'] }); From 9d409aeadcfcc8b064663bc96bfd51d65bd109e6 Mon Sep 17 00:00:00 2001 From: oscar_busk Date: Wed, 23 Aug 2017 22:10:51 +0200 Subject: [PATCH 037/254] Angular: add comment about debugInfo on scope() Add a comment explaining that the scope() and isolatedScope() methods requires debugInfoEnabled(true) to return the $scope. --- types/angular/jqlite.d.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index fd199da74b..858201fb18 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -661,8 +661,21 @@ interface JQuery { controller(name?: string): any; injector(): ng.auto.IInjectorService; - /** It's declared generic for custom scope interfaces */ + /** + * Returns the `$scope` of the element. + * + * **IMPORTANT**: Requires `debugInfoEnabled` to be true. + * + * See https://docs.angularjs.org/guide/production#disabling-debug-data for more information. + */ scope(): T; + /** + * Returns the `$scope` of the element. + * + * **IMPORTANT**: Requires `debugInfoEnabled` to be true. + * + * See https://docs.angularjs.org/guide/production#disabling-debug-data for more information. + */ isolateScope(): T; inheritedData(key: string, value: any): this; From 377cb9f1ff0843edb950f57ae94f35c6f0bdbeac Mon Sep 17 00:00:00 2001 From: willisplummer Date: Wed, 23 Aug 2017 17:04:10 -0400 Subject: [PATCH 038/254] make createFromArray a static method on BlockMapBuilder class --- types/draft-js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 5516e43559..af97b6d676 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -798,8 +798,8 @@ declare namespace Draft { "undo" ) - interface BlockMapBuilder { - createFromArray(blocks: Array): BlockMap; + class BlockMapBuilder { + static createFromArray(blocks: Array): BlockMap; } const DefaultDraftBlockRenderMap: Immutable.Map; From be0c9d5d57018c33564f2c086e57a168395242fb Mon Sep 17 00:00:00 2001 From: Ian Tan Date: Thu, 24 Aug 2017 11:54:20 +0800 Subject: [PATCH 039/254] Make keyboard and focus handlers accept HTMLInputElement as type parameter --- types/react-select/index.d.ts | 6 ++-- types/react-select/react-select-tests.tsx | 35 +++++++++++++++++++++-- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index aba6c4d68e..8254435ce2 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -32,11 +32,11 @@ declare namespace ReactSelectClass { type MenuRendererHandler = (props: MenuRendererProps) => HandlerRendererResult; type OnCloseHandler = () => void; type OnInputChangeHandler = (inputValue: string) => void; - type OnInputKeyDownHandler = React.KeyboardEventHandler; + type OnInputKeyDownHandler = React.KeyboardEventHandler; type OnMenuScrollToBottomHandler = () => void; type OnOpenHandler = () => void; - type OnFocusHandler = React.FocusEventHandler; - type OnBlurHandler = React.FocusEventHandler; + type OnFocusHandler = React.FocusEventHandler; + type OnBlurHandler = React.FocusEventHandler; type OptionRendererHandler = (option: Option) => HandlerRendererResult; type ValueRendererHandler = (option: Option) => HandlerRendererResult; type OnValueClickHandler = (value: string, event: React.MouseEvent) => void; diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index 8b834d1bb6..b19656ec5d 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -77,9 +77,10 @@ describe("react-select", () => { }); it("Overriding default key-down behavior with onInputKeyDown", () => { - const keyDownHandler: ReactSelect.OnInputKeyDownHandler = event => { - const e: React.KeyboardEvent = event; - }; + const keyDownHandler: ReactSelect.OnInputKeyDownHandler = (event => { + const divEvent = event as React.KeyboardEvent; + const inputEvent = event as React.KeyboardEvent; + }); }); it("Updating input values with onInputChange", () => { @@ -89,6 +90,34 @@ describe("react-select", () => { }); }); +describe("Focus events", () => { + it("Passing custom onFocus", () => { + class Component extends React.PureComponent { + render() { + return ( + { + const inputEvent = e as React.FocusEvent; + const divEvent = e as React.FocusEvent; + }} /> + ); + } + } + }); + + it("Passing custom onBlur", () => { + class Component extends React.PureComponent { + render() { + return ( + { + const inputEvent = e as React.FocusEvent; + const divEvent = e as React.FocusEvent; + }} /> + ); + } + } + }); +}); + describe("Examples", () => { it("Simple example", () => { class Component extends React.Component { From 279a617246661da2c3d067f6b00134238cfc17aa Mon Sep 17 00:00:00 2001 From: Ian Tan Date: Thu, 24 Aug 2017 13:44:17 +0800 Subject: [PATCH 040/254] Add index type to Option --- types/react-select/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 8254435ce2..35e5bf127d 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -82,6 +82,11 @@ declare namespace ReactSelectClass { * @default false */ disabled?: boolean; + /** + * In the event that a custom menuRenderer is provided, Option should be able + * to accept arbitrary key-value pairs. See react-virtualized-select. + */ + [property: string]: any; } type OptionValues = string | number | boolean; From 6800cd1a0aa752cf6f2e05cb7d5317fd5d3856c1 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Thu, 24 Aug 2017 17:54:13 +1000 Subject: [PATCH 041/254] add: xhr-mock --- types/xhr-mock/index.d.ts | 57 ++++++++++++++++++++++++++++++++ types/xhr-mock/tsconfig.json | 23 +++++++++++++ types/xhr-mock/tslint.json | 1 + types/xhr-mock/xhr-mock-tests.ts | 25 ++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 types/xhr-mock/index.d.ts create mode 100644 types/xhr-mock/tsconfig.json create mode 100644 types/xhr-mock/tslint.json create mode 100644 types/xhr-mock/xhr-mock-tests.ts diff --git a/types/xhr-mock/index.d.ts b/types/xhr-mock/index.d.ts new file mode 100644 index 0000000000..eacec1c5fc --- /dev/null +++ b/types/xhr-mock/index.d.ts @@ -0,0 +1,57 @@ +// Type definitions for xhr-mock 1.9 +// Project: https://github.com/jameslnewell/xhr-mock#readme +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace mock { + interface Headers { + [k: string]: string; + } + + interface MockResponse { + status(code: number): this; + status(): number; + statusText(statusText: string): this; + statusText(): string; + header(name: string, value: string): this; + header(name: string): string | null; + headers(obj: Headers): this; + headers(): Headers; + body(body: string): this; + body(): string; + timeout(timeout: boolean | number): this; + timeout(): boolean | number; + } + + interface MockRequest { + method(): string; + url(): string; + query(): string; + header(name: string, value: string): this; + header(name: string): string | null; + headers(obj: Headers): this; + headers(): Headers; + body(body: string): this; + body(): string; + progress(loaded: number, total: number, lengthComputable?: boolean): void; + } + + type MockFunction = (req: MockRequest, res: MockResponse) => MockResponse | null; + + interface XhrMock { + XMLHttpRequest: XMLHttpRequest; + setup(): this; + teardown(): this; + reset(): this; + mock(method: string, url: string, fn: mock.MockFunction): this; + get(url: string, fn: mock.MockFunction): this; + post(url: string, fn: mock.MockFunction): this; + put(url: string, fn: mock.MockFunction): this; + patch(url: string, fn: mock.MockFunction): this; + delete(url: string, fn: mock.MockFunction): this; + } +} + +declare var mock: mock.XhrMock; +export = mock; +export as namespace mock; diff --git a/types/xhr-mock/tsconfig.json b/types/xhr-mock/tsconfig.json new file mode 100644 index 0000000000..6a5c03268f --- /dev/null +++ b/types/xhr-mock/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", + "xhr-mock-tests.ts" + ] +} diff --git a/types/xhr-mock/tslint.json b/types/xhr-mock/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/xhr-mock/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/xhr-mock/xhr-mock-tests.ts b/types/xhr-mock/xhr-mock-tests.ts new file mode 100644 index 0000000000..fd26b3a43f --- /dev/null +++ b/types/xhr-mock/xhr-mock-tests.ts @@ -0,0 +1,25 @@ +// replace the real XHR object with the mock XHR object +mock.setup(); + +// create a mock response for all POST requests with the URL http://localhost/api/user +mock.post('http://localhost/api/user', (req: mock.MockRequest, res: mock.MockResponse) => { + // return null; //simulate an error + // return res.timeout(true); //simulate a timeout + + return res + .status(201) + .header('Content-Type', 'application/json') + .body(JSON.stringify({data: { + first_name: 'John', last_name: 'Smith' + }})); +}); + +// create an instance of the (mock) XHR object and use as per normal +const xhr = new XMLHttpRequest(); + +xhr.onreadystatechange = () => { + if (xhr.readyState === 4) { + // when you're finished put the real XHR object back + mock.teardown(); + } +}; From 86bc2a8109a649ced860f26bdbae8d9515b10362 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 11:03:10 +0300 Subject: [PATCH 042/254] change reference --- types/jquery.filtertable/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index e33e34b9a5..eefa7edd92 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -1,9 +1,10 @@ -/// // Type definitions for jquery.filterTable v1.5.7 // Project: https://github.com/sunnywalker/jQuery.FilterTable // Definitions by: TotPeRo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare namespace FilterTable { interface FilterTableOptions { From 7e671cfcc9a453404b6101c87bc29663d5269aec Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 11:03:42 +0300 Subject: [PATCH 043/254] change references --- types/waitMe/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/waitMe/index.d.ts b/types/waitMe/index.d.ts index 0ca53dd8a6..86cee519a7 100644 --- a/types/waitMe/index.d.ts +++ b/types/waitMe/index.d.ts @@ -1,9 +1,10 @@ -/// // Type definitions for waitMe 1.18 // Project: https://github.com/vadimsva/waitMe // Definitions by: TotPeRo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare namespace WaitMe { interface WaitMeOptions { From baa55f4dfa5479899d00560d333de3c6658386d3 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 11:09:19 +0300 Subject: [PATCH 044/254] folder lowercase --- types/{waitMe => waitme}/index.d.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/{waitMe => waitme}/index.d.ts (100%) diff --git a/types/waitMe/index.d.ts b/types/waitme/index.d.ts similarity index 100% rename from types/waitMe/index.d.ts rename to types/waitme/index.d.ts From e29633c36a089accc351255d9e6497d3f9f1f8b2 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 11:56:17 +0300 Subject: [PATCH 045/254] folder name lowercase --- types/{waitMe => waitme}/waitMe-tests.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/{waitMe => waitme}/waitMe-tests.ts (100%) diff --git a/types/waitMe/waitMe-tests.ts b/types/waitme/waitMe-tests.ts similarity index 100% rename from types/waitMe/waitMe-tests.ts rename to types/waitme/waitMe-tests.ts From a6156cbf5f91069a0bc70234a97ca8c344c0cde6 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:07:50 +0300 Subject: [PATCH 046/254] Update tsconfig.json --- types/waitMe/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/waitMe/tsconfig.json b/types/waitMe/tsconfig.json index 1ebcce27a2..1112bfd9a6 100644 --- a/types/waitMe/tsconfig.json +++ b/types/waitMe/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "waitMe-tests.ts" + "waitme-tests.ts" ] -} \ No newline at end of file +} From f463e8d0320eb69d41eba1627dac5c2e7fdccf2a Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:08:11 +0300 Subject: [PATCH 047/254] Rename types/waitMe/tsconfig.json to types/waitme/tsconfig.json --- types/{waitMe => waitme}/tsconfig.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/{waitMe => waitme}/tsconfig.json (100%) diff --git a/types/waitMe/tsconfig.json b/types/waitme/tsconfig.json similarity index 100% rename from types/waitMe/tsconfig.json rename to types/waitme/tsconfig.json From ac2445e935041136d3ffa14597bf42343363e69d Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:08:25 +0300 Subject: [PATCH 048/254] Rename waitMe-tests.ts to waitme-tests.ts --- types/waitme/{waitMe-tests.ts => waitme-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/waitme/{waitMe-tests.ts => waitme-tests.ts} (100%) diff --git a/types/waitme/waitMe-tests.ts b/types/waitme/waitme-tests.ts similarity index 100% rename from types/waitme/waitMe-tests.ts rename to types/waitme/waitme-tests.ts From 5923a4ab93a84bb138c32d81d78052c52e7b4f0e Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:08:54 +0300 Subject: [PATCH 049/254] Rename types/waitMe/tslint.json to types/waitme/tslint.json --- types/waitMe/tslint.json | 1 - types/waitme/tslint.json | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 types/waitMe/tslint.json create mode 100644 types/waitme/tslint.json diff --git a/types/waitMe/tslint.json b/types/waitMe/tslint.json deleted file mode 100644 index 2750cc0197..0000000000 --- a/types/waitMe/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/waitme/tslint.json b/types/waitme/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/waitme/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 87eca779e327d76f82dd7d171042e0c7a877b87f Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:15:48 +0300 Subject: [PATCH 050/254] Update waitme-tests.ts --- types/waitme/waitme-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/waitme/waitme-tests.ts b/types/waitme/waitme-tests.ts index 9963e54dc2..e22b366663 100644 --- a/types/waitme/waitme-tests.ts +++ b/types/waitme/waitme-tests.ts @@ -16,8 +16,8 @@ $('#container').waitMe({ }); $('#container').waitMe() - .on('close', (e) => { - //console.log(e); - }); + .on('close', () => { + //code here +}); $("#container").waitMe("hide"); From 25899e0a827e29a9c4f0995e39d7bba88fec4f54 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:22:24 +0300 Subject: [PATCH 051/254] Update index.d.ts --- types/jquery.filtertable/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index eefa7edd92..30d4630d6a 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sunnywalker/jQuery.FilterTable // Definitions by: TotPeRo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// From 42e17e48b08a43bf48ad56afcfab52cdd7966648 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:23:06 +0300 Subject: [PATCH 052/254] Update index.d.ts --- types/waitme/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/waitme/index.d.ts b/types/waitme/index.d.ts index 86cee519a7..18693e9db3 100644 --- a/types/waitme/index.d.ts +++ b/types/waitme/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/vadimsva/waitMe // Definitions by: TotPeRo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// From 71e05ab1e83ebe60c2fffce88721ce682ff6ba72 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:25:24 +0300 Subject: [PATCH 053/254] Update index.d.ts --- types/waitme/index.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/waitme/index.d.ts b/types/waitme/index.d.ts index 18693e9db3..78616faa3d 100644 --- a/types/waitme/index.d.ts +++ b/types/waitme/index.d.ts @@ -7,7 +7,6 @@ /// declare namespace WaitMe { - interface WaitMeOptions { /** * animation effect (string). @@ -86,9 +85,8 @@ declare namespace WaitMe { */ onClose?: () => void; } - + interface WaitMeStatic { - /** * init with default options * @returns {JQuery} @@ -113,7 +111,6 @@ declare namespace WaitMe { } interface JQuery { - /** * $(container).waitMe({param1 : value1, param2 : value2, ...}); */ From 5e5fcc4379565dbe0bf6f97191ccb4d921e063c8 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:26:02 +0300 Subject: [PATCH 054/254] Update index.d.ts --- types/jquery.filtertable/index.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index 30d4630d6a..44c6e31fe8 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -7,7 +7,6 @@ /// declare namespace FilterTable { - interface FilterTableOptions { /** * Makes the filter input field autofocused (not recommended for accessibility reasons) @@ -120,7 +119,6 @@ declare namespace FilterTable { } interface FilterTableStatic { - /** * init with default options * @returns {JQuery} @@ -137,7 +135,6 @@ declare namespace FilterTable { } interface JQuery { - /** * if this code appears after your tables; otherwise, include it in your document.ready() code. * $('table').filterTable() From d45fd84c0e9561f85258fcc0bcbcb357e477b0af Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:26:32 +0300 Subject: [PATCH 055/254] Update waitme-tests.ts --- types/waitme/waitme-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/waitme/waitme-tests.ts b/types/waitme/waitme-tests.ts index e22b366663..d3cb1ccf77 100644 --- a/types/waitme/waitme-tests.ts +++ b/types/waitme/waitme-tests.ts @@ -17,7 +17,7 @@ $('#container').waitMe({ $('#container').waitMe() .on('close', () => { - //code here + // code here }); $("#container").waitMe("hide"); From 036374f02756cffdf54e12f00daed92a3f08dbeb Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 14:40:04 +0300 Subject: [PATCH 056/254] Update index.d.ts --- types/waitme/index.d.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/types/waitme/index.d.ts b/types/waitme/index.d.ts index 78616faa3d..37024a99ca 100644 --- a/types/waitme/index.d.ts +++ b/types/waitme/index.d.ts @@ -89,24 +89,18 @@ declare namespace WaitMe { interface WaitMeStatic { /** * init with default options - * @returns {JQuery} - */ - (): JQuery; - - /** + * Use: $(container).waitMe(); + * * init with custom options - * @param method - * @returns {JQuery} - */ - (method: WaitMeOptions): JQuery; - - /** + * Use: $(container).waitMe({param1 : value1, param2 : value2, ...}); + * * for close waitMe. * Use: $(container).waitMe("hide"); - * @param hide + * + * @param options * @returns {JQuery} */ - (hide: "hide"): JQuery; + (options?: WaitMeOptions | "hide"): JQuery; } } From 155294bec5e017a2112946d7a5a1538d09c1a388 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 15:00:22 +0300 Subject: [PATCH 057/254] Update index.d.ts --- types/waitme/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/waitme/index.d.ts b/types/waitme/index.d.ts index 37024a99ca..4d6dc9c8f7 100644 --- a/types/waitme/index.d.ts +++ b/types/waitme/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for waitMe 1.18 // Project: https://github.com/vadimsva/waitMe -// Definitions by: TotPeRo +// Definitions by: TotPeRo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 6af9cd73104ad34046c23b455b09a7418bd286c0 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 15:00:57 +0300 Subject: [PATCH 058/254] Update index.d.ts --- types/jquery.filtertable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index 44c6e31fe8..a43e5efba2 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jquery.filterTable v1.5.7 // Project: https://github.com/sunnywalker/jQuery.FilterTable -// Definitions by: TotPeRo +// Definitions by: TotPeRo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From a7555134366cc685aa185d9708652adbebd144be Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 15:03:41 +0300 Subject: [PATCH 059/254] Update index.d.ts --- types/waitme/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/waitme/index.d.ts b/types/waitme/index.d.ts index 4d6dc9c8f7..2f305c8b80 100644 --- a/types/waitme/index.d.ts +++ b/types/waitme/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +/// declare namespace WaitMe { interface WaitMeOptions { From 1e10007eeeabac1ef8b523bad9e437e537506c0e Mon Sep 17 00:00:00 2001 From: Iulian Alexe Date: Thu, 24 Aug 2017 15:07:55 +0300 Subject: [PATCH 060/254] removed tslint --- types/jquery.filtertable/tslint.json | 1 - types/waitme/tslint.json | 1 - 2 files changed, 2 deletions(-) delete mode 100644 types/jquery.filtertable/tslint.json delete mode 100644 types/waitme/tslint.json diff --git a/types/jquery.filtertable/tslint.json b/types/jquery.filtertable/tslint.json deleted file mode 100644 index 2750cc0197..0000000000 --- a/types/jquery.filtertable/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/waitme/tslint.json b/types/waitme/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/waitme/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 95b19b554fa48f812eafe9e0924601af4b5a05ad Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 15:20:04 +0300 Subject: [PATCH 061/254] Update index.d.ts --- types/jquery.filtertable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index a43e5efba2..69b3d11daf 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -20,7 +20,7 @@ declare namespace FilterTable { * @param table table being filtered (jQuery object) * @returns {void} */ - callback?: (term, table) => void; + callback?: (term:string, table:jQuery) => void; /** * Class applied to the main filter input container * Default: 'filter-table' From dffa35b20e8819d71cf793573a4b7868e02f7be5 Mon Sep 17 00:00:00 2001 From: TotPeRo Date: Thu, 24 Aug 2017 15:27:17 +0300 Subject: [PATCH 062/254] Update index.d.ts --- types/jquery.filtertable/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/jquery.filtertable/index.d.ts b/types/jquery.filtertable/index.d.ts index 69b3d11daf..71b2a26a12 100644 --- a/types/jquery.filtertable/index.d.ts +++ b/types/jquery.filtertable/index.d.ts @@ -17,10 +17,10 @@ declare namespace FilterTable { * Callback function after a filter is performed. * Default: 'null' * @param term filter term (string) - * @param table table being filtered (jQuery object) + * @param table table being filtered (JQuery object) * @returns {void} */ - callback?: (term:string, table:jQuery) => void; + callback?: (term:string, table:JQuery) => void; /** * Class applied to the main filter input container * Default: 'filter-table' From 149dde5da4afd0172f82a1bdd66b23581e4a56c2 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Thu, 24 Aug 2017 09:02:31 -0400 Subject: [PATCH 063/254] Revert "Remove `--allowSyntheticDefaultImports`" (from ember-testing-helpers) This reverts commit 2ff76c2755156481894f7db78a7fa539b2aa3112. --- types/ember-testing-helpers/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ember-testing-helpers/tsconfig.json b/types/ember-testing-helpers/tsconfig.json index aaf474ecba..cd7634bd25 100644 --- a/types/ember-testing-helpers/tsconfig.json +++ b/types/ember-testing-helpers/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", From 4ad5e86ffe81753f4fd3b53171ab33d9f313947e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Thu, 24 Aug 2017 09:02:49 -0400 Subject: [PATCH 064/254] Revert "Remove `--allowSyntheticDefaultImports`" (from ember) This reverts commit 43a1348b9146b0c6130a37f28d019eb2924ad9a3. --- types/ember/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index b73838d20e..fbc4052a08 100644 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", From 5538de5f355da0157225bc9e22154736e120f003 Mon Sep 17 00:00:00 2001 From: amikhalev Date: Tue, 8 Aug 2017 11:21:28 -0600 Subject: [PATCH 065/254] Updated types for reactstrap Input --- types/reactstrap/lib/Input.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index 406a25c6d2..ce928fb35c 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -38,7 +38,8 @@ interface InputProps extends Intermediate { size?: string; state?: string; tag?: React.ReactType; - getRef?: string | ((instance: HTMLButtonElement) => any); + getRef?: string | ((instance: HTMLInputElement) => any); + static?: boolean; addon?: boolean; className?: string; cssModule?: CSSModule; From 900168727f9941c8a0a907958422d12dbdfb8353 Mon Sep 17 00:00:00 2001 From: amikhalev Date: Tue, 8 Aug 2017 11:26:53 -0600 Subject: [PATCH 066/254] Added tests for reactstrap input update --- types/reactstrap/reactstrap-tests.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 9605fe3174..c8eb56f120 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3296,3 +3296,11 @@ const CSSModuleExample = (props: any) => { ); }; + +class Example107 extends React.Component { + private input: HTMLInputElement; + + render() { + return { this.input = input; }} />; + } +} From b5eaa88e9effe4eebf076951217bdaf3be861721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez?= Date: Thu, 24 Aug 2017 17:18:50 -0600 Subject: [PATCH 067/254] Updated leaflet typings to match v1.2.x and to use newer typescript features --- .../esri-leaflet-geocoder-tests.ts | 3 +- types/esri-leaflet-geocoder/index.d.ts | 10 +- types/esri-leaflet/esri-leaflet-tests.ts | 17 +- types/esri-leaflet/index.d.ts | 13 +- types/leaflet-areaselect/index.d.ts | 4 +- .../leaflet-areaselect-tests.ts | 5 +- types/leaflet-areaselect/tslint.json | 4 +- types/leaflet-curve/index.d.ts | 8 +- types/leaflet-curve/leaflet-curve-tests.ts | 46 +- types/leaflet-curve/tslint.json | 1 + types/leaflet-draw/index.d.ts | 5 +- types/leaflet-draw/leaflet-draw-tests.ts | 9 +- types/leaflet-editable/index.d.ts | 74 +- .../leaflet-editable-tests.ts | 15 +- types/leaflet-editable/tslint.json | 1 + types/leaflet-fullscreen/index.d.ts | 4 +- .../leaflet-fullscreen-tests.ts | 2 + types/leaflet-fullscreen/tslint.json | 4 +- types/leaflet-geocoder-mapzen/index.d.ts | 34 +- .../leaflet-geocoder-mapzen-tests.ts | 11 +- types/leaflet-geocoder-mapzen/tslint.json | 1 + types/leaflet-imageoverlay-rotated/index.d.ts | 8 +- .../leaflet-imageoverlay-rotated-tests.ts | 3 + types/leaflet-label/index.d.ts | 130 +- types/leaflet-label/leaflet-label-tests.ts | 5 +- types/leaflet-polylinedecorator/index.d.ts | 5 +- .../leaflet-polylinedecorator-tests.ts | 3 + types/leaflet-providers/index.d.ts | 6 +- .../leaflet-providers-tests.ts | 3 + types/leaflet.awesome-markers/index.d.ts | 50 +- .../leaflet.awesome-markers-tests.ts | 9 +- types/leaflet.awesome-markers/tslint.json | 1 + types/leaflet.fullscreen/index.d.ts | 33 +- .../leaflet.fullscreen-tests.ts | 9 +- types/leaflet.fullscreen/tslint.json | 1 + .../leaflet.gridlayer.googlemutant/index.d.ts | 140 +- .../leaflet.gridlayer.googlemutant-tests.ts | 9 +- types/leaflet.locatecontrol/index.d.ts | 5 +- .../leaflet.locatecontrol-tests.ts | 3 + .../index.d.ts | 11 +- ...eaflet.markercluster.layersupport-tests.ts | 3 +- types/leaflet.markercluster/index.d.ts | 9 +- .../leaflet.markercluster-tests.ts | 3 +- types/leaflet.pm/index.d.ts | 5 +- types/leaflet.pm/leaflet.pm-tests.ts | 3 + types/leaflet/index.d.ts | 2961 ++++++++--------- types/leaflet/leaflet-tests.ts | 6 +- types/proj4leaflet/index.d.ts | 19 +- types/proj4leaflet/proj4leaflet-tests.ts | 6 +- types/react-leaflet/index.d.ts | 98 +- types/react-leaflet/react-leaflet-tests.tsx | 60 +- 51 files changed, 1939 insertions(+), 1939 deletions(-) create mode 100644 types/leaflet-curve/tslint.json create mode 100644 types/leaflet-editable/tslint.json create mode 100644 types/leaflet-geocoder-mapzen/tslint.json create mode 100644 types/leaflet.awesome-markers/tslint.json create mode 100644 types/leaflet.fullscreen/tslint.json diff --git a/types/esri-leaflet-geocoder/esri-leaflet-geocoder-tests.ts b/types/esri-leaflet-geocoder/esri-leaflet-geocoder-tests.ts index a79e8f068f..09b6c94288 100644 --- a/types/esri-leaflet-geocoder/esri-leaflet-geocoder-tests.ts +++ b/types/esri-leaflet-geocoder/esri-leaflet-geocoder-tests.ts @@ -1,4 +1,5 @@ -import * as L from 'esri-leaflet-geocoder'; +import * as L from 'leaflet'; +import 'esri-leaflet-geocoder'; const map = L.map('map').setView([45.5165, -122.6764], 12); const tiles = L.esri.basemapLayer("Streets").addTo(map); diff --git a/types/esri-leaflet-geocoder/index.d.ts b/types/esri-leaflet-geocoder/index.d.ts index 50c1ff779b..593f7cbb0b 100644 --- a/types/esri-leaflet-geocoder/index.d.ts +++ b/types/esri-leaflet-geocoder/index.d.ts @@ -4,13 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as leaflet from 'leaflet'; -import * as esriLeaflet from 'esri-leaflet'; +import * as L from 'leaflet'; +import 'esri-leaflet'; -export = L; - -declare global { - namespace L.esri.Geocoding { +declare module 'leaflet' { + namespace esri.Geocoding { type GeosearchConstructor = new (options?: GeosearchObject) => Geosearch; type Geosearch = GeosearchControl & Evented; diff --git a/types/esri-leaflet/esri-leaflet-tests.ts b/types/esri-leaflet/esri-leaflet-tests.ts index d0f1249232..89520101a3 100644 --- a/types/esri-leaflet/esri-leaflet-tests.ts +++ b/types/esri-leaflet/esri-leaflet-tests.ts @@ -4,14 +4,17 @@ // tslint:disable:only-arrow-functions // tslint:disable:space-before-function-paren -let latlng: L.LatLng = new L.LatLng(0, 0); -let latlngbounds: L.LatLngBounds = new L.LatLngBounds(latlng, latlng); -let map: L.Map = new L.Map('map'); +import * as L from 'leaflet'; +import 'esri-leaflet'; -let marker: L.Marker = new L.Marker(latlng); -let polygon: L.Polygon = new L.Polygon([latlng, latlng]); -let polyline: L.Polyline = new L.Polyline([latlng, latlng]); -let geojson: L.GeoJSON = new L.GeoJSON(); +const latlng: L.LatLng = new L.LatLng(0, 0); +const latlngbounds: L.LatLngBounds = new L.LatLngBounds(latlng, latlng); +const map: L.Map = new L.Map('map'); + +const marker: L.Marker = new L.Marker(latlng); +const polygon: L.Polygon = new L.Polygon([latlng, latlng]); +const polyline: L.Polyline = new L.Polyline([latlng, latlng]); +const geojson: L.GeoJSON = new L.GeoJSON(); let basemapLayer: L.esri.BasemapLayer; basemapLayer = L.esri.basemapLayer('Streets'); diff --git a/types/esri-leaflet/index.d.ts b/types/esri-leaflet/index.d.ts index a79322983e..07cab832e0 100644 --- a/types/esri-leaflet/index.d.ts +++ b/types/esri-leaflet/index.d.ts @@ -2,10 +2,11 @@ // Project: http://esri.github.io/esri-leaflet // Definitions by: strajuser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { namespace esri { type CallbackHandler = (error: any, metadata: any) => void; @@ -834,11 +835,7 @@ declare namespace L { * @returns {FeatureLayer} */ function featureLayer(options: FeatureLayerOptions): FeatureLayer; - } -} -declare namespace L { - namespace esri { type FeatureCallbackHandler = (error?: any, featureCollection?: any, response?: any) => void; type ResponseCallbackHandler = (error?: any, response?: any) => void; @@ -1621,7 +1618,3 @@ declare namespace L { function find(options: FindOptions | MapService): Find; } } - -declare module 'esri-leaflet' { - export = L.esri; -} diff --git a/types/leaflet-areaselect/index.d.ts b/types/leaflet-areaselect/index.d.ts index 7c3fe5a476..50b0202f6a 100644 --- a/types/leaflet-areaselect/index.d.ts +++ b/types/leaflet-areaselect/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: André Wallat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { function areaSelect(box: AreaSelectOptions): AreaSelect; interface AreaSelectOptions { diff --git a/types/leaflet-areaselect/leaflet-areaselect-tests.ts b/types/leaflet-areaselect/leaflet-areaselect-tests.ts index b5d4785257..e285a17432 100644 --- a/types/leaflet-areaselect/leaflet-areaselect-tests.ts +++ b/types/leaflet-areaselect/leaflet-areaselect-tests.ts @@ -1,6 +1,9 @@ +import * as L from 'leaflet'; +import 'leaflet-areaselect'; + const map = L.map('map', {center: L.latLng(-37.7772, 175.2756), zoom: 15 }); let area: L.AreaSelect; -let dim: L.Dimension = { width: 1, height: 2 }; +const dim: L.Dimension = { width: 1, height: 2 }; area = L.areaSelect({}); diff --git a/types/leaflet-areaselect/tslint.json b/types/leaflet-areaselect/tslint.json index d88586e5bd..4e88071852 100644 --- a/types/leaflet-areaselect/tslint.json +++ b/types/leaflet-areaselect/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{"extends": "dtslint/dt.json"} diff --git a/types/leaflet-curve/index.d.ts b/types/leaflet-curve/index.d.ts index b15f701f81..58e4551dec 100644 --- a/types/leaflet-curve/index.d.ts +++ b/types/leaflet-curve/index.d.ts @@ -1,13 +1,13 @@ -// Type definitions for leaflet-curve 0.0.1 +// Type definitions for leaflet-curve 0.1 // Project: https://github.com/onikiienko/Leaflet.curve // Definitions by: Onikiienko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { /** * Drawing Bezier curves and other complex shapes. */ - function curve(path: any[], options?: L.PathOptions): Path; + function curve(path: any[], options?: PathOptions): Path; } diff --git a/types/leaflet-curve/leaflet-curve-tests.ts b/types/leaflet-curve/leaflet-curve-tests.ts index 3d8b319e63..7390f82b9d 100644 --- a/types/leaflet-curve/leaflet-curve-tests.ts +++ b/types/leaflet-curve/leaflet-curve-tests.ts @@ -1,29 +1,31 @@ -var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - osmAttrib = '© OpenStreetMap contributors', - osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), - map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 }), - objectToSetOnMap = { - "color": "black", - start: { - x: 37.64903402157866, - y: -3.6474609375000004 - }, - vertex: { - x: 38.839707613545144, - y: -1.9555664062500002 - }, - end: { - x: 39.977120098439634, - y: -3.6474609375000004 - } - }; +import * as L from 'leaflet'; +import 'leaflet-curve'; +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; +const osmAttrib = '© OpenStreetMap contributors'; +const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); +const map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 }); +const objectToSetOnMap = { + color: 'black', + start: { + x: 37.64903402157866, + y: -3.6474609375000004 + }, + vertex: { + x: 38.839707613545144, + y: -1.9555664062500002 + }, + end: { + x: 39.977120098439634, + y: -3.6474609375000004 + } +}; L.curve( [ - 'M',[objectToSetOnMap.start.x, objectToSetOnMap.start.y], - 'C',[objectToSetOnMap.start.x, objectToSetOnMap.start.y], [objectToSetOnMap.vertex.x, objectToSetOnMap.vertex.y], [objectToSetOnMap.end.x, objectToSetOnMap.end.y], - 'T',[objectToSetOnMap.end.x, objectToSetOnMap.end.y] + 'M', [objectToSetOnMap.start.x, objectToSetOnMap.start.y], + 'C', [objectToSetOnMap.start.x, objectToSetOnMap.start.y], [objectToSetOnMap.vertex.x, objectToSetOnMap.vertex.y], [objectToSetOnMap.end.x, objectToSetOnMap.end.y], + 'T', [objectToSetOnMap.end.x, objectToSetOnMap.end.y] ], {color: objectToSetOnMap.color} ).addTo(map); diff --git a/types/leaflet-curve/tslint.json b/types/leaflet-curve/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/leaflet-curve/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/leaflet-draw/index.d.ts b/types/leaflet-draw/index.d.ts index 7d791f62ae..5ae8c81605 100644 --- a/types/leaflet-draw/index.d.ts +++ b/types/leaflet-draw/index.d.ts @@ -2,10 +2,11 @@ // Project: https://github.com/Leaflet/Leaflet.draw // Definitions by: Matt Guest , Ryan Blace // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { interface MapOptions { drawControl?: boolean; } diff --git a/types/leaflet-draw/leaflet-draw-tests.ts b/types/leaflet-draw/leaflet-draw-tests.ts index 80e175732f..e63006edce 100644 --- a/types/leaflet-draw/leaflet-draw-tests.ts +++ b/types/leaflet-draw/leaflet-draw-tests.ts @@ -1,3 +1,6 @@ +import * as L from 'leaflet'; +import 'leaflet-draw'; + const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; const osmAttrib = '© OpenStreetMap contributors'; const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); @@ -42,8 +45,8 @@ map.on(L.Draw.Event.CREATED, (e: L.DrawEvents.Created) => { drawnItems.addLayer(layer); }); -let examplePolygon: L.LatLngLiteral[] = [{lng: 0, lat: 0}, {lng: 10, lat: 0}, {lng: 10, lat: 10}, {lng: 0, lat: 10}, {lng: 0, lat: 0}]; -let examplePolygonArea: number = L.GeometryUtil.geodesicArea(examplePolygon); +const examplePolygon: L.LatLngLiteral[] = [{lng: 0, lat: 0}, {lng: 10, lat: 0}, {lng: 10, lat: 10}, {lng: 0, lat: 10}, {lng: 0, lat: 0}]; +const examplePolygonArea: number = L.GeometryUtil.geodesicArea(examplePolygon); L.GeometryUtil.readableArea(examplePolygonArea, true); function testBooleanControlOptions() { @@ -104,7 +107,7 @@ function testExampleControlOptions() { circle: false, // Turns off this drawing tool rectangle: { shapeOptions: { - clickable: false + // clickable: false // clickabkle is not a polyline option according to leaflet docs } }, marker: { diff --git a/types/leaflet-editable/index.d.ts b/types/leaflet-editable/index.d.ts index f66b45a9b8..ee42cb1fb1 100644 --- a/types/leaflet-editable/index.d.ts +++ b/types/leaflet-editable/index.d.ts @@ -2,38 +2,39 @@ // Project: https://github.com/yohanboniface/Leaflet.Editable // Definitions by: Dominic Alie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import * as Leaflet from "leaflet"; +import * as Leaflet from 'leaflet'; -declare global { namespace L { +declare module 'leaflet' { /** * Make geometries editable in Leaflet. * * This is not a plug and play UI, and will not. This is a minimal, lightweight, and fully extendable API to * control editing of geometries. So you can easily build your own UI with your own needs and choices. */ - export interface EditableStatic { + interface EditableStatic { new (map: Map, options: EditOptions): Editable; } /** * Options to pass to L.Editable when instanciating. */ - export interface EditOptions { + interface EditOptions { /** * Class to be used when creating a new Polyline. */ - polylineClass?: Object; + polylineClass?: object; /** * Class to be used when creating a new Polygon. */ - polygonClass?: Object; + polygonClass?: object; /** * Class to be used when creating a new Marker. */ - markerClass?: Object; + markerClass?: object; /** * CSS class to be added to the map container while drawing. @@ -43,42 +44,42 @@ declare global { namespace L { /** * Layer used to store edit tools (vertex, line guide…). */ - editLayer?: Leaflet.LayerGroup; + editLayer?: LayerGroup; /** * Default layer used to store drawn features (marker, polyline…). */ - featuresLayer?: Leaflet.LayerGroup; + featuresLayer?: LayerGroup; /** * Class to be used as vertex, for path editing. */ - vertexMarkerClass?: Object; + vertexMarkerClass?: object; /** * Class to be used as middle vertex, pulled by the user to create a new point in the middle of a path. */ - middleMarkerClass?: Object; + middleMarkerClass?: object; /** * Class to be used as Polyline editor. */ - polylineEditorClass?: Object; + polylineEditorClass?: object; /** * Class to be used as Polygon editor. */ - polygonEditorClass?: Object; + polygonEditorClass?: object; /** * Class to be used as Marker editor. */ - markerEditorClass?: Object; + markerEditorClass?: object; /** * Options to be passed to the line guides. */ - lineGuideOptions?: Object; + lineGuideOptions?: object; /** * Set this to true if you don't want middle markers. @@ -92,7 +93,7 @@ declare global { namespace L { * This is not a plug and play UI, and will not. This is a minimal, lightweight, and fully extendable API to * control editing of geometries. So you can easily build your own UI with your own needs and choices. */ - export interface Editable extends Mixin.LeafletMixinEvents { + interface Editable extends Mixin.LeafletMixinEvents { /** * Options to pass to L.Editable when instanciating. */ @@ -104,20 +105,20 @@ declare global { namespace L { * Start drawing a polyline. If latlng is given, a first point will be added. In any case, continuing on user * click. If options is given, it will be passed to the polyline class constructor. */ - startPolyline(latLng?: LatLng, options?: Leaflet.PolylineOptions): L.Polyline; + startPolyline(latLng?: LatLng, options?: PolylineOptions): Polyline; /** * Start drawing a polygon. If latlng is given, a first point will be added. In any case, continuing on user * click. If options is given, it will be passed to the polygon class constructor. */ - startPolygon(latLng?: LatLng, options?: Leaflet.PolylineOptions): L.Polygon; + startPolygon(latLng?: LatLng, options?: PolylineOptions): Polygon; /** * Start adding a marker. If latlng is given, the marker will be shown first at this point. In any case, it * will follow the user mouse, and will have a final latlng on next click (or touch). If options is given, * it will be passed to the marker class constructor. */ - startMarker(latLng?: LatLng, options?: Leaflet.MarkerOptions): L.Marker; + startMarker(latLng?: LatLng, options?: MarkerOptions): Marker; /** * When you need to stop any ongoing drawing, without needing to know which editor is active. @@ -125,14 +126,14 @@ declare global { namespace L { stopDrawing(): void; } - export var Editable: EditableStatic; + let Editable: EditableStatic; /** * EditableMixin is included to L.Polyline, L.Polygon and L.Marker. It adds the following methods to them. * * When editing is enabled, the editor is accessible on the instance with the editor property. */ - export interface EditableMixin { + interface EditableMixin { /** * Enable editing, by creating an editor if not existing, and then calling enable on it. */ @@ -154,7 +155,7 @@ declare global { namespace L { editEnabled(): boolean; } - export interface Map { + interface Map { /** * Whether to create a L.Editable instance at map init or not. */ @@ -171,11 +172,11 @@ declare global { namespace L { editTools: Editable; } - export interface Polyline extends EditableMixin { - } + // tslint:disable-next-line:no-empty-interface + interface Polyline extends EditableMixin {} namespace Map { - export interface MapOptions { + interface MapOptions { /** * Whether to create a L.Editable instance at map init or not. */ @@ -192,7 +193,7 @@ declare global { namespace L { * When editing a feature (marker, polyline…), an editor is attached to it. This editor basically knows * how to handle the edition. */ - export interface BaseEditor { + interface BaseEditor { /** * Set up the drawing tools for the feature to be editable. */ @@ -208,7 +209,7 @@ declare global { namespace L { * Inherit from L.Editable.BaseEditor. * Inherited by L.Editable.PolylineEditor and L.Editable.PolygonEditor. */ - export interface PathEditor extends BaseEditor { + interface PathEditor extends BaseEditor { /** * Rebuild edit elements (vertex, middlemarker, etc.). */ @@ -218,7 +219,7 @@ declare global { namespace L { /** * Inherit from L.Editable.PathEditor. */ - export interface PolylineEditor extends PathEditor { + interface PolylineEditor extends PathEditor { /** * Set up drawing tools to continue the line forward. */ @@ -233,7 +234,7 @@ declare global { namespace L { /** * Inherit from L.Editable.PathEditor. */ - export interface PolygonEditor extends PathEditor { + interface PolygonEditor extends PathEditor { /** * Set up drawing tools for creating a new hole on the polygon. If the latlng param is given, a first * point is created. @@ -244,15 +245,12 @@ declare global { namespace L { /** * Inherit from L.Editable.BaseEditor. */ - export interface MarkerEditor extends BaseEditor { - } + // tslint:disable-next-line:no-empty-interface + interface MarkerEditor extends BaseEditor {} - export interface Marker extends EditableMixin, MarkerEditor { - } + interface Marker extends EditableMixin, MarkerEditor {} - export interface Polyline extends EditableMixin, PolylineEditor { - } + interface Polyline extends EditableMixin, PolylineEditor {} - export interface Polygon extends EditableMixin, PolygonEditor { - } -} } + interface Polygon extends EditableMixin, PolygonEditor {} +} diff --git a/types/leaflet-editable/leaflet-editable-tests.ts b/types/leaflet-editable/leaflet-editable-tests.ts index 09728add47..23bcc988fb 100644 --- a/types/leaflet-editable/leaflet-editable-tests.ts +++ b/types/leaflet-editable/leaflet-editable-tests.ts @@ -1,3 +1,6 @@ +import * as L from 'leaflet'; +import 'leaflet-editable'; + class MarkerClass { } class MarkerEditorClass { } class MiddleMarkerClass { } @@ -7,7 +10,7 @@ class PolylineClass { } class PolylineEditorClass { } class VertexMarkerClass { } -var map: L.Map = L.map('div', { +const map: L.Map = L.map('div', { editable: true, editOptions: { drawingCSSClass: 'css-class', @@ -26,16 +29,16 @@ var map: L.Map = L.map('div', { } }); -var currentPoly: L.Polygon|L.Polyline| L.Marker = map.editTools.currentPolygon; +const currentPoly: L.Polygon|L.Polyline| L.Marker = map.editTools.currentPolygon; map.editTools.stopDrawing(); -var marker: L.Marker = map.editTools.startMarker(L.latLng(0, 0), { draggable: true }); +const marker: L.Marker = map.editTools.startMarker(L.latLng(0, 0), { draggable: true }); marker.disable(); marker.enable(); marker.toggleEdit(); -var enabled: boolean = marker.editEnabled(); +let enabled: boolean = marker.editEnabled(); -var polyline: L.Polyline = map.editTools.startPolyline(L.latLng(0, 0), { noClip: true }); +const polyline: L.Polyline = map.editTools.startPolyline(L.latLng(0, 0), { noClip: true }); polyline.continueBackward(); polyline.continueForward(); polyline.disable(); @@ -44,7 +47,7 @@ enabled = polyline.editEnabled(); polyline.reset(); polyline.toggleEdit(); -var polygon: L.Polygon = map.editTools.startPolygon(L.latLng(0, 0), { noClip: true }); +const polygon: L.Polygon = map.editTools.startPolygon(L.latLng(0, 0), { noClip: true }); polygon.continueBackward(); polygon.continueForward(); polygon.disable(); diff --git a/types/leaflet-editable/tslint.json b/types/leaflet-editable/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/leaflet-editable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/leaflet-fullscreen/index.d.ts b/types/leaflet-fullscreen/index.d.ts index 168fae8a28..bf354e9155 100644 --- a/types/leaflet-fullscreen/index.d.ts +++ b/types/leaflet-fullscreen/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Denis Carriere // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { interface MapOptions { fullscreenControl?: true | {pseudoFullscreen: boolean}; } diff --git a/types/leaflet-fullscreen/leaflet-fullscreen-tests.ts b/types/leaflet-fullscreen/leaflet-fullscreen-tests.ts index 661f1bc208..efc611c193 100644 --- a/types/leaflet-fullscreen/leaflet-fullscreen-tests.ts +++ b/types/leaflet-fullscreen/leaflet-fullscreen-tests.ts @@ -1,3 +1,5 @@ +import * as L from 'leaflet'; + const map = L.map('map', { center: [51.505, -0.09], zoom: 13, diff --git a/types/leaflet-fullscreen/tslint.json b/types/leaflet-fullscreen/tslint.json index f93cf8562a..4e88071852 100644 --- a/types/leaflet-fullscreen/tslint.json +++ b/types/leaflet-fullscreen/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{"extends": "dtslint/dt.json"} diff --git a/types/leaflet-geocoder-mapzen/index.d.ts b/types/leaflet-geocoder-mapzen/index.d.ts index 390a751360..d4f8b445d9 100644 --- a/types/leaflet-geocoder-mapzen/index.d.ts +++ b/types/leaflet-geocoder-mapzen/index.d.ts @@ -1,23 +1,24 @@ -// Type definitions for leaflet-geocoder-mapzen v1.6.3 +// Type definitions for leaflet-geocoder-mapzen 1.6 // Project: https://github.com/mapzen/leaflet-geocoder -// Definitions by: Leonard Lausen +// Definitions by: Leonard Lausen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import * as Leaflet from "leaflet"; +import * as L from 'leaflet'; -declare global { namespace L { +declare module 'leaflet' { namespace Control { - export interface GeocoderStatic extends Leaflet.ClassStatic { + interface GeocoderStatic extends ClassStatic { /** * Creates a geocoder control. */ new (options?: GeocoderOptions): Geocoder; } - export interface Geocoder extends Leaflet.Control { - } + // tslint:disable-next-line:no-empty-interface + interface Geocoder extends Control {} - export interface GeocoderOptions { + interface GeocoderOptions { /** * Host endpoint for a Pelias-compatible search API. * @@ -32,7 +33,7 @@ declare global { namespace L { * * Default value: false. */ - bounds?: Leaflet.LatLngBounds | boolean; + bounds?: LatLngBounds | boolean; /** * If true, search and autocomplete prioritizes results near the center @@ -42,7 +43,7 @@ declare global { namespace L { * * Default value: 'true'. */ - focus?: Leaflet.LatLng | boolean; + focus?: LatLng | boolean; /** * Filters results by layers (documentation). @@ -69,7 +70,7 @@ declare global { namespace L { * * Default value: null. */ - params?: Object; + params?: object; /** * The position of the control (one of the map corners). @@ -77,7 +78,7 @@ declare global { namespace L { * * Default value: 'topleft'. */ - position?: Leaflet.PositionString; + position?: PositionString; /** * Attribution text to include. @@ -126,7 +127,7 @@ declare global { namespace L { * * Default value: true */ - markers?: Leaflet.MarkerOptions | boolean; + markers?: MarkerOptions | boolean; /** * If true, the input box will expand to take up the full width of the map container. @@ -166,11 +167,10 @@ declare global { namespace L { } } - export namespace control { - + namespace control { /** * Creates a geocoder control. */ - export function geocoder(api_key: string, options?: Control.GeocoderOptions): L.Control.Geocoder; + function geocoder(api_key: string, options?: Control.GeocoderOptions): Control.Geocoder; } -} } +} diff --git a/types/leaflet-geocoder-mapzen/leaflet-geocoder-mapzen-tests.ts b/types/leaflet-geocoder-mapzen/leaflet-geocoder-mapzen-tests.ts index daf6d20bd6..92bb68f1a9 100644 --- a/types/leaflet-geocoder-mapzen/leaflet-geocoder-mapzen-tests.ts +++ b/types/leaflet-geocoder-mapzen/leaflet-geocoder-mapzen-tests.ts @@ -1,7 +1,10 @@ -var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - osmAttrib = '© OpenStreetMap contributors', - osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), - map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 }); +import * as L from 'leaflet'; +import 'leaflet-geocoder-mapzen'; + +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; +const osmAttrib = '© OpenStreetMap contributors'; +const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); +const map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 }); // Add geocoding plugin L.control.geocoder('search-MKZrG6M').addTo(map); diff --git a/types/leaflet-geocoder-mapzen/tslint.json b/types/leaflet-geocoder-mapzen/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/leaflet-geocoder-mapzen/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/leaflet-imageoverlay-rotated/index.d.ts b/types/leaflet-imageoverlay-rotated/index.d.ts index 89dde5e375..6a37345ca5 100644 --- a/types/leaflet-imageoverlay-rotated/index.d.ts +++ b/types/leaflet-imageoverlay-rotated/index.d.ts @@ -3,11 +3,11 @@ // Definitions by: Thomas Kleinke // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { namespace ImageOverlay { - interface Rotated extends L.ImageOverlay { + interface Rotated extends ImageOverlay { reposition( topleft: LatLngExpression, topright: LatLngExpression, @@ -21,6 +21,6 @@ declare namespace L { topleft: LatLngExpression, topright: LatLngExpression, bottomleft: LatLngExpression, - options?: ImageOverlayOptions): L.ImageOverlay.Rotated; + options?: ImageOverlayOptions): ImageOverlay.Rotated; } } diff --git a/types/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts b/types/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts index 50db445f79..22b4a54ec1 100644 --- a/types/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts +++ b/types/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts @@ -1,3 +1,6 @@ +import * as L from 'leaflet'; +import 'leaflet-imageoverlay-rotated'; + const topleft = L.latLng(40.52256691873593, -3.7743186950683594); const topright = L.latLng(40.5210255066156, -3.7734764814376835); const bottomleft = L.latLng(40.52180437272552, -3.7768453359603886); diff --git a/types/leaflet-label/index.d.ts b/types/leaflet-label/index.d.ts index e1e96b717a..60f2b6b398 100644 --- a/types/leaflet-label/index.d.ts +++ b/types/leaflet-label/index.d.ts @@ -3,83 +3,79 @@ // Definitions by: Wim Looman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import * as Leaflet from "leaflet"; +import * as L from 'leaflet'; -declare global { - namespace L { - interface IconOptions { - labelAnchor?: Point; - } +declare module 'leaflet' { + interface IconOptions { + labelAnchor?: Point; + } - interface PathOptions { - labelAnchor?: Point; - } + interface PathOptions { + labelAnchor?: Point; + } - interface CircleMarkerOptions { - labelAnchor?: Point; - } + interface CircleMarkerOptions { + labelAnchor?: Point; + } - interface Marker { - showLabel(): Marker; - hideLabel(): Marker; - setLabelNoHide(noHide: boolean): void; - bindLabel(content: string, options?: LabelOptions): Marker; - unbindLabel(): Marker; - updateLabelContent(content: string): void; - getLabel(): Label; - setOpacity(opacity: number, labelHasSemiTransparency: boolean): void; - } + interface Marker { + showLabel(): Marker; + hideLabel(): Marker; + setLabelNoHide(noHide: boolean): void; + bindLabel(content: string, options?: LabelOptions): Marker; + unbindLabel(): Marker; + updateLabelContent(content: string): void; + getLabel(): Label; + setOpacity(opacity: number, labelHasSemiTransparency: boolean): void; + } - interface CircleMarker { - showLabel(): CircleMarker; - hideLabel(): CircleMarker; - setLabelNoHide(noHide: boolean): void; - bindLabel(content: string, options?: LabelOptions): CircleMarker; - unbindLabel(): CircleMarker; - updateLabelContent(content: string): void; - getLabel(): Label; - } + interface CircleMarker { + showLabel(): CircleMarker; + hideLabel(): CircleMarker; + setLabelNoHide(noHide: boolean): void; + bindLabel(content: string, options?: LabelOptions): CircleMarker; + unbindLabel(): CircleMarker; + updateLabelContent(content: string): void; + getLabel(): Label; + } - interface FeatureGroup { - clearLayers(): FeatureGroup; - bindLabel(content: string, options?: LabelOptions): FeatureGroup; - unbindLabel(): FeatureGroup; - updateLabelContent(content: string): FeatureGroup; - } + interface FeatureGroup { + clearLayers(): FeatureGroup; + bindLabel(content: string, options?: LabelOptions): FeatureGroup; + unbindLabel(): FeatureGroup; + updateLabelContent(content: string): FeatureGroup; + } - interface Path { - bindLabel(content: string, options?: LabelOptions): Path; - unbindLabel(): Path; - updateLabelContent(content: string): void; - } + interface Path { + bindLabel(content: string, options?: LabelOptions): Path; + unbindLabel(): Path; + updateLabelContent(content: string): void; + } - interface LabelOptions { - className?: string; - clickable?: boolean; - direction?: string; // 'left' | 'right' | 'auto'; - pane?: string; - noHide?: boolean; - offset?: Point; - opacity?: number; - zoomAnimation?: boolean; - } + interface LabelOptions { + className?: string; + clickable?: boolean; + direction?: string; // 'left' | 'right' | 'auto'; + pane?: string; + noHide?: boolean; + offset?: Point; + opacity?: number; + zoomAnimation?: boolean; + } - interface LabelStatic extends ClassStatic { - new(options?: LabelOptions): Label; - } + interface LabelStatic extends ClassStatic { + new(options?: LabelOptions): Label; + } - const Label: LabelStatic; + const Label: LabelStatic; - interface Label extends IEventPowered