Skip to content

Commit

Permalink
feat(TypeScript): support TypeScript 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Apr 29, 2017
1 parent d556807 commit aa957d9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
},
"homepage": "https://github.com/almin/almin-react-container",
"peerDependencies": {
"react": "^15.0.0",
"almin": ">=0.11.0"
"almin": ">=0.11.0",
"react": "^15.0.0"
},
"devDependencies": {
"@types/node": "^7.0.12",
"@types/react": "^15.0.20",
"almin": "^0.11.0",
"almin": "beta",
"cross-env": "^3.2.4",
"react": "^15.4.2",
"typescript": "^2.2.2"
"typescript": "~latest"
}
}
7 changes: 4 additions & 3 deletions src/almin-react-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import { Context } from "almin";
export default class AlminReactContainer {
static create<T>(WrappedComponent: React.ComponentClass<T>,
context: Context): React.ComponentClass<T> {
context: Context<any>): React.ComponentClass<T> {
const componentName = WrappedComponent.displayName || WrappedComponent.name;
return class AlminContainer extends React.Component<T, {}> {
static displayName = `AlminContainer(${componentName})`;
Expand All @@ -13,7 +13,7 @@ export default class AlminReactContainer {

constructor() {
super();
this.state = context.getState<T>();
this.state = context.getState();
}

componentWillMount() {
Expand All @@ -30,7 +30,8 @@ export default class AlminReactContainer {
}

render() {
return <WrappedComponent {...this.state} />;
// Workaround TS2.3.1: https://github.com/Microsoft/TypeScript/pull/13288
return <WrappedComponent {...(this.state as any)} />;
}
};
}
Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"module": "commonjs",
"moduleResolution": "node",
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"pretty": true
"strict": true
},
"include": [
"src/**/*"
Expand Down
25 changes: 15 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
version "15.0.20"
resolved "https://registry.yarnpkg.com/@types/react/-/react-15.0.20.tgz#3d4a05ed04a8b1847ac6c8fa6093591d3910fba5"

almin@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/almin/-/almin-0.11.0.tgz#4bf913559b53cbc685875115bada70a718422f85"
almin@beta:
version "0.12.0-3"
resolved "https://registry.yarnpkg.com/almin/-/almin-0.12.0-3.tgz#5bf7dc615c25a32570d96dba981cd65df89e542b"
dependencies:
lru-map-like "^1.1.2"
map-like "^1.1.0"
map-like "^1.1.2"
object-assign "^4.1.0"
shallow-equal-object "^1.0.1"

asap@~2.0.3:
version "2.0.5"
Expand Down Expand Up @@ -105,9 +106,9 @@ lru-map-like@^1.1.2:
dependencies:
map-like "^1.0.3"

map-like@^1.0.3, map-like@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/map-like/-/map-like-1.1.0.tgz#c0700757955253b629335492f89d4002115795c0"
map-like@^1.0.3, map-like@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/map-like/-/map-like-1.1.2.tgz#f42a301ebd9290372b9e4ddc49e5df9804a507b9"

node-fetch@^1.0.1:
version "1.6.3"
Expand Down Expand Up @@ -142,6 +143,10 @@ setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"

shallow-equal-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/shallow-equal-object/-/shallow-equal-object-1.0.1.tgz#a402410fb4b7c15370ec7e78701e9280f1c1d1e4"

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
Expand All @@ -152,9 +157,9 @@ shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"

typescript@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.2.2.tgz#606022508479b55ffa368b58fee963a03dfd7b0c"
typescript@~latest:
version "2.3.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.1.tgz#e3361fb395c6c3f9c69faeeabc9503f8bdecaea1"

ua-parser-js@^0.7.9:
version "0.7.12"
Expand Down

0 comments on commit aa957d9

Please sign in to comment.