From cfc40da29bebbe9adfc83c918dee9b4522ef3e16 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:41:40 +0900 Subject: [PATCH 1/2] Add react-props-decorators@0.1.0 --- .../react-props-decorators-tests.ts | 17 ++++++++++++++ .../react-props-decorators-tests.ts.tscparams | 1 + .../react-props-decorators.d.ts | 23 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 react-props-decorators/react-props-decorators-tests.ts create mode 100644 react-props-decorators/react-props-decorators-tests.ts.tscparams create mode 100644 react-props-decorators/react-props-decorators.d.ts diff --git a/react-props-decorators/react-props-decorators-tests.ts b/react-props-decorators/react-props-decorators-tests.ts new file mode 100644 index 000000000..6ba9b7cef --- /dev/null +++ b/react-props-decorators/react-props-decorators-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import React from 'react'; +import { propTypes, defaultProps } from 'react-props-decorators'; + +@propTypes({ + foo: React.PropTypes.string, + bar: React.PropTypes.number +}) +@defaultProps({ + foo: "defaultString", + bar: 100 +}) +class Baz extends React.Component { + /* ... */ +} diff --git a/react-props-decorators/react-props-decorators-tests.ts.tscparams b/react-props-decorators/react-props-decorators-tests.ts.tscparams new file mode 100644 index 000000000..3f0863ac6 --- /dev/null +++ b/react-props-decorators/react-props-decorators-tests.ts.tscparams @@ -0,0 +1 @@ +--experimentalDecorators --noImplicitAny --target ES5 diff --git a/react-props-decorators/react-props-decorators.d.ts b/react-props-decorators/react-props-decorators.d.ts new file mode 100644 index 000000000..98edc9884 --- /dev/null +++ b/react-props-decorators/react-props-decorators.d.ts @@ -0,0 +1,23 @@ +// Type definitions for react-props-decorators +// Project: https://github.com/popkirby/react-props-decorators +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "react-props-decorators" { + import * as React from 'react'; + + export interface ClassDecorator { + (target:TFunction): TFunction|void; + } + + var propTypes: (map: React.ValidationMap) => ClassDecorator; + var defaultProps: (defaultProps: any) => ClassDecorator; + + export { + propTypes, + defaultProps + } +} + From 9718a35bba88f7b34627a9f41a1794c342f039cd Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:48:18 +0900 Subject: [PATCH 2/2] Fix bug --- react-props-decorators/react-props-decorators-tests.ts | 4 ++-- react-props-decorators/react-props-decorators.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react-props-decorators/react-props-decorators-tests.ts b/react-props-decorators/react-props-decorators-tests.ts index 6ba9b7cef..33691834c 100644 --- a/react-props-decorators/react-props-decorators-tests.ts +++ b/react-props-decorators/react-props-decorators-tests.ts @@ -1,7 +1,7 @@ /// /// -import React from 'react'; +import * as React from 'react'; import { propTypes, defaultProps } from 'react-props-decorators'; @propTypes({ @@ -12,6 +12,6 @@ import { propTypes, defaultProps } from 'react-props-decorators'; foo: "defaultString", bar: 100 }) -class Baz extends React.Component { +class Baz extends React.Component { /* ... */ } diff --git a/react-props-decorators/react-props-decorators.d.ts b/react-props-decorators/react-props-decorators.d.ts index 98edc9884..9b62d84f9 100644 --- a/react-props-decorators/react-props-decorators.d.ts +++ b/react-props-decorators/react-props-decorators.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-props-decorators +// Type definitions for react-props-decorators 0.1.0 // Project: https://github.com/popkirby/react-props-decorators // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped