This repository was archived by the owner on Dec 9, 2021. It is now read-only.
File tree 7 files changed +37
-14
lines changed
7 files changed +37
-14
lines changed Original file line number Diff line number Diff line change 50
50
"@types/hapi" : " 16.1.8" ,
51
51
"@types/inert" : " 4.2.2" ,
52
52
"@types/node" : " 8.0.20" ,
53
+ "@types/node-notifier" : " 0.0.28" ,
53
54
"@types/react" : " 16.0.2" ,
54
55
"@types/react-dom" : " 15.5.2" ,
55
56
"@types/react-hot-loader" : " 3.0.3" ,
Original file line number Diff line number Diff line change 1
1
import path from 'path' ;
2
+ import * as Hapi from 'hapi' ;
3
+ import IController from '../../interfaces/IController' ;
2
4
3
- class AssetsController {
5
+ class AssetsController implements IController {
4
6
5
- mapRoutes ( server ) {
7
+ public mapRoutes ( server : Hapi . Server ) : void {
6
8
server . route ( {
7
9
method : 'GET' ,
8
10
path : '/assets/{file*}' ,
9
- handler : ( request , reply ) => {
11
+ handler : ( request : hapi . Request , reply : hapi . ReplyNoContinue ) => {
10
12
reply . file ( path . resolve ( __dirname , `../../public${ request . path } ` ) ) ;
11
13
} ,
12
14
} ) ;
Original file line number Diff line number Diff line change @@ -7,16 +7,18 @@ import ProviderService from '../../services/ProviderService';
7
7
import rootSaga from '../../store/rootSaga' ;
8
8
import ISagaStore from '../../interfaces/ISagaStore' ;
9
9
import IStore from '../../interfaces/IStore' ;
10
+ import * as Hapi from 'hapi' ;
11
+ import IController from '../../interfaces/IController' ;
10
12
11
- class ReactController {
13
+ class ReactController implements IController {
12
14
13
- mapRoutes ( server ) {
15
+ public mapRoutes ( server : Hapi . Server ) : void {
14
16
server . route ( {
15
17
method : 'GET' ,
16
18
path : '/{route*}' ,
17
- handler : async ( request , reply ) => {
19
+ handler : async ( request : hapi . Request , reply : hapi . ReplyNoContinue ) : Promise < void > => {
18
20
const store : ISagaStore < IStore > = ProviderService . createProviderStore ( { } , true ) ;
19
- const context = { } ;
21
+ const context : any = { } ;
20
22
const app = (
21
23
< RouterWrapper
22
24
store = { store }
@@ -36,7 +38,7 @@ class ReactController {
36
38
} ,
37
39
} ;
38
40
39
- let html = await fse . readFile ( path . resolve ( __dirname , '../../public/index.html' ) , 'utf8' ) ;
41
+ let html : string = await fse . readFile ( path . resolve ( __dirname , '../../public/index.html' ) , 'utf8' ) ;
40
42
html = html . replace ( '{title}' , state . metaReducer . title ) ;
41
43
html = html . replace ( '{description}' , state . metaReducer . description ) ;
42
44
html = html . replace ( '{content}' , renderedHtml ) ;
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ import Webpack from 'webpack';
2
2
import ServerManager from '../ServerManager' ;
3
3
import HapiWebpackPlugin from 'hapi-webpack-plugin' ;
4
4
import notifier from 'node-notifier' ;
5
+ import * as Hapi from 'hapi' ;
5
6
6
7
class HapiWebpackHotPlugin {
7
8
8
- constructor ( server ) {
9
+ constructor ( server : Hapi . Server ) {
9
10
const compiler = new Webpack ( require ( '../../../webpack.config.js' ) ) ;
10
11
11
12
compiler . plugin ( 'done' , ( stats ) => this . _onDone ( stats ) ) ;
@@ -31,7 +32,7 @@ class HapiWebpackHotPlugin {
31
32
} ) ;
32
33
}
33
34
34
- _onDone ( stats ) {
35
+ private _onDone ( stats ) : void {
35
36
const pkg = require ( '../../../package.json' ) ;
36
37
const time = ( ( stats . endTime - stats . startTime ) / 1000 ) . toFixed ( 2 ) ;
37
38
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import { connect } from 'react-redux' ;
3
3
import MetaAction from '../store/meta/MetaAction' ;
4
- import { Field , reduxForm } from 'redux-form' ;
4
+ import { Field , FormProps , reduxForm } from 'redux-form' ;
5
5
import IStore from '../interfaces/IStore' ;
6
6
import { Dispatch } from 'redux' ;
7
7
@@ -11,7 +11,10 @@ const mapDispatchToProps = (dispatch: Dispatch<any>) => ({
11
11
setMeta : ( meta ) => dispatch ( MetaAction . setMeta ( meta ) ) ,
12
12
} ) ;
13
13
14
- class Contact extends React . Component < any , void > {
14
+ interface IContactProps extends FormProp {
15
+ }
16
+
17
+ class Contact extends React . Component < IContactProps , void > {
15
18
16
19
_handleSubmitHandler = ( formData ) => this . _onFormSubmit ( formData ) ;
17
20
Original file line number Diff line number Diff line change @@ -4,17 +4,25 @@ import UserAction from '../store/user/UserAction';
4
4
import MetaAction from '../store/meta/MetaAction' ;
5
5
import IStore from '../interfaces/IStore' ;
6
6
import { Dispatch } from 'redux' ;
7
+ import IMetaReducerState from '../interfaces/reducers/IMetaReducerState' ;
8
+ import IUserReducerState from '../interfaces/reducers/IUserReducerState' ;
7
9
8
10
const mapStateToProps = ( state : IStore ) => ( {
9
11
user : state . userReducer ,
10
12
} ) ;
11
13
12
14
const mapDispatchToProps = ( dispatch : Dispatch < any > ) => ( {
13
15
loadUser : ( ) => dispatch ( UserAction . loadUser ( ) ) ,
14
- setMeta : ( meta ) => dispatch ( MetaAction . setMeta ( meta ) ) ,
16
+ setMeta : ( meta : IMetaReducerState ) => dispatch ( MetaAction . setMeta ( meta ) ) ,
15
17
} ) ;
16
18
17
- class Home extends React . Component < any , void > {
19
+ interface IHomeProps {
20
+ readonly user : IUserReducerState ;
21
+ loadUser : ( ) => void ,
22
+ setMeta : ( meta : IMetaReducerState ) => void ,
23
+ }
24
+
25
+ class Home extends React . Component < IHomeProps , void > {
18
26
19
27
componentWillMount ( ) : void {
20
28
this . props . setMeta ( {
Original file line number Diff line number Diff line change 54
54
dependencies :
55
55
" @types/mime-db" " *"
56
56
57
+ " @types/node-notifier@0.0.28 " :
58
+ version "0.0.28"
59
+ resolved "https://registry.yarnpkg.com/@types/node-notifier/-/node-notifier-0.0.28.tgz#86ba3d3aa8d918352cc3191d88de328b20dc93c1"
60
+ dependencies :
61
+ " @types/node" " *"
62
+
57
63
" @types/node@*" , "@types/node@8.0.20":
58
64
version "8.0.20"
59
65
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.20.tgz#65c7375255c24b184c215a5d0b63247c32f01c91"
You can’t perform that action at this time.
0 commit comments