This commit is contained in:
Paul van Brenk
2017-03-20 17:31:39 -07:00
14 changed files with 1023 additions and 1050 deletions
+2
View File
@@ -80,6 +80,8 @@ declare global {
// then: typeof Bluebird.prototype.then;
thenReturn: typeof Bluebird.prototype.thenReturn;
thenThrow: typeof Bluebird.prototype.thenThrow;
catchReturn: typeof Bluebird.prototype.catchReturn;
catchThrow: typeof Bluebird.prototype.catchThrow;
throw: typeof Bluebird.prototype.throw;
timeout: typeof Bluebird.prototype.timeout;
toJSON: typeof Bluebird.prototype.toJSON;
+9
View File
@@ -506,6 +506,15 @@ fooProm = fooProm.thenThrow(err);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
barProm = fooProm.catchReturn(bar);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// fooProm
fooProm = fooProm.catchThrow(err);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
str = fooProm.toString();
obj = fooProm.toJSON();
+31
View File
@@ -248,6 +248,37 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
throw(reason: Error): Bluebird<R>;
thenThrow(reason: Error): Bluebird<R>;
/**
* Convenience method for:
*
* <code>
* .catch(function() {
* return value;
* });
* </code>
*
* in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.catchReturn()`
*/
catchReturn<U>(value: U): Bluebird<U>;
catchReturn<U>(predicate: (error: any) => boolean, value: U): Bluebird<U | R>;
catchReturn<E extends Error, U>(ErrorClass: new (...args: any[]) => E, value: U): Bluebird<U | R>;
catchReturn<U>(predicate: Object, value: U): Bluebird<U | R>;
/**
* Convenience method for:
*
* <code>
* .catch(function() {
* throw reason;
* });
* </code>
* Same limitations apply as with `.catchReturn()`.
*/
catchThrow(reason: Error): Bluebird<R>;
catchThrow(predicate: (error: any) => boolean, reason: Error): Bluebird<R>;
catchThrow<E extends Error, U>(ErrorClass: new (...args: any[]) => E, reason: Error): Bluebird<R>;
catchThrow(predicate: Object, reason: Error): Bluebird<R>;
/**
* Convert to String.
*/
+14
View File
@@ -37,6 +37,13 @@ namespace ShallowWrapperTest {
elementWrapper: ShallowWrapper<HTMLAttributes<{}>, {}>,
statelessWrapper: ShallowWrapper<StatelessProps, never>;
function test_props_state_inferring() {
let wrapper: ShallowWrapper<MyComponentProps, MyComponentState>;
wrapper = shallow(<MyComponent stringProp="value" />);
wrapper.state().stateProperty;
wrapper.props().stringProp.toUpperCase();
}
function test_shallow_options() {
shallow(<MyComponent stringProp="1"/>, {
context: {
@@ -337,6 +344,13 @@ namespace ReactWrapperTest {
elementWrapper: ReactWrapper<HTMLAttributes<{}>, {}>,
statelessWrapper: ReactWrapper<StatelessProps, never>;
function test_prop_state_inferring() {
let wrapper: ReactWrapper<MyComponentProps, MyComponentState>;
wrapper = mount(<MyComponent stringProp="value" />);
wrapper.state().stateProperty;
wrapper.props().stringProp.toUpperCase();
}
function test_unmount() {
reactWrapper = reactWrapper.unmount();
}
+2
View File
@@ -546,6 +546,7 @@ export interface MountRendererProps {
* @param node
* @param [options]
*/
export function shallow<P>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, any>;
export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, S>;
/**
@@ -553,6 +554,7 @@ export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererPr
* @param node
* @param [options]
*/
export function mount<P>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, any>;
export function mount<P, S>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, S>;
/**
+852 -851
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -5,6 +5,12 @@
"typingsPackageName": "ajv",
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
"asOfVersion": "1.0.0"
},
{
"libraryName": "Numbro",
"typingsPackageName": "numbro",
"sourceRepoURL": "https://github.com/foretagsplatsen/numbro/",
"asOfVersion": "1.9.3"
},
{
"libraryName": "antd",
-49
View File
@@ -1,49 +0,0 @@
// Type definitions for Numbro.js
// Project: https://github.com/foretagsplatsen/numbro
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface NumbroLanguage {
delimiters: {
thousands: string;
decimal: string;
};
abbreviations: {
thousand: string;
million: string;
billion: string;
trillion: string;
};
ordinal(num: number): string;
currency: {
symbol: string;
};
}
interface Numbro {
(value?: any): Numbro;
version: string;
isNumbro: boolean;
language(key: string, values?: NumbroLanguage): Numbro;
zeroFormat(format: string): string;
clone(): Numbro;
format(inputString?: string): string;
formatCurrency(inputString?: string): string;
unformat(inputString: string): number;
value(): number;
valueOf(): number;
set (value: any): Numbro;
add(value: any): Numbro;
subtract(value: any): Numbro;
multiply(value: any): Numbro;
divide(value: any): Numbro;
difference(value: any): number;
}
declare var numbro: Numbro;
declare module "numbro" {
export = numbro;
}
-43
View File
@@ -1,43 +0,0 @@
var valueFormat: string = numbro(1000).format('0,0');
// '1,000'
var valueUnformat: number = numbro().unformat('($10,000.00)');
// '-10000'
var value3: Numbro = numbro(1000);
var added: Numbro = value3.add(10);
// 1010
var value4: Numbro = numbro(1000);
var formatValue4a: string = value4.format('0,0');
// '1,000'
var formatValue4b: number = value4.value();
// 1000
var value5: Numbro = numbro();
value5.set(1000);
var value5Num: number = value5.value();
// 1000
var value6: Numbro = numbro(1000);
var value: number = 100;
var difference = value6.difference(value);
// 900
var value7: Numbro = numbro(0);
numbro.zeroFormat('N/A');
var zeroString: string = value7.format('0.0');
// 'N/A'
var a: Numbro = numbro(1000);
var b: Numbro = numbro(a);
var c: Numbro = a.clone();
var aVal: number = a.set(2000).value();
// 2000
var bVal: number = b.value();
// 1000
var cVal: number = c.add(10).value();
// 1010
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"numbro-tests.ts"
]
}
+26 -23
View File
@@ -5,33 +5,36 @@
/// <reference types="jointjs" />
declare namespace joint {
namespace ui {
interface Handle {
name: string;
position: string;
icon: string;
}
import * as joint from 'jointjs';
import * as Backbone from "backbone";
class SelectionView extends Backbone.Model {
export as namespace joint;
export namespace ui {
interface Handle {
name: string;
position: string;
icon: string;
}
class SelectionView extends Backbone.Model {
paper: joint.dia.Paper;
graph: joint.dia.Graph;
model: Backbone.Collection<joint.dia.Cell>;
constructor(opt: {
paper: joint.dia.Paper;
graph: joint.dia.Graph;
model: Backbone.Collection<joint.dia.Cell>;
model: Backbone.Collection<joint.dia.Cell>
});
constructor(opt: {
paper: joint.dia.Paper;
graph: joint.dia.Graph;
model: Backbone.Collection<joint.dia.Cell>
});
createSelectionBox(cellView: joint.dia.CellView): void;
destroySelectionBox(cellView: joint.dia.CellView): void;
startSelecting(evt: any): void;
cancelSelection(): void;
createSelectionBox(cellView: joint.dia.CellView): void;
destroySelectionBox(cellView: joint.dia.CellView): void;
startSelecting(evt: any): void;
cancelSelection(): void;
addHandle(handle: Handle): void;
removeHandle(name: string): void;
changeHandle(name: string, handle: Handle): void;
}
addHandle(handle: Handle): void;
removeHandle(name: string): void;
changeHandle(name: string, handle: Handle): void;
}
}
+74 -57
View File
@@ -437,7 +437,7 @@ declare namespace React {
interface ChangeTargetHTMLProps<T extends HTMLElement> extends ChangeTargetHTMLAttributes<T>, ClassAttributes<T> {
}
interface SVGProps extends SVGAttributes<SVGElement>, ClassAttributes<SVGElement> {
interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
}
interface DOMAttributes<T> {
@@ -2211,7 +2211,25 @@ declare namespace React {
// - "number | string"
// - "string"
// - union of string literals
interface SVGAttributes<T> extends HTMLAttributes<T> {
interface SVGAttributes<T> extends DOMAttributes<T> {
// Attributes which also defined in HTMLAttributes
// See comment in SVGDOMPropertyConfig.js
className?: string;
color?: string;
height?: number | string;
id?: string;
lang?: string;
max?: number | string;
media?: string;
method?: string;
min?: number | string;
name?: string;
style?: CSSProperties;
target?: string;
type?: string;
width?: number | string;
// SVG Specific attributes
accentHeight?: number | string;
accumulate?: "none" | "sum";
additive?: "replace" | "sum";
@@ -2404,7 +2422,6 @@ declare namespace React {
textRendering?: number | string;
to?: number | string;
transform?: string;
type?: string;
u1?: number | string;
u2?: number | string;
underlinePosition?: number | string;
@@ -2802,61 +2819,61 @@ declare global {
wbr: React.HTMLProps<HTMLElement>;
// SVG
svg: React.SVGProps;
svg: React.SVGProps<SVGSVGElement>;
animate: React.SVGProps;
circle: React.SVGProps;
clipPath: React.SVGProps;
defs: React.SVGProps;
desc: React.SVGProps;
ellipse: React.SVGProps;
feBlend: React.SVGProps;
feColorMatrix: React.SVGProps;
feComponentTransfer: React.SVGProps;
feComposite: React.SVGProps;
feConvolveMatrix: React.SVGProps;
feDiffuseLighting: React.SVGProps;
feDisplacementMap: React.SVGProps;
feDistantLight: React.SVGProps;
feFlood: React.SVGProps;
feFuncA: React.SVGProps;
feFuncB: React.SVGProps;
feFuncG: React.SVGProps;
feFuncR: React.SVGProps;
feGaussianBlur: React.SVGProps;
feImage: React.SVGProps;
feMerge: React.SVGProps;
feMergeNode: React.SVGProps;
feMorphology: React.SVGProps;
feOffset: React.SVGProps;
fePointLight: React.SVGProps;
feSpecularLighting: React.SVGProps;
feSpotLight: React.SVGProps;
feTile: React.SVGProps;
feTurbulence: React.SVGProps;
filter: React.SVGProps;
foreignObject: React.SVGProps;
g: React.SVGProps;
image: React.SVGProps;
line: React.SVGProps;
linearGradient: React.SVGProps;
marker: React.SVGProps;
mask: React.SVGProps;
metadata: React.SVGProps;
path: React.SVGProps;
pattern: React.SVGProps;
polygon: React.SVGProps;
polyline: React.SVGProps;
radialGradient: React.SVGProps;
rect: React.SVGProps;
stop: React.SVGProps;
switch: React.SVGProps;
symbol: React.SVGProps;
text: React.SVGProps;
textPath: React.SVGProps;
tspan: React.SVGProps;
use: React.SVGProps;
view: React.SVGProps;
animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now.
circle: React.SVGProps<SVGCircleElement>;
clipPath: React.SVGProps<SVGClipPathElement>;
defs: React.SVGProps<SVGDefsElement>;
desc: React.SVGProps<SVGDescElement>;
ellipse: React.SVGProps<SVGEllipseElement>;
feBlend: React.SVGProps<SVGFEBlendElement>;
feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>;
feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>;
feComposite: React.SVGProps<SVGFECompositeElement>;
feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>;
feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>;
feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>;
feDistantLight: React.SVGProps<SVGFEDistantLightElement>;
feFlood: React.SVGProps<SVGFEFloodElement>;
feFuncA: React.SVGProps<SVGFEFuncAElement>;
feFuncB: React.SVGProps<SVGFEFuncBElement>;
feFuncG: React.SVGProps<SVGFEFuncGElement>;
feFuncR: React.SVGProps<SVGFEFuncRElement>;
feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>;
feImage: React.SVGProps<SVGFEImageElement>;
feMerge: React.SVGProps<SVGFEMergeElement>;
feMergeNode: React.SVGProps<SVGFEMergeNodeElement>;
feMorphology: React.SVGProps<SVGFEMorphologyElement>;
feOffset: React.SVGProps<SVGFEOffsetElement>;
fePointLight: React.SVGProps<SVGFEPointLightElement>;
feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>;
feSpotLight: React.SVGProps<SVGFESpotLightElement>;
feTile: React.SVGProps<SVGFETileElement>;
feTurbulence: React.SVGProps<SVGFETurbulenceElement>;
filter: React.SVGProps<SVGFilterElement>;
foreignObject: React.SVGProps<SVGForeignObjectElement>;
g: React.SVGProps<SVGGElement>;
image: React.SVGProps<SVGImageElement>;
line: React.SVGProps<SVGLineElement>;
linearGradient: React.SVGProps<SVGLinearGradientElement>;
marker: React.SVGProps<SVGMarkerElement>;
mask: React.SVGProps<SVGMaskElement>;
metadata: React.SVGProps<SVGMetadataElement>;
path: React.SVGProps<SVGPathElement>;
pattern: React.SVGProps<SVGPatternElement>;
polygon: React.SVGProps<SVGPolygonElement>;
polyline: React.SVGProps<SVGPolylineElement>;
radialGradient: React.SVGProps<SVGRadialGradientElement>;
rect: React.SVGProps<SVGRectElement>;
stop: React.SVGProps<SVGStopElement>;
switch: React.SVGProps<SVGSwitchElement>;
symbol: React.SVGProps<SVGSymbolElement>;
text: React.SVGProps<SVGTextElement>;
textPath: React.SVGProps<SVGTextPathElement>;
tspan: React.SVGProps<SVGTSpanElement>;
use: React.SVGProps<SVGUseElement>;
view: React.SVGProps<SVGViewElement>;
}
}
}
+3
View File
@@ -342,6 +342,9 @@ React.DOM.svg({
xmlns: "http://www.w3.org/2000/svg"
},
React.DOM.rect({
className: 'foobar',
id: 'foo',
color: 'black',
x: 22,
y: 10,
width: 4,
@@ -1,14 +1,13 @@
import FileStore = require("session-file-store");
const options:FileStore.Options = {
const options: FileStore.Options = {
path: "./tmp/sessions/",
logFn:function(a:string) {
logFn: (a: string) => {
}
};
const sessionStore = new FileStore(options);
sessionStore.list(function (err: any, file: Array<string>) {
sessionStore.list((err: any, file: Array<string>) => {
});
});