diff --git a/mapbox/mapbox.d.ts b/mapbox/mapbox.d.ts index bc2c3c980..3c774bdf6 100644 --- a/mapbox/mapbox.d.ts +++ b/mapbox/mapbox.d.ts @@ -21,7 +21,7 @@ declare module L.mapbox { function map(element: string, id: string, options?: MapOptions): L.mapbox.Map; function map(element: string, tilejson: any, options?: MapOptions): L.mapbox.Map; - interface MapOptions extends L.MapOptions { + interface MapOptions extends L.Map.MapOptions { featureLayer? : FeatureLayerOptions; gridLayer? : any; tileLayer? : TileLayerOptions; diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 711587001..da07b4d07 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3,14 +3,13 @@ "version": "0.0.1", "dependencies": { "definition-tester": { - "version": "0.2.0", - "from": "definition-tester@0.2.0", - "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.2.0.tgz", + "version": "0.3.0", + "from": "definition-tester@0.3.0", "dependencies": { "bluebird": { - "version": "2.10.0", - "from": "bluebird@>=2.5.3 <3.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.0.tgz" + "version": "2.10.1", + "from": "bluebird@>=2.10.1 <3.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.1.tgz" }, "definition-header": { "version": "0.1.0", @@ -23,9 +22,9 @@ "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz", "dependencies": { "hoek": { - "version": "2.16.2", + "version": "2.16.3", "from": "hoek@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.2.tgz" + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" }, "topo": { "version": "1.0.3", @@ -76,71 +75,9 @@ } }, "findup-sync": { - "version": "0.2.1", - "from": "findup-sync@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz", - "dependencies": { - "glob": { - "version": "4.3.5", - "from": "glob@>=4.3.0 <4.4.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz", - "dependencies": { - "inflight": { - "version": "1.0.4", - "from": "inflight@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", - "dependencies": { - "wrappy": { - "version": "1.0.1", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" - } - } - }, - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "minimatch": { - "version": "2.0.10", - "from": "minimatch@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "dependencies": { - "brace-expansion": { - "version": "1.1.0", - "from": "brace-expansion@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", - "dependencies": { - "balanced-match": { - "version": "0.2.0", - "from": "balanced-match@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" - }, - "concat-map": { - "version": "0.0.1", - "from": "concat-map@0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" - } - } - } - } - }, - "once": { - "version": "1.3.2", - "from": "once@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", - "dependencies": { - "wrappy": { - "version": "1.0.1", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" - } - } - } - } - } - } + "version": "0.3.0", + "from": "findup-sync@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz" }, "git-wrapper": { "version": "0.1.1", @@ -148,9 +85,9 @@ "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" }, "glob": { - "version": "4.5.3", - "from": "glob@>=4.3.2 <5.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", + "version": "5.0.14", + "from": "glob@>=5.0.14 <6.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.14.tgz", "dependencies": { "inflight": { "version": "1.0.4", @@ -204,12 +141,17 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" } } + }, + "path-is-absolute": { + "version": "1.0.0", + "from": "path-is-absolute@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" } } }, "lazy.js": { "version": "0.4.2", - "from": "lazy.js@>=0.4.0 <0.5.0", + "from": "lazy.js@>=0.4.2 <0.5.0", "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz" }, "manticore": { diff --git a/package.json b/package.json index b92031a38..2b9d019f8 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "url": "https://github.com/borisyankov/DefinitelyTyped/issues" }, "engines": { - "node": ">= 0.10.0" + "node": ">= 0.12.0" }, "scripts": { "test": "./node_modules/.bin/dt --changes", @@ -35,7 +35,7 @@ "dependencies": { }, "devDependencies": { - "definition-tester": "0.2.0", + "definition-tester": "0.3.0", "typescript": "1.6.2" } } diff --git a/react-mixin/react-mixin-tests.tsx b/react-mixin/react-mixin-tests.tsx new file mode 100644 index 000000000..32532b133 --- /dev/null +++ b/react-mixin/react-mixin-tests.tsx @@ -0,0 +1,55 @@ +/// +/// + +import reactMixin = require('react-mixin'); +import * as React from 'react'; + +var someMixin: React.Mixin; +var someOtherMixin: React.Mixin; + +class Foo extends React.Component { + render(): JSX.Element { return
; } +} + +reactMixin(Foo.prototype, someMixin); +reactMixin(Foo.prototype, someOtherMixin); + + +var mixin: React.Mixin = { + getDefaultProps: function(): any { + return {b: 2}; + } +}; + +class Foo2 extends React.Component { + static defaultProps = { + a: 1 + }; + render(): JSX.Element { + console.log(this.props); // {a: 1, b: 2} + return null; + } +} + +reactMixin.onClass(Foo2, mixin); + +@reactMixin.decorate(mixin) +class Foo3 extends React.Component { +} + +function autobind(methodNames: string[]): React.Mixin { + return { + componentWillMount: function(): void { + methodNames.forEach((name) => { + this[name] = this[name].bind(this); + }); + } + }; +} + +@reactMixin.decorate(mixin) +@reactMixin.decorate(autobind(Object.keys(mixin))) +class Foo4 extends React.Component { +} + + diff --git a/react-mixin/react-mixin-tests.tsx.tscparams b/react-mixin/react-mixin-tests.tsx.tscparams new file mode 100644 index 000000000..c90abf04f --- /dev/null +++ b/react-mixin/react-mixin-tests.tsx.tscparams @@ -0,0 +1 @@ +--target es5 --noImplicitAny --experimentalDecorators --jsx react diff --git a/react-mixin/react-mixin.d.ts b/react-mixin/react-mixin.d.ts new file mode 100644 index 000000000..e7d25a6ab --- /dev/null +++ b/react-mixin/react-mixin.d.ts @@ -0,0 +1,27 @@ +// Type definitions for react-mixin 2.0.2 +// Project: https://github.com/brigand/react-mixin +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "react-mixin" { + import * as React from 'react'; + + namespace reactMixin { + export interface ClassDecorator { + (target: TFunction): TFunction|void; + } + + interface ReactMixin { + decorate(mixin: React.Mixin): ClassDecorator; + onClass(clazz: any, mixin: React.Mixin): React.ComponentClass; + (clazz: any, mixin: React.Mixin): React.ComponentClass; + } + } + + var reactMixin: reactMixin.ReactMixin; + + export = reactMixin; +} + diff --git a/react/react.d.ts b/react/react.d.ts index 54d13d5eb..8d5b621e0 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -336,7 +336,7 @@ declare namespace __React { ref?: string | ((component: T) => any); } - interface DOMAttributes extends Props> { + interface DOMAttributesBase extends Props { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -377,6 +377,9 @@ declare namespace __React { }; } + interface DOMAttributes extends DOMAttributesBase> { + } + // This interface is not complete. Only properties accepting // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { @@ -406,9 +409,7 @@ declare namespace __React { [propertyName: string]: any; } - interface HTMLAttributes extends DOMAttributes { - ref?: string | ((component: HTMLComponent) => void); - + interface HTMLAttributesBase extends DOMAttributesBase { accept?: string; acceptCharset?: string; accessKey?: string; @@ -528,6 +529,9 @@ declare namespace __React { unselectable?: boolean; } + interface HTMLAttributes extends HTMLAttributesBase { + } + interface SVGElementAttributes extends HTMLAttributes { viewBox?: string; preserveAspectRatio?: string; @@ -1133,7 +1137,7 @@ declare module "react/addons" { ref?: string | ((component: T) => any); } - interface DOMAttributes extends Props> { + interface DOMAttributesBase extends Props { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -1174,6 +1178,9 @@ declare module "react/addons" { }; } + interface DOMAttributes extends DOMAttributesBase> { + } + // This interface is not complete. Only properties accepting // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { @@ -1203,9 +1210,7 @@ declare module "react/addons" { [propertyName: string]: any; } - interface HTMLAttributes extends DOMAttributes { - ref?: string | ((component: HTMLComponent) => void); - + interface HTMLAttributesBase extends DOMAttributesBase { accept?: string; acceptCharset?: string; accessKey?: string; @@ -1325,6 +1330,9 @@ declare module "react/addons" { unselectable?: boolean; } + interface HTMLAttributes extends HTMLAttributesBase { + } + interface SVGElementAttributes extends HTMLAttributes { viewBox?: string; preserveAspectRatio?: string;