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/amqplib/index.d.ts b/types/amqplib/index.d.ts index 25b0ef04e9..269ed0112e 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for amqplib 0.5 // Project: https://github.com/squaremo/amqp.node -// Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone +// Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone , Nick Zelei // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/amqplib/properties.d.ts b/types/amqplib/properties.d.ts index af90909d8c..9f96b14f5c 100644 --- a/types/amqplib/properties.d.ts +++ b/types/amqplib/properties.d.ts @@ -141,6 +141,52 @@ export namespace Options { export interface Message { content: Buffer; - fields: any; - properties: any; + fields: MessageFields; + properties: MessageProperties; +} + +export interface MessageFields { + deliveryTag: number; + redelivered: boolean; + exchange: string; + routingKey: string; + messageCount: string; +} + +export interface MessageProperties { + contentType: any | undefined; + contentEncoding: any | undefined; + headers: MessagePropertyHeaders; + deliveryMode: any | undefined; + priority: any | undefined; + correlationId: any | undefined; + replyTo: any | undefined; + expiration: any | undefined; + messageId: any | undefined; + timestamp: any | undefined; + type: any | undefined; + userId: any | undefined; + appId: any | undefined; + clusterId: any | undefined; +} + +export interface MessagePropertyHeaders { + "x-first-death-exchange"?: string; + "x-first-death-queue"?: string; + "x-first-death-reason"?: string; + "x-death"?: XDeath[]; + [key: string]: any; +} + +export interface XDeath { + count: number; + reason: "rejected" | "expired" | "maxlen"; + queue: string; + time: { + "!": "timestamp"; + value: number; + }; + exchange: string; + "original-expiration"?: any; + "routing-keys": string[]; } diff --git a/types/braft-editor/braft-editor-tests.tsx b/types/braft-editor/braft-editor-tests.tsx index 999850acaa..48513f6de4 100644 --- a/types/braft-editor/braft-editor-tests.tsx +++ b/types/braft-editor/braft-editor-tests.tsx @@ -12,7 +12,7 @@ class BraftEditorTest extends React.Component { height: 500, initialContent: this.state.content, onChange: this.handleChange, - onHTMLChange: this.handleHTMLChange + onHTMLChange: this.handleHTMLChange, }; return (
diff --git a/types/braft-editor/index.d.ts b/types/braft-editor/index.d.ts index 505403d2f3..1ad5f728ad 100644 --- a/types/braft-editor/index.d.ts +++ b/types/braft-editor/index.d.ts @@ -15,8 +15,8 @@ declare namespace BraftEditor { } interface editorProps { editorState?: any; - contentFormat?: RawDraftContentState; - initialContent?: RawDraftContentState | null; + contentFormat?: 'raw' | 'html'; + initialContent?: string | null; onChange?: (content: RawDraftContentState) => void; onRawChange?: (content: RawDraftContentState) => void; onHTMLChange?: (content: string) => void; 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/chroma-js/chroma-js-tests.ts b/types/chroma-js/chroma-js-tests.ts index 82cfb7274d..fdd1b5946b 100644 --- a/types/chroma-js/chroma-js-tests.ts +++ b/types/chroma-js/chroma-js-tests.ts @@ -1,3 +1,6 @@ +import { Color } from "chroma-js"; +import chroma = require("chroma-js"); + function test_chroma() { chroma('hotpink'); chroma('#ff3399'); @@ -187,3 +190,9 @@ function test_types() { const color: chroma.Color = chroma('orange'); const scale: chroma.Scale = chroma.scale('RdYlBu'); } + +// the following should actually, pass, but TS can't disambiguate between a parameter +// which is passed as undefined/null or not passed at all +// const scaleColors1: Color[] = chroma.scale(['black', 'white']).colors(12); +const scaleColors2: Color[] = chroma.scale(['black', 'white']).colors(12, null); +const scaleColors3: Color[] = chroma.scale(['black', 'white']).colors(12, undefined); diff --git a/types/chroma-js/index.d.ts b/types/chroma-js/index.d.ts index c18484dc1f..797752c8ad 100644 --- a/types/chroma-js/index.d.ts +++ b/types/chroma-js/index.d.ts @@ -303,10 +303,10 @@ declare namespace chroma { * You can call scale.colors(n) to quickly grab `c` equi-distant colors from a color scale. If called with no * arguments, scale.colors returns the original array of colors used to create the scale. */ - colors(c?: number, format?: 'hex' | 'name'): string[]; - colors(c?: number, format?: null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[]; - colors(c?: number, format?: 'luminance' | 'temperature'): number[]; - colors(c?: number, format?: K): Array; + colors(c: number | undefined, format: undefined | null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[]; + colors(c: number | undefined, format: 'luminance' | 'temperature'): number[]; + colors(c: number | undefined, format: K): Array; + colors(c: number | undefined, format?: 'hex' | 'name'): string[]; /** * If you want the scale function to return a distinct set of colors instead of a continuous gradient, you can 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/graphql-resolve-batch/graphql-resolve-batch-tests.ts b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts index 1e9a2395a4..519a3a4088 100644 --- a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts +++ b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts @@ -16,6 +16,17 @@ interface SomeTestResult { someTestResultProp: string; } +const asyncBatchFunction = async (sources: ReadonlyArray) => { + return new Promise(resolve => { + const res = [ + { + someTestResultProp: "" + } + ]; + resolve(res); + }); +}; + const withSourceAndResultTyped = createBatchResolver< SomeTestSource, SomeTestResult @@ -32,40 +43,25 @@ const withSourceAndResultTyped = createBatchResolver< const withSourceAndResultTypedAsPromise = createBatchResolver< SomeTestSource, SomeTestResult ->((sources, _, __) => { +>(async (sources, _, __) => { // $ExpectType ReadonlyArray const verifySources = sources; - - return sources.map(source => { - return new Promise(resolve => { - const res: SomeTestResult = { - someTestResultProp: "" - }; - - resolve(res); - }); - }); + const result = await asyncBatchFunction(sources); + return result; }); const withSourceAndArgsAndResultTyped = createBatchResolver< SomeTestSource, SomeTestResult, SomeTestArgs ->((sources, args, _) => { +>(async (sources, args, _) => { // $ExpectType ReadonlyArray const verifySources = sources; // $ExpectType string const verifyArgs = args.someArg; - return sources.map(source => { - return new Promise(resolve => { - const res: SomeTestResult = { - someTestResultProp: "" - }; - - resolve(res); - }); - }); + const result = await asyncBatchFunction(sources); + return result; }); const withSourceAndArgsAndContextTyped = createBatchResolver< @@ -73,7 +69,7 @@ const withSourceAndArgsAndContextTyped = createBatchResolver< SomeTestResult, SomeTestArgs, SomeTestContext ->((sources, args, context) => { +>(async (sources, args, context) => { // $ExpectType ReadonlyArray const verifySources = sources; // $ExpectType string @@ -81,13 +77,6 @@ const withSourceAndArgsAndContextTyped = createBatchResolver< // $ExpectType string const verifyContext = context.someContextProp; - return sources.map(source => { - return new Promise(resolve => { - const res: SomeTestResult = { - someTestResultProp: "" - }; - - resolve(res); - }); - }); + const result = await asyncBatchFunction(sources); + return result; }); diff --git a/types/graphql-resolve-batch/index.d.ts b/types/graphql-resolve-batch/index.d.ts index 46f354f7b7..e78ddafb37 100644 --- a/types/graphql-resolve-batch/index.d.ts +++ b/types/graphql-resolve-batch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for graphql-resolve-batch 1.0 +// Type definitions for graphql-resolve-batch 1.1 // Project: https://github.com/calebmer/graphql-resolve-batch#readme // Definitions by: Rutger Hendrickx // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -17,10 +17,10 @@ export type ResolverFunction = ( source: TSource, args: TArgs, context: TContext -) => Promise; +) => Promise | Promise; export type BatchResolveFunction = ( sources: ReadonlyArray, args: TArgs, context: TContext -) => TReturn[] | Array>; +) => TReturn[] | Promise; diff --git a/types/johnny-five/index.d.ts b/types/johnny-five/index.d.ts index b8c108f63b..297069f0f1 100644 --- a/types/johnny-five/index.d.ts +++ b/types/johnny-five/index.d.ts @@ -597,12 +597,12 @@ export declare class Pin { mode: number; static write(pin: number, value: number): void; - static read(pin: number, cb: (data: number) => void): void; + static read(pin: number, cb: (error: Error, data: number) => void): void; query(cb: (pin: PinState) => void): void; high(): void; low(): void; write(value: number): void; - read(cb: (value: number) => void): void; + read(cb: (error: Error, value: number) => void): void; on(event: string, cb: () => void): this; on(event: "high", cb: () => void): this; on(event: "low", cb: () => void): this; 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/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 6ea7fea725..b854d92b29 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -18894,6 +18894,7 @@ declare namespace kendo.ooxml { cells?: WorkbookSheetRowCell[]; index?: number; height?: number; + type?: "header" | "footer" | "groupHeader" | "groupFooter" | "data"; } interface WorkbookSheet { 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/openlayers/index.d.ts b/types/openlayers/index.d.ts index 56aaf41a9e..fad339ab44 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -11712,7 +11712,7 @@ declare module olx { } interface DragAndDropOptions { - formatConstructors?: Array<((n: ol.format.Feature) => any)>; + formatConstructors?: Array; projection: ol.ProjectionLike; target?: Element; source?: ol.source.Vector; @@ -12306,7 +12306,7 @@ declare module olx { anchorYUnits?: ol.style.IconAnchorUnits; color?: (ol.Color | string); crossOrigin?: (string); - img?: (any | HTMLCanvasElement); + img?: (HTMLImageElement | HTMLCanvasElement); offset?: number[]; offsetOrigin?: ol.style.IconOrigin; opacity?: number; diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 3941345625..ff37abb4dc 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -1,23 +1,26 @@ // Basic type variables for test functions let anyValue: any; -let numberValue: number; let booleanValue: boolean; -let stringValue: string; -let stringArray: string[]; -let jsonValue: JSON; +let canvas: HTMLCanvasElement; let domEventTarget: EventTarget; -let listener: ol.EventsListenerFunctionType; -let object: { [key: string]: any }; let fn: () => void; +let image: HTMLImageElement; +let jsonValue: JSON; +let listener: ol.EventsListenerFunctionType; +let numberArray: number[]; +let numberValue: number; +let object: { [key: string]: any }; +let stringArray: string[]; +let stringValue: string; // Callback predefinitions for OpenLayers +let coordinateFormatType: ol.CoordinateFormatType; +let drawGeometryFunction: ol.DrawGeometryFunctionType; +let easingFunction: (t: number) => number; +let featureLoader: ol.FeatureLoader; +let featureStyleFunction: ol.FeatureStyleFunction; let preRenderFunction: ol.PreRenderFunction; let transformFunction: ol.TransformFunction; -let coordinateFormatType: ol.CoordinateFormatType; -let featureStyleFunction: ol.FeatureStyleFunction; -let featureLoader: ol.FeatureLoader; -let easingFunction: (t: number) => number; -let drawGeometryFunction: ol.DrawGeometryFunctionType; drawGeometryFunction([0, 0], new ol.geom.Point([0, 0])); drawGeometryFunction([0, 0]); @@ -25,27 +28,29 @@ drawGeometryFunction([0, 0]); let attribution: ol.Attribution; let boundingCoordinates: ol.Coordinate[]; let circle: ol.geom.Circle; +let clusterSource: ol.source.Cluster; let color: ol.Color; let coordinate: ol.Coordinate; let coordinatesArray: ol.Coordinate[]; let coordinatesArrayDim2: ol.Coordinate[][]; -let extent: ol.Extent; -let olEvent: ol.events.Event; let eventKey: ol.EventsKey; let eventKeyArray: ol.EventsKey[]; let eventKeyMixed: ol.EventsKey | ol.EventsKey[]; let eventTarget: ol.events.EventTarget; +let extent: ol.Extent; let feature: ol.Feature; let featureArray: ol.Feature[]; let featureCollection: ol.Collection; let featureFormat: ol.format.Feature; let featureUrlFunction: ol.FeatureUrlFunction; -let graticule: ol.Graticule; let geometriesArray: ol.geom.Geometry[]; let geometry: ol.geom.Geometry; let geometryCollection: ol.geom.GeometryCollection; let geometryLayout: ol.geom.GeometryLayout; let geometryType: ol.geom.GeometryType; +let graticule: ol.Graticule; +let iconAnchorUnits: ol.style.IconAnchorUnits; +let iconOrigin: ol.style.IconOrigin; let linearRing: ol.geom.LinearRing; let lineString: ol.geom.LineString; let loadingStrategy: ol.LoadingStrategy; @@ -54,6 +59,7 @@ let mapBrowserEvent: ol.MapBrowserEvent; let multiLineString: ol.geom.MultiLineString; let multiPoint: ol.geom.MultiPoint; let multiPolygon: ol.geom.MultiPolygon; +let olEvent: ol.events.Event; let pixel: ol.Pixel; let point: ol.geom.Point; let polygon: ol.geom.Polygon; @@ -64,12 +70,11 @@ let size: ol.Size; let style: ol.style.Style; let styleArray: ol.style.Style[]; let styleFunction: ol.StyleFunction; +let styleRegularShape: ol.style.RegularShape; let tilegrid: ol.tilegrid.TileGrid; let transformFn: ol.TransformFunction; -let clusterSource: ol.source.Cluster; -let vectorSource: ol.source.Vector; let units: ol.proj.Units; -let styleRegularShape: ol.style.RegularShape; +let vectorSource: ol.source.Vector; // // ol.Attribution @@ -897,6 +902,16 @@ let modifySource: ol.interaction.Modify = new ol.interaction.Modify({ }), }); +const dragAndDrop: ol.interaction.DragAndDrop = new ol.interaction.DragAndDrop({ + formatConstructors: [ol.format.KML], + projection: projectionLike, + source: vectorSource, +}); + +const dragAndDropWithUndefined: ol.interaction.DragAndDrop = new ol.interaction.DragAndDrop({ + projection: projectionLike, +}); + let draw: ol.interaction.Draw = new ol.interaction.Draw({ type: "Point", clickTolerance: numberValue, @@ -976,6 +991,53 @@ let mouseWheelZoom: ol.interaction.MouseWheelZoom = new ol.interaction.MouseWhee timeout: numberValue, useAnchor: booleanValue }); + +// +// ol.style.Icon +// + +let iconWithUndefined = new ol.style.Icon({}); +let icon: ol.style.Icon; + +icon = new ol.style.Icon({ + anchor: numberArray, + anchorOrigin: iconOrigin, + anchorXUnits: iconAnchorUnits, + anchorYUnits: iconAnchorUnits, + color: stringValue, + crossOrigin: stringValue, + img: image, + offset: numberArray, + offsetOrigin: iconOrigin, + opacity: numberValue, + scale: numberValue, + snapToPixel: booleanValue, + rotateWithView: booleanValue, + rotation: numberValue, + size, + imgSize: size, + src: stringValue, +}); +icon = new ol.style.Icon({ + anchor: numberArray, + anchorOrigin: iconOrigin, + anchorXUnits: iconAnchorUnits, + anchorYUnits: iconAnchorUnits, + color, + crossOrigin: stringValue, + img: canvas, + offset: numberArray, + offsetOrigin: iconOrigin, + opacity: numberValue, + scale: numberValue, + snapToPixel: booleanValue, + rotateWithView: booleanValue, + rotation: numberValue, + size, + imgSize: size, + src: stringValue, +}); + // // ol.style.RegularShape // diff --git a/types/openlayers/tslint.json b/types/openlayers/tslint.json index 81c4a23e78..e7fec67fe5 100644 --- a/types/openlayers/tslint.json +++ b/types/openlayers/tslint.json @@ -1,8 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - // This currently fails for an option that does not appear to be in OL 4 - "no-any-union": false, // Not sure how to work around this, or if it's necessary to "no-declare-current-package": false, "no-internal-module": false, 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/react-rnd/index.d.ts b/types/react-rnd/index.d.ts new file mode 100644 index 0000000000..9164b409ce --- /dev/null +++ b/types/react-rnd/index.d.ts @@ -0,0 +1,107 @@ +// Type definitions for react-rnd 7.3 +// Project: https://github.com/bokuweb/react-rnd +// Definitions by: Ragg +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 +import React = require('react'); + +type CSSProperties = React.CSSProperties; + +declare namespace Rnd { + type Direction = + | 'bottom' + | 'bottomLeft' + | 'bottomRight' + | 'left' + | 'right' + | 'top' + | 'topLeft' + | 'topRight'; + + interface HandleClasses { + bottom?: string; + bottomLeft?: string; + bottomRight?: string; + left?: string; + right?: string; + top?: string; + topLeft?: string; + topRight?: string; + } + + interface HandleStyles { + bottom?: CSSProperties; + bottomLeft?: CSSProperties; + bottomRight?: CSSProperties; + left?: CSSProperties; + right?: CSSProperties; + top?: CSSProperties; + topLeft?: CSSProperties; + topRight?: CSSProperties; + } + + interface Position { + x: number; + y: number; + } + + interface Size { + width: number; + height: number; + } + + interface DraggableData { + node: HTMLElement; + x: number; + y: number; + deltaX: number; + deltaY: number; + lastX: number; + lastY: number; + } + + type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; + + type ResizeHandler = ( + e: MouseEvent|TouchEvent, + direction: Direction, + ref: HTMLDivElement, + delta: Size, + position: Position + ) => void; + + interface Options { + default: { + x?: number; + y?: number; + width?: number|string; + height?: number|string; + }; + className: string; + style: any; + width: number|string; + height: number|string; + minWidth: number|string; + minHeight: number|string; + maxWidth: number|string; + maxHeight: number|string; + z: number; + resizeHandleClasses: HandleClasses; + resizeHandleStyles: HandleStyles; + + lockAspectRatio: boolean; + enableResizing: boolean; + + onResizeStart: () => void; + onResize: () => void; + onResizeStop: ResizeHandler; + + onDragStart: DraggableEventHandler; + onDrag: DraggableEventHandler; + onDragStop: DraggableEventHandler; + } +} + +declare class Rnd extends React.Component> {} + +export = Rnd; diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx new file mode 100644 index 0000000000..ee434117fe --- /dev/null +++ b/types/react-rnd/react-rnd-tests.tsx @@ -0,0 +1,20 @@ +import React = require('react'); +import Rnd = require('react-rnd'); + +const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => { + direction === 'right'; + delta.width; + delta.height; + position.x; + position.y; +}; + +; diff --git a/types/react-rnd/tsconfig.json b/types/react-rnd/tsconfig.json new file mode 100644 index 0000000000..61a1ff7b55 --- /dev/null +++ b/types/react-rnd/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-rnd-tests.tsx" + ] +} diff --git a/types/react-rnd/tslint.json b/types/react-rnd/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-rnd/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 084f878618..d256bb437e 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -130,6 +130,67 @@ export interface MenuRendererProps { valueArray: Options; } +export interface OptionComponentProps { + /** + * Classname(s) to apply to the option component. + */ + className?: string; + + /** + * Currently focused option. + */ + focusOption?: Option; + + inputValue?: string; + instancePrefix?: string; + + /** + * True if this option is disabled. + */ + isDisabled?: boolean; + + /** + * True if this option is focused. + */ + isFocused?: boolean; + + /** + * True if this option is selected. + */ + isSelected?: boolean; + + /** + * Callback to be invoked when this option is focused. + */ + onFocus?: (option: Option, event: any) => void; + + /** + * Callback to be invoked when this option is selected. + */ + onSelect?: (option: Option, event: any) => void; + + /** + * Option to be rendered by this component. + */ + option: Option; + + /** + * Index of the option being rendered in the list + */ + optionIndex?: number; + + /** + * Callback to invoke when removing an option from a multi-selection. (Not necessarily the one + * being rendered) + */ + removeValue?: (value: TValue | TValue[]) => void; + + /** + * Callback to invoke to select an option. (Not necessarily the one being rendered) + */ + selectValue?: (value: TValue | TValue[]) => void; +} + export interface ArrowRendererProps { /** * Arrow mouse down event handler. @@ -388,7 +449,7 @@ export interface ReactSelectProps extends React.Props; + optionComponent?: React.ComponentType>; /** * function which returns a custom way to render the options in the menu */ diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index b048343555..3635fe3145 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -339,6 +339,16 @@ describe("Examples", () => { />; }); + it("Custom option component", () => { + class OptionComponent extends React.Component { + render() { + return
{this.props.option.label}
; + } + } + + ; + }); + it("Value render with custom value option", () => { const valueRenderer = (option: ReactSelectModule.Option): ReactSelectModule.HandlerRendererResult => null; diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 0f159daf3f..20a1c5a1fb 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -5,12 +5,12 @@ // TypeScript Version: 2.6 import * as React from 'react'; -export type ReactTableFunction = () => void; +export type ReactTableFunction = (value?: any) => void; export type AccessorFunction = (row: object) => any; export type Accessor = string | string[] | object | AccessorFunction; export type Aggregator = (values: any, rows: any) => any; export type TableCellRenderer = ((data: any, column: any) => React.ReactNode) | React.ReactNode; -export type FilterRender = (params: { column: Column, filter: any, onFilterChange: ReactTableFunction, key?: string }) => React.ReactElement; +export type FilterRender = (params: { column: Column, filter: any, onChange: ReactTableFunction, key?: string }) => React.ReactElement; export type PivotRenderer = ((cellInfo: any) => React.ReactNode) | (() => any) | string | React.ReactNode; export type ComponentPropsGetter0 = (finalState: any, rowInfo: undefined, column: undefined, instance?: any) => object | undefined; diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index b6a9f21b14..edff2061b5 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -133,7 +133,7 @@ declare module 'recompose' { >; // withStateHandlers: https://github.com/acdlite/recompose/blob/master/docs/API.md#withstatehandlers - type StateHandler = (...payload: any[]) => TState | undefined; + type StateHandler = (...payload: any[]) => Partial | undefined; type StateHandlerMap = { [updaterName: string]: StateHandler; }; diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 7a3c11af3f..a6c2b2e5bb 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -72,6 +72,7 @@ export class Field

extends Comp export interface WrappedFieldProps { input: WrappedFieldInputProps; meta: WrappedFieldMetaProps; + label?: string; } export interface WrappedFieldInputProps extends CommonFieldInputProps { diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 8949fa6ec2..f4317ade87 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -109,6 +109,7 @@ interface MyFieldCustomProps { type MyFieldProps = MyFieldCustomProps & WrappedFieldProps; const MyField: React.StatelessComponent = ({ children, + label, input, meta, foo 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 40de978fac..3266251b26 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 { } /** @@ -3993,8 +3993,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/sharp/index.d.ts b/types/sharp/index.d.ts index 69f4bc970a..432be5346d 100644 --- a/types/sharp/index.d.ts +++ b/types/sharp/index.d.ts @@ -382,14 +382,14 @@ declare namespace sharp { * @throws {Error} Invalid options * @returns A sharp instance that can be used to chain operations */ - webp(options?: OutputOptions): SharpInstance; + webp(options?: WebpOptions): SharpInstance; /** * Use these TIFF options for output image. * @param options Output options. * @throws {Error} Invalid options * @returns A sharp instance that can be used to chain operations */ - tiff(options?: OutputOptions): SharpInstance; + tiff(options?: TiffOptions): SharpInstance; /** * Force output to be raw, uncompressed uint8 pixel data. * @returns A sharp instance that can be used to chain operations @@ -498,6 +498,28 @@ declare namespace sharp { optimizeScans?: boolean; } + interface WebpOptions extends OutputOptions { + /** Quality of alpha layer, number from 0-100 (optional, default 100) */ + alphaQuality?: number; + /** Use lossless compression mode (optional, default false) */ + lossless?: boolean; + /** Use near_lossless compression mode (optional, default false) */ + nearLossless?: boolean; + } + + interface TiffOptions extends OutputOptions { + /** Compression options: lzw, deflate, jpeg (optional, default 'jpeg') */ + compression?: string; + /** Compression predictor options: none, horizontal, float (optional, default 'horizontal') */ + predictor?: string; + /** Horizontal resolution in pixels/mm (optional, default 1.0) */ + xres?: number; + /** Vertical resolution in pixels/mm (optional, default 1.0) */ + yres?: number; + /** Squash 8-bit images down to 1 bit (optional, default false) */ + squash?: boolean; + } + interface PngOptions { /** Use progressive (interlace) scan (optional, default false) */ progressive?: boolean; 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/steam-totp/index.d.ts b/types/steam-totp/index.d.ts new file mode 100644 index 0000000000..a3ff963428 --- /dev/null +++ b/types/steam-totp/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for steam-totp 2.0 +// Project: https://github.com/DoctorMcKay/node-steam-totp +// Definitions by: Max Uetrecht +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +export type TimeOffsetFunction = () => number; + +/** + * Returns the current local Unix time + * @param [timeOffset=0] - This many seconds will be added to the returned time + * @returns the current local Unix time + */ +export function time(timeOffset?: number): number; + +/** + * Generate a Steam-style TOTP authentication code. + * @param secret - Your TOTP shared_secret as a Buffer, hex, or base64 + * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds + * @returns the generated auth code + */ +export function generateAuthCode(secret: string, timeOffset: number | TimeOffsetFunction): string; + +/** + * Generate a Steam-style TOTP authentication code. + * @param secret - Your TOTP shared_secret as a Buffer, hex, or base64 + * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds + * @returns the generated auth code + */ +export function getAuthCode(secret: string, timeOffset: number | TimeOffsetFunction): string; + +/** + * Generate a base64 confirmation key for use with mobile trade confirmations. The key can only be used once. + * @param identitySecret - The identity_secret that you received when enabling two-factor authentication + * @param time - The Unix time for which you are generating this secret. Generally should be the current time. + * @param tag - The tag which identifies what this request (and therefore key) will be for. + * "conf" to load the confirmations page, "details" to load details about a trade, "allow" to confirm a trade, "cancel" to cancel it. + * @returns the generated confirmation key + */ +export function generateConfirmationKey(identitySecret: Buffer | string, time: number, tag: string): string; + +/** + * Generate a base64 confirmation key for use with mobile trade confirmations. The key can only be used once. + * @param identitySecret - The identity_secret that you received when enabling two-factor authentication + * @param time - The Unix time for which you are generating this secret. Generally should be the current time. + * @param tag - The tag which identifies what this request (and therefore key) will be for. + * "conf" to load the confirmations page, "details" to load details about a trade, "allow" to confirm a trade, "cancel" to cancel it. + * @returns the generated confirmation key + */ +export function getConfirmationKey(identitySecret: Buffer | string, time: number, tag: string): string; + +/** + * Requests the time offset from the Steam API. + * @param callback - The result of the steam api request + * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds + * @returns the time offset + */ +export function getTimeOffset(callback: (error: Error, offset?: number, elapsedTime?: number) => void): void; + +/** + * Get a standardized device ID based on your SteamID. + * @param steamID - Your SteamID, either as a string or as an object which has a toString() method that returns the SteamID + * @returns the device ID + */ +export function getDeviceID(steamID: string | object): string; diff --git a/types/steam-totp/steam-totp-tests.ts b/types/steam-totp/steam-totp-tests.ts new file mode 100644 index 0000000000..57702ccaaa --- /dev/null +++ b/types/steam-totp/steam-totp-tests.ts @@ -0,0 +1,3 @@ +import steamTotp = require('steam-totp'); + +const time: number = steamTotp.time(); diff --git a/types/steam-totp/tsconfig.json b/types/steam-totp/tsconfig.json new file mode 100644 index 0000000000..01223cacba --- /dev/null +++ b/types/steam-totp/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", + "steam-totp-tests.ts" + ] +} diff --git a/types/steam-totp/tslint.json b/types/steam-totp/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/steam-totp/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } 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) { diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 72a2c23c33..8822deca98 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -856,7 +856,7 @@ declare module _ { * @param array Array to compact. * @return Copy of `array` without false values. **/ - compact(array: _.List): T[]; + compact(array: _.List | null | undefined): T[] /** * Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will