diff --git a/notNeededPackages.json b/notNeededPackages.json index 7c6d2629a8..8b56dbd9b5 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -678,6 +678,12 @@ "sourceRepoURL": "https://github.com/facebook/immutable-js", "asOfVersion": "3.8.7" }, + { + "libraryName": "interactjs", + "typingsPackageName": "interact.js", + "sourceRepoURL": "https://github.com/taye/interact.js", + "asOfVersion": "1.3.0" + }, { "libraryName": "inversify", "typingsPackageName": "inversify", diff --git a/types/angular-gettext/angular-gettext-tests.ts b/types/angular-gettext/angular-gettext-tests.ts index 766b16a963..1b1d5b6342 100644 --- a/types/angular-gettext/angular-gettext-tests.ts +++ b/types/angular-gettext/angular-gettext-tests.ts @@ -24,6 +24,8 @@ angular.module("myApp").controller("helloController", function (gettextCatalog: angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); + var myStringWithScope: string = gettextCatalog.getPlural(4, "{{color}} Bird", "{{color}} Birds", {color: 'Blue'}); + var myStringWithContext: string = gettextCatalog.getPlural(5, "pick", "picks", null, 'noun'); }); angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { diff --git a/types/angular-gettext/index.d.ts b/types/angular-gettext/index.d.ts index 5b6eb1d90f..6b5fe29e73 100644 --- a/types/angular-gettext/index.d.ts +++ b/types/angular-gettext/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-gettext v2.1.0 +// Type definitions for angular-gettext v2.1.1 // Project: https://angular-gettext.rocketeer.be/ // Definitions by: Ákos Lukács // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -66,7 +66,7 @@ declare module 'angular' { getString(string: string, scope?: any, context?: string): string; /** Translate a plural string with the given context. */ - getPlural(n: number, string: string, stringPlural: string, context?: any): string; + getPlural(n: number, string: string, stringPlural: string, scope?: any, context?: string): string; /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ loadRemote(url: string): ng.IHttpPromise; diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index 79277e04c9..f13599ebae 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -10,7 +10,8 @@ webAuth.authorize({ scope: 'read:order write:order', responseType: 'token', redirectUri: 'https://example.com/auth/callback', - language: 'en' + language: 'en', + prompt: 'login', }); webAuth.parseHash((err, authResult) => { diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 62047bae71..e66cd5f712 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -761,6 +761,7 @@ export interface AuthorizeOptions { scope?: string; audience?: string; language?: string; + prompt?: string; } export interface CheckSessionOptions extends AuthorizeOptions { diff --git a/types/bricks.js/bricks.js-tests.ts b/types/bricks.js/bricks.js-tests.ts index b916e97aca..dbef221df0 100644 --- a/types/bricks.js/bricks.js-tests.ts +++ b/types/bricks.js/bricks.js-tests.ts @@ -1,7 +1,7 @@ import Bricks from 'bricks.js'; const bricks = Bricks({ - container: document.body!.firstChild!, + container: document.body.firstChild!, packed: 'packed', sizes: [ { columns: 2, gutter: 10 }, diff --git a/types/capture-console/capture-console-tests.ts b/types/capture-console/capture-console-tests.ts new file mode 100644 index 0000000000..45dd3a7130 --- /dev/null +++ b/types/capture-console/capture-console-tests.ts @@ -0,0 +1,53 @@ +import * as captureconsole from "capture-console"; + +captureconsole.capture(process.stdout, () => { }); // $ExpectType string[] +captureconsole.capture(process.stdout, {}, () => { }); // $ExpectType string[] +captureconsole.capture(process.stdout, { quiet: true }, () => { }); // $ExpectType string[] + +captureconsole.capture([process.stdout, process.stdin], () => { }); // $ExpectType string[] +captureconsole.capture([process.stdout, process.stdin], {}, () => { }); // $ExpectType string[] +captureconsole.capture([process.stdout, process.stdin], { quiet: true }, () => { }); // $ExpectType string[] + +captureconsole.captureStderr(() => { }); // $ExpectType string +captureconsole.captureStderr({}, () => { }); // $ExpectType string +captureconsole.captureStderr({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.captureStdio(() => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.captureStdio({}, () => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.captureStdio({ quiet: true }, () => { }); // $ExpectType { stdout: string; stderr: string; } + +captureconsole.captureStdout(() => { }); // $ExpectType string +captureconsole.captureStdout({}, () => { }); // $ExpectType string +captureconsole.captureStdout({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.hook(process.stdout, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType () => boolean +captureconsole.hook(process.stdout, {}, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType () => boolean +captureconsole.hook(process.stdout, { quiet: true }, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType () => boolean + +captureconsole.intercept(process.stdout, () => { }); // $ExpectType string[] +captureconsole.intercept(process.stdout, {}, () => { }); // $ExpectType string[] +captureconsole.intercept(process.stdout, { quiet: true }, () => { }); // $ExpectType string[] + +captureconsole.interceptStderr(() => { }); // $ExpectType string +captureconsole.interceptStderr({}, () => { }); // $ExpectType string +captureconsole.interceptStderr({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.interceptStdio(() => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.interceptStdio({}, () => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.interceptStdio({ quiet: true }, () => { }); // $ExpectType { stdout: string; stderr: string; } + +captureconsole.interceptStdout(() => { }); // $ExpectType string +captureconsole.interceptStdout({}, () => { }); // $ExpectType string +captureconsole.interceptStdout({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.startCapture(process.stdout, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType boolean +captureconsole.startCapture(process.stdout, {}, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType boolean +captureconsole.startCapture(process.stdout, { quiet: true }, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType boolean + +captureconsole.startIntercept(process.stdout, () => { }); // $ExpectType boolean +captureconsole.startIntercept(process.stdout, {}, () => { }); // $ExpectType boolean +captureconsole.startIntercept(process.stdout, { quiet: true }, () => { }); // $ExpectType boolean + +captureconsole.stopCapture(process.stdout); // $ExpectType boolean + +captureconsole.stopIntercept(process.stdout); // $ExpectType boolean diff --git a/types/capture-console/index.d.ts b/types/capture-console/index.d.ts new file mode 100644 index 0000000000..d3ebd914f9 --- /dev/null +++ b/types/capture-console/index.d.ts @@ -0,0 +1,190 @@ +// Type definitions for capture-console 1.0 +// Project: https://github.com/zackehh/capture-console +// Definitions by: Auston Zahrt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * Options controlling behavior when capturing + */ +export interface CaptureOptions { + /** + * Option to silence the output going to the console + */ + quiet?: boolean; +} + +/** + * Executes the provided function with the output + * on the provided streams. + */ +export function capture( + streams: ReadonlyArray | NodeJS.WritableStream, + exec: () => void +): string[]; + +/** + * Executes the provided function with the output + * on the provided streams. Accepts options to silence + * the output going to the console. + */ +export function capture( + streams: ReadonlyArray | NodeJS.WritableStream, + opts: CaptureOptions, + exec: () => void +): string[]; + +/** + * Captures stderr for the provided execution scope. + */ +export function captureStderr(exec: () => void): string; + +/** + * Captures stderr for the provided execution scope. + */ +export function captureStderr(opts: CaptureOptions, exec: () => void): string; + +/** + * Captures stdout and stderr into an object for + * the provided execution scope. + */ +export function captureStdio(exec: () => void): { stdout: string; stderr: string; }; + +/** + * Captures stdout and stderr into an object for + * the provided execution scope. + */ +export function captureStdio(opts: CaptureOptions, exec: () => void): { stdout: string; stderr: string; }; + +/** + * Captures stdout for the provided execution scope. + */ +export function captureStdout(exec: () => void): string; + +/** + * Captures stdout for the provided execution scope. + */ +export function captureStdout(opts: CaptureOptions, exec: () => void): string; + +/** + * Listens to a provided stream, and executes the provided + * function for every write call. Accepts options to silence + * the output going to the console. + * + * Returns a function to call when you wish to stop listening + * to the call. + */ +export function hook( + stream: NodeJS.WritableStream, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): () => boolean; + +/** + * Listens to a provided stream, and executes the provided + * function for every write call. Accepts options to silence + * the output going to the console. + * + * Returns a function to call when you wish to stop listening + * to the call. + */ +export function hook( + stream: NodeJS.WritableStream, + opts: CaptureOptions, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): () => boolean; + +/** + * Delegate to #capture with a quiet passthrough. + */ +export function intercept(stream: NodeJS.WritableStream, exec: () => void): string[]; + +/** + * Delegate to #capture with a quiet passthrough. + */ +export function intercept(stream: NodeJS.WritableStream, opts: CaptureOptions, exec: () => void): string[]; + +/** + * Delegate to #captureStderr with a quiet passthrough. + */ +export function interceptStderr(exec: () => void): string; + +/** + * Delegate to #captureStderr with a quiet passthrough. + */ +export function interceptStderr(opts: CaptureOptions, exec: () => void): string; + +/** + * Delegate to #captureStdio with a quiet passthrough. + */ +export function interceptStdio(exec: () => void): { stdout: string; stderr: string; }; + +/** + * Delegate to #captureStdio with a quiet passthrough. + */ +export function interceptStdio(opts: CaptureOptions, exec: () => void): { stdout: string; stderr: string; }; + +/** + * Delegate to #captureStdout with a quiet passthrough. + */ +export function interceptStdout(exec: () => void): string; + +/** + * Delegate to #captureStdout with a quiet passthrough. + */ +export function interceptStdout(opts: CaptureOptions, exec: () => void): string; + +/** + * Starts a capture on the provided stream using the + * provided options and stream execution. + */ +export function startCapture( + stream: NodeJS.WritableStream, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): boolean; + +/** + * Starts a capture on the provided stream using the + * provided options and stream execution. + */ +export function startCapture( + stream: NodeJS.WritableStream, + opts: CaptureOptions, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): boolean; + +/** + * Delegate to #startCapture with a quiet passthrough. + */ +export function startIntercept(stream: NodeJS.WritableStream, exec: () => void): boolean; + +/** + * Delegate to #startCapture with a quiet passthrough. + */ +export function startIntercept(stream: NodeJS.WritableStream, opts: CaptureOptions, exec: () => void): boolean; + +/** + * Stops a capture on the provided stream. + */ +export function stopCapture(stream: NodeJS.WritableStream): boolean; + +/** + * Delegate to #stopCapture with a quiet passthrough. + */ +export function stopIntercept(stream: NodeJS.WritableStream): boolean; diff --git a/types/capture-console/tsconfig.json b/types/capture-console/tsconfig.json new file mode 100644 index 0000000000..01807d6e22 --- /dev/null +++ b/types/capture-console/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "capture-console-tests.ts" + ] +} \ No newline at end of file diff --git a/types/capture-console/tslint.json b/types/capture-console/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/capture-console/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/catbox-redis/catbox-redis-tests.ts b/types/catbox-redis/catbox-redis-tests.ts new file mode 100644 index 0000000000..d7fb5eb701 --- /dev/null +++ b/types/catbox-redis/catbox-redis-tests.ts @@ -0,0 +1,12 @@ +import * as CatbotRedis from 'catbox-redis'; + +const cache = new CatbotRedis({ + host: 'localhost', + partition: 'test', + port: 2018, +}); + +cache.get({ + segment: 'test', + id: 'test', +}); diff --git a/types/catbox-redis/index.d.ts b/types/catbox-redis/index.d.ts new file mode 100644 index 0000000000..a0d3590953 --- /dev/null +++ b/types/catbox-redis/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for catbox-redis 4.1 +// Project: https://github.com/hapijs/catbox-redis#readme +// Definitions by: Simon Schick +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +// tslint:disable-next-line +declare module 'catbox-redis' { + import { Redis } from 'ioredis'; + import { EnginePrototype, ClientOptions, Client } from 'catbox'; + namespace CatboxRedis { + interface CatboxRedisOptions extends ClientOptions { + /** + * Raw client. + */ + client?: Redis; + /** + * the Redis server URL (if url is provided, host, port, and socket are ignored) + */ + url?: string; + /** + * the Redis server hostname. + * Defaults to '127.0.0.1'. + */ + host?: string; + /** + * the Redis server port or unix domain socket path. + * Defaults to 6379. + */ + port?: number; + /** + * the unix socket string to connect to (if socket is provided, host and port are ignored) + */ + socket?: string; + /** + * the Redis authentication password when required. + */ + password?: string; + /** + * the Redis database. + */ + database?: string; + /** + * an array of redis sentinel addresses to connect to. + */ + sentinels?: Array<{ + host: string; + }>; + /** + * the name of the sentinel master. + * (Only needed when sentinels is specified) + */ + sentinelName?: string; + } + } + class CatboxRedis extends Client { + constructor(options: CatboxRedis.CatboxRedisOptions); + } + export = CatboxRedis; + } diff --git a/types/interact.js/tsconfig.json b/types/catbox-redis/tsconfig.json similarity index 79% rename from types/interact.js/tsconfig.json rename to types/catbox-redis/tsconfig.json index 6d4887d0f1..2d31a4bc59 100644 --- a/types/interact.js/tsconfig.json +++ b/types/catbox-redis/tsconfig.json @@ -2,12 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -19,6 +18,6 @@ }, "files": [ "index.d.ts", - "interact.js-tests.ts" + "catbox-redis-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/catbox-redis/tslint.json b/types/catbox-redis/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/catbox-redis/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index 6d51e48696..f6881b1aef 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -112,6 +112,9 @@ export interface CachedObject { export type CacheItem = any; export interface ClientOptions { + /** + * this will store items under keys that start with this value. + */ partition: string; } diff --git a/types/clipboard-js/clipboard-js-tests.ts b/types/clipboard-js/clipboard-js-tests.ts index bcc576b7c9..ef1bfbdf5d 100644 --- a/types/clipboard-js/clipboard-js-tests.ts +++ b/types/clipboard-js/clipboard-js-tests.ts @@ -1,4 +1,4 @@ clipboard.copy("Hello World"); -clipboard.copy(document.body!).then(() => console.log("success")); +clipboard.copy(document.body).then(() => console.log("success")); clipboard.paste().then(val => console.log(val)); diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index c38acead19..59482ad507 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2819,13 +2819,13 @@ declare namespace cytoscape { /** * The handler returns true when it finds the desired node, and it returns false to cancel the search. - * i - The index indicating this node is the ith visited node. - * depth - How many edge hops away this node is from the root nodes. * v - The current node. * e - The edge connecting the previous node to the current node. * u - The previous node. + * i - The index indicating this node is the ith visited node. + * depth - How many edge hops away this node is from the root nodes. */ - type SearchVisitFunction = (i: number, depth: number, v: NodeCollection, e: EdgeCollection, u: NodeCollection) => boolean; + type SearchVisitFunction = (v: NodeCollection, e: EdgeCollection, u: NodeCollection, i: number, depth: number) => boolean | void; interface SearchFirstOptions { /** * The root nodes (selector or collection) to start the search from. diff --git a/types/d3-dispatch/d3-dispatch-tests.ts b/types/d3-dispatch/d3-dispatch-tests.ts index b4f44ad4d2..4e8d2cfb31 100644 --- a/types/d3-dispatch/d3-dispatch-tests.ts +++ b/types/d3-dispatch/d3-dispatch-tests.ts @@ -47,12 +47,12 @@ undef = dispatch.on('unknown') as undefined; dispatch.on('bar', dispatch.on('bar')!); dispatch.call('foo'); -dispatch.call('foo', document.body!); -dispatch.call('foo', document.body!, { a: 3, b: 'test' }, 1); +dispatch.call('foo', document.body); +dispatch.call('foo', document.body, { a: 3, b: 'test' }, 1); dispatch.apply('bar'); -dispatch.apply('bar', document.body!); -dispatch.apply('bar', document.body!, [{ a: 3, b: 'test' }, 1]); +dispatch.apply('bar', document.body); +dispatch.apply('bar', document.body, [{ a: 3, b: 'test' }, 1]); dispatch.on('bar', null); diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 54ddb5ea11..b99c81e39a 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -796,7 +796,7 @@ newDiv2 = body.append(function(d, i, g) { const index: number = i; const group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum - return this.ownerDocument.createElement('div'); // this-type HTMLBodyElement + return this.ownerDocument!.createElement('div'); // this-type HTMLBodyElement }); // newDiv2 = body.append(function(d) { @@ -828,7 +828,7 @@ const typeValueFunction = function( i: number, g: HTMLBodyElement[] | d3Selection.ArrayLike ) { - return this.ownerDocument.createElement('p'); // this-type HTMLParagraphElement + return this.ownerDocument!.createElement('p'); // this-type HTMLParagraphElement }; const beforeValueFunction = function( diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index d1e127dfdf..d9988636fd 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -22,7 +22,7 @@ export type BaseType = Element | EnterElement | Document | Window | null; */ export interface ArrayLike { length: number; - item(index: number): T; + item(index: number): T | null; [index: number]: T; } diff --git a/types/deku/deku-tests.ts b/types/deku/deku-tests.ts index d0467adead..d123c7b8f7 100644 --- a/types/deku/deku-tests.ts +++ b/types/deku/deku-tests.ts @@ -24,7 +24,7 @@ }) } - let render = createApp(document.body!) + let render = createApp(document.body) function main(state: any){ let vnode = view(state, (action: any) => main({ count: 0 })) @@ -43,7 +43,7 @@ return element('div', { class: `size-${ props.size }` }) } - const render = createApp(document.body!) + const render = createApp(document.body) render(element(App, { size: 'small' })) @@ -82,11 +82,11 @@ (function (){ const { createApp, element } = deku - let render: Function = createApp(document.body!) + let render: Function = createApp(document.body) render(element('div')) - render = createApp(document.body!, (action: any) => { + render = createApp(document.body, (action: any) => { render(element('div')) }) diff --git a/types/dnssd/index.d.ts b/types/dnssd/index.d.ts index 80de2900f3..8ef8aa84fd 100644 --- a/types/dnssd/index.d.ts +++ b/types/dnssd/index.d.ts @@ -3,13 +3,14 @@ // Definitions by: Angel Merino // Max Rumpf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// import { EventEmitter } from 'events'; /** Declaration file generated by dts-gen */ -export class Advertisement { +export class Advertisement extends EventEmitter { constructor(type: string | string[] | ServiceType, port: number, ...args: any[]); start(): Advertisement; @@ -43,7 +44,7 @@ export class Service { } export class ServiceType { - constructor(...args: string[]) + constructor(...args: Array) constructor(args: ServiceType); name: string; @@ -60,29 +61,29 @@ export class ServiceType { } export class Browser extends EventEmitter { - constructor(type: any, ...args: any[]); + constructor(type: string | string[] | ServiceType, ...args: any[]); - list(): any; + start(): Browser; - start(): any; + stop(): void; - stop(): any; + list(): any[]; } -export const resolveA: any; +export function resolve(name: string, type: string, args: object): Promise; -export const resolveAAAA: any; +export function resolve4(name: string, type: string, args: object): Promise; -export function all(): ServiceType; +export function resolve6(name: string, type: string, args: object): Promise; -export function resolve(name: any, type: any, ...args: any[]): any; +export function resolveSRV(name: string, args: object): Promise; -export function resolveSRV(name: any, opts: any): any; +export function resolveTXT(name: string, args: object): Promise; -export function resolveService(name: any, ...args: any[]): any; - -export function resolveTXT(name: any, opts: any): any; +export function resolveService(name: string, args: object): Promise; export function tcp(...args: string[]): ServiceType; export function udp(...args: string[]): ServiceType; + +export function all(): ServiceType; diff --git a/types/extsprintf/extsprintf-tests.ts b/types/extsprintf/extsprintf-tests.ts new file mode 100644 index 0000000000..4b45462487 --- /dev/null +++ b/types/extsprintf/extsprintf-tests.ts @@ -0,0 +1,8 @@ +import { sprintf, fprintf, printf } from "extsprintf"; + +fprintf({write: (s: string) => {}}, ''); +fprintf({write: (s: string) => {}}, '', {}, [], null, 0, ''); +printf(''); +printf('', {}, [], null, 0, ''); +sprintf(''); // $ExpectType string +sprintf('', {}, [], null, 0, ''); // $ExpectType string diff --git a/types/extsprintf/index.d.ts b/types/extsprintf/index.d.ts new file mode 100644 index 0000000000..29d073b4c5 --- /dev/null +++ b/types/extsprintf/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for extsprintf 1.4 +// Project: https://github.com/joyent/node-extsprintf#readme +// Definitions by: Alex Hankins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Stream { + write(str: string): void; +} + +export function fprintf(stream: Stream, format: string, ...args: any[]): any; +export function printf(format: string, ...args: any[]): any; +export function sprintf(format: string, ...args: any[]): string; diff --git a/types/extsprintf/tsconfig.json b/types/extsprintf/tsconfig.json new file mode 100644 index 0000000000..bc9783f347 --- /dev/null +++ b/types/extsprintf/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "extsprintf-tests.ts" + ] +} diff --git a/types/extsprintf/tslint.json b/types/extsprintf/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/extsprintf/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts b/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts index 78ead793b4..7f28a37597 100644 --- a/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts +++ b/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts @@ -21,4 +21,16 @@ config = { ] }; +config = { + plugins: [ + new ForkTsCheckerWebpackPlugin({ + logger: { + error: message => console.error(message), + warn: message => console.warn(message), + info: message => console.info(message), + } + }) + ] +}; + export default config; diff --git a/types/fork-ts-checker-webpack-plugin/index.d.ts b/types/fork-ts-checker-webpack-plugin/index.d.ts index ace3db5b24..715b1fe41b 100644 --- a/types/fork-ts-checker-webpack-plugin/index.d.ts +++ b/types/fork-ts-checker-webpack-plugin/index.d.ts @@ -73,6 +73,12 @@ declare namespace ForkTsCheckerWebpackPlugin { type Formatter = (message: NormalizedMessage, useColors: boolean) => string; + interface Logger { + error(message?: any): void; + warn(message?: any): void; + info(message?: any): void; + } + interface Options { tsconfig?: string; tslint?: string | true; @@ -81,7 +87,7 @@ declare namespace ForkTsCheckerWebpackPlugin { ignoreDiagnostics?: number[]; ignoreLints?: string[]; colors?: boolean; - logger?: Console; + logger?: Logger; formatter?: 'default' | 'codeframe' | Formatter; formatterOptions?: { highlightCode?: boolean diff --git a/types/fork-ts-checker-webpack-plugin/package.json b/types/fork-ts-checker-webpack-plugin/package.json index bc1b130102..2371372125 100644 --- a/types/fork-ts-checker-webpack-plugin/package.json +++ b/types/fork-ts-checker-webpack-plugin/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "tslint": "*" + "tslint": "*", + "typescript": "*" } } diff --git a/types/google-cloud__datastore/google-cloud__datastore-tests.ts b/types/google-cloud__datastore/google-cloud__datastore-tests.ts index cb723d0d5b..df48a70f59 100644 --- a/types/google-cloud__datastore/google-cloud__datastore-tests.ts +++ b/types/google-cloud__datastore/google-cloud__datastore-tests.ts @@ -72,7 +72,7 @@ const complexQuery = ds.createQuery('special_namespace', kind) .offset(10); // Running queries: -const queryCallback: QueryCallback = (err: Error, entities: TestEntity[]) => entities[0][Datastore.KEY]; +const queryCallback: QueryCallback = (err: Error, entities: TestEntity[]) => entities[0][ds.KEY]; ds.runQuery(query, queryCallback); ds.runQuery(query, options, queryCallback); diff --git a/types/google-cloud__datastore/index.d.ts b/types/google-cloud__datastore/index.d.ts index e0ef60b4bb..c6b7ed3462 100644 --- a/types/google-cloud__datastore/index.d.ts +++ b/types/google-cloud__datastore/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/googleapis/nodejs-datastore // Definitions by: Antoine Beauvais-Lacasse // Futa Ogawa +// Thomas den Hollander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 @@ -35,6 +36,15 @@ declare module '@google-cloud/datastore' { import { DatastoreTransaction } from '@google-cloud/datastore/transaction'; class Datastore extends DatastoreRequest_ { + static readonly KEY: unique symbol; + static readonly MORE_RESULTS_AFTER_CURSOR: MoreResultsAfterCursor; + static readonly MORE_RESULTS_AFTER_LIMIT: MoreResultsAfterLimit; + static readonly NO_MORE_RESULTS: NoMoreResults; + + static readonly Query: typeof DatastoreQuery; + static readonly DatastoreRequest: typeof DatastoreRequest_; + static readonly Transaction: typeof DatastoreTransaction; + constructor(options?: InitOptions); readonly KEY: typeof Datastore.KEY; @@ -80,17 +90,6 @@ declare module '@google-cloud/datastore' { keyFilename?: string; credentials?: object; } - - namespace Datastore { - const KEY: unique symbol; - const MORE_RESULTS_AFTER_CURSOR: MoreResultsAfterCursor; - const MORE_RESULTS_AFTER_LIMIT: MoreResultsAfterLimit; - const NO_MORE_RESULTS: NoMoreResults; - - const Query: typeof DatastoreQuery; - const DatastoreRequest: typeof DatastoreRequest_; - const Transaction: typeof DatastoreTransaction; - } } declare module '@google-cloud/datastore/entity' { diff --git a/types/google.picker/index.d.ts b/types/google.picker/index.d.ts index b5fc91404d..9a0c95f920 100644 --- a/types/google.picker/index.d.ts +++ b/types/google.picker/index.d.ts @@ -83,7 +83,7 @@ declare namespace google { */ export interface Picker { isVisible(): boolean; - setCallback():Picker; + setCallback(method:Function):Picker; setRelayUrl(url:string):Picker; setVisible(visible:boolean):Picker; } diff --git a/types/interact.js/index.d.ts b/types/interact.js/index.d.ts deleted file mode 100644 index 866ced2216..0000000000 --- a/types/interact.js/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -// Type definitions for Interacting for interact.js v1.0.25 -// Project: https://github.com/taye/interact.js -// Definitions by: Douglas Eichelberger , Adi Dahiya , Tom Hasner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// API documentation: http://interactjs.io/docs - -declare namespace Interact { - interface Interactable { - // returns Element or string - accept(): any; - accept(newValue: Element): Interactable; - accept(newValue: string): Interactable; - actionChecker(): Function; - actionChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): Interactable; - autoScroll(options: {[key: string]: any}): Interactable; - context(): Node; - defaultActionChecker(event: any): string; - deltaSource(): string; - // returns Interactable if newValue is "page" or "client", otherwise returns string - deltaSource(newValue: String): Interactable; - draggable(): boolean; - draggable(options: boolean): Interactable; - draggable(options: {[key: string]: any}): Interactable; - dropCheck(event: MouseEvent): boolean; - dropCheck(event: TouchEvent): boolean; - dropChecker(): Function; - dropChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - dropzone(): any; - dropzone(options: boolean): Interactable; - dropzone(options: {[key: string]: any}): Interactable; - // return HTMLElement or SVGElement - element(): Element; - fire(iEvent: InteractEvent): Interactable; - // returns boolean or {[key: string]: any} - gesturable(): any; - gesturable(options: boolean): Interactable; - gesturable(options: {[key: string]: any}): Interactable; - getRect(): ClientRect; - // returns Element or string - ignoreFrom(): any; - ignoreFrom(newValue: string): Interactable; - ignoreFrom(newValue: Element): Interactable; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): Interactable; - inertia(options: {[key: string]: any}): Interactable; - off(eventType: string, listener: Function, useCapture?: boolean): Interactable; - on(eventType: string, listener: Function, useCapture?: boolean): Interactable; - origin(): Point; - origin(newValue: HTMLElement): Interactable; - origin(newValue: SVGElement): Interactable; - origin(newValue: Point): Interactable; - preventDefault(newValue: boolean | string): Interactable; - rectChecker(): Function; - rectChecker(newValue: Function): Interactable; - resizable(): Interactable; - resizable(options: boolean): Interactable; - resizable(options: {[key: string]: any}): Interactable; - restrict(): Restrict; - restrict(newValue: Restrict): Interactable; - set(options: {[key: string]: any}): Interactable; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): Interactable; - snap(options: {[key: string]: any}): Interactable; - squareResize(): boolean; - squareResize(newValue: boolean): Interactable; - styleCursor(): boolean; - styleCursor(newValue: boolean): Interactable; - unset(): InteractStatic; - validateSetting(context: string, option: string, value: any): any; - } - - interface Coordinates { - clientX: number; - clientY: number; - pageX: number; - pageY: number; - timeStamp: number; - } - - interface Debug { - target: any; - dragging: any; - resizing: any; - gesturing: any; - prepared: any; - - prevCoords: Coordinates; - downCoords: Coordinates; - - pointerIds: any[]; - pointerMoves: any[]; - addPointer: any; - removePointer: any; - recordPointers: any; - - inertia: InertiaStatus; - - downTime: any; - downEvent: any; - prevEvent: any; - - Interactable: any; - IOptions: any; - interactables: any; - dropzones: any; - pointerIsDown: any; - defaultOptions: any; - defaultActionChecker: any; - - actions: any; - dragMove: any; - resizeMove: any; - gestureMove: any; - pointerUp: any; - pointerDown: any; - pointerMove: any; - pointerHover: any; - - events: any; - globalEvents: any; - delegatedEvents: any; - } - - interface InertiaStatus { - active: boolean; - target: any; - targetElement: any; - - startEvent: any; - pointerUp: any - - xe: number; - ye: number; - duration: number; - - t0: number; - vx0: number; - vys: number; - - lambda_v0: number; - one_ve_v0: number; - i: any; - } - - interface Point { - x: number; - y: number; - } - - // value types are either ClientRect or Element - interface Restrict { - drag?: any; - gesture?: any; - resize?: any; - elementRect?: {[direction: string]: number}; - } - - interface InteractEvent { - altKey: boolean; - axes: string; - button: number - clientX0: number; - clientX: number - clientY0: number; - clientY: number - ctrlKey: boolean - dt: number; - duration: number; - dx: number; - dy: number; - metaKey: boolean; - pageX: number; - pageY: number; - shiftKey: boolean; - speed: number; - t0: number; - target: any; - timeStamp: number; - type: string; - velocityX: number; - velocityY: number; - x0: number; - y0: number; - } - - interface TouchEvent { - pageX: number; - pageY: number; - type: string; - } - - interface InteractStatic { - (element: HTMLElement): Interactable; - (element: SVGElement): Interactable; - (element: string): Interactable; - (element: string, options: {context: Element}): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): InteractStatic; - autoScroll(options: {[key: string]: any}): InteractStatic; - currentAction(): string - debug(): Debug; - deltaSource(): string; - // "page" and "client" are the valid parameters - deltaSource(newValue: string): InteractStatic; - dynamicDrop(): boolean; - dynamicDrop(newValue: boolean): InteractStatic; - enableDragging(): boolean; - enableDragging(newValue: boolean): InteractStatic; - enableGesturing(): boolean; - enableGesturing(newValue: boolean): InteractStatic; - enableResizing(): boolean; - enableResizing(newValue: boolean): InteractStatic; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): InteractStatic; - inertia(options: {[key: string]: any}): InteractStatic; - isSet(element: Element): boolean; - margin(): number; - margin(newvalue: number): InteractStatic; - off(type: string, listener: Function, useCapture?: boolean): InteractStatic; - on(type: string, listener: Function, useCapture?: boolean): InteractStatic; - restrict(): Restrict; - restrict(newValue: Restrict): InteractStatic; - simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): InteractStatic; - snap(options: {[key: string]: any}): InteractStatic; - stop(event: Event): InteractStatic; - styleCursor(): boolean; - styleCursor(newValue: boolean): InteractStatic; - supportsTouch(): boolean - } -} - -declare var interact: Interact.InteractStatic; - -// CommonJS module name until version 1.2.6 is "interact.js" - declare module "interact.js" { - export = interact; - } - -// CommonJS module name from version 1.2.7 onward is "interactjs" -declare module "interactjs" { - export = interact; -} - -// AMD module name is "interact" -declare module "interact" { - export = interact; -} diff --git a/types/interact.js/interact.js-tests.ts b/types/interact.js/interact.js-tests.ts deleted file mode 100644 index f2a735e2da..0000000000 --- a/types/interact.js/interact.js-tests.ts +++ /dev/null @@ -1,110 +0,0 @@ - - -import interact = require("interact.js"); - -var button: HTMLElement = document.createElement("BUTTON"); -var rectangle: ClientRect = { - left: 100, - width: 100, - right: 100, - top: 100, - bottom: 100, - height: 100 -}; -let context = document.createElement("a"); -let interactable = interact(".foo", {context: context}); -interactable = interact(button); - -interactable.draggable(); -interactable.draggable(true); -interactable.draggable({ - onstart: (event: Interact.InteractEvent) => {}, - onmove : (event: Interact.InteractEvent) => {}, - onend : (event: Interact.InteractEvent) => {} -}); -interactable.dropzone(); -interactable.dropzone(true); -interactable.dropChecker(() => {}); -interactable.accept(); -interactable.accept("button"); -interactable.accept(button); -interactable.resizable(); -interactable.resizable(true); -interactable.squareResize(); -interactable.squareResize(true); -interactable.gesturable(); -interactable.gesturable(true); -interactable.gesturable({ - onmove: () => {} -}); -interactable.autoScroll(); -interactable.autoScroll(true); -interactable.snap(); -interactable.snap(true); -interactable.inertia(); -interactable.inertia({ - resistance: 1 -}); -interactable.inertia(true); -interactable.actionChecker(); -interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interact.Interactable) => defaultAction); -var rect: ClientRect = interactable.getRect(); -interactable.rectChecker(); -interactable.styleCursor(); -interactable.origin(); -interactable.origin({x: 0, y: 0}); -interactable.origin(button); -interactable.deltaSource(); -interactable.deltaSource("client"); -interactable.restrict(); -interactable.restrict({ - "drag": button, - "resize": button, - "gesture": button -}); -interactable.context(); -interactable.ignoreFrom(); -interactable.ignoreFrom("button"); -interactable.ignoreFrom(button); -interactable.validateSetting("restrict", "drag", button); -interactable.element(); -interactable.on("click", () => {}, true); -interactable.off("click", () => {}, true); -interactable.unset(); - -interact.isSet(button); -interact.on("click", () => {}, true); -interact.off("click", () => {}, true); -interact.enableDragging(); -interact.enableDragging(true); -interact.enableResizing(); -interact.enableResizing(true); -interact.enableGesturing(); -interact.enableGesturing(true); -interact.debug(); -interact.margin(); -interact.margin(10); -interact.styleCursor(); -interact.styleCursor(true); -interact.autoScroll(true); -interact.autoScroll(); -interact.snap(); -interact.snap(true); -interact.snap({ - mode: "grid" -}); -interact.inertia(); -interact.inertia(true); -interact.supportsTouch(); -interact.currentAction(); -interact.dynamicDrop(); -interact.dynamicDrop(true); -interact.deltaSource(); -interact.deltaSource("page"); - -interact.restrict({ - "drag": rectangle, - "resize": rectangle, - "gesture": rectangle, - "elementRect": { top: 0, left: 0, bottom: 1, right: 1 } -}); diff --git a/types/interact.js/tslint.json b/types/interact.js/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/interact.js/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 45b334a205..e593f4dcc3 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -6,6 +6,7 @@ // Ebrahim // Shahar Mor // Whemoon Jang +// Francis Gulotta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -65,10 +66,23 @@ declare namespace IORedis { get(key: string, callback: (err: Error, res: string) => void): void; get(key: string): Promise; + getBuffer(key: string, callback: (err: Error, res: Buffer) => void): void; getBuffer(key: string): Promise; - set(key: string, value: any, ...args: any[]): any; + set(key: string, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + + set(key: string, value: any, callback: (err: Error, res: string) => void): void; + set(key: string, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void; + set(key: string, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void; + set(key: string, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void; + + setBuffer(key: string, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + + setBuffer(key: string, value: any, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: string, value: any, setMode: string, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: string, value: any, expiryMode: string, time: number, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: string, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: Buffer) => void): void; setnx(key: string, value: any, callback: (err: Error, res: any) => void): void; setnx(key: string, value: any): Promise; @@ -241,12 +255,16 @@ declare namespace IORedis { hset(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; hset(key: string, field: string, value: any): Promise<0 | 1>; + hsetBuffer(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; + hsetBuffer(key: string, field: string, value: any): Promise; hsetnx(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; hsetnx(key: string, field: string, value: any): Promise<0 | 1>; hget(key: string, field: string, callback: (err: Error, res: string) => void): void; hget(key: string, field: string): Promise; + hgetBuffer(key: string, field: string, callback: (err: Error, res: Buffer) => void): void; + hgetBuffer(key: string, field: string): Promise; hmset(key: string, field: string, value: any, ...args: string[]): Promise<0 | 1>; hmset(key: string, data: any, callback: (err: Error, res: 0 | 1) => void): void; @@ -471,7 +489,15 @@ declare namespace IORedis { get(key: string, callback?: (err: Error, res: string) => void): Pipeline; getBuffer(key: string, callback?: (err: Error, res: Buffer) => void): Pipeline; - set(key: string, value: any, ...args: any[]): Pipeline; + set(key: string, value: any, callback?: (err: Error, res: string) => void): Pipeline; + set(key: string, value: any, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; + set(key: string, value: any, expiryMode: string, time: number, callback?: (err: Error, res: string) => void): Pipeline; + set(key: string, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; + + setBuffer(key: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: string, value: any, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: string, value: any, expiryMode: string, time: number, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: string, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; setnx(key: string, value: any, callback?: (err: Error, res: any) => void): Pipeline; @@ -602,10 +628,12 @@ declare namespace IORedis { zrevrank(key: string, member: string, callback?: (err: Error, res: number) => void): Pipeline; hset(key: string, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + hsetBuffer(key: string, field: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; hsetnx(key: string, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; hget(key: string, field: string, callback?: (err: Error, res: string) => void): Pipeline; + hgetBuffer(key: string, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline; hmset(key: string, field: string, value: any, ...args: string[]): Pipeline; hmset(key: string, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 7dd98879a5..32ae5c24d5 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -16,7 +16,20 @@ redis.sadd('set', 1, 3, 5, 7); redis.sadd('set', [1, 3, 5, 7]); // All arguments are passed directly to the redis server: -redis.set('key', '100', 'EX', 10); +redis.set('key', '100'); +redis.set('key', '100', 'XX'); +redis.set('key', '100', 'PX', 10); +redis.set('key', '100', 'EX', 10, 'NX'); +redis.set('key', '100', 'NX', 'EX', 10); +redis.set('key', '100', ['EX', 10, 'NX']); +redis.setBuffer('key', '100', 'NX', 'EX', 10); + +redis.set('key', '100', (err, data) => {}); +redis.set('key', '100', 'XX', (err, data) => {}); +redis.set('key', '100', 'PX', 10, (err, data) => {}); +redis.set('key', '100', 'EX', 10, 'NX', (err, data) => {}); +redis.set('key', '100', ['EX', 10, 'NX'], (err, data) => {}); +redis.setBuffer('key', '100', 'NX', 'EX', 10, (err, data) => {}); new Redis(); // Connect to 127.0.0.1:6379 new Redis(6380); // 127.0.0.1:6380 @@ -59,6 +72,10 @@ redis.on('messageBuffer', (channel: any, message: any) => { const pipeline = redis.pipeline(); pipeline.set('foo', 'bar'); pipeline.del('cc'); +pipeline.hset('hash', 'foo', 4); +pipeline.hget('hash', 'foo'); +pipeline.hsetBuffer('hash', 'fooBuffer', 4); +pipeline.hgetBuffer('hash', 'fooBuffer'); pipeline.exec((err, results) => { // `err` is always null, and `results` is an array of responses // corresponding to the sequence of queued commands. diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 12aa17b643..2f6b8679f6 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -1122,7 +1122,7 @@ export function ref(key: string, options?: ReferenceOptions): Reference; export function isRef(ref: any): ref is Reference; /** - * Get a sub-schema of an existing schema based on a `path` that can be either a string or an array + * Get a sub-schema of an existing schema based on a `path` that can be either a string or an array * of strings For string values path separator is a dot (`.`) */ export function reach(schema: ObjectSchema, path: string): Schema; @@ -1189,6 +1189,11 @@ export function not(values: any[]): Schema; */ export function required(): Schema; +/** + * Alias of `required`. + */ +export function exist(): Schema; + /** * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. */ diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index def9eaafd4..6eb7950682 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -1110,6 +1110,7 @@ schema = Joi.not(x, x); schema = Joi.not([x, x, x]); schema = Joi.required(); +schema = Joi.exist(); schema = Joi.optional(); schema = Joi.forbidden(); schema = Joi.strip(); diff --git a/types/jquery.notify/jquery.notify-tests.ts b/types/jquery.notify/jquery.notify-tests.ts index 1d872e92fa..1af31996a1 100644 --- a/types/jquery.notify/jquery.notify-tests.ts +++ b/types/jquery.notify/jquery.notify-tests.ts @@ -1,4 +1,4 @@ -let $container: JQueryNotifyWidget = $("").appendTo(document.body!).notify(); +let $container: JQueryNotifyWidget = $("").appendTo(document.body).notify(); let notification: JQueryNotifyInstance = $container.notify( "create", diff --git a/types/jquery/test/example-tests.ts b/types/jquery/test/example-tests.ts index f725cb2bcb..60fbd431bb 100644 --- a/types/jquery/test/example-tests.ts +++ b/types/jquery/test/example-tests.ts @@ -1,3 +1,17 @@ +// tslint:disable:no-arg +// tslint:disable:no-var-keyword +// tslint:disable:object-literal-key-quotes +// tslint:disable:object-literal-shorthand +// tslint:disable:one-variable-per-declaration +// tslint:disable:only-arrow-functions +// tslint:disable:prefer-conditional-expression +// tslint:disable:prefer-const +// tslint:disable:prefer-for-of +// tslint:disable:prefer-switch +// tslint:disable:prefer-template +// tslint:disable:space-within-parens +// tslint:disable:triple-equals + function examples() { function add_0() { $('div').css('border', '2px solid red') @@ -816,7 +830,7 @@ function examples() { var len = kids.addClass('hilite').length; $('#results span:first').text(len); - $('#results span:last').text(( event.target).tagName); + $('#results span:last').text(event.target.tagName); event.preventDefault(); }); @@ -1600,7 +1614,7 @@ function examples() { function event_target_0() { $('body').click(function(event) { - $('#log').html('clicked: ' + ( event.target).nodeName); + $('#log').html('clicked: ' + event.target.nodeName); }); } @@ -2320,8 +2334,8 @@ function examples() { } function jQuery_contains_0() { - $.contains(document.documentElement, document.body); // true - $.contains(document.body, document.documentElement); // false + $.contains(document.documentElement!, document.body); // true + $.contains(document.body, document.documentElement!); // false } function jQuery_data_0() { diff --git a/types/jquery/test/learn-tests.ts b/types/jquery/test/learn-tests.ts index 17fc7cd285..ef52084da5 100644 --- a/types/jquery/test/learn-tests.ts +++ b/types/jquery/test/learn-tests.ts @@ -11,7 +11,7 @@ interface GreenifyPlugin { } jQuery.fn.greenify = function() { - this.css( "color", "green" ); + this.css("color", "green"); }; -jQuery( "a" ).greenify(); // Makes all the links green. +jQuery("a").greenify(); // Makes all the links green. diff --git a/types/jquery/test/longdesc-tests.ts b/types/jquery/test/longdesc-tests.ts index 3405bb83b5..5275191b5b 100644 --- a/types/jquery/test/longdesc-tests.ts +++ b/types/jquery/test/longdesc-tests.ts @@ -1,3 +1,14 @@ +// tslint:disable:no-var-keyword +// tslint:disable:object-literal-key-quotes +// tslint:disable:object-literal-shorthand +// tslint:disable:one-variable-per-declaration +// tslint:disable:only-arrow-functions +// tslint:disable:prefer-const +// tslint:disable:prefer-for-of +// tslint:disable:prefer-template +// tslint:disable:space-within-parens +// tslint:disable:triple-equals + function longdesc() { function add_0() { $('p').add('div').addClass('widget'); @@ -2358,9 +2369,9 @@ function longdesc() { } function toggle_3(display: boolean) { - if (display === true) { + if (display) { $('#foo').show(); - } else if (display === false) { + } else { $('#foo').hide(); } } diff --git a/types/jquery/tslint.json b/types/jquery/tslint.json index 1d12f59138..93e1f3e072 100644 --- a/types/jquery/tslint.json +++ b/types/jquery/tslint.json @@ -7,21 +7,6 @@ "no-declare-current-package": false, "ban-types": false, - "no-arg": false, - "no-boolean-literal-compare": false, - "no-object-literal-type-assertion": false, - "no-unnecessary-type-assertion": false, - "no-var-keyword": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-for-of": false, - "prefer-switch": false, - "prefer-template": false, - "space-within-parens": false, - "triple-equals": false + "no-object-literal-type-assertion": false } } diff --git a/types/jsdom/jsdom-tests.ts b/types/jsdom/jsdom-tests.ts index 24b136e5ad..2dbbdca601 100644 --- a/types/jsdom/jsdom-tests.ts +++ b/types/jsdom/jsdom-tests.ts @@ -17,7 +17,7 @@ function test_executing_scripts1() { `); // The script will not be executed, by default: - dom.window.document.body!.children.length === 1; + dom.window.document.body.children.length === 1; } function test_executing_scripts2() { @@ -26,14 +26,14 @@ function test_executing_scripts2() { `, { runScripts: 'dangerously' }); // The script will be executed and modify the DOM: - dom.window.document.body!.children.length === 2; + dom.window.document.body.children.length === 2; } function test_executing_scripts3() { const window = (new JSDOM(``, { runScripts: 'outside-only' })).window; window.eval(`document.body.innerHTML = "

Hello, world!

";`); - window.document.body!.children.length === 1; + window.document.body.children.length === 1; } function test_virtualConsole() { @@ -86,7 +86,7 @@ function test_nodeLocation() { ); const document = dom.window.document; - const bodyEl = document.body!; // implicitly created + const bodyEl = document.body; // implicitly created const pEl = document.querySelector('p')!; const textNode = pEl.firstChild!; const imgEl = document.querySelector('img')!; diff --git a/types/klaw/v1/index.d.ts b/types/klaw/v1/index.d.ts index 74939f30c2..f65da7af6f 100644 --- a/types/klaw/v1/index.d.ts +++ b/types/klaw/v1/index.d.ts @@ -5,7 +5,7 @@ /// -import * as fs from "fs"; +import { Stats } from "fs"; import { Readable, ReadableOptions } from 'stream'; declare function K(root: string, options?: K.Options): K.Walker; @@ -13,16 +13,16 @@ declare function K(root: string, options?: K.Options): K.Walker; declare namespace K { interface Item { path: string; - stats: fs.Stats; + stats: Stats; } type QueueMethod = "shift" | "pop"; interface Options extends ReadableOptions { queueMethod?: QueueMethod; - pathSorter?: (pathA: string, pathB: string) => number; + pathSorter?(pathA: string, pathB: string): number; fs?: any; // fs or mock-fs - filter?: (path: string) => boolean; + filter?(path: string): boolean; } type Event = "close" | "data" | "end" | "readable" | "error"; diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index fe8d46658a..c1fb224fa0 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -312,9 +312,9 @@ declare namespace Knex { } interface Union { - (callback: QueryCallback, wrap?: boolean): QueryBuilder; - (callbacks: QueryCallback[], wrap?: boolean): QueryBuilder; - (...callbacks: QueryCallback[]): QueryBuilder; + (callback: QueryCallback | QueryBuilder | Raw, wrap?: boolean): QueryBuilder; + (callbacks: (QueryCallback | QueryBuilder | Raw)[], wrap?: boolean): QueryBuilder; + (...callbacks: (QueryCallback | QueryBuilder | Raw)[]): QueryBuilder; // (...callbacks: QueryCallback[], wrap?: boolean): QueryInterface; } diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 329ed9d414..0037948415 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -1145,3 +1145,19 @@ knex('characters') .whereIn(['name', 'class'], function() { this.select('name', 'class').from('characters'); }); + +knex('characters') + .select() + .where({ name: 'Bar', class: 'Fighter' }) + .union(knex('characters').select().where({ name: 'Foo', class: 'Druid' })); +knex('characters') + .select() + .where({ name: 'Bar', class: 'Fighter' }) + .union([knex('characters').select().where({ name: 'Foo', class: 'Druid' })]); +knex('characters') + .select() + .where({ name: 'Bar', class: 'Fighter' }) + .union( + knex('characters').select().where({ name: 'Foo', class: 'Druid' }), + knex('characters').select().where({ name: 'Baz', class: 'Paladin' }) + ); diff --git a/types/leaflet-routing-machine/index.d.ts b/types/leaflet-routing-machine/index.d.ts index 16da37f7c5..2ec6d9ef27 100644 --- a/types/leaflet-routing-machine/index.d.ts +++ b/types/leaflet-routing-machine/index.d.ts @@ -111,6 +111,7 @@ declare module 'leaflet' { profile?: string; polylinePrecision?: number; useHints?: boolean; + routingOptions?: any; } class Formatter { @@ -190,6 +191,7 @@ declare module 'leaflet' { allowUTurns: boolean; geometryOnly: boolean; fileFormat: string; + simplifyGeometry: boolean; } // tslint:disable-next-line interface-name diff --git a/types/mark.js/mark.js-tests.ts b/types/mark.js/mark.js-tests.ts index 2f4bb62d9a..a979990521 100644 --- a/types/mark.js/mark.js-tests.ts +++ b/types/mark.js/mark.js-tests.ts @@ -3,7 +3,7 @@ import * as Mark from 'mark.js'; /* test instance */ const mark = new Mark(document.querySelectorAll('div')); const markBySelector = new Mark('div'); -const markByElement = new Mark(document.body!); +const markByElement = new Mark(document.body); mark.mark('keyword'); mark.mark('keyword', { diff --git a/types/markdown-pdf/index.d.ts b/types/markdown-pdf/index.d.ts new file mode 100644 index 0000000000..1df6a9f314 --- /dev/null +++ b/types/markdown-pdf/index.d.ts @@ -0,0 +1,92 @@ +// Type definitions for MarkdownPDF (markdown-pdf) 9.0 +// Project: https://github.com/alanshaw/markdown-pdf +// Definitions by: Ange PICARD +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = MarkdownPDF; + +declare function MarkdownPDF(options?: MarkdownPDF.Options): MarkdownPDF.OptionsBuilder; + +declare namespace MarkdownPDF { + /** Configuration options */ + interface Options { + /** Current working directory. */ + cwd?: string; + /** Path to the phantomjs library. */ + phantomPath?: string; + /** Path to custom CSS file, relative to current directory. */ + cssPath?: string; + /** Path to custorm highlight CSS file (for code highlighting with highlight.js), relative to the current directory. */ + highlightCssPath?: string; + /** Path to CommonJS module which sets the page header and footer (see runnings.js). */ + runningsPath?: string; + /** Delay (in ms) before the PDF is rendered. */ + renderDelay?: number; + /** If renderDelay option isn't set, this is the timeout (in ms) before the page is rendered in case the page.onLoadFinished event doesn't fire. */ + loadTimeout?: number; + /** Supported dimension units are: 'mm', 'cm', 'in', 'px' */ + paperBorder?: string; + paperFormat?: PaperFormat; + paperOrientation?: PaperOrientation; + /** A function that returns a through2 stream that transforms the markdown before it is converted to HTML. */ + preProcessMd?: () => any; + /** A function that returns a through2 stream that transforms the HTML before it is converted to PDF. */ + preProcessHtml?: () => any; + /** A config object that is passed to remarkable, the underlying markdown parser */ + remarkable?: any; // FIXME: remarkable config types + } + type PaperFormat = "A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid"; + type PaperOrientation = "portait" | "landscape"; + + interface OptionsBuilder { + /** Create a readable stream and pipe it to markdown pdf. */ + from: FromOptionsBuilder & FromFunction; + /** Concatenates stream and pipe them to markdown pdf. */ + concat: ConcatOptionsBuilder; + } + + type FromFunction = + /** Create a readable stream from path and pipe to markdown-pdf. path can be a single path or array of paths. */ + (path: string | string[]) => ToOptionsBuilder; + interface FromOptionsBuilder { + /** Create a readable stream from string and pipe to markdown-pdf. string can be a single string or array of strings. */ + string(markdown: string | string[]): ToOptionsBuilder; + /** Create a readable stream from path and pipe to markdown-pdf. path can be a single path or array of paths. */ + path(path: string | string[], opts: any): ToOptionsBuilder; + } + + interface ConcatOptionsBuilder { + from: ConcatFromOptionsBuilder; + } + interface ConcatFromOptionsBuilder { + /** Create and concatenate readable streams from strings and pipe to markdown-pdf. */ + strings(markdownTexts: string[], opts: any): ToOptionsBuilder; + /** Create and concatenate readable streams from paths and pipe to markdown-pdf. */ + paths(paths: string[], opts: any): ToOptionsBuilder; + } + + interface ToOptionsBuilder { + to: ToBuilder & ToFunction; + } + + interface ToBuilder { + /** + * Create a writeable stream to path and pipe output from markdown-pdf to it. + * path can be a single path, or array of output paths if you specified an array of inputs. + * The callback function cb will be invoked when data has finished being written. + */ + path(path: string, callback?: () => void): void; + /** Create a concat-stream and pipe output from markdown-pdf to it. The callback function cb will be invoked when the buffer has been created. */ + buffer(opts: any, callback?: () => void): void; + /** Create a concat-stream and pipe output from markdown-pdf to it. The callback function cb will be invoked when the string has been created. */ + string(opts: any, callback?: () => void): void; + } + + type ToFunction = + /** + * Create a writeable stream to path and pipe output from markdown-pdf to it. + * path can be a single path, or array of output paths if you specified an array of inputs. + * The callback function cb will be invoked when data has finished being written. + */ + (path: string, callback?: () => void) => void; +} diff --git a/types/markdown-pdf/markdown-pdf-tests.ts b/types/markdown-pdf/markdown-pdf-tests.ts new file mode 100644 index 0000000000..429028bf8b --- /dev/null +++ b/types/markdown-pdf/markdown-pdf-tests.ts @@ -0,0 +1,11 @@ +import mdPdf = require('markdown-pdf'); + +mdPdf().from('path').to('path', () => { }); // $ExpectType void +mdPdf().from.string('markdown').to('path', () => { }); // $ExpectType void +mdPdf({ paperOrientation: 'landscape', paperFormat: 'A3' }).from('lol').to('lol', () => { }); // $ExpectType void +mdPdf().concat.from.paths(['lol', 'lol'], {}).to('path', () => { }); // $ExpectType void +mdPdf().concat.from.strings(['lol', 'lol'], {}).to('path', () => { }); // $ExpectType void +mdPdf().from('path').to.path('path', () => { }); // $ExpectType void +mdPdf().from('path').to('path'); // $ExpectType void + +mdPdf({ paperFormat: 'wrongFormat' }); // $ExpectError diff --git a/types/markdown-pdf/tsconfig.json b/types/markdown-pdf/tsconfig.json new file mode 100644 index 0000000000..8ce150383b --- /dev/null +++ b/types/markdown-pdf/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", + "markdown-pdf-tests.ts" + ] +} diff --git a/types/markdown-pdf/tslint.json b/types/markdown-pdf/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/markdown-pdf/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/marko/marko-tests.ts b/types/marko/marko-tests.ts index e43f61d8b5..623ad12e5f 100644 --- a/types/marko/marko-tests.ts +++ b/types/marko/marko-tests.ts @@ -18,7 +18,7 @@ const template: Template = require('template.marko'); // $ExpectType RenderResult template .renderSync({ name: 'Marko' }) - .appendTo(document.body!); + .appendTo(document.body); createServer((req, res) => { res.setHeader('content-type', 'text/html'); @@ -30,12 +30,12 @@ const template: Template = require('template.marko'); .render({ $global: { flags: ['mobile'] } }) .then((result) => { // $ExpectType RenderResult - result.appendTo(document.body!); + result.appendTo(document.body); }); template.render({}, (err: Error | null, result: RenderResult) => { // $ExpectType RenderResult - result.appendTo(document.body!); + result.appendTo(document.body); }); }; diff --git a/types/material__menu/constants.d.ts b/types/material__menu/constants.d.ts index 8bec0c2e0c..8c76365ef8 100644 --- a/types/material__menu/constants.d.ts +++ b/types/material__menu/constants.d.ts @@ -66,12 +66,12 @@ export interface CornerBit extends MDCNumbers { * Likewise END maps to RIGHT or LEFT depending on the directionality. */ export interface Corner extends MDCNumbers { - TOP_LEFT: 0; - TOP_RIGHT: CornerBit["RIGHT"]; - BOTTOM_LEFT: CornerBit["BOTTOM"]; - BOTTOM_RIGHT: CornerBit["BOTTOM"] | CornerBit["RIGHT"]; - TOP_START: CornerBit["FLIP_RTL"]; - TOP_END: CornerBit["FLIP_RTL"] | CornerBit["RIGHT"]; - BOTTOM_START: CornerBit["BOTTOM"] | CornerBit["FLIP_RTL"]; - BOTTOM_END: CornerBit["BOTTOM"] | CornerBit["RIGHT"] | CornerBit["FLIP_RTL"]; + TOP_LEFT: 0; + TOP_RIGHT: 4; + BOTTOM_LEFT: 1; + BOTTOM_RIGHT: 5; + TOP_START: 8; + TOP_END: 12; + BOTTOM_START: 9; + BOTTOM_END: 13; } diff --git a/types/mithril/test/test-api.ts b/types/mithril/test/test-api.ts index 66c026f47d..73e03edeae 100644 --- a/types/mithril/test/test-api.ts +++ b/types/mithril/test/test-api.ts @@ -142,7 +142,7 @@ const FRAME_BUDGET = 100; }); }; - m.render(document.body!, userInputs(users)); + m.render(document.body, userInputs(users)); } //////////////////////////////////////////////////////////////////////////////// @@ -246,7 +246,7 @@ const FRAME_BUDGET = 100; }; // example 1 - m.route(document.body!, "/", { + m.route(document.body, "/", { "/": { view() { return m(Layout, m(Home)); @@ -260,7 +260,7 @@ const FRAME_BUDGET = 100; }); // example 2 - m.route(document.body!, "/", { + m.route(document.body, "/", { "/": { render() { return m(Layout, m(Home)); @@ -285,7 +285,7 @@ const FRAME_BUDGET = 100; }, }; - m.route(document.body!, "/", { + m.route(document.body, "/", { "/": { render() { return m(Anon1); @@ -313,7 +313,7 @@ const FRAME_BUDGET = 100; } }; - m.route(document.body!, "/user/list", { + m.route(document.body, "/user/list", { "/user/list": { onmatch: state.loadUsers, render() { @@ -330,7 +330,7 @@ const FRAME_BUDGET = 100; { let progress = 0; - m.mount(document.body!, { + m.mount(document.body, { view() { return [ m("input[type=file]", { onchange: upload }), @@ -396,7 +396,7 @@ const FRAME_BUDGET = 100; deserialize: value => value }) .then(svg => { - m.render(document.body!, m.trust(svg)); + m.render(document.body, m.trust(svg)); }); } diff --git a/types/mithril/test/test-class-component.ts b/types/mithril/test/test-class-component.ts index 44c81a8b56..0b70773c9e 100644 --- a/types/mithril/test/test-class-component.ts +++ b/types/mithril/test/test-class-component.ts @@ -112,7 +112,7 @@ class Comp4 implements ClassComponent { // // Test that all are mountable components // -m.route(document.body!, '/', { +m.route(document.body, '/', { '/comp0': Comp0, '/comp1': Comp1, '/comp2': Comp2, diff --git a/types/mithril/test/test-factory-component.ts b/types/mithril/test/test-factory-component.ts index b53619fbf1..6d0102fe38 100644 --- a/types/mithril/test/test-factory-component.ts +++ b/types/mithril/test/test-factory-component.ts @@ -148,7 +148,7 @@ function comp5(): Component { // // Test that all are mountable components // -m.route(document.body!, '/', { +m.route(document.body, '/', { '/comp0': comp0, '/comp1': comp1, '/comp2': comp2, diff --git a/types/mithril/test/test-misc.ts b/types/mithril/test/test-misc.ts index 548811247d..3f377fec60 100644 --- a/types/mithril/test/test-misc.ts +++ b/types/mithril/test/test-misc.ts @@ -10,9 +10,9 @@ const params = parseQueryString('?id=123'); const qstr = buildQueryString({id: 123}); -render(document.body!, 'Hello'); -render(document.body!, h('h1', 'Test')); -render(document.body!, [ +render(document.body, 'Hello'); +render(document.body, h('h1', 'Test')); +render(document.body, [ h('h1', 'Test'), "abc", null, 123, false, h('p', 'Vnode array'), ['a', 123, undefined, h('div', 'Nested')] ]); diff --git a/types/mithril/test/test-route.ts b/types/mithril/test/test-route.ts index 63f10e510e..7f82c9fa40 100644 --- a/types/mithril/test/test-route.ts +++ b/types/mithril/test/test-route.ts @@ -66,7 +66,7 @@ const routeResolver: RouteResolver & RRState = { } }; -route(document.body!, '/', { +route(document.body, '/', { '/': component1, '/test1': { onmatch(args, path) { diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 49fd7364e3..ed04749756 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -5863,8 +5863,8 @@ declare module "crypto" { export interface Signer extends NodeJS.WritableStream { update(data: string | Buffer | NodeJS.TypedArray | DataView): Signer; update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string }): Buffer; - sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase: string, padding?: number, saltLength?: number }): Buffer; + sign(private_key: string | { key: string; passphrase: string, padding?: number, saltLength?: number }, output_format: HexBase64Latin1Encoding): string; } export function createVerify(algorith: string, options?: stream.WritableOptions): Verify; export interface Verify extends NodeJS.WritableStream { diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index d24d35d469..36af5da50a 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -613,7 +613,20 @@ declare namespace Office { * True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False. * * @remarks - * The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser, do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed. + * The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed. + * + * **Support details** + * + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * + * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * + * *Supported hosts, by platform* + * + * + * + * + *
Office for iPad
Excel Y
Word Y
*/ commerceAllowed: boolean; /** @@ -698,7 +711,7 @@ declare namespace Office { * Word Y Y Y * */ - document: Document; + document: Office.Document; /** * Contains the Office application host in which the add-in is running. */ @@ -725,7 +738,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read */ - mailbox: Mailbox; + mailbox: Office.Mailbox; /** * Provides access to the properties for Office theme colors. */ @@ -750,12 +763,26 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read */ - roamingSettings: RoamingSettings; + roamingSettings: Office.RoamingSettings; /** - * Specifies whether the platform and device allows touch interaction. + * Specifies whether the platform and device allows touch interaction. True if the add-in is running on a touch device, such as an iPad; false otherwise. * * @remarks * Use the touchEnabled property to determine when your add-in is running on a touch device and if necessary, adjust the kind of controls, and size and spacing of elements in your add-in's UI to accommodate touch interactions. + * + * **Support details** + * + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * + * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * + * *Supported hosts, by platform* + * + * + * + * + * + *
Office for iPad
Excel Y
PowerPoint Y
Word Y
*/ touchEnabled: boolean; /** @@ -2048,11 +2075,11 @@ declare namespace Office { * Represents a binding to a section of the document. * * @remarks - * Requirement SetsMatrixBinding, TableBinding, TextBinding + *
Requirement SetsMatrixBinding, TableBinding, TextBinding
* * The Binding object exposes the functionality possessed by all bindings regardless of type. * - * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. + * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: {@link Office.MatrixBinding}, {@link Office.TableBinding}, or {@link Office.TextBinding}. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. * * **Support details** * @@ -2074,15 +2101,15 @@ declare namespace Office { /** * Get the Document object associated with the binding. */ - document: Document; + document: Office.Document; /** - * A string that uniquely identifies this binding among the bindings in the same Document object. + * A string that uniquely identifies this binding among the bindings in the same {@link Office.Document} object. */ id: string; /** * Gets the type of the binding. */ - type: BindingType; + type: Office.BindingType; /** * Adds an event handler to the object for the specified {@link Office.EventType}. Supported EventTypes are `Office.EventType.BindingDataChanged` and `Office.EventType.BindingSelectionChanged`. * @@ -2092,26 +2119,26 @@ declare namespace Office { * @param eventType The event type. For bindings, it can be `Office.EventType.BindingDataChanged` or `Office.EventType.BindingSelectionChanged`. * @param handler The event handler function to add, whose only parameter is of type {@link Office.BindingDataChangedEventArgs} or {@link Office.BindingSelectionChangedEventArgs}. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; /** * Returns the data contained within the binding. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * * @param options Provides options for how to get the data in a binding. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ getDataAsync(options?: GetBindingDataOptions, callback?: (result: AsyncResult) => void): void; /** * Removes the specified handler from the binding for the specified event type. * * @remarks - * Requirement SetsBindingEvents + *
Requirement SetsBindingEvents
* * @param eventType The event type. For bindings, it can be `Office.EventType.BindingDataChanged` or `Office.EventType.BindingSelectionChanged`. * @param options Provides options to determine which event handler or handlers are removed. @@ -2123,7 +2150,7 @@ declare namespace Office { * * @remarks * - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * The value passed for data contains the data to be written in the binding. The kind of value passed determines what will be written as described in the following table. * @@ -2341,7 +2368,7 @@ declare namespace Office { * Creates a binding against a named object in the document. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * For Excel, the itemName parameter can refer to a named range or a table. * @@ -2378,7 +2405,7 @@ declare namespace Office { * Create a binding by prompting the user to make a selection on the document. * * @remarks - * Requirement SetsNot in a set + *
Requirement SetsNot in a set
* * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. * @@ -2404,7 +2431,7 @@ declare namespace Office { * Create a binding based on the user's current selection. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. * @@ -2434,7 +2461,7 @@ declare namespace Office { * Gets all bindings that were previously created. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * **Support details** * @@ -2458,7 +2485,7 @@ declare namespace Office { * Retrieves a binding based on its Name * * @remarks - * Requirement SetsCustomXmlParts, MatrixBindings, TableBindings, TextBindings + *
Requirement SetsCustomXmlParts, MatrixBindings, TableBindings, TextBindings
* * Fails if the specified id does not exist. * @@ -2485,7 +2512,7 @@ declare namespace Office { * Removes the binding from the document * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * Fails if the specified id does not exist. * @@ -2532,28 +2559,28 @@ declare namespace Office { * Gets the base name of the node without the namespace prefix, if one exists. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
*/ baseName: string; /** * Retrieves the string GUID of the CustomXMLPart. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
*/ namespaceUri: string; /** * Gets the type of the CustomXMLNode. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
*/ nodeType: string; /** * Gets the nodes associated with the XPath expression. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param xPath The XPath expression that specifies the nodes to get. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2564,7 +2591,7 @@ declare namespace Office { * Gets the node value. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2574,7 +2601,7 @@ declare namespace Office { * Gets the text of an XML node in a custom XML part. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2584,7 +2611,7 @@ declare namespace Office { * Gets the node's XML. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2594,7 +2621,7 @@ declare namespace Office { * Sets the node value. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param value The value to be set on the node * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2618,7 +2645,7 @@ declare namespace Office { * Sets the node XML. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param xml The XML to be set on the node * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2779,6 +2806,7 @@ declare namespace Office { /** * Provides information about the replaced node that raised the nodeReplaced event. * + * @remarks * **Support details** * * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index a6122c8477..37cac7e65d 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -10135,6 +10135,13 @@ export namespace style { */ getLineDash(): number[]; + /** + * Get the line dash offset style for the stroke. + * @return Line dash offset + * @api + */ + getLineDashOffset(): number; + /** * Get the line join type for the stroke. * @return Line join. @@ -10186,6 +10193,14 @@ export namespace style { */ setLineDash(lineDash: number[]): void; + /** + * Set the line dash offset. + * + * @param lineDashOffset Line dash offset. + * @api + */ + setLineDashOffset(lineDashOffset: number): void; + /** * Set the line join. * @@ -12347,6 +12362,7 @@ export namespace olx { lineCap?: string; lineJoin?: string; lineDash?: number[]; + lineDashOffset?: number; miterLimit?: number; width?: number; } diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index fcf925886d..6e28ad4cd2 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -74,6 +74,7 @@ const style = new ol.style.Style(); const styleArray: ol.style.Style[] = []; const styleFunction: ol.StyleFunction = (feature, resolution) => style; let styleRegularShape: ol.style.RegularShape; +let styleStroke: ol.style.Stroke; const tilegrid = new ol.tilegrid.TileGrid({resolutions: numberArray}); const transformFn: ol.TransformFunction = (array, out, dimension) => numberArray; let units: ol.proj.Units; @@ -1111,6 +1112,35 @@ styleRegularShape = new ol.style.RegularShape({ points: 4, }); +// +// ol.style.Stroke +// + +styleStroke = new ol.style.Stroke(); +styleStroke.setColor('#FF0000'); +styleStroke.setColor('red'); +styleStroke.setColor('#CCC'); +styleStroke.setColor('rgb(255, 255, 255)'); +styleStroke.setColor('rgb(255, 255, 255, 0.7)'); +styleStroke.setLineCap('butt'); +styleStroke.setLineCap('round'); +styleStroke.setLineCap('square'); +styleStroke.setLineJoin('bevel'); +styleStroke.setLineJoin('round'); +styleStroke.setLineJoin('miter'); +styleStroke.setLineDash([10, 5]); +styleStroke.setLineDashOffset(10); +styleStroke.setMiterLimit(20); +styleStroke.setWidth(5); + +const strokeColor: ol.Color|ol.ColorLike = styleStroke.getColor(); +const strokeLineCap: string = styleStroke.getLineCap(); +const strokeLineJoin: string = styleStroke.getLineJoin(); +const strokeLineDash: number[] = styleStroke.getLineDash(); +const strokeLineDashOffset: number = styleStroke.getLineDashOffset(); +const strokeMiterLimit: number = styleStroke.getMiterLimit(); +const strokeWidth: number = styleStroke.getWidth(); + // // ol.proj // diff --git a/types/owl.carousel/index.d.ts b/types/owl.carousel/index.d.ts index b1b093ef77..9b4fbe5e89 100644 --- a/types/owl.carousel/index.d.ts +++ b/types/owl.carousel/index.d.ts @@ -61,6 +61,7 @@ declare namespace OwlCarousel { dotsContainer?: string | boolean; checkVisible?: boolean; slideTransition?: string; + autoHeight?: boolean; // CLASSES refreshClass?: string; loadingClass?: string; diff --git a/types/parse-git-config/index.d.ts b/types/parse-git-config/index.d.ts index b3302106b0..3ca55b897a 100644 --- a/types/parse-git-config/index.d.ts +++ b/types/parse-git-config/index.d.ts @@ -39,7 +39,7 @@ interface Parse { /** * Returns an object with only the properties that had ini-style keys converted to objects. */ - keys(config: Config): Config; + expandKeys(config: Config): Config; } // no-empty-interface is disabled for a better debugging experience. Empty interfaces are used to alias a type alias. @@ -49,6 +49,8 @@ interface Options extends Pick<_Options, keyof _Options> { } interface _Options { cwd: string; path: string; + include?: boolean; + expandKeys?: boolean; } type ParseCallback = ((err: Error | null, config: Config) => void); diff --git a/types/parse-git-config/parse-git-config-tests.ts b/types/parse-git-config/parse-git-config-tests.ts index c5ce43040a..a6d2a4c983 100644 --- a/types/parse-git-config/parse-git-config-tests.ts +++ b/types/parse-git-config/parse-git-config-tests.ts @@ -99,12 +99,12 @@ function test_sync() { } } -function test_keys() { +function test_expandKeys() { const config = { 'foo "bar"': { doStuff: true }, 'foo "baz"': { doStuff: true } }; - const keys = parse.keys(config); + const keys = parse.expandKeys(config); keys.foo.bar.doStuff === true; keys.foo.baz.doStuff === true; diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index ddecfe843b..0dbf5def5b 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -626,7 +626,7 @@ declare namespace PouchDB { }; } - interface Database { + interface Database extends EventEmitter { /** The name passed to the PouchDB constructor and unique identifier of the database. */ name: string; diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index fe79997461..f8accd1c3a 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -114,6 +114,8 @@ function testBasics() { const db = new PouchDB(); + db.on("closed", () => {}); + db.post(model).then((result) => { isString(result.id); }); diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index 4fdeef44a0..0eda9a4eff 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -43,7 +43,7 @@ export interface KeyboardStatic { } export interface ClipboardStatic { - convert(html: string|Blot): DeltaStatic; + convert(html?: string): DeltaStatic; addMatcher(selectorOrNodeType: string|number, callback: (node: any, delta: DeltaStatic) => DeltaStatic): void; dangerouslyPasteHTML(html: string, source?: Sources): void; dangerouslyPasteHTML(index: number, html: string, source?: Sources): void; diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index 96527a8158..073e68f115 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -148,6 +148,7 @@ function test_setHtmlContents() { const html = "this is a bold text"; const delta = quillEditor.clipboard.convert(html); quillEditor.setContents(delta); + quillEditor.clipboard.convert(); } function test_getSelection() { diff --git a/types/radium/index.d.ts b/types/radium/index.d.ts index 6e46ce4ddd..d8d56caf26 100644 --- a/types/radium/index.d.ts +++ b/types/radium/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for radium 0.24.0 // Project: https://github.com/formidablelabs/radium -// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov , Mikael Hermansson +// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index 7cee82930b..23e542d322 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -86,6 +86,7 @@ export interface ReactDatePickerProps { startDate?: moment.Moment; startOpen?: boolean; tabIndex?: number; + timeCaption?: string; timeFormat?: string; timeIntervals?: number; title?: string; diff --git a/types/react-i18next/index.d.ts b/types/react-i18next/index.d.ts index e7b9c88526..979c648f50 100644 --- a/types/react-i18next/index.d.ts +++ b/types/react-i18next/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Giedrius Grabauskas // Simon Baumann // Benedict Etzel +// Wu Haotian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-i18next/src/I18n.d.ts b/types/react-i18next/src/I18n.d.ts index 6bc1cf8f0f..91de868caf 100644 --- a/types/react-i18next/src/I18n.d.ts +++ b/types/react-i18next/src/I18n.d.ts @@ -15,7 +15,7 @@ export interface i18nProps { i18n?: i18n; initialI18nStore?: any; initialLanguage?: string; - children: (t: TranslationFunction, options: Options) => JSX.Element; + children: (t: TranslationFunction, options: Options) => React.ReactNode; } export default class I18n extends React.Component { } diff --git a/types/react-i18next/src/I18nextProvider.d.ts b/types/react-i18next/src/I18nextProvider.d.ts index 2cd4e333e3..2db5d0361b 100644 --- a/types/react-i18next/src/I18nextProvider.d.ts +++ b/types/react-i18next/src/I18nextProvider.d.ts @@ -6,7 +6,7 @@ export interface I18nextProviderProps { i18n: i18n; initialI18nStore?: any; initialLanguage?: string; - children: JSX.Element; + children: React.ReactNode; } export default class I18nextProvider extends React.Component { } diff --git a/types/react-i18next/test/react-i18next-tests.tsx b/types/react-i18next/test/react-i18next-tests.tsx index d3afe7643a..30b95ece24 100644 --- a/types/react-i18next/test/react-i18next-tests.tsx +++ b/types/react-i18next/test/react-i18next-tests.tsx @@ -107,6 +107,10 @@ class App extends React.Component { ; + + 123 +; + loadNamespaces({components: [App], i18n}).then(() => { }).catch(error => { }); @@ -182,6 +186,10 @@ interface CustomTranslateFunctionProps { } ; + + {t => '123'} +; + const defaults: ReactI18NextOptions = { wait: true, withRef: true, diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 1713cd7eee..51c5ea3528 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -20,6 +20,7 @@ // Luca Campana // Ullrich Schaefer // Linus Unnebäck +// Jake // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -442,6 +443,7 @@ export type NavigationStackAction = | NavigationBackAction | NavigationSetParamsAction | NavigationResetAction + | NavigationReplaceAction | NavigationPopAction | NavigationPushAction | NavigationPopToTopAction; diff --git a/types/react-resize-detector/index.d.ts b/types/react-resize-detector/index.d.ts old mode 100644 new mode 100755 index ee9341a358..68f0382dba --- a/types/react-resize-detector/index.d.ts +++ b/types/react-resize-detector/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for react-resize-detector 2.2 +// Type definitions for react-resize-detector 3.1 // Project: https://github.com/maslianok/react-resize-detector -// Definitions by: Matthew James , James Greenleaf +// Definitions by: Matthew James +// James Greenleaf +// Remin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -8,7 +10,7 @@ import * as React from "react"; interface ReactResizeDetectorProps extends React.Props { /** Function that will be invoked with width and height arguments */ - onResize: (width: number, height: number) => void; + onResize?: (width: number, height: number) => void; /** Trigger onResize on height change. Default: false */ handleHeight?: boolean; /** Trigger onResize on width change. Default: false */ @@ -18,11 +20,18 @@ interface ReactResizeDetectorProps extends React.Props { /** Id of the element we want to observe. If none provided, parentElement of the component will be used. Default: "" */ resizableElementId?: string; /** Possible values: throttle and debounce */ - refreshMode?: 'throttle' | 'debounce'; + refreshMode?: "throttle" | "debounce"; /** Makes sense only when refreshMode is set. Default: 1000. */ refreshRate?: number; + + render?: (props: any) => React.ReactNode; } declare class ReactResizeDetector extends React.PureComponent { } +export declare function withResizeDetector( + WrappedComponent: React.ReactNode, + props?: ReactResizeDetectorProps +): React.Component; + export default ReactResizeDetector; diff --git a/types/react-resize-detector/react-resize-detector-tests.tsx b/types/react-resize-detector/react-resize-detector-tests.tsx old mode 100644 new mode 100755 index 42a76d8a52..d6e471f340 --- a/types/react-resize-detector/react-resize-detector-tests.tsx +++ b/types/react-resize-detector/react-resize-detector-tests.tsx @@ -2,8 +2,11 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; +import ReactResizeDetector, { withResizeDetector } from "react-resize-detector"; -import ReactResizeRouter from "react-resize-detector"; +const CustomComponent = ({ width, height }: any) => ( +
{`${width}x${height}`}
+); class App extends React.PureComponent { constructor(props: {}) { @@ -13,17 +16,38 @@ class App extends React.PureComponent { } render(): JSX.Element { - return
-
Some child content
- -
; + return ( +
+
Some child content
+ + + {(width: number, height: number) => ( +
{`${width}x${height}`}
+ )} +
+ + + + {withResizeDetector(CustomComponent)} + ( +
+ Width:{width}, Height:{height} +
+ )} + /> +
+ ); } private handleResize(width: number, height: number) { diff --git a/types/react-select/lib/Creatable.d.ts b/types/react-select/lib/Creatable.d.ts index ac67bf039c..5cae63021c 100644 --- a/types/react-select/lib/Creatable.d.ts +++ b/types/react-select/lib/Creatable.d.ts @@ -11,13 +11,13 @@ export interface CreatableProps { allowCreateWhileLoading?: boolean; /* Gets the label for the "create new ..." option in the menu. Is given the current input value. */ - formatCreateLabel?: (inputValue: string) => Node; + formatCreateLabel?: (inputValue: string) => React.ReactNode; /* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array. */ isValidNewOption?: (inputValue: string, value: ValueType, options: OptionsType) => boolean; /* Returns the data for the new option when it is created. Used to display the value, and is passed to `onChange`. */ - getNewOptionData?: (inputValue: string, optionLabel: Node) => OptionType; + getNewOptionData?: (inputValue: string, optionLabel: React.ReactNode) => OptionType; /* If provided, this will be called with the input value when a new option is created, and `onChange` will **not** be called. Use this when you need more control over what happens when new options are created. */ diff --git a/types/react-select/lib/Select.d.ts b/types/react-select/lib/Select.d.ts index 3e89a139ac..aa8524103e 100644 --- a/types/react-select/lib/Select.d.ts +++ b/types/react-select/lib/Select.d.ts @@ -107,7 +107,7 @@ export interface Props { /* Formats group labels in the menu as React components */ formatGroupLabel?: typeof formatGroupLabel; /* Formats option labels in the menu and control as React components */ - formatOptionLabel?: (option: OptionType, labelMeta: FormatOptionLabelMeta) => Node; + formatOptionLabel?: (option: OptionType, labelMeta: FormatOptionLabelMeta) => React.ReactNode; /* Resolves option data to a string to be displayed as the label by components */ getOptionLabel?: typeof getOptionLabel; /* Resolves option data to a string to compare options and specify value attributes */ @@ -311,7 +311,7 @@ export default class Select extends React.Component void; setValue: (newValue: ValueType, action: ActionTypes, option?: OptionType) => void; selectProps: Readonly<{ - children?: Node; + children?: React.ReactNode; }> & Readonly>; }; @@ -343,8 +343,8 @@ export default class Select extends React.Component): boolean; isOptionSelected(option: OptionType, selectValue: OptionsType): boolean; filterOption(option: {}, inputValue: string): boolean; - formatOptionLabel(data: OptionType, context: FormatOptionLabelContext): Node; - formatGroupLabel(data: GroupType): Node; + formatOptionLabel(data: OptionType, context: FormatOptionLabelContext): React.ReactNode; + formatGroupLabel(data: GroupType): React.ReactNode; // ============================== // Mouse Handlers @@ -406,14 +406,14 @@ export default class Select extends React.Component | null; - renderClearIndicator(): Node; - renderLoadingIndicator(): Node; - renderIndicatorSeparator(): Node; - renderDropdownIndicator(): Node; - renderMenu(): Node; - renderFormField(): Node; + renderClearIndicator(): React.ReactNode; + renderLoadingIndicator(): React.ReactNode; + renderIndicatorSeparator(): React.ReactNode; + renderDropdownIndicator(): React.ReactNode; + renderMenu(): React.ReactNode; + renderFormField(): React.ReactNode; - renderLiveRegion(): Node; + renderLiveRegion(): React.ReactNode; } diff --git a/types/react-select/lib/builtins.d.ts b/types/react-select/lib/builtins.d.ts index b1e1c37cc8..5d404230cd 100644 --- a/types/react-select/lib/builtins.d.ts +++ b/types/react-select/lib/builtins.d.ts @@ -1,7 +1,7 @@ -import { ReactNode as Node } from 'react'; +import { ReactNode } from 'react'; import { GroupType } from './types'; -export function formatGroupLabel(group: GroupType): Node; +export function formatGroupLabel(group: GroupType): ReactNode; export function getOptionLabel(option: any): string; diff --git a/types/react-select/lib/components/Control.d.ts b/types/react-select/lib/components/Control.d.ts index c48dee76d4..8a9513197b 100644 --- a/types/react-select/lib/components/Control.d.ts +++ b/types/react-select/lib/components/Control.d.ts @@ -1,4 +1,4 @@ -import { ComponentType, ReactNode as Node, Ref as ElementRef } from 'react'; +import { ComponentType, ReactNode, Ref as ElementRef } from 'react'; import { borderRadius, colors, spacing } from '../theme'; import { CommonProps, PropsWithStyles } from '../types'; @@ -14,7 +14,7 @@ export type ControlProps = CommonProps & PropsWithStyles & State & { /** Children to render. */ - children: Node, + children: ReactNode, innerRef: ElementRef, /** The mouse down event and the innerRef to pass down to the controller element. */ innerProps: { diff --git a/types/react-select/lib/components/Group.d.ts b/types/react-select/lib/components/Group.d.ts index 9e05263224..39c3489bce 100644 --- a/types/react-select/lib/components/Group.d.ts +++ b/types/react-select/lib/components/Group.d.ts @@ -1,15 +1,15 @@ -import { ReactNode as Node, ComponentType } from 'react'; +import { ReactNode, ComponentType } from 'react'; import { spacing } from '../theme'; import { CommonProps } from '../types'; interface ComponentProps { /** The children to be rendered. */ - children: Node; + children: ReactNode; /** Component to wrap the label, recieves headingProps. */ Heading: ComponentType; /** Label to be displayed in the heading component. */ - label: Node; + label: ReactNode; } export type GroupProps = CommonProps & ComponentProps; diff --git a/types/react-select/lib/components/Menu.d.ts b/types/react-select/lib/components/Menu.d.ts index d91288cdeb..0af2bf16c1 100644 --- a/types/react-select/lib/components/Menu.d.ts +++ b/types/react-select/lib/components/Menu.d.ts @@ -2,7 +2,7 @@ import { Component, ReactElement, Ref as ElementRef, - ReactNode as Node, + ReactNode, ComponentType } from 'react'; import { createPortal } from 'react-dom'; @@ -89,7 +89,7 @@ interface MenuListState { export interface MenuListProps { /** The children to be rendered. */ - children: Node; + children: ReactNode; /** Inner ref to DOM Node */ innerRef: InnerRef; } @@ -108,7 +108,7 @@ export function loadingMessageCSS(): React.CSSProperties; export type NoticeProps = CommonProps & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** Props to be passed on to the wrapper. */ innerProps: { [key: string]: any }, }; @@ -129,7 +129,7 @@ export const LoadingMessage: ComponentType>; export type MenuPortalProps = CommonProps & { appendTo: HTMLElement, - children: Node, // ideally Menu + children: ReactNode, // ideally Menu controlElement: HTMLElement, menuPlacement: MenuPlacement, menuPosition: MenuPosition, diff --git a/types/react-select/lib/components/MultiValue.d.ts b/types/react-select/lib/components/MultiValue.d.ts index ac304bd42a..59974fbc46 100644 --- a/types/react-select/lib/components/MultiValue.d.ts +++ b/types/react-select/lib/components/MultiValue.d.ts @@ -1,10 +1,10 @@ -import { ComponentType, Component, ReactNode as Node } from 'react'; +import { ComponentType, Component, ReactNode } from 'react'; import { borderRadius, colors, spacing } from '../theme'; import { CommonProps } from '../types'; export type MultiValueProps = CommonProps &{ - children: Node, + children: ReactNode, components: any, cropWithEllipsis: boolean, data: OptionType, @@ -23,7 +23,7 @@ export function multiValueLabelCSS(props: MultiValueProps): React.CSSProper export function multiValueRemoveCSS(props: MultiValueProps): React.CSSProperties; export interface MultiValueGenericProps { - children: Node; + children: ReactNode; data: OptionType; innerProps: { className?: string }; selectProps: any; @@ -33,7 +33,7 @@ export const MultiValueGeneric: ComponentType>; export const MultiValueContainer: typeof MultiValueGeneric; export const MultiValueLabel: typeof MultiValueGeneric; export type MultiValueRemoveProps = CommonProps & { - children: Node, + children: ReactNode, innerProps: { className: string, onTouchEnd: (event: any) => void, @@ -44,7 +44,7 @@ export type MultiValueRemoveProps = CommonProps & { }; export class MultiValueRemove extends Component> { static defaultProps: { - children: Node, + children: ReactNode, }; } diff --git a/types/react-select/lib/components/Option.d.ts b/types/react-select/lib/components/Option.d.ts index 81ab38e401..defe37711a 100644 --- a/types/react-select/lib/components/Option.d.ts +++ b/types/react-select/lib/components/Option.d.ts @@ -1,4 +1,4 @@ -import { ComponentType, ReactNode as Node, MouseEventHandler } from 'react'; +import { ComponentType, ReactNode, MouseEventHandler } from 'react'; import { colors, spacing } from '../theme'; import { CommonProps, PropsWithStyles, InnerRef } from '../types'; @@ -22,7 +22,7 @@ export type OptionProps = PropsWithStyles & CommonProps & State & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** Inner ref to DOM Node */ innerRef: InnerRef, /** props passed to the wrapping element for the group. */ diff --git a/types/react-select/lib/components/Placeholder.d.ts b/types/react-select/lib/components/Placeholder.d.ts index 6f674d70a8..1a72bd69a7 100644 --- a/types/react-select/lib/components/Placeholder.d.ts +++ b/types/react-select/lib/components/Placeholder.d.ts @@ -1,11 +1,11 @@ -import { ComponentType, ReactNode as Node } from 'react'; +import { ComponentType, ReactNode } from 'react'; import { colors, spacing } from '../theme'; import { CommonProps } from '../types'; export type PlaceholderProps = CommonProps & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** props passed to the wrapping element for the group. */ innerProps: { [key: string]: any }, }; diff --git a/types/react-select/lib/components/containers.d.ts b/types/react-select/lib/components/containers.d.ts index e75de6d756..c72609bf31 100644 --- a/types/react-select/lib/components/containers.d.ts +++ b/types/react-select/lib/components/containers.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode as Node, ComponentType } from 'react'; +import { Component, ReactNode, ComponentType } from 'react'; import { spacing } from '../theme'; import { CommonProps, KeyboardEventHandler } from '../types'; @@ -16,7 +16,7 @@ export interface ContainerState { export type ContainerProps = CommonProps & ContainerState & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** Inner props to be passed down to the container. */ innerProps: { onKeyDown: KeyboardEventHandler }, }; @@ -33,7 +33,7 @@ export type ValueContainerProps = CommonProps & { /** Whether the value container currently holds a value. */ hasValue: boolean, /** The children to be rendered. */ - children: Node, + children: ReactNode, }; export function valueContainerCSS(): React.CSSProperties; export class ValueContainer extends Component> {} @@ -50,7 +50,7 @@ export interface IndicatorsState { export type IndicatorContainerProps = CommonProps & IndicatorsState & { /** The children to be rendered. */ - children: Node, + children: ReactNode, }; export function indicatorsContainerCSS(): React.CSSProperties; diff --git a/types/react-transition-group/Transition.d.ts b/types/react-transition-group/Transition.d.ts index 123f8b1622..f8722a41d8 100644 --- a/types/react-transition-group/Transition.d.ts +++ b/types/react-transition-group/Transition.d.ts @@ -16,7 +16,13 @@ export interface TransitionActions { exit?: boolean; } -export type TransitionChildren = React.ReactNode | ((status: string) => React.ReactNode); +type TransitionStatus = + typeof ENTERING | + typeof ENTERED | + typeof EXITING | + typeof EXITED | + typeof UNMOUNTED; +export type TransitionChildren = React.ReactNode | ((status: TransitionStatus) => React.ReactNode); export interface TransitionProps extends TransitionActions { in?: boolean; mountOnEnter?: boolean; diff --git a/types/react-transition-group/index.d.ts b/types/react-transition-group/index.d.ts index 785e1f1941..2d97f64ce6 100644 --- a/types/react-transition-group/index.d.ts +++ b/types/react-transition-group/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/reactjs/react-transition-group // Definitions by: Karol Janyst // Epskampie +// Masafumi Koba // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-transition-group/react-transition-group-tests.tsx b/types/react-transition-group/react-transition-group-tests.tsx index ce096f3dc7..172d91ce54 100644 --- a/types/react-transition-group/react-transition-group-tests.tsx +++ b/types/react-transition-group/react-transition-group-tests.tsx @@ -52,7 +52,16 @@ const Test: React.StatelessComponent = () => {
{ "test" }
- {(status) =>
{status}
} + {(status) => { + switch (status) { + case ENTERING: + case ENTERED: + case EXITING: + case EXITED: + case UNMOUNTED: + return
{status}
; + } + }}
void; + onChildScroll: (params: { scrollTop: number }) => void; }; export type WindowScrollerProps = { /** * Function responsible for rendering children. * This function should implement the following signature: - * ({ height, isScrolling, scrollLeft, scrollTop, width }) => PropTypes.element + * ({ height, isScrolling, scrollLeft, scrollTop, width, onChildScroll }) => PropTypes.element */ - children: ( - params: { - onChildScroll: (params: { scrollTop: number }) => void; - registerChild: (params?: Element) => void; - height: number; - isScrolling: boolean; - scrollLeft: number; - scrollTop: number; - width: number; - } - ) => React.ReactNode; + children: (params: WindowScrollerChildProps) => React.ReactNode; /** Callback to be invoked on-resize: ({ height, width }) */ onResize?: (params: { height: number; width: number }) => void; diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index b7c557d875..4cbc644bc8 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -7,6 +7,7 @@ // Kræn Hansen // Steve Zhang // Maciej Goszczycki +// Brandon Hall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/redom/index.d.ts b/types/redom/index.d.ts index 2814b63c61..fde67bfb12 100644 --- a/types/redom/index.d.ts +++ b/types/redom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redom 3.6 +// Type definitions for redom 3.12 // Project: https://github.com/redom/redom/ // Definitions by: Rauli Laine // Felix Nehrke diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index f421303f94..8c3ddc35f8 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for @storybook/addon-knobs 3.3 +// Type definitions for @storybook/addon-knobs 3.4 // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Martynas Kadisa +// A.MacLeay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -49,11 +50,14 @@ export function object(name: string, value: T, groupId?: string): T; export type SelectValue = string | number; export function select(name: string, options: { [s: string]: string }, value: T, groupId?: string): T; export function select(name: string, options: { [s: number]: string }, value: T, groupId?: string): T; -export function select(name: string, options: T[], value: T, groupId?: string): T; +export function select(name: string, options: ReadonlyArray, value: T, groupId?: string): T; + +export function selectV2(name: string, options: { [s: string]: T | T[] }, value: T | T[], groupId?: string): T; +export function selectV2(name: string, options: T[], value: T, groupId?: string): T; export function date(name: string, value?: Date, groupId?: string): Date; -export function array(name: string, value: T[], separator?: string, groupId?: string): T[]; +export function array(name: string, value: ReadonlyArray, separator?: string, groupId?: string): T[]; export function button(name: string, handler: () => any, groupId?: string): void; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index c35268ac6b..85155fc5c7 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -14,6 +14,7 @@ import { array, button, knob, + selectV2, } from '@storybook/addon-knobs'; enum SomeEnum { @@ -49,13 +50,16 @@ stories.add('with all knobs', () => { type X = 'a' | 'b'; - const genericSelect: X = select('Some generic select', { a: 'type a', b: 'type b'}, 'b'); + const genericSelect: X = select('Some generic select', { a: 'type a', b: 'type b' }, 'b'); const enumSelectOptions: { [s: number]: string } = {}; enumSelectOptions[SomeEnum.Type1] = "Type 1"; enumSelectOptions[SomeEnum.Type2] = "Type 2"; const genericSelect2: SomeEnum = select('Some generic select', enumSelectOptions, SomeEnum.Type1); + const genericSelectV2: X = selectV2('Some generic select', { 'type a': 'a', 'type b': 'b' }, 'b'); + const genericSelectV2Enum: SomeEnum = selectV2('Some generic select v2', { 'type a': SomeEnum.Type1, 'type b': SomeEnum.Type2 }, SomeEnum.Type2); + const genericArray: string[] = array('Some generic array', ['red', 'green', 'blue']); const genericKnob: X = knob('Some generic knob', { value: 'a', type: 'text' }); @@ -90,6 +94,14 @@ stories.add('dynamic knobs', () => { ); }); +const readonlyOptionsArray: ReadonlyArray = ['hi']; +select('With readonly array', readonlyOptionsArray, readonlyOptionsArray[0]); + +const genericArray = array('With regular array', ['hi', 'there']); + +const userInputArray = array('With readonly array', readonlyOptionsArray); +userInputArray.push('Make sure that the output is still mutable although the input need not be!'); + // groups const groupId = 'GROUP-ID1'; diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index e05908e579..cc944284e0 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -189,7 +189,7 @@ declare namespace Stripe { * account holder to setup a username and password, and handle all account * management directly with them. Possible values are custom and standard. */ - type: 'custom' | 'standard'; + type: "custom" | "standard"; } interface IAccountShared { @@ -1470,7 +1470,7 @@ declare namespace Stripe { source?: sources.ISourceCreationOptionsExtended; } - interface ICustomerListOptions extends IListOptionsCreated { + interface ICustomerListOptions extends IListOptionsCreated { /** * A filter on the list based on the customer’s email field. The value must be a string. */ @@ -4347,7 +4347,7 @@ declare namespace Stripe { /** * Value is 'card' */ - object: 'card'; + object: "card"; /** * The card number @@ -4680,7 +4680,7 @@ declare namespace Stripe { trial_period_days?: number; /** - * Indicates if a plan’s trial_period_days should be applied to the subscription. Setting trial_end per subscription is preferred, + * Indicates if a plan’s trial_period_days should be applied to the subscription. Setting trial_end per subscription is preferred, * and this defaults to false. Setting this flag to true together with trial_end is not allowed. */ trial_from_plan?: boolean; @@ -5039,6 +5039,11 @@ declare namespace Stripe { * For other types of refunds, it can be pending, succeeded, failed, or canceled. */ status: "pending" | "succeeded" | "failed" | "canceled"; + + /** + * If the refund failed, the reason for refund failure if known. + */ + failure_reason?: "lost_or_stolen_card" | "expired_or_canceled_card" | "unknown"; } interface IRefundCreationOptions extends IDataOptionsWithMetadata { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index ef30b621b2..4e538abddb 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -59,6 +59,7 @@ stripe.charges.create({ // asynchronously called charge.refunds.create().then(function (refund) { + const reason = refund.failure_reason; // asynchronously called }); charge.refunds.create({ amount: 100 }).then(function (refund) { diff --git a/types/timezone-js/index.d.ts b/types/timezone-js/index.d.ts index 5a648ab41e..ee39a7ee7b 100644 --- a/types/timezone-js/index.d.ts +++ b/types/timezone-js/index.d.ts @@ -19,7 +19,7 @@ export declare class Date { setTimezone: (timezone: string) => void; // regular Date members - toString(): string; + toString(format?:string): string; toDateString(): string; toTimeString(): string; toLocaleString(): string; diff --git a/types/velocity-animate/index.d.ts b/types/velocity-animate/index.d.ts index f6b696870f..24dc53b4be 100644 --- a/types/velocity-animate/index.d.ts +++ b/types/velocity-animate/index.d.ts @@ -87,8 +87,8 @@ declare namespace jquery.velocity { interface VelocityStatic { Sequences: any; mock: any; - animate(options: {elements: NodeListOf; properties: Properties; options: Options}): any; - animate(elements: HTMLElement|NodeListOf, properties: Properties, options: Options): any; + animate(options: {elements: HTMLCollection | NodeListOf; properties: Properties; options: Options}): any; + animate(elements: HTMLElement | HTMLCollection | NodeListOf, properties: Properties, options: Options): any; RegisterEffect(name: string, options: RegisterEffectOptions): VelocityStatic; RunSequence(sequence: SequenceCall[]): VelocityStatic; diff --git a/types/vimeo__player/index.d.ts b/types/vimeo__player/index.d.ts index d5f224975e..6fac1db7d9 100755 --- a/types/vimeo__player/index.d.ts +++ b/types/vimeo__player/index.d.ts @@ -1,13 +1,11 @@ -// Type definitions for @vimeo/player 2.0 +// Type definitions for @vimeo/player 2.6.3 // Project: https://github.com/vimeo/player.js // Definitions by: Denis Yılmaz // Felix Albert // Tim Chen +// Terry Mun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function myMethod(a: string): string; -export function myOtherMethod(a: number): number; - export type CallbackFunction = (...args: any[]) => any; export interface Error {name: string; message: string; method: string; } @@ -22,11 +20,12 @@ export interface InvalidCuePoint extends Error {name: "InvalidCuePoint"; message export interface RangeError extends Error {name: "RangeError"; message: string; method: string; } export interface TypeError extends Error {name: "TypeError"; message: string; method: string; } -export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | "cuechange" | "cuepoint" | "volumechange" | "error" | "loaded" | string; +export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | + "cuechange" | "cuepoint" | "volumechange" | "playbackratechange" | "bufferstart" | "bufferend" | "error" | "loaded" | string; export type EventCallback = (data: any) => any; export class Player { - constructor(element: HTMLIFrameElement|HTMLElement|string, options: Options); + constructor(element: HTMLIFrameElement|HTMLElement|string, options?: Options); on(event: EventName, callback: EventCallback): void; off(event: EventName, callback?: EventCallback): void; @@ -51,6 +50,8 @@ export class Player { getLoop(): VimeoPromise; setLoop(loop: boolean): VimeoPromise; getPaused(): VimeoPromise; + getPlaybackRate(): VimeoPromise; + setPlaybackRate(playbackRate: number): VimeoPromise; getTextTracks(): VimeoPromise; getVideoEmbedCode(): VimeoPromise; getVideoId(): VimeoPromise; @@ -85,14 +86,20 @@ export interface Options { url?: string; autopause?: boolean; autoplay?: boolean; + background?: boolean; byline?: boolean; color?: string; height?: number; loop?: boolean; maxheight?: number; maxwidth?: number; + muted?: boolean; + playsinline?: boolean; portrait?: boolean; + responsive?: boolean; + speed?: boolean; title?: boolean; + transparent?: boolean; width?: number; } diff --git a/types/vimeo__player/vimeo__player-tests.ts b/types/vimeo__player/vimeo__player-tests.ts index bf5a637762..0dbba1a3a8 100644 --- a/types/vimeo__player/vimeo__player-tests.ts +++ b/types/vimeo__player/vimeo__player-tests.ts @@ -6,7 +6,21 @@ let player: Player ; player = new Player('handstick', { id: 19231868, - width: 640 + width: 640, + + // Use default values for settings, to test typings + autopause: true, + autoplay: false, + background: false, + byline: true, + color: '#00adef', + loop: false, + muted: false, + playsinline: true, + portrait: true, + speed: false, + title: true, + transparent: true }); const onPlay = (data: any) => { @@ -281,12 +295,33 @@ player.getPaused().then((paused) => { // an error occurred }); +player.getPlaybackRate().then((playbackRate) => { + // playbackRate = a numeric value of the current playback rate +}).catch((error) => { + // an error occurred +}); + +player.setPlaybackRate(0.5).then((playbackRate) => { + // playback rate was set +}).catch((error) => { + switch (error.name) { + case 'RangeError': + // the playback rate was less than 0.5 or greater than 2 + break; + + default: + // some other error occurred + break; + } +}); + player.getTextTracks().then((tracks) => { // tracks = an array of track objects tracks.forEach((track) => { console.log(track.label); console.log(track.kind); console.log(track.language); + console.log(track.mode); }); }).catch((error) => { // an error occurred @@ -436,6 +471,19 @@ player.on('volumechange', (data) => { console.log(data.volume); }); +player.on('playbackratechange', (data) => { + // data is an object containing properties specific to that event + console.log(data.playbackRate); +}); + +player.on('bufferstart', (data) => { + // no associated data with this event +}); + +player.on('bufferend', (data) => { + // no associated data with this event +}); + player.on('error', (data) => { // data is an object containing properties specific to that event console.log(data.message); diff --git a/types/web3/index.d.ts b/types/web3/index.d.ts index c93e9c2ebd..9ddbc7a00b 100644 --- a/types/web3/index.d.ts +++ b/types/web3/index.d.ts @@ -14,6 +14,7 @@ // André Vitor de Lima Matos // Levin Keller // Dmitry Radkovskiy +// Konstantin Melnikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 import BigNumber = require("bn.js"); @@ -34,6 +35,7 @@ declare class Web3 { Shh: new (provider: Provider) => Shh; Bzz: new (provider: Provider) => Bzz; }; + static utils: Utils; constructor(provider?: Provider | string); version: string; BatchRequest: new () => BatchRequest; diff --git a/types/web3/web3-tests.ts b/types/web3/web3-tests.ts index 85e4bc9b0a..fc4be8534a 100644 --- a/types/web3/web3-tests.ts +++ b/types/web3/web3-tests.ts @@ -20,3 +20,4 @@ myContract.options.gas = 5000000; const weiStr: string = web3.utils.toWei("100", "gwei"); const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1")); +const rndHex: string = Web3.utils.randomHex(10); diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index 9ab3292c3b..ba9058a9a0 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -25,6 +25,9 @@ interface GlobalFetch { // variant for navigator.credentials monkey patching fetch(url: Request|string, init?: CMRequestInit): Promise; } +interface WindowOrWorkerGlobalScope { + fetch(url: Request|string, init?: CMRequestInit): Promise; +} /** * Variant of TS 2.2 {@link RequestInit} that permits a diff --git a/types/webappsec-credential-management/webappsec-credential-management-tests.ts b/types/webappsec-credential-management/webappsec-credential-management-tests.ts index 2afa9f8785..9d20ed37dc 100644 --- a/types/webappsec-credential-management/webappsec-credential-management-tests.ts +++ b/types/webappsec-credential-management/webappsec-credential-management-tests.ts @@ -214,7 +214,7 @@ function signOutDeprecated() { } navigator.credentials.requireUserMediation().then(() => { - document.location.assign('/'); + document.location!.assign('/'); }); } @@ -224,7 +224,7 @@ function signOut() { } navigator.credentials.preventSilentAccess().then(() => { - document.location.assign('/'); + document.location!.assign('/'); }); } diff --git a/types/webcomponents.js/webcomponents.js-tests.ts b/types/webcomponents.js/webcomponents.js-tests.ts index 8fb40bd824..2ed224ef23 100644 --- a/types/webcomponents.js/webcomponents.js-tests.ts +++ b/types/webcomponents.js/webcomponents.js-tests.ts @@ -16,7 +16,7 @@ const XFoo = document.registerElement("x-foo", { const xFoo = new XFoo(); xFoo.textContent = ""; -document.body!.appendChild(xFoo); +document.body.appendChild(xFoo); window.CustomElements.hasNative; window.CustomElements.flags; diff --git a/types/webtorrent/webtorrent-tests.ts b/types/webtorrent/webtorrent-tests.ts index d8ffba389d..63a9647902 100644 --- a/types/webtorrent/webtorrent-tests.ts +++ b/types/webtorrent/webtorrent-tests.ts @@ -31,7 +31,7 @@ client.add(magnetURI, {}, torrent => { a.href = url; } a.textContent = 'Download ' + file.name; - document.body!.appendChild(a); + document.body.appendChild(a); }); }); diff --git a/types/zipcodes/index.d.ts b/types/zipcodes/index.d.ts index b1903ad48b..276db5cbac 100644 --- a/types/zipcodes/index.d.ts +++ b/types/zipcodes/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for zipcodes 6.0 +// Type definitions for zipcodes 6.1 // Project: https://github.com/davglass/zipcodes#readme -// Definitions by: Brayden Lopez +// Definitions by: Brayden Lopez , Dobes Vandermeer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace ZipCodes; @@ -14,18 +14,18 @@ export interface ZipCode { country: string; } -export function lookup(zip: any): ZipCode; +export function lookup(zip: string|number): ZipCode | undefined; export function lookupByName(city: string, state: string): ZipCode[]; export function lookupByState(state: string): ZipCode[]; -export function distance(zipA: ZipCode, zipB: ZipCode): number; +export function distance(zipA: string|number, zipB: string|number): number | null; -export function radius(zip: ZipCode, miles: number, full: boolean): string | ZipCode[]; +export function radius(zip: string|number, miles: number, full: boolean): string[] | ZipCode[]; export function toMiles(kilos: number): number; export function toKilometers(miles: number): number; -export function lookupByCoords(lat: number, lon: number): ZipCode; +export function lookupByCoords(lat: number, lon: number): string | null; diff --git a/types/zipcodes/zipcodes-tests.ts b/types/zipcodes/zipcodes-tests.ts index 43bb711474..acaa6a0d46 100644 --- a/types/zipcodes/zipcodes-tests.ts +++ b/types/zipcodes/zipcodes-tests.ts @@ -18,19 +18,19 @@ const zipB: ZipCodes.ZipCode = { country: 'US' }; -ZipCodes.lookup(zipA); // $ExpectType ZipCode +ZipCodes.lookup(zipA.zip); // $ExpectType ZipCode | undefined ZipCodes.lookupByName('Cupertino', 'CA'); // $ExpectType ZipCode[] ZipCodes.lookupByState('CA'); // $ExpectType ZipCode[] -ZipCodes.distance(zipA, zipB); // $ExpectType number +ZipCodes.distance(zipA.zip, zipB.zip); // $ExpectType number | null -ZipCodes.radius(zipA, 1, true); // $ExpectType string | ZipCode[] -ZipCodes.radius(zipA, 1, false); // $ExpectType string | ZipCode[] +ZipCodes.radius(zipA.zip, 1, true); // $ExpectType ZipCode[] | string[] +ZipCodes.radius(zipA.zip, 1, false); // $ExpectType ZipCode[] | string[] ZipCodes.toMiles(3); // $ExpectType number ZipCodes.toKilometers(3); // $ExpectType number -ZipCodes.lookupByCoords(37.323, -122.0527); // $ExpectType ZipCode +ZipCodes.lookupByCoords(37.323, -122.0527); // $ExpectType string | null