Skip to content

Commit

Permalink
feat: initialize typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
johncardiologs committed Jun 4, 2024
1 parent 091c076 commit f7b9b33
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ props_template/performance/**/*.png
.tool-versions
testapp/

built/
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
import React from 'react'
import { urlToPageKey, pathWithoutBZParams } from '../utils'
import { REMOVE_PAGE, HISTORY_CHANGE } from '../actions'
import PropTypes from 'prop-types'
import { object, func, string } from 'prop-types'

interface Props {
store: any, // object
history: any, // object
mapping: any, // object
visit: any, // fund
remote: any, // func
initialPageKey: string,
}

interface State {
pageKey: any,
ownProps: any
}

class Nav extends React.Component<Props, State> {
public history
public hasWindow
public unsubscribeHistory

class Nav extends React.Component {
constructor(props) {
super(props)
const { history, initialPageKey } = this.props
Expand Down Expand Up @@ -211,13 +229,14 @@ class Nav extends React.Component {
}
}

Nav.propTypes = {
store: PropTypes.object,
history: PropTypes.object,
mapping: PropTypes.object,
visit: PropTypes.func,
remote: PropTypes.func,
initialPageKey: PropTypes.string,
}
// TODO: remove now that we have Props ?
// Nav.propTypes = {
// store: object,
// history: object,
// mapping: object,
// visit: func,
// remote: func,
// initialPageKey: string,
// }

export default Nav
File renamed without changes.
16 changes: 14 additions & 2 deletions superglue/lib/index.js → superglue/lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export {
superglueReducer,
pageReducer,
rootReducer,
updateFragments,
} from './reducers'
export { fragmentMiddleware } from './middleware'
export { getIn } from './utils/immutability'
Expand Down Expand Up @@ -94,7 +93,20 @@ class NotImplementedError extends Error {
}
}

export class ApplicationBase extends React.Component {

interface Props {}

export class ApplicationBase extends React.Component<Props> {
public hasWindow: any
public navigatorRef: any
public initialPageKey: any
public store: any
public history: any
public connectedMapping: any
public ujsHandlers: any
public visit: any
public remote: any

constructor(props) {
super(props)
this.hasWindow = typeof window !== 'undefined'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions superglue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"redux-thunk": ">=2.3"
},
"dependencies": {
"@types/url-parse": "^1.4.11",
"abortcontroller-polyfill": "^1.7.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"url-parse": "^1.5.1"
Expand Down
11 changes: 11 additions & 0 deletions superglue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"jsx": "react",
"outDir": "./built",
"allowJs": true,
"target": "es5",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["./lib/**/*"]
}

0 comments on commit f7b9b33

Please sign in to comment.