-
Notifications
You must be signed in to change notification settings - Fork 78
Conversation
This was the previous css-layout project.
- Removes flowconfig - Adds tsconfig - Renames all .js files to .tsx
Generated by 🚫 dangerJS |
@sarahscott I'm currently working on defining types and fixing errors for the |
@orta Sounds good, I added the hack for now but hot-reloading doesn't work yet so either I'll try to fix it or switch to using your fork. |
@l2succes fantastic! I'll start on the Artist container/components. |
- includes VS Code typescript related tasks - uses new @types modules instead of typings
Ran `node ../relay2ts/dist/src/bin.js src/lib/**/*.(ts|tsx) --list --update` to add interfaces for relay fragments. Still need to add to `Props` for most components
src/lib/components/tab_view.tsx
Outdated
render() { | ||
const { children, ...props } = this.props | ||
return ( | ||
<View> | ||
<SwitchView style={styles.switch} {...props} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This spread operator gave me a lot of trouble - I did appreciate the elegance of this class though so if someone knows how to pass the props in this way without ts errors, it'll be very appreciated 😄 .
} | ||
} | ||
|
||
class Article extends React.Component<Props, {}> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the second state
type should be null
if there’s no state.
tsconfig.json
Outdated
"allowJs": true, | ||
"sourceMap": true, | ||
"moduleResolution": "node", | ||
"strictNullChecks": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the good stuff
tsconfig.json
Outdated
"build", | ||
"index.ios.js" | ||
], | ||
"compileOnSave": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this we want to eliminate via orta/systems-theory#1 and facebook/react-native#11932
const { View } = ReactNative; | ||
const { TestModule } = ReactNative.NativeModules; | ||
import Emission from 'emission' | ||
import React from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t this be?
import * as React from 'react'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's correct, still working on converting all the tests. I'll have it updated soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, just checked, this doesn't need to change - it's still a JS file, and should stay one probably. It's only referenced by the iOS Sim Test Runner.
Merge remote-tracking branch 'remotes/origin/upgrade-react-native' into typescript
static propTypes = { | ||
// A callback that is called when the user requests a retry. | ||
onRetry: React.PropTypes.func, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should move this to a Props interface instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to have propTypes defined for native components but yes this should be defined in the Props interface as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, forgot about that 👍
This should probably be documented in the README:
- JS components: only a TS interface (which inherits from x and y)
- Native components: also add prop types
Closing this PR in favour of the following one #453 |
This migrates the codebase from flow to typescript for type definitions.
Fixed just enough to get top level containers to run in the simulator.
You may need to run
tsc --watch
if files are not automatically being compiled by VS Code (didn't work for me but will fix).To-do list: