diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3938bc24d1..f9324d1bdd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2639,7 +2639,7 @@ /types/nightmare/ @horiuchi @samyang-au @Bleser92 /types/nightwatch/ @rkavalap @schlesiger /types/nivo-slider/ @AndersonFriaca -/types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball @keton @thegecko +/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour /types/nodal/ @charrondev /types/node/v4/ @eps1lon diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 2898f889fc..96270b31eb 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -9,6 +9,7 @@ import { Response, IndexSettings, QueryParameters, + Client } from 'algoliasearch'; let _algoliaResponse: Response = { @@ -78,7 +79,7 @@ let _algoliaIndexSettings: IndexSettings = { ignorePlurals: false, disableTypoToleranceOnAttributes: '', separatorsToIndex: '', - queryType: '', + queryType: 'prefixAll', removeWordsIfNoResults: '', advancedSyntax: false, optionalWords: [''], @@ -86,7 +87,7 @@ let _algoliaIndexSettings: IndexSettings = { disablePrefixOnAttributes: [''], disableExactOnAttributes: [''], exactOnSingleWordQuery: '', - alternativesAsExact: false, + alternativesAsExact: ['ignorePlurals'], attributeForDistinct: '', distinct: false, numericAttributesToIndex: [''], @@ -147,7 +148,8 @@ let _algoliaQueryParameters: QueryParameters = { minProximity: 0, }; -let index: Index = algoliasearch('', '').initIndex(''); +let client: Client = algoliasearch('', ''); +let index: Index = client.initIndex(''); let search = index.search({ query: '' }); @@ -164,3 +166,12 @@ index.partialUpdateObjects([{}], () => {}); index.partialUpdateObjects([{}], false, () => {}); index.partialUpdateObjects([{}]).then(() => {}); index.partialUpdateObjects([{}], false).then(() => {}); + +let indexName : string = index.indexName; + +// complete copy +client.copyIndex('from', 'to').then(()=>{}) +client.copyIndex('from', 'to', ()=> {}) +// with scope +client.copyIndex('from', 'to', ['settings']).then(()=>{}) +client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 87c1f79a0e..ba46f37ce6 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Baptiste Coquelle // Haroen Viaene // Aurélien Hervé +// Samuel Vaillant // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -88,7 +89,16 @@ declare namespace algoliasearch { */ deleteIndex(name: string): Promise; /** - * Copy an index from a specific index to a new one + * Copy an index from a specific index to a new one + * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex + */ + copyIndex( + from: string, + to: string, + cb: (err: Error, res: Task) => void + ): void; + /** + * Copy settings of an index from a specific index to a new one * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex */ copyIndex( @@ -98,13 +108,13 @@ declare namespace algoliasearch { cb: (err: Error, res: Task) => void ): void; /** - * Copy an index from a specific index to a new one + * Copy settings of an index from a specific index to a new one * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex */ copyIndex( from: string, to: string, - scope: ('settings' | 'synonyms' | 'rules')[] + scope?: ('settings' | 'synonyms' | 'rules')[] ): Promise; /** * Move index to a new one (and will overwrite the original one) @@ -230,6 +240,7 @@ declare namespace algoliasearch { * Interface for the index algolia object */ interface Index { + indexName: string; /** * Gets a specific object * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects @@ -329,7 +340,7 @@ declare namespace algoliasearch { * Wait for an indexing task to be compete * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask */ - waitTask(taskID: number, cb: (err: Error, res: any) => void): void; + waitTask(taskID: number, cb: (err: Error, res: TaskStatus) => void): void; /** * Get an index settings * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings @@ -561,7 +572,7 @@ declare namespace algoliasearch { * Wait for an indexing task to be compete * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask */ - waitTask(taskID: number): Promise; + waitTask(taskID: number): Promise; /** * Get an index settings * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings @@ -1481,6 +1492,13 @@ declare namespace algoliasearch { interface Task { taskID: number; + createdAt: string; + objectID?: string; + } + + interface TaskStatus { + status: 'published' | 'notPublished', + pendingTask: boolean, } interface IndexSettings { @@ -1601,7 +1619,7 @@ declare namespace algoliasearch { * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. * https://github.com/algolia/algoliasearch-client-js#typotolerance */ - typoTolerance?: any; + typoTolerance?: boolean | 'min' | 'strict'; /** * If set to false, disables typo tolerance on numeric tokens (numbers). * default: true @@ -1634,7 +1652,7 @@ declare namespace algoliasearch { * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. * https://github.com/algolia/algoliasearch-client-js#querytype */ - queryType?: any; + queryType?: 'prefixAll' | 'prefixLast' | 'prefixNone'; /** * This option is used to select a strategy in order to avoid having an empty result page * default: 'none' @@ -1700,7 +1718,10 @@ declare namespace algoliasearch { * 'multiWordsSynonym': multiple-words synonym * https://github.com/algolia/algoliasearch-client-js#alternativesasexact */ - alternativesAsExact?: any; + alternativesAsExact?: ( + | "ignorePlurals" + | "singleWordSynonym" + | "multiWordsSynonym")[]; /** * The name of the attribute used for the Distinct feature * default: null @@ -1711,7 +1732,7 @@ declare namespace algoliasearch { * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. * https://github.com/algolia/algoliasearch-client-js#distinct */ - distinct?: any; + distinct?: boolean | number; /** * All numerical attributes are automatically indexed as numerical filters * default '' diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 588e2ac543..b9932f1346 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Baptiste Coquelle // Haroen Viaene // Aurélien Hervé +// Samuel Vaillant // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -67,6 +68,7 @@ declare namespace algoliasearch { * Interface for the index algolia object */ interface Index { + indexName: string; /** * Gets a specific object * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 920df43d6e..1e8255e7ef 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -23,6 +23,7 @@ export interface In { hash: Buffer; index: number; sequence: number; + witness: Buffer[]; } export interface Network { diff --git a/types/correlation-id/correlation-id-tests.ts b/types/correlation-id/correlation-id-tests.ts new file mode 100644 index 0000000000..36bf65c27d --- /dev/null +++ b/types/correlation-id/correlation-id-tests.ts @@ -0,0 +1,21 @@ +import { withId, bindId, getId } from "correlation-id"; + +withId("my-id", () => { + const id: string = getId() || ""; +}); + +withId(() => { + const id: string = getId() || ""; +}); + +const x: string = bindId("my-id", (foo: string, bar: number): string => { + const id: string = getId() || ""; + + return foo + bar + id; +})("foo", 12); + +const y: string = bindId((foo: string, bar: number): string => { + const id: string = getId() || ""; + + return foo + bar + id; +})("foo", 12); diff --git a/types/correlation-id/index.d.ts b/types/correlation-id/index.d.ts new file mode 100644 index 0000000000..f765765409 --- /dev/null +++ b/types/correlation-id/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for correlation-id 2.1 +// Project: https://github.com/toboid/correlation-id#readme +// Definitions by: Nate +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function withId(id: string, work: () => void): void; +export function withId(work: () => void): void; + +export function bindId any>(id: string, work: T): T; +export function bindId any>(work: T): T; + +export function getId(): string | undefined; diff --git a/types/correlation-id/tsconfig.json b/types/correlation-id/tsconfig.json new file mode 100644 index 0000000000..eda38b5e28 --- /dev/null +++ b/types/correlation-id/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "correlation-id-tests.ts"] +} diff --git a/types/correlation-id/tslint.json b/types/correlation-id/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/correlation-id/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts index 632569c6f9..508ad00aa0 100644 --- a/types/cosmiconfig/cosmiconfig-tests.ts +++ b/types/cosmiconfig/cosmiconfig-tests.ts @@ -11,8 +11,12 @@ const explorer = cosmiconfig("yourModuleName", { ignoreEmptySearchPlaces: false, }); +const explorer2 = cosmiconfig("yourModuleName"); + Promise.all([ + explorer.search(), explorer.search(path.join(__dirname)), + explorer.searchSync(), explorer.searchSync(path.join(__dirname)), explorer.load(path.join(__dirname, "sample-config.json")), explorer.loadSync(path.join(__dirname, "sample-config.json")), diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts index bdafc922ec..eb876b6ef2 100644 --- a/types/cosmiconfig/index.d.ts +++ b/types/cosmiconfig/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/davidtheclark/cosmiconfig // Definitions by: ozum // szeck87 +// saadq // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -35,8 +36,8 @@ export interface Loaders { } export interface Explorer { - search(searchFrom: string): Promise; - searchSync(searchFrom: string): null | CosmiconfigResult; + search(searchFrom?: string): Promise; + searchSync(searchFrom?: string): null | CosmiconfigResult; load(loadPath: string): Promise; loadSync(loadPath: string): CosmiconfigResult; clearLoadCache(): void; @@ -55,4 +56,4 @@ export interface ExplorerOptions { ignoreEmptySearchPlaces?: boolean; } -export default function cosmiconfig(moduleName: string, options: ExplorerOptions): Explorer; +export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer; diff --git a/types/croppie/croppie-tests.ts b/types/croppie/croppie-tests.ts index 581d01435d..a82b04fabb 100644 --- a/types/croppie/croppie-tests.ts +++ b/types/croppie/croppie-tests.ts @@ -22,4 +22,6 @@ c.result({ type: 'blob' }).then(blob => { x = blob; }); +c.get(); + c.destroy(); diff --git a/types/croppie/index.d.ts b/types/croppie/index.d.ts index 97f53f84c8..a8b53c54e5 100644 --- a/types/croppie/index.d.ts +++ b/types/croppie/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Connor Peet // dklmuc // Sarun Intaralawan +// Knut Erik Helgesen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace Croppie; @@ -26,6 +27,8 @@ declare class Croppie { result(options: Croppie.ResultOptions & { type: 'rawcanvas' }): Promise; result(options?: Croppie.ResultOptions): Promise; + get(): Croppie.CropData; + rotate(degrees: 90 | 180 | 270 | -90 | -180 | -270): void; setZoom(zoom: number): void; @@ -59,4 +62,10 @@ declare namespace Croppie { showZoomer?: boolean; viewport?: { width: number, height: number, type?: CropType }; } + + interface CropData { + points?: number[]; + orientation?: number; + zoom?: number; + } } diff --git a/types/d3-format/d3-format-tests.ts b/types/d3-format/d3-format-tests.ts index 5ab53a45a7..5702870640 100644 --- a/types/d3-format/d3-format-tests.ts +++ b/types/d3-format/d3-format-tests.ts @@ -64,6 +64,7 @@ const zero: boolean = specifier.zero; const width: number | undefined = specifier.width; const comma: boolean = specifier.comma; const precision: number | undefined = specifier.precision; +const trim: boolean = specifier.trim; const type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type; const formatString: string = specifier.toString(); diff --git a/types/d3-format/index.d.ts b/types/d3-format/index.d.ts index bb0473a4fb..0508606148 100644 --- a/types/d3-format/index.d.ts +++ b/types/d3-format/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for D3JS d3-format module 1.2 +// Type definitions for D3JS d3-format module 1.3 // Project: https://github.com/d3/d3-format/ // Definitions by: Tom Wanzek -// Alex Ford -// Boris Yankov -// denisname +// Alex Ford +// Boris Yankov +// denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.2.0 +// Last module patch version validated against: 1.3.0 /** * Specification of locale to use when creating a new FormatLocaleObject @@ -124,6 +124,11 @@ export interface FormatSpecifier { * See precisionFixed and precisionRound for help picking an appropriate precision. */ precision: number | undefined; + /** + * The '~' option trims insignificant trailing zeros across all format types. + * This is most commonly used in conjunction with types 'r', 'e', 's' and '%'. + */ + trim: boolean; /** * The available type values are: * @@ -140,9 +145,9 @@ export interface FormatSpecifier { * 'x' - hexadecimal notation, using lower-case letters, rounded to integer. * 'X' - hexadecimal notation, using upper-case letters, rounded to integer. * 'c' - converts the integer to the corresponding unicode character before printing. - * '' (none) - like g, but trim insignificant trailing zeros. * - * The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and '' (none) types, + * The type '' (none) is also supported as shorthand for '~g' (with a default precision of 12 instead of 6), and + * the type 'n' is shorthand for ',g'. For the 'g', 'n' and '' (none) types, * decimal notation is used if the resulting string would have precision or fewer digits; otherwise, exponent notation is used. */ type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n'; @@ -175,7 +180,7 @@ export function formatDefaultLocale(defaultLocale: FormatLocaleDefinition): Form * * Uses the current default locale. * - * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][~][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A Specifier string. @@ -191,7 +196,7 @@ export function format(specifier: string): (n: number | { valueOf(): number }) = * * Uses the current default locale. * - * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][~][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A Specifier string. @@ -204,7 +209,7 @@ export function formatPrefix(specifier: string, value: number): (n: number | { v * Parses the specified specifier, returning an object with exposed fields that correspond to the * format specification mini-language and a toString method that reconstructs the specifier. * - * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][~][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A specifier string. diff --git a/types/express-correlation-id/express-correlation-id-tests.ts b/types/express-correlation-id/express-correlation-id-tests.ts new file mode 100644 index 0000000000..20c9b872de --- /dev/null +++ b/types/express-correlation-id/express-correlation-id-tests.ts @@ -0,0 +1,9 @@ +import * as express from "express"; +import correlator from "express-correlation-id"; + +const app = express(); +app.use(correlator()); +app.use(correlator({})); +app.use(correlator({ header: "x-correlation-id" })); + +const x: string = correlator.getId() || ""; diff --git a/types/express-correlation-id/index.d.ts b/types/express-correlation-id/index.d.ts new file mode 100644 index 0000000000..fa09b65071 --- /dev/null +++ b/types/express-correlation-id/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for express-correlation-id 1.2 +// Project: https://github.com/toboid/express-correlation-id#readme +// Definitions by: Nate +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { RequestHandler } from "express-serve-static-core"; + +declare const correlator: { + (options?: { header?: string }): RequestHandler; + getId(): string | undefined; +}; + +export default correlator; diff --git a/types/express-correlation-id/tsconfig.json b/types/express-correlation-id/tsconfig.json new file mode 100644 index 0000000000..bcfa9423b6 --- /dev/null +++ b/types/express-correlation-id/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "express-correlation-id-tests.ts"] +} diff --git a/types/express-correlation-id/tslint.json b/types/express-correlation-id/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/express-correlation-id/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/express-socket.io-session/express-socket.io-session-tests.ts b/types/express-socket.io-session/express-socket.io-session-tests.ts new file mode 100644 index 0000000000..46dd000882 --- /dev/null +++ b/types/express-socket.io-session/express-socket.io-session-tests.ts @@ -0,0 +1,28 @@ +/** + * Create by AylaJK on 05/09/2018 + */ +import express = require('express'); +const app = express(); + +import http = require('http'); +const server = http.createServer(app); + +import expresssession = require('express-session'); +const session = expresssession({ + secret: 'my-secret', + resave: true, + saveUninitialized: true, +}); + +import cookieparser = require('cookie-parser'); +const cookieParser = cookieparser('my-secret'); + +import socketio = require('socket.io'); +const io = socketio(server); + +import sharedsession = require('express-socket.io-session'); + +io.use(sharedsession(session)); +io.use(sharedsession(session, { autoSave: true, saveUninitialized: true })); +io.use(sharedsession(session, cookieParser)); +io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true })); diff --git a/types/express-socket.io-session/index.d.ts b/types/express-socket.io-session/index.d.ts new file mode 100644 index 0000000000..39a1fb4ff6 --- /dev/null +++ b/types/express-socket.io-session/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for express-socket.io-session 1.3 +// Project: https://github.com/oskosk/express-socket.io-session +// Definitions by: AylaJK +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import socketio = require('socket.io'); +import express = require('express'); + +declare function sharedsession( + expressSessionMiddleware: express.RequestHandler, + cookieParserMiddleware: express.RequestHandler, + options?: sharedsession.SharedSessionOptions): sharedsession.SocketIoSharedSessionMiddleware; + +declare function sharedsession( + expressSessionMiddleware: express.RequestHandler, + options?: sharedsession.SharedSessionOptions): sharedsession.SocketIoSharedSessionMiddleware; + +declare namespace sharedsession { + interface SharedSessionOptions { + autoSave?: boolean; + saveUninitialized?: boolean; + } + + type SocketIoSharedSessionMiddleware = (socket: socketio.Socket, next: (err?: any) => void) => void; +} + +export = sharedsession; diff --git a/types/express-socket.io-session/tsconfig.json b/types/express-socket.io-session/tsconfig.json new file mode 100644 index 0000000000..6d4aca9e90 --- /dev/null +++ b/types/express-socket.io-session/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-socket.io-session-tests.ts" + ] +} diff --git a/types/express-socket.io-session/tslint.json b/types/express-socket.io-session/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/express-socket.io-session/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/firefox-webext-browser/index.d.ts b/types/firefox-webext-browser/index.d.ts old mode 100755 new mode 100644 diff --git a/types/glue/glue-tests.ts b/types/glue/glue-tests.ts index 7ac309352c..dd400697e6 100644 --- a/types/glue/glue-tests.ts +++ b/types/glue/glue-tests.ts @@ -7,8 +7,9 @@ const manifest: Glue.Manifest = { }, register: { plugins: [ + "./test-plugin.js", { - plugin: "./test", + plugin: "./test.js", routes: { prefix: "test" } diff --git a/types/glue/index.d.ts b/types/glue/index.d.ts index f347e69746..060d729d66 100644 --- a/types/glue/index.d.ts +++ b/types/glue/index.d.ts @@ -24,8 +24,8 @@ export interface Plugin { export interface Manifest { server: ServerOptions; register?: { - plugins: string[] | Plugin[] + plugins: string[] | Plugin[] | Array<(string|Plugin)> }; } -export function compose(manifest: Manifest, options?: Options): Server; +export function compose(manifest: Manifest, options?: Options): Promise; diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index ee4fbf1654..61ca1f2113 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for noble // Project: https://github.com/sandeepmistry/noble // Definitions by: Seon-Wook Park -// Hans Bakker // Shantanu Bhadoria // Luke Libraro // Dan Chao @@ -42,7 +41,7 @@ export declare class Peripheral extends events.EventEmitter { advertisement: Advertisement; rssi: number; services: Service[]; - state: string; + state: 'error' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected'; connect(callback?: (error: string) => void): void; disconnect(callback?: () => void): void; diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 703c78aa9b..65ff4edb47 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-forge 0.7.2 +// Type definitions for node-forge 0.7.5 // Project: https://github.com/digitalbazaar/forge // Definitions by: Seth Westphal // Kay Schecker @@ -16,22 +16,22 @@ declare module "node-forge" { namespace pem { - interface EncodeOptions { - maxline?: number; - } + interface EncodeOptions { + maxline?: number; + } - interface ObjectPEM { - type: string; - body: Bytes; - procType?: any; - contentDomain?: any; - dekInfo?: any; - headers?: any[]; - } + interface ObjectPEM { + type: string; + body: Bytes; + procType?: any; + contentDomain?: any; + dekInfo?: any; + headers?: any[]; + } - function encode(msg: ObjectPEM, options?: EncodeOptions): string; - function decode(str: string): ObjectPEM[]; - } + function encode(msg: ObjectPEM, options?: EncodeOptions): string; + function decode(str: string): ObjectPEM[]; + } namespace pki { @@ -43,7 +43,9 @@ declare module "node-forge" { privateKey: Key; } + function pemToDer(pem: PEM): util.ByteStringBuffer; function privateKeyToPem(key: Key, maxline?: number): PEM; + function privateKeyInfoToPem(key: Key, maxline?: number): PEM; function publicKeyToPem(key: Key, maxline?: number): PEM; function publicKeyFromPem(pem: PEM): Key; function privateKeyFromPem(pem: PEM): Key; diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 1bb8dff08c..575661e9aa 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -8,6 +8,8 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key); let pemKey: forge.pki.PEM = publicKeyPem; let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey); let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem); +let privateKeyRsa2 = forge.pki.privateKeyInfoToPem(privateKeyPem); +let byteBufferString = forge.pki.pemToDer(privateKeyRsa); let certPem = forge.pki.certificateFromPem(pemKey); let cert = forge.pki.createCertificate(); diff --git a/types/node-red/index.d.ts b/types/node-red/index.d.ts index 4c9a1f093a..bc58257e2c 100644 --- a/types/node-red/index.d.ts +++ b/types/node-red/index.d.ts @@ -215,5 +215,6 @@ export interface Nodes { * @param constructor - the constructor function for this node type * @param opts - optional additional options for the node */ - registerType(type: string, constructor: (props: NodeProperties) => any, opts?: any): void; + // tslint:disable-next-line no-unnecessary-generics + registerType(type: string, constructor: (props: T) => any, opts?: any): void; } diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d228742629..4e03c3f78b 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -23,6 +23,7 @@ // Mohsen Azimi // Hoàng Văn Khải // Alexander T. +// Lishude // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -560,6 +561,7 @@ declare namespace NodeJS { on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + off(event: string | symbol, listener: (...args: any[]) => void): this; removeAllListeners(event?: string | symbol): this; setMaxListeners(n: number): this; getMaxListeners(): number; @@ -1003,7 +1005,8 @@ declare module "events" { namespace internal { export class EventEmitter extends internal { - static listenerCount(emitter: EventEmitter, event: string | symbol): number; // deprecated + /** @deprecated since v4.0.0 */ + static listenerCount(emitter: EventEmitter, event: string | symbol): number; static defaultMaxListeners: number; addListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1012,6 +1015,7 @@ declare module "events" { prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + off(event: string | symbol, listener: (...args: any[]) => void): this; removeAllListeners(event?: string | symbol): this; setMaxListeners(n: number): this; getMaxListeners(): number; @@ -2253,33 +2257,33 @@ declare module "child_process" { export function execFile(file: string): ChildProcess; export function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; + export function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; // no `options` definitely means stdout/stderr are `string`. export function execFile(file: string, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. export function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; // `options` with well known `encoding` means stdout/stderr are definitely `string`. export function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. export function execFile(file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; // `options` without an `encoding` means stdout/stderr are definitely `string`. export function execFile(file: string, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; // fallback if nothing else matches. Worst case is always `string | Buffer`. export function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace execFile { @@ -2308,7 +2312,7 @@ declare module "child_process" { gid?: number; windowsVerbatimArguments?: boolean; } - export function fork(modulePath: string, args?: string[], options?: ForkOptions): ChildProcess; + export function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; export interface SpawnSyncOptions { cwd?: string; @@ -2344,9 +2348,9 @@ declare module "child_process" { export function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; export function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; export function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptions): SpawnSyncReturns; + export function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + export function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + export function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; export interface ExecSyncOptions { cwd?: string; @@ -2396,9 +2400,9 @@ declare module "child_process" { export function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string; export function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; export function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer; - export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithStringEncoding): string; - export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptions): Buffer; + export function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithStringEncoding): string; + export function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; + export function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): Buffer; } declare module "url" { @@ -5715,6 +5719,8 @@ declare module "crypto" { digest(): Buffer; digest(encoding: HexBase64Latin1Encoding): string; } + + /** @deprecated since v10.0.0 use createCipheriv() */ export function createCipher(algorithm: string, password: any): Cipher; export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; export interface Cipher extends NodeJS.ReadWriteStream { @@ -5728,6 +5734,7 @@ declare module "crypto" { getAuthTag(): Buffer; setAAD(buffer: Buffer): this; } + /** @deprecated since v10.0.0 use createCipheriv() */ export function createDecipher(algorithm: string, password: any): Decipher; export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; export interface Decipher extends NodeJS.ReadWriteStream { @@ -5813,17 +5820,16 @@ declare module "crypto" { export function getCurves(): string[]; export function getHashes(): string[]; export interface ECDH { + convertKey(key: string | Buffer /*| TypedArray*/ | DataView, curve: string, inputEncoding?: string, outputEncoding?: string, format?: string): Buffer | string; generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding): string; - generateKeys(encoding: HexBase64Latin1Encoding, format: ECDHKeyFormat): string; + generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; computeSecret(other_public_key: Buffer): Buffer; computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; getPrivateKey(): Buffer; getPrivateKey(encoding: HexBase64Latin1Encoding): string; getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding): string; - getPublicKey(encoding: HexBase64Latin1Encoding, format: ECDHKeyFormat): string; + getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; setPrivateKey(private_key: Buffer): void; setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void; } @@ -6220,6 +6226,38 @@ declare module "util" { export function isWeakSet(object: any): object is WeakSet; export function isWebAssemblyCompiledModule(object: any): boolean; } + + export class TextDecoder { + readonly encoding: string; + readonly fatal: boolean; + readonly ignoreBOM: boolean; + constructor( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean } + ); + decode( + input?: + Int8Array + | Int16Array + | Int32Array + | Uint8Array + | Uint16Array + | Uint32Array + | Uint8ClampedArray + | Float32Array + | Float64Array + | DataView + | ArrayBuffer + | null, + options?: { stream?: boolean } + ): string; + } + + export class TextEncoder { + readonly encoding: string; + constructor(); + encode(input?: string): Uint8Array; + } } declare module "assert" { @@ -6240,11 +6278,16 @@ declare module "assert" { } export function fail(message: string): never; + /** @deprecated since v10.0.0 */ export function fail(actual: any, expected: any, message?: string, operator?: string): never; export function ok(value: any, message?: string): void; + /** @deprecated use strictEqual() */ export function equal(actual: any, expected: any, message?: string): void; + /** @deprecated use notStrictEqual() */ export function notEqual(actual: any, expected: any, message?: string): void; + /** @deprecated use deepStrictEqual() */ export function deepEqual(actual: any, expected: any, message?: string): void; + /** @deprecated use notDeepStrictEqual() */ export function notDeepEqual(acutal: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index d428cf8753..8651d361b7 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -109,6 +109,7 @@ namespace events_tests { result = emitter.prependListener(event, listener); result = emitter.prependOnceListener(event, listener); result = emitter.removeListener(event, listener); + result = emitter.off(event, listener); result = emitter.removeAllListeners(); result = emitter.removeAllListeners(event); result = emitter.setMaxListeners(42); @@ -857,6 +858,35 @@ namespace util_tests { // util.isDeepStrictEqual util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'}); + + // util.TextDecoder() + var td = new util.TextDecoder(); + new util.TextDecoder("utf-8"); + new util.TextDecoder("utf-8", { fatal: true }); + new util.TextDecoder("utf-8", { fatal: true, ignoreBOM: true }); + var ignoreBom: boolean = td.ignoreBOM; + var fatal: boolean = td.fatal; + var encoding: string = td.encoding; + td.decode(new Int8Array(1)); + td.decode(new Int16Array(1)); + td.decode(new Int32Array(1)); + td.decode(new Uint8Array(1)); + td.decode(new Uint16Array(1)); + td.decode(new Uint32Array(1)); + td.decode(new Uint8ClampedArray(1)); + td.decode(new Float32Array(1)); + td.decode(new Float64Array(1)); + td.decode(new DataView(new Int8Array(1).buffer)); + td.decode(new ArrayBuffer(1)); + td.decode(null); + td.decode(null, { stream: true }); + td.decode(new Int8Array(1), { stream: true }); + var decode: string = td.decode(new Int8Array(1)); + + // util.TextEncoder() + var te = new util.TextEncoder(); + var teEncoding: string = te.encoding; + var teEncodeRes: Uint8Array = te.encode("TextEncoder"); } } diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 45f1c85b64..32530306c2 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -5588,7 +5588,7 @@ declare module "util" { ); decode( input?: - | Int8Array + Int8Array | Int16Array | Int32Array | Uint8Array diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 5a76e4cc45..e7112daa25 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -24,6 +24,7 @@ // Mohsen Azimi // Hoàng Văn Khải // Alexander T. +// Lishude // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -5659,6 +5660,38 @@ declare module "util" { export namespace promisify { const custom: symbol; } + + export class TextDecoder { + readonly encoding: string; + readonly fatal: boolean; + readonly ignoreBOM: boolean; + constructor( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean } + ); + decode( + input?: + Int8Array + | Int16Array + | Int32Array + | Uint8Array + | Uint16Array + | Uint32Array + | Uint8ClampedArray + | Float32Array + | Float64Array + | DataView + | ArrayBuffer + | null, + options?: { stream?: boolean } + ): string; + } + + export class TextEncoder { + readonly encoding: string; + constructor(); + encode(input?: string): Uint8Array; + } } declare module "assert" { diff --git a/types/node/v9/node-tests.ts b/types/node/v9/node-tests.ts index d6751541b9..b7c7471fe1 100644 --- a/types/node/v9/node-tests.ts +++ b/types/node/v9/node-tests.ts @@ -854,6 +854,35 @@ namespace util_tests { // util.isDeepStrictEqual util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'}); + + // util.TextDecoder() + var td = new util.TextDecoder(); + new util.TextDecoder("utf-8"); + new util.TextDecoder("utf-8", { fatal: true }); + new util.TextDecoder("utf-8", { fatal: true, ignoreBOM: true }); + var ignoreBom: boolean = td.ignoreBOM; + var fatal: boolean = td.fatal; + var encoding: string = td.encoding; + td.decode(new Int8Array(1)); + td.decode(new Int16Array(1)); + td.decode(new Int32Array(1)); + td.decode(new Uint8Array(1)); + td.decode(new Uint16Array(1)); + td.decode(new Uint32Array(1)); + td.decode(new Uint8ClampedArray(1)); + td.decode(new Float32Array(1)); + td.decode(new Float64Array(1)); + td.decode(new DataView(new Int8Array(1).buffer)); + td.decode(new ArrayBuffer(1)); + td.decode(null); + td.decode(null, { stream: true }); + td.decode(new Int8Array(1), { stream: true }); + var decode: string = td.decode(new Int8Array(1)); + + // util.TextEncoder() + var te = new util.TextEncoder(); + var teEncoding: string = te.encoding; + var teEncodeRes: Uint8Array = te.encode("TextEncoder"); } } diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index 5dd811f342..323d39853d 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -1,15 +1,24 @@ // Type definitions for passport-oauth2 1.4 // Project: https://github.com/jaredhanson/passport-oauth2#readme // Definitions by: Pasi Eronen +// Wang Zishi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import { Request } from 'express'; import { Strategy } from 'passport'; +import { OAuth2 } from 'oauth'; declare class OAuth2Strategy extends Strategy { name: string; + /** + * NOTE: The _oauth2 property is considered "protected". Subclasses are + * allowed to use it when making protected resource requests to retrieve + * the user profile. + */ + protected _oauth2: OAuth2; + constructor(options: OAuth2Strategy.StrategyOptions, verify: OAuth2Strategy.VerifyFunction); constructor(options: OAuth2Strategy.StrategyOptionsWithRequest, verify: OAuth2Strategy.VerifyFunctionWithRequest); diff --git a/types/passport-oauth2/passport-oauth2-tests.ts b/types/passport-oauth2/passport-oauth2-tests.ts index bfedf67dad..133bf5ec4e 100644 --- a/types/passport-oauth2/passport-oauth2-tests.ts +++ b/types/passport-oauth2/passport-oauth2-tests.ts @@ -24,11 +24,11 @@ const strategy1: OAuth2Strategy = new OAuth2Strategy(strategyOptions1, verifyFun const strategy2: Strategy = new OAuth2Strategy(strategyOptions1, verifyFunction2); function verifyFunction3(_req: Request, _accessToken: string, _refreshToken: string, _profile: any, verifyCallback: VerifyCallback) { - verifyCallback(undefined, {userid: '1'}); + verifyCallback(undefined, { userid: '1' }); } function verifyFunction4(_req: Request, _accessToken: string, _refreshToken: string, _results: any, _profile: any, verifyCallback: VerifyCallback) { - verifyCallback(undefined, {userid: '1'}); + verifyCallback(undefined, { userid: '1' }); } const strategyOptions2: StrategyOptionsWithRequest = { @@ -49,3 +49,9 @@ const err1 = new AuthorizationError('Description', 'invalid_request', undefined) const err2 = new TokenError(undefined, 'invalid_request', undefined); const err3 = new InternalOAuthError('Hello', {}); + +class MyStrategy extends OAuth2Strategy { + useProtectedProperty() { + this._oauth2.get('http://www.example.com/profile', 'token', 'http://www.example.com/callback'); + } +} diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 7437976d44..ffb2379a7c 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -16,6 +16,7 @@ export interface ConnectionConfig { port?: number; host?: string; connectionString?: string; + keepAlive?: boolean; } export interface Defaults extends ConnectionConfig { diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index ae60f1bb6f..5051447667 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -9,6 +9,7 @@ const client = new Client({ port: 5334, user: 'database-user', password: 'secretpassword!!', + keepAlive: true, }); client.connect(err => { if (err) { @@ -125,6 +126,7 @@ const pool = new Pool({ max: 20, idleTimeoutMillis: 30000, connectionTimeoutMillis: 2000, + keepAlive: false, }); console.log(pool.totalCount); pool.connect((err, client, done) => { diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index 21f58664ca..d0e23901cc 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-content-loader 2.0 +// Type definitions for react-content-loader 3.1 // Project: https://github.com/danilowoz/react-content-loader // Definitions by: Alaa Masoud +// Sam Walsh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -14,6 +15,8 @@ export interface ContentLoaderProps { height?: number; primaryColor?: string; secondaryColor?: string; + primaryOpacity?: number; + secondaryOpacity?: number; preserveAspectRatio?: 'none' | 'xMinYMin meet' | 'xMidYMin meet' | 'xMaxYMin meet' | 'xMinYMid meet' | 'xMidYMid meet' | 'xMaxYMid meet' | 'xMinYMax meet' | 'xMidYMax meet' | 'xMaxYMax meet' | 'xMinYMin slice' | 'xMidYMin slice' | 'xMaxYMin slice' | 'xMinYMid slice' | 'xMidYMid slice' | 'xMaxYMid slice' | 'xMinYMax slice' | 'xMidYMax slice' | 'xMaxYMax slice'; diff --git a/types/react-content-loader/react-content-loader-tests.tsx b/types/react-content-loader/react-content-loader-tests.tsx index 4eeeecedc1..22e3dbaa7d 100644 --- a/types/react-content-loader/react-content-loader-tests.tsx +++ b/types/react-content-loader/react-content-loader-tests.tsx @@ -10,6 +10,8 @@ const CustomComponent = () => { width={100} primaryColor="#333" secondaryColor="#999" + primaryOpacity={0.06} + secondaryOpacity={0.12} preserveAspectRatio="xMinYMin meet" className="my-class" > diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index af6edce257..82070c673c 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -203,6 +203,16 @@ declare namespace AdazzleReactDataGrid { isSelectedKey?: string; } } + /** + * A custom formatter for the select all checkbox cell + * @default react-data-grid/src/formatters/SelectAll.js + */ + selectAllRenderer?: React.ComponentClass | React.StatelessComponent; + /** + * A custom formatter for select row column + * @default AdazzleReactDataGridPlugins.Editors.CheckboxEditor + */ + rowActionsCell?: React.ComponentClass | React.StatelessComponent; /** * An event function called when a row is clicked. * Clicking the header row will trigger a call with -1 for the rowIdx. diff --git a/types/react-data-grid/react-data-grid-tests.tsx b/types/react-data-grid/react-data-grid-tests.tsx index 827e20c820..8c0feb8f64 100644 --- a/types/react-data-grid/react-data-grid-tests.tsx +++ b/types/react-data-grid/react-data-grid-tests.tsx @@ -31,6 +31,35 @@ class CustomFilterHeaderCell extends React.Component { } } +class CustomRowSelectorCell extends ReactDataGridPlugins.Editors.CheckboxEditor { + render(){ + return super.render(); + } +} + +export interface ICustomSelectAllProps { + onChange: any; + inputRef: any; +} + +class CustomSelectAll extends React.Component { + render() { + return ( +
+ + +
+ ); + } +} + faker.locale = 'en_GB'; function createFakeRowObjectData(index:number):Object { @@ -327,6 +356,8 @@ class Example extends React.Component { keys: {rowKey: 'id', values: selectedRows} } }} + rowActionsCell={CustomRowSelectorCell} + selectAllRenderer={CustomSelectAll} onRowClick={this.onRowClick} /> diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 756ef2b340..0ad2e8279f 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -800,12 +800,6 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { } export interface TextPropsIOS { - /** - * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The - * default is `true`. - */ - allowFontScaling?: boolean; - /** * Specifies whether font should be scaled down automatically to fit given style constraints. */ @@ -843,6 +837,12 @@ export interface TextPropsAndroid { // https://facebook.github.io/react-native/docs/text.html#props export interface TextProps extends TextPropsIOS, TextPropsAndroid, AccessibilityProps { + /** + * Specifies whether fonts should scale to respect Text Size accessibility settings. + * The default is `true`. + */ + allowFontScaling?: boolean; + /** * This can be one of the following values: * @@ -1088,6 +1088,12 @@ export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | Return */ export interface TextInputProps extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps { + /** + * Specifies whether fonts should scale to respect Text Size accessibility settings. + * The default is `true`. + */ + allowFontScaling?: boolean; + /** * Can tell TextInput to automatically capitalize certain characters. * characters: all characters, @@ -3837,6 +3843,19 @@ export interface SectionListProps extends ScrollViewProps { */ initialNumToRender?: number; + /** + * Called once when the scroll position gets within onEndReachedThreshold of the rendered content. + */ + onEndReached?: ((info: { distanceFromEnd: number }) => void) | null; + + /** + * How far from the end (in units of visible length of the list) the bottom edge of the + * list must be from the end of the content to trigger the `onEndReached` callback. + * Thus a value of 0.5 will trigger `onEndReached` when the end of the content is + * within half the visible length of the list. + */ + onEndReachedThreshold?: number | null; + /** * Used to extract a unique key for a given item at the specified index. Key is used for caching * and as the react key to track item re-ordering. The default extractor checks `item.key`, then diff --git a/types/read-package-tree/index.d.ts b/types/read-package-tree/index.d.ts index e67083ffca..9a5d66214c 100644 --- a/types/read-package-tree/index.d.ts +++ b/types/read-package-tree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for read-package-tree 5.1 +// Type definitions for read-package-tree 5.2 // Project: https://github.com/npm/read-package-tree // Definitions by: Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,6 +9,7 @@ declare function rpt(root: string, filterWith: (node: rpt.Node, kidName: string) declare namespace rpt { class Node { id: number; + name: string; package: any; children: Node[]; parent: Node | null; diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index 53ec01bf87..f50691e116 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -264,6 +264,13 @@ export interface HeadingLinkProps extends BaseProps { type HeadingLinkClass = React.StatelessComponent export declare const HeadingLink: HeadingLinkClass; +export interface LinkProps extends BaseProps { + is?: string | Object | Function; + href?: string; +} +type LinkClass = React.StatelessComponent +export declare const Link: LinkClass; + export interface InlineFormProps extends BaseProps { label?: string; name?: string; diff --git a/types/three/three-trackballcontrols.d.ts b/types/three/three-trackballcontrols.d.ts index 88770ef79f..f5fb324079 100644 --- a/types/three/three-trackballcontrols.d.ts +++ b/types/three/three-trackballcontrols.d.ts @@ -31,6 +31,8 @@ export class TrackballControls extends EventDispatcher { reset(): void; + dispose(): void; + checkDistances(): void; zoomCamera(): void; diff --git a/types/video.js/index.d.ts b/types/video.js/index.d.ts index eaf49a1833..3a658fc05f 100644 --- a/types/video.js/index.d.ts +++ b/types/video.js/index.d.ts @@ -4,6 +4,7 @@ // Simon Clériot // Sean Bennett // Christoph Wagner +// Gio Freitas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // The Video.js API allows you to interact with the video through @@ -15,6 +16,9 @@ export = videojs; export as namespace videojs; declare namespace videojs { + const getComponent: typeof Component.getComponent; + const registerComponent: typeof Component.registerComponent; + interface PlayerOptions { techOrder?: string[]; sourceOrder?: boolean; @@ -35,6 +39,7 @@ declare namespace videojs { language?: string; notSupportedMessage?: string; plugins?: any; + poster?: string; } interface Source { @@ -42,39 +47,102 @@ declare namespace videojs { src: string; } - interface Player { - play(): Player; - pause(): Player; - paused(): boolean; - src(newSource: string | Source | Source[]): Player; - currentTime(seconds: number): Player; - currentTime(): number; - duration(): number; + interface Dimensions { + width: number; + height: number; + } + + class Component { + constructor(player: Player, options: any); + + static getComponent(name: 'Player'|'player'): typeof Player; + static getComponent(name: 'Component'|'component' | string): typeof Component; + static registerComponent(name: string, ComponentToRegister: typeof Component): typeof Component; + + $(selector: string, context?: string|Element): Element; + $$(selector: string, context?: string|Element): NodeList; + addClass(classToAdd: string): void; + blur(): void; + cancelAnimationFrame(id: number): number; + children(): Component[]; + clearInterval(intervalId: number): number; + clearTimeout(timeoutId: number): number; + contentEl(): Element; + createEl(tagNameopt?: string, properties?: any, attributes?: any): Element; + currentDimension(widthOrHeight: 'width'|'height'): number; + currentDimensions(): Dimensions; + currentHeight(): number; + currentWidth(): number; + dimension(widthOrHeight: 'width'|'height'): number; + dimension(widthOrHeight: 'width'|'height', num: string|number, skipListenersopt?: boolean): void; + dimensions(width: string|number, height: string|number): void; + dispose(): void; + el(): Element; + enableTouchActivity(): void; + focus(): void; + getAttribute(attribute: string): string|null; + getChild(name: string): Component|undefined; + getChildById(id: string): Component|undefined; + hasClass(classToCheck: string): boolean; + height(): number|string; + height(num: number|string, skipListeners?: boolean): void; + hide(): void; + id(): string; + initChildren(): void; + localize(key: string, tokens?: string[], defaultValue?: string): string; + name(): string; + options(obj: any): any; + player(): Player; + ready(callback: (this: this) => void): this; + removeAttribute(attribute: string): void; + removeChild(component: Component): void; + removeClass(classToRemove: string): void; + requestAnimationFrame(fn: () => void): number; + setAttribute(attribute: string, value: string): void; + setInterval(fn: () => void, interval: number): number; + setTimeout(fn: () => void, timeout: number): number; + show(): void; + toggleClass(classToToggle: string, predicate?: string): void; + triggerReady(): void; + width(): string | number; + width(num: number, skipListeners?: number): void; + } + + class Player extends Component { + autoplay(value?: boolean): string; + addRemoteTextTrack(options: {}): HTMLTrackElement; buffered(): TimeRanges; bufferedPercent(): number; - volume(percentAsDecimal: number): TimeRanges; - volume(): number; - width(): number; - width(pixels: number): Player; - height(): number; - height(pixels: number): Player; - size(width: number, height: number): Player; - requestFullScreen(): Player; cancelFullScreen(): Player; - requestFullscreen(): Player; - exitFullscreen(): Player; - ready(callback: (this: Player) => void): Player; - on(eventName: string, callback: (eventObject: Event) => void): void; - off(eventName?: string, callback?: (eventObject: Event) => void): void; - dispose(): void; - addRemoteTextTrack(options: {}): HTMLTrackElement; - removeRemoteTextTrack(track: HTMLTrackElement): void; - poster(val?: string): string | Player; - playbackRate(rate?: number): number; controls(bool?: boolean): boolean; - muted(muted?: boolean): boolean; - preload(value?: boolean): string; - autoplay(value?: boolean): string; + currentTime(): number; + currentTime(seconds: number): Player; + duration(): number; + exitFullscreen(): Player; + height(): number; + height(num: number): void; + languageSwitch(options: any): void; loop(value?: boolean): string; + muted(muted?: boolean): boolean; + off(eventName?: string, callback?: (eventObject: Event) => void): void; + on(eventName: string, callback: (eventObject: Event) => void): void; + pause(): Player; + paused(): boolean; + play(): Player; + playbackRate(rate?: number): number; + poster(val?: string): string | Player; + preload(value?: boolean): string; + removeRemoteTextTrack(track: HTMLTrackElement): void; + requestFullScreen(): Player; + size(width: number, height: number): Player; + src(newSource: string | Source | Source[]): Player; + volume(): number; + volume(percentAsDecimal: number): TimeRanges; + width(): number; + width(num: number): void; + } + + namespace dom { + function appendContent(element: Element, content: any): Element; } } diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 5be4abdcbd..403036d378 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -648,6 +648,27 @@ declare namespace webpack { portableRecords?: boolean; } } + + namespace debug { + interface ProfilingPluginOptions { + /** A relative path to a custom output file (json) */ + outputPath?: string; + } + /** + * Generate Chrome profile file which includes timings of plugins execution. Outputs `events.json` file by + * default. It is possible to provide custom file path using `outputPath` option. + * + * In order to view the profile file: + * * Run webpack with ProfilingPlugin. + * * Go to Chrome, open the Profile Tab. + * * Drag and drop generated file (events.json by default) into the profiler. + * + * It will then display timeline stats and calls per plugin! + */ + class ProfilingPlugin extends Plugin { + constructor(options?: ProfilingPluginOptions); + } + } namespace compilation { class Asset { } diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index b42d836c0c..ec5d0236a8 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -732,3 +732,10 @@ configuration = { ] } }; + +let profiling = new webpack.debug.ProfilingPlugin(); +profiling = new webpack.debug.ProfilingPlugin({ outputPath: './path.json' }); + +configuration = { + plugins: [profiling] +}; diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index fe5d44214e..18d8cae218 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1121,13 +1121,13 @@ declare namespace Xrm { * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ - retrieveRecord(entityType: string, id: string, options: string): Async.PromiseLike; + retrieveRecord(entityType: string, id: string, options?: string): Async.PromiseLike; /** * Retrieves a collection of entity records in mobile clients while working in the offline mode. * * @param entityType The logical name of the entity. - * @param options (Optional) The logical name of the enti + * @param options (Optional) The logical name of the entity * @param maxPageSize (Optional) A positive number to indicates the number of entity records to be returned per page. * * If you do not specify this parameter, the default value is passed as 5000. * * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property @@ -1144,7 +1144,7 @@ declare namespace Xrm { * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ - retrieveMultipleRecords(entityType: string, options: string, maxPageSize: number): Async.PromiseLike>; + retrieveMultipleRecords(entityType: string, options?: string, maxPageSize?: number): Async.PromiseLike>; /** * Updates an entity record in mobile clients while working in the offline mode. @@ -2100,7 +2100,7 @@ declare namespace Xrm { * * optionset * * string */ - getAttributeType(): string; + getAttributeType(): AttributeType; /** * Gets the attribute format. @@ -3541,9 +3541,9 @@ declare namespace Xrm { /** * Saves the record with the given save mode. - * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". + * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". If no parameter is included in the method, the record will simply be saved. */ - save(saveMode: EntitySaveMode): void; + save(saveMode?: EntitySaveMode): void; /** * The collection of attributes for the record. @@ -3692,14 +3692,14 @@ declare namespace Xrm { * Returns all process instances for the entity record that the calling user has access to. * @param callbackFunction (Optional) a function to call when the operation is complete. */ - getProcessInstances(callbackFunction: GetProcessInstancesDelegate): void; + getProcessInstances(callbackFunction?: GetProcessInstancesDelegate): void; /** * Sets a process instance as the active instance * @param processInstanceId The Id of the process instance to make the active instance. * @param callbackFunction (Optional) a function to call when the operation is complete. */ - setActiveProcessInstance(processInstanceId: string, callbackFunction: SetProcessInstanceDelegate): void; + setActiveProcessInstance(processInstanceId: string, callbackFunction?: SetProcessInstanceDelegate): void; /** * Returns a Stage object representing the active stage. @@ -3837,7 +3837,7 @@ declare namespace Xrm { * @param status The new status for the process * @param callbackFunction (Optional) a function to call when the operation is complete. */ - setStatus(status: ProcessStatus, callbackFunction: ProcessSetStatusDelegate): void; + setStatus(status: ProcessStatus, callbackFunction?: ProcessSetStatusDelegate): void; } /** @@ -4786,7 +4786,7 @@ declare namespace Xrm { * @returns On success, returns a promise containing a JSON object with the retrieved attributes and their values. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord External Link: retrieveRecord (Client API reference)} */ - retrieveRecord(entityLogicalName: string, id: string, options: string): Async.PromiseLike; + retrieveRecord(entityLogicalName: string, id: string, options?: string): Async.PromiseLike; /** * Retrieves a collection of entity records.