refactor: transform more to TS

This commit is contained in:
EnixCoda 2019-02-09 19:41:38 +08:00
parent 36ffbbee04
commit 538527bd39
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
7 changed files with 17 additions and 34 deletions

View file

@ -1,23 +0,0 @@
import React from 'react'
import SideBar from 'components/SideBar'
import { Gitako as GitakoCore } from 'driver/core'
import connect from 'driver/connect'
import { raiseError } from 'analytics'
@connect(GitakoCore)
export default class Gitako extends React.PureComponent {
componentDidMount() {
const { init } = this.props
init()
}
componentDidCatch(error) {
raiseError(error)
}
render() {
return (
<SideBar />
)
}
}

13
src/components/Gitako.tsx Normal file
View file

@ -0,0 +1,13 @@
import * as React from 'react'
import SideBar from 'components/SideBar'
import { raiseError } from 'analytics'
export default class Gitako extends React.PureComponent {
componentDidCatch(error: Error) {
raiseError(error)
}
render() {
return React.createElement(SideBar as any)
}
}

View file

@ -1,5 +1,5 @@
import React from 'react'
import ReactDOM from 'react-dom'
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import Gitako from 'components/Gitako'
import { addMiddleware } from 'driver/connect'
import { withErrorLog } from 'analytics'

View file

@ -1,6 +0,0 @@
const init = dispatch => () => {
}
export default {
init,
}

View file

@ -1,3 +1,2 @@
export { default as Gitako } from './Gitako'
export { default as SideBar } from './SideBar'
export { default as FileExplorer } from './FileExplorer'

View file

@ -1,5 +1,5 @@
{
"files": ["src/content.jsx"],
"files": ["src/content.tsx"],
"compilerOptions": {
"target": "es2016",
"outDir": "dist",

View file

@ -41,7 +41,7 @@ if (IN_PRODUCTION_MODE) {
module.exports = {
entry: {
content: './src/content.jsx',
content: './src/content.tsx',
},
mode: IN_PRODUCTION_MODE ? 'production' : 'development',
output: {