Merge branch 'master' into feature/clean-ban-type

This commit is contained in:
Olivier Sechet 2018-03-08 21:58:39 -08:00 committed by GitHub
commit b26d1af940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 717 additions and 95 deletions

View File

@ -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.

View File

@ -1,6 +1,6 @@
// Type definitions for amqplib 0.5
// Project: https://github.com/squaremo/amqp.node
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>, Nick Zelei <https://github.com/zelein>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -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[];
}

View File

@ -12,7 +12,7 @@ class BraftEditorTest extends React.Component<BraftEditor.editorProps> {
height: 500,
initialContent: this.state.content,
onChange: this.handleChange,
onHTMLChange: this.handleHTMLChange
onHTMLChange: this.handleHTMLChange,
};
return (
<div>

View File

@ -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;

View File

@ -5,6 +5,7 @@
// Marshall Cottrell <https://github.com/marshall007>
// Weeco <https://github.com/weeco>
// Gabriel Terwesten <https://github.com/blaugold>
// Oleg Repin <https://github.com/iamolegga>
// 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 {

View File

@ -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);

View File

@ -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<K extends keyof ColorSpaces>(c?: number, format?: K): Array<ColorSpaces[K]>;
colors(c: number | undefined, format: undefined | null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[];
colors(c: number | undefined, format: 'luminance' | 'temperature'): number[];
colors<K extends keyof ColorSpaces>(c: number | undefined, format: K): Array<ColorSpaces[K]>;
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

View File

@ -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;

View File

@ -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 <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;

View File

@ -16,6 +16,17 @@ interface SomeTestResult {
someTestResultProp: string;
}
const asyncBatchFunction = async (sources: ReadonlyArray<SomeTestSource>) => {
return new Promise<SomeTestResult[]>(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<SomeTestSource>
const verifySources = sources;
return sources.map(source => {
return new Promise<SomeTestResult>(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<SomeTestSource>
const verifySources = sources;
// $ExpectType string
const verifyArgs = args.someArg;
return sources.map(source => {
return new Promise<SomeTestResult>(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<SomeTestSource>
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<SomeTestResult>(resolve => {
const res: SomeTestResult = {
someTestResultProp: ""
};
resolve(res);
});
});
const result = await asyncBatchFunction(sources);
return result;
});

View File

@ -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 <https://github.com/nayni>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -17,10 +17,10 @@ export type ResolverFunction<TSource, TArgs, TContext, TReturn> = (
source: TSource,
args: TArgs,
context: TContext
) => Promise<TReturn>;
) => Promise<TReturn> | Promise<TReturn[]>;
export type BatchResolveFunction<TSource, TArgs, TContext, TReturn> = (
sources: ReadonlyArray<TSource>,
args: TArgs,
context: TContext
) => TReturn[] | Array<Promise<TReturn>>;
) => TReturn[] | Promise<TReturn[]>;

View File

@ -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;

View File

@ -152,7 +152,7 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
* @since 1.4
*/
(selector_object_callback?: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element> | JQuery |
JQuery.PlainObject |
JQuery.PlainObject | Window |
((this: Document, $: JQueryStatic<TElement>) => void)): JQuery<TElement>;
/**
* A multi-purpose callbacks list object that provides a powerful way to manage callback lists.

View File

@ -18894,6 +18894,7 @@ declare namespace kendo.ooxml {
cells?: WorkbookSheetRowCell[];
index?: number;
height?: number;
type?: "header" | "footer" | "groupHeader" | "groupFooter" | "data";
}
interface WorkbookSheet {

View File

@ -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 <https://github.com/nenadalm>
// Benjamin Riggs <https://github.com/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 peerconnections 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.
*/

View File

@ -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, {}) => {});

View File

@ -11712,7 +11712,7 @@ declare module olx {
}
interface DragAndDropOptions {
formatConstructors?: Array<((n: ol.format.Feature) => any)>;
formatConstructors?: Array<typeof ol.format.Feature>;
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;

View File

@ -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<ol.Feature>;
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
//

View File

@ -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,

51
types/react-avatar-editor/index.d.ts vendored Normal file
View File

@ -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 <https://github.com/diogocorrea>
// 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<AvatarEditorProps, any> {
static getImage(): HTMLCanvasElement;
static getImageScaledToCanvas(): HTMLCanvasElement;
static getCroppingRect(): CroppedRect;
}

View File

@ -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 (
<div>
<AvatarEditor image="" />
<AvatarEditor image={file} />
<AvatarEditor image="" width={1} />
<AvatarEditor image="" height={1} />
<AvatarEditor image="" border={1} />
<AvatarEditor image="" border={[1, 2]} />
<AvatarEditor image="" borderRadius={1} />
<AvatarEditor image="" color={[1]} />
<AvatarEditor image="" style={{}} />
<AvatarEditor image="" scale={1} />
<AvatarEditor image="" position={{}} />
<AvatarEditor image="" rotate={1} />
<AvatarEditor image="" crossOrigin="" />
<AvatarEditor image="" disableDrop={true} />
<AvatarEditor image="" onDropFile={event => {}} />
<AvatarEditor image="" onLoadFailure={event => {}} />
<AvatarEditor image="" onLoadSuccess={imageState => {}} />
<AvatarEditor image="" onImageReady={event => {}} />
<AvatarEditor image="" onMouseUp={() => {}} />
<AvatarEditor image="" onMouseMove={event => {}} />
<AvatarEditor image="" onImageChange={() => {}} />
<AvatarEditor image="" onPositionChange={() => {}} />
</div>
);
}
}
const getImage: HTMLCanvasElement = AvatarEditor.getImage();
const getImageScaledToCanvas: HTMLCanvasElement = AvatarEditor.getImageScaledToCanvas();
const getCroppingRect: CroppedRect = AvatarEditor.getCroppingRect();

View File

@ -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
}
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

107
types/react-rnd/index.d.ts vendored Normal file
View File

@ -0,0 +1,107 @@
// Type definitions for react-rnd 7.3
// Project: https://github.com/bokuweb/react-rnd
// Definitions by: Ragg <https://github.com/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<Partial<Rnd.Options>> {}
export = Rnd;

View File

@ -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;
};
<Rnd
className="class"
lockAspectRatio
maxWidth={100}
enableResizing={false}
resizeHandleStyles={{
top: { background: '#000' }
}}
/>;

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -130,6 +130,67 @@ export interface MenuRendererProps<TValue = OptionValues> {
valueArray: Options<TValue>;
}
export interface OptionComponentProps<TValue = OptionValues> {
/**
* Classname(s) to apply to the option component.
*/
className?: string;
/**
* Currently focused option.
*/
focusOption?: Option<TValue>;
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<TValue>, event: any) => void;
/**
* Callback to be invoked when this option is selected.
*/
onSelect?: (option: Option<TValue>, event: any) => void;
/**
* Option to be rendered by this component.
*/
option: Option<TValue>;
/**
* 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<TValue = OptionValues> extends React.Props<Rea
/**
* option component to render in dropdown
*/
optionComponent?: React.ComponentType<TValue>;
optionComponent?: React.ComponentType<OptionComponentProps<TValue>>;
/**
* function which returns a custom way to render the options in the menu
*/

View File

@ -339,6 +339,16 @@ describe("Examples", () => {
/>;
});
it("Custom option component", () => {
class OptionComponent extends React.Component<ReactSelectModule.OptionComponentProps> {
render() {
return <div>{this.props.option.label}</div>;
}
}
<ReactSelect optionComponent={OptionComponent} />;
});
it("Value render with custom value option", () => {
const valueRenderer = (option: ReactSelectModule.Option<CustomValueType>): ReactSelectModule.HandlerRendererResult =>
null;

View File

@ -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<any>;
export type FilterRender = (params: { column: Column, filter: any, onChange: ReactTableFunction, key?: string }) => React.ReactElement<any>;
export type PivotRenderer = ((cellInfo: any) => React.ReactNode) | (() => any) | string | React.ReactNode;
export type ComponentPropsGetter0 = (finalState: any, rowInfo: undefined, column: undefined, instance?: any) => object | undefined;

View File

@ -133,7 +133,7 @@ declare module 'recompose' {
>;
// withStateHandlers: https://github.com/acdlite/recompose/blob/master/docs/API.md#withstatehandlers
type StateHandler<TState> = (...payload: any[]) => TState | undefined;
type StateHandler<TState> = (...payload: any[]) => Partial<TState> | undefined;
type StateHandlerMap<TState> = {
[updaterName: string]: StateHandler<TState>;
};

View File

@ -72,6 +72,7 @@ export class Field<P = GenericFieldHTMLAttributes | BaseFieldProps> extends Comp
export interface WrappedFieldProps {
input: WrappedFieldInputProps;
meta: WrappedFieldMetaProps;
label?: string;
}
export interface WrappedFieldInputProps extends CommonFieldInputProps {

View File

@ -109,6 +109,7 @@ interface MyFieldCustomProps {
type MyFieldProps = MyFieldCustomProps & WrappedFieldProps;
const MyField: React.StatelessComponent<MyFieldProps> = ({
children,
label,
input,
meta,
foo

View File

@ -1,6 +1,6 @@
// Type definitions for RethinkDB 2.3
// Project: http://rethinkdb.com/
// Definitions by: Alex Gorbatchev <https://github.com/alexgorbatchev>
// Definitions by: Alex Gorbatchev <https://github.com/alexgorbatchev>, Adrian Farmadin <https://github.com/AdrianFarmadin>
// 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<Sequence> {
indexCreate(name: string, index?: ExpressionFunction<any>): Operation<CreateResult>;
@ -247,6 +256,7 @@ declare module "rethinkdb" {
get<TObjectType extends object>(key: string): Operation<TObjectType | null> & 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;
}

View File

@ -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

View File

@ -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']);
rsync.include(['/a/file', '/b/file']);

View File

@ -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 <https://github.com/samuelneff>
// Peter Harris <https://github.com/codeanimal>
@ -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<boolean>;
insertOrUpdate(values: TAttributes, options?: UpsertOptions): Promise<boolean>;
upsert(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise<boolean>;
upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>;
insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise<boolean>;
insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>;
/**
* Create and insert multiple instances in bulk.

View File

@ -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<boolean> = 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<boolean> = 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' }] );

View File

@ -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;

View File

@ -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 <https://github.com/cbowdon>, Pei-Tang Huang <https://github.com/tan9>
// Definitions by: cbowdon <https://github.com/cbowdon>, Pei-Tang Huang <https://github.com/tan9>, Ariel-Saldana <https://github.com/arielsaldana>
// 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
*/

View File

@ -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 '<h1 id="hellomarkdown">hello, markdown</h1>'

67
types/steam-totp/index.d.ts vendored Normal file
View File

@ -0,0 +1,67 @@
// Type definitions for steam-totp 2.0
// Project: https://github.com/DoctorMcKay/node-steam-totp
// Definitions by: Max Uetrecht <https://github.com/phenomax>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
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;

View File

@ -0,0 +1,3 @@
import steamTotp = require('steam-totp');
const time: number = steamTotp.time();

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -7,6 +7,7 @@
// Brannon Jones <https://github.com/brannon>
// Kyle Kamperschroer <https://github.com/kkamperschroer>
// Kensuke Hoshikawa <https://github.com/starhoshi>
// Thomas Bruun <https://github.com/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 {

View File

@ -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) {

View File

@ -856,7 +856,7 @@ declare module _ {
* @param array Array to compact.
* @return Copy of `array` without false values.
**/
compact<T>(array: _.List<T>): T[];
compact<T>(array: _.List<T | null | undefined | false | "" | 0> | null | undefined): T[]
/**
* Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will