diff --git a/types/ace/index.d.ts b/types/ace/index.d.ts index 822c394a32..1f7dd9752b 100644 --- a/types/ace/index.d.ts +++ b/types/ace/index.d.ts @@ -52,6 +52,10 @@ declare namespace AceAjax { export interface TokenInfo { value: string; + + index?: number; + + start?: number; } export interface Position { @@ -575,7 +579,7 @@ declare namespace AceAjax { * @param row The row number to retrieve from * @param column The column number to retrieve from **/ - getTokenAt(row: number, column: number): TokenInfo; + getTokenAt(row: number, column: number): TokenInfo|null; /** * Sets the undo manager. diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index a7a9ea350b..97844cfbbb 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -5,6 +5,7 @@ // Marshall Cottrell // Weeco // Gabriel Terwesten +// Oleg Repin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -51,6 +52,8 @@ declare namespace Bull { settings?: AdvancedSettings; limiter?: RateLimiter; + + defaultJobOptions?: JobOptions; } interface AdvancedSettings { diff --git a/types/dragula/index.d.ts b/types/dragula/index.d.ts index f91e8b70ac..51998fb583 100644 --- a/types/dragula/index.d.ts +++ b/types/dragula/index.d.ts @@ -13,7 +13,7 @@ declare namespace dragula { interface DragulaOptions { containers?: Element[]; isContainer?: (el?: Element) => boolean; - moves?: (el?: Element, container?: Element, handle?: Element) => boolean; + moves?: (el?: Element, container?: Element, handle?: Element, sibling?: Element) => boolean; accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean; invalid?: (el?: Element, target?: Element) => boolean; direction?: string; diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 51824fc932..2cf61a9362 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -500,7 +500,7 @@ interface PromiseConstructor { /** * Creates a new Promise. * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, + * a resolve callback used to resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 90f6ffbd03..8422f3ec5c 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -152,7 +152,7 @@ interface JQueryStatic { * @since 1.4 */ (selector_object_callback?: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery | - JQuery.PlainObject | + JQuery.PlainObject | Window | ((this: Document, $: JQueryStatic) => void)): JQuery; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. diff --git a/types/kurento-utils/index.d.ts b/types/kurento-utils/index.d.ts index 8074661881..a8a30005b6 100644 --- a/types/kurento-utils/index.d.ts +++ b/types/kurento-utils/index.d.ts @@ -1,10 +1,13 @@ -// Type definitions for kurento-utils 6.6 +// Type definitions for kurento-utils 6.7 // Project: https://github.com/Kurento/kurento-utils-js // Definitions by: Miloslav Nenadál +// Benjamin Riggs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export class WebRtcPeer { +import { EventEmitter } from 'events'; + +export class WebRtcPeer extends EventEmitter { /** * Using this property the user can get the peerConnection and use it directly. */ @@ -60,7 +63,7 @@ export class WebRtcPeer { */ addIceCandidate: ( iceCandidate: RTCIceCandidate, - callback?: () => void + callback?: (error: string | undefined) => void ) => void; /** * Using this method the user can get peerconnection’s local session descriptor. @@ -73,8 +76,9 @@ export class WebRtcPeer { /** * Creates an offer that is a request to find a remote peer with a specific configuration. */ - generateOffer: (error: string | undefined, sdp: string) => void; - + generateOffer: ( + callback: (error: string | undefined, sdp: string) => void + ) => void; /** * Create a WebRtcPeer as receive only. */ diff --git a/types/kurento-utils/kurento-utils-tests.ts b/types/kurento-utils/kurento-utils-tests.ts index 5866a2e157..380b1b1019 100644 --- a/types/kurento-utils/kurento-utils-tests.ts +++ b/types/kurento-utils/kurento-utils-tests.ts @@ -4,6 +4,10 @@ import * as kurentoUtils from 'kurento-utils'; const peer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv({}, error => {}); peer.showLocalVideo(); peer.getLocalStream().getAudioTracks(); + peer.generateOffer((error, sdp) => {}); + peer.on('icecandidate', (candidate: any) => { + peer.addIceCandidate(candidate, error => {}); + }); peer.getRemoteStream().getAudioTracks(); peer.processAnswer('answer', error => {}); peer.processOffer('offer', (error, {}) => {}); diff --git a/types/react-avatar-editor/index.d.ts b/types/react-avatar-editor/index.d.ts new file mode 100644 index 0000000000..a3bbf49f3b --- /dev/null +++ b/types/react-avatar-editor/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for react-avatar-editor 10.3 +// Project: https://github.com/mosch/react-avatar-editor +// Definitions by: Diogo Corrêa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +export interface ImageState { + height: number; + width: number; + x: number; + y: number; + resource: ImageData; +} + +export interface CroppedRect { + x: number; + y: number; + width: number; + height: number; +} + +export interface AvatarEditorProps { + image: string | File; + width?: number; + height?: number; + border?: number | number[]; + borderRadius?: number; + color?: number[]; + style?: object; + scale?: number; + position?: object; + rotate?: number; + crossOrigin?: string; + disableDrop?: boolean; + onDropFile?(event: DragEvent): void; + onLoadFailure?(event: Event): void; + onLoadSuccess?(imgInfo: ImageState): void; + onImageReady?(event: Event): void; + onMouseUp?(): void; + onMouseMove?(event: Event): void; + onImageChange?(): void; + onPositionChange?(): void; +} + +export default class AvatarEditor extends React.Component { + static getImage(): HTMLCanvasElement; + static getImageScaledToCanvas(): HTMLCanvasElement; + static getCroppingRect(): CroppedRect; +} diff --git a/types/react-avatar-editor/react-avatar-editor-tests.tsx b/types/react-avatar-editor/react-avatar-editor-tests.tsx new file mode 100644 index 0000000000..063d083f3f --- /dev/null +++ b/types/react-avatar-editor/react-avatar-editor-tests.tsx @@ -0,0 +1,47 @@ +import * as React from "react"; +import AvatarEditor, { ImageState, CroppedRect } from "react-avatar-editor"; + +const file: File = new File(["str"], "image.jpg"); +const image: ImageData = new ImageData(1, 2); +const imageState: ImageState = { + height: 1, + width: 1, + x: 1, + y: 1, + resource: image +}; + +class AvatarEditorTest extends React.Component { + render() { + return ( +
+ + + + + + + + + + + + + + + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> +
+ ); + } +} + +const getImage: HTMLCanvasElement = AvatarEditor.getImage(); +const getImageScaledToCanvas: HTMLCanvasElement = AvatarEditor.getImageScaledToCanvas(); +const getCroppingRect: CroppedRect = AvatarEditor.getCroppingRect(); diff --git a/types/react-avatar-editor/tsconfig.json b/types/react-avatar-editor/tsconfig.json new file mode 100644 index 0000000000..b947d3271a --- /dev/null +++ b/types/react-avatar-editor/tsconfig.json @@ -0,0 +1,25 @@ +{ + "files": [ + "index.d.ts", + "react-avatar-editor-tests.tsx" + ], + "compilerOptions": { + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-avatar-editor/tslint.json b/types/react-avatar-editor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-avatar-editor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index 4ef00ecb09..038a9d48e6 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ -// Definitions by: Alex Gorbatchev +// Definitions by: Alex Gorbatchev , Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -40,6 +40,9 @@ declare module "rethinkdb" { export function asc(property: string): Sort; export function desc(property: string): Sort; + export function point(lng: number, lat: number): Point; + export function polygon(...point: Point[]): Polygon; + export var count: Aggregator; export function sum(prop: string): Aggregator; export function avg(prop: string): Aggregator; @@ -233,7 +236,13 @@ declare module "rethinkdb" { * See: https://rethinkdb.com/api/javascript/has_fields/ */ hasFields(...fields: string[]): T; - } + } + + interface Geometry { } + + interface Point { } + + interface Polygon extends Geometry { } interface Table extends Sequence, HasFields { indexCreate(name: string, index?: ExpressionFunction): Operation; @@ -247,6 +256,7 @@ declare module "rethinkdb" { get(key: string): Operation & Writeable; getAll(key: string, index?: Index): Sequence; // without index defaults to primary key getAll(...keys: string[]): Sequence; + getIntersecting(geometry: Geometry, index: Index): Sequence; wait(WaitOptions?: WaitOptions): WaitResult; } diff --git a/types/rsync/index.d.ts b/types/rsync/index.d.ts index e86d22647a..b67932eb5a 100644 --- a/types/rsync/index.d.ts +++ b/types/rsync/index.d.ts @@ -48,7 +48,7 @@ interface Rsync { stdout: StreamDataHandler, stderr: StreamDataHandler ): child_process.ChildProcess; - + // cwd cwd(cwd: string): string; @@ -63,6 +63,7 @@ interface Rsync { quiet(): Rsync; dirs(): Rsync; links(): Rsync; + chmod(flags: string): Rsync; dry(): Rsync; // accessor methods diff --git a/types/rsync/rsync-tests.ts b/types/rsync/rsync-tests.ts index 41ec4dd9b1..fe9bf39558 100644 --- a/types/rsync/rsync-tests.ts +++ b/types/rsync/rsync-tests.ts @@ -114,6 +114,7 @@ rsync.shell('ssh') .quiet() .dirs() .links() + .chmod("ug=rwX") .dry(); @@ -152,4 +153,4 @@ rsync.include('/a/file') .include('/b/file'); // as Array -rsync.include(['/a/file', '/b/file']); \ No newline at end of file +rsync.include(['/a/file', '/b/file']); diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index e7d5f9637d..7d72a0b096 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Sequelize 4.27.0 +// Type definitions for Sequelize 4.27.8 // Project: http://sequelizejs.com // Definitions by: samuelneff // Peter Harris @@ -3445,7 +3445,7 @@ declare namespace sequelize { /** * Options for Model.upsert method */ - interface UpsertOptions extends FieldsOptions, LoggingOptions, SearchPathOptions { + interface UpsertOptions extends FieldsOptions, LoggingOptions, SearchPathOptions, ReturningOptions { } /** @@ -4005,8 +4005,10 @@ declare namespace sequelize { * because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know * whether the row was inserted or not. */ - upsert(values: TAttributes, options?: UpsertOptions): Promise; - insertOrUpdate(values: TAttributes, options?: UpsertOptions): Promise; + upsert(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; + upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; + insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; + insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; /** * Create and insert multiple instances in bulk. diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index a6f6cb0038..5d1f6eed34 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1043,7 +1043,9 @@ findOrRetVal = User.findOrCreate( { where : { id : undefined }, defaults : { nam findOrRetVal = User.findOrCreate( { where : { email : 'unique.email.@d.com', companyId : Math.floor( Math.random() * 5 ) } } ); findOrRetVal = User.findOrCreate( { where : { objectId : 1 }, defaults : { bool : false } } ); -User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); +let upsertPromiseNoOptions: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); +let upsertPromiseReturning: Bluebird<[boolean, AnyInstance]> = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: true } ); +let upsertPromiseNotReturning: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: false } ); User.bulkCreate( [{ aNumber : 10 }, { aNumber : 12 }] ).then( ( i ) => i[0].isNewRecord ); User.bulkCreate( [{ username : 'bar' }, { username : 'bar' }, { username : 'bar' }] ); diff --git a/types/showdown/index.d.ts b/types/showdown/index.d.ts index 3a1accb411..948fd966ec 100644 --- a/types/showdown/index.d.ts +++ b/types/showdown/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Showdown 1.7.2 +// Type definitions for Showdown 1.7.3 // Project: https://github.com/coreyti/showdown -// Definitions by: cbowdon , Pei-Tang Huang +// Definitions by: cbowdon , Pei-Tang Huang , Ariel-Saldana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = Showdown; @@ -362,10 +362,21 @@ declare namespace Showdown { */ new (converterOptions?: ConverterOptions): Converter; } + /** + * Helper Interface + */ + interface Helper { + replaceRecursiveRegExp(...args: any[]): string; + } /** Constructor function for a Converter */ var Converter: ConverterStatic; + /** + * Showdown helper + */ + var helper: Helper; + /** * Setting a "global" option affects all instances of showdown */ diff --git a/types/showdown/showdown-tests.ts b/types/showdown/showdown-tests.ts index e0d9093bc1..09a04b920c 100644 --- a/types/showdown/showdown-tests.ts +++ b/types/showdown/showdown-tests.ts @@ -17,6 +17,8 @@ var preloadedExtensions = [ 'my-ext' ], var configuredConverter = new showdown.Converter(); configuredConverter.addExtension({type: 'output', filter: (text, converter)=>{return text.replace('#', '*')}}, 'myext'); +console.log(showdown.helper); + console.log(converter.makeHtml(exampleMarkdown)); // should log '

hello, markdown

' diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index f7003cc638..361ee4c86b 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -7,6 +7,7 @@ // Brannon Jones // Kyle Kamperschroer // Kensuke Hoshikawa +// Thomas Bruun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -4783,6 +4784,12 @@ declare namespace Stripe { * This is the transaction number that appears on email receipts sent for this refund. */ receipt_number: string; + + /** + * Status of the refund. For credit card refunds, this can be succeeded or failed. + * For other types of refunds, it can be pending, succeeded, failed, or canceled. + */ + status: "pending" | "succeeded" | "failed" | "canceled"; } interface IRefundCreationOptions extends IDataOptionsWithMetadata { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index cbc7ccfcb5..1e7b47a3c7 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -66,7 +66,7 @@ stripe.charges.create({ }); charge.refunds.retrieve("re_15jzA4Ee31JkLCeQcxbTbjaL").then(function (refund) { - + var status: "pending" | "succeeded" | "failed" | "canceled" = refund.status; }); charge.refunds.update("re_15jzA4Ee31JkLCeQcxbTbjaL", { metadata: { test: "data" } }).then(function (refund) {