Skip to content

Commit

Permalink
dx: update TypeScript to 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Oct 18, 2018
1 parent 6ec10f3 commit 343c549
Show file tree
Hide file tree
Showing 29 changed files with 163 additions and 133 deletions.
78 changes: 56 additions & 22 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"release": "npm run update-version && npm run clean-bundler && npm run clean-android && npm run build-android-release && npm run test-e2e-android && npm run changelog && npm run commit-release && npm run dat-release"
},
"dependencies": {
"@cycle/isolate": "3.4",
"@cycle/react": "1.3.4",
"@cycle/isolate": "4.1",
"@cycle/react": "1.4.0",
"@cycle/state": "1.0.0",
"@staltz/rn-viewpager": "1.2.5",
"@types/react": "16.4.6",
"@types/react-native": "0.55.26",
Expand All @@ -39,7 +40,6 @@
"cycle-native-navigation": "4.2.0",
"cycle-native-share": "1.0.0",
"cycle-native-toastandroid": "1.0.0",
"cycle-onionify": "6.1.0",
"depject": "^4.1.1",
"depnest": "^1.3.0",
"estimate-progress": "1.0.0",
Expand Down Expand Up @@ -109,11 +109,11 @@
"tape": "^4.8.0",
"try-thread-sleep": "^1.0.2",
"tslint": "^5.11.0",
"typescript": "3.0.x",
"typescript": "3.1.x",
"wd": "^1.5.0"
},
"react-native": {
"os": "@staltz/react-native-os",
"rn-viewpager": "@staltz/rn-viewpager"
}
}
}
2 changes: 1 addition & 1 deletion src/app/components/EmptySection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class EmptySection extends PureComponent<Props> {
View,
{style: [styles.container, style || null]},
[
image ? h(Image, {style: styles.image, source: image}) : null,
image ? h(Image, {style: styles.image as any, source: image}) : null,
h(Text, {style: styles.title}, title),
h(Text, {style: styles.description}, description),
] as Array<ReactElement<any>>,
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/messages/AboutMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function renderWithImage(
h(Text, {style: styles.followed}, ' is using a new picture:'),
]),
h(Image, {
style: styles.aboutImage,
style: styles.aboutImage as any,
source: {uri: imageUrl || undefined},
}),
h(View, {style: styles.row}, [
Expand Down
18 changes: 9 additions & 9 deletions src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export enum Screens {
RawMessage = 'Manyverse.RawMessage',
}

import onionify from 'cycle-onionify';
import {withState} from '@cycle/state';
import {makeKeyboardDriver} from 'cycle-native-keyboard';
import {alertDriver} from 'cycle-native-alert';
import {linkingDriver} from 'cycle-native-linking';
Expand All @@ -55,14 +55,14 @@ import {Palette} from './global-styles/palette';
import {Typography} from './global-styles/typography';

export const screens: {[k in Screens]?: (so: any) => any} = {
[Screens.Central]: onionify(central),
[Screens.Drawer]: onionify(drawer),
[Screens.Compose]: onionify(compose),
[Screens.Thread]: onionify(thread),
[Screens.InvitePaste]: onionify(pasteInvite),
[Screens.InviteCreate]: onionify(createInvite),
[Screens.Profile]: onionify(profile),
[Screens.ProfileEdit]: onionify(editProfile),
[Screens.Central]: withState(central),
[Screens.Drawer]: withState(drawer),
[Screens.Compose]: withState(compose),
[Screens.Thread]: withState(thread),
[Screens.InvitePaste]: withState(pasteInvite),
[Screens.InviteCreate]: withState(createInvite),
[Screens.Profile]: withState(profile),
[Screens.ProfileEdit]: withState(editProfile),
[Screens.RawDatabase]: rawDatabase,
[Screens.RawMessage]: rawMessage,
};
Expand Down
18 changes: 9 additions & 9 deletions src/app/screens/central/connections-tab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import {Stream} from 'xstream';
import {ReactElement} from 'react';
import {StateSource, Reducer} from 'cycle-onionify';
import {StateSource, Reducer} from '@cycle/state';
import {Command as AlertCommand} from 'cycle-native-alert';
import {ReactSource} from '@cycle/react';
import {Command} from 'cycle-native-navigation';
Expand All @@ -35,7 +35,7 @@ import navigation from './navigation';

export type Sources = {
screen: ReactSource;
onion: StateSource<State>;
state: StateSource<State>;
network: NetworkSource;
ssb: SSBSource;
fab: Stream<string>;
Expand All @@ -45,23 +45,23 @@ export type Sinks = {
screen: Stream<ReactElement<any>>;
navigation: Stream<Command>;
alert: Stream<AlertCommand>;
onion: Stream<Reducer<State>>;
state: Stream<Reducer<State>>;
fab: Stream<FabProps>;
};

export function connectionsTab(sources: Sources): Sinks {
const actions = intent(sources.screen, sources.fab);
const vdom$ = view(sources.onion.state$);
const command$ = navigation(actions, sources.onion.state$);
const reducer$ = model(sources.onion.state$, sources.ssb, sources.network);
const fabProps$ = floatingAction(sources.onion.state$);
const alert$ = alert(actions, sources.onion.state$);
const vdom$ = view(sources.state.stream);
const command$ = navigation(actions, sources.state.stream);
const reducer$ = model(sources.state.stream, sources.ssb, sources.network);
const fabProps$ = floatingAction(sources.state.stream);
const alert$ = alert(actions, sources.state.stream);

return {
alert: alert$,
navigation: command$,
screen: vdom$,
onion: reducer$,
state: reducer$,
fab: fabProps$,
};
}
2 changes: 1 addition & 1 deletion src/app/screens/central/connections-tab/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import xs, {Stream} from 'xstream';
import concat from 'xstream/extra/concat';
import {PeerMetadata, FeedId} from 'ssb-typescript';
import {Reducer} from 'cycle-onionify';
import {Reducer} from '@cycle/state';
import {SSBSource, StagedPeerMetadata} from '../../../drivers/ssb';
import {NetworkSource} from '../../../drivers/network';
import dropRepeats from 'xstream/extra/dropRepeats';
Expand Down
24 changes: 12 additions & 12 deletions src/app/screens/central/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import xs, {Stream} from 'xstream';
import {StateSource, Reducer} from 'cycle-onionify';
import {StateSource, Reducer} from '@cycle/state';
import {ReactElement} from 'react';
import isolate from '@cycle/isolate';
import {ReactSource} from '@cycle/react';
Expand Down Expand Up @@ -48,15 +48,15 @@ export type Sources = {
screen: ReactSource;
navigation: NavSource;
network: NetworkSource;
onion: StateSource<State>;
state: StateSource<State>;
ssb: SSBSource;
};

export type Sinks = {
screen: Stream<ReactElement<any>>;
navigation: Stream<Command>;
alert: Stream<AlertCommand>;
onion: Stream<Reducer<any>>;
state: Stream<Reducer<any>>;
ssb: Stream<Req>;
toast: Stream<Toast>;
};
Expand All @@ -76,13 +76,13 @@ export const navOptions = {
export function central(sources: Sources): Sinks {
const topBarSinks: TBSinks = isolate(topBar, {
'*': 'topBar',
onion: topBarLens,
state: topBarLens,
})(sources);

const actions = intent(sources.screen, sources.navigation);

const scrollToTop$ = actions.changeTab$
.compose(sampleCombine(sources.onion.state$))
.compose(sampleCombine(sources.state.stream))
.filter(([i, state]) => state.currentTab === 0 && i === 0)
.mapTo(null);

Expand All @@ -91,16 +91,16 @@ export function central(sources: Sources): Sinks {
.events('pressItem');

const publicTabSinks: PublicTabSinks = isolate(publicTab, {
onion: publicTabLens,
state: publicTabLens,
'*': 'publicTab',
})({...sources, scrollToTop: scrollToTop$, fab: fabPress$});

const connectionsTabSinks: ConnectionsTabSinks = isolate(connectionsTab, {
onion: connectionsTabLens,
state: connectionsTabLens,
'*': 'connectionsTab',
})({...sources, fab: fabPress$});

const fabProps$ = sources.onion.state$
const fabProps$ = sources.state.stream
.map(
state =>
state.currentTab === 0 ? publicTabSinks.fab : connectionsTabSinks.fab,
Expand All @@ -116,12 +116,12 @@ export function central(sources: Sources): Sinks {

const reducer$ = xs.merge(
centralReducer$,
publicTabSinks.onion,
connectionsTabSinks.onion,
publicTabSinks.state,
connectionsTabSinks.state,
) as Stream<Reducer<State>>;

const vdom$ = view(
sources.onion.state$,
sources.state.stream,
fabProps$,
topBarSinks.screen,
publicTabSinks.screen,
Expand All @@ -145,7 +145,7 @@ export function central(sources: Sources): Sinks {

return {
screen: vdom$,
onion: reducer$,
state: reducer$,
navigation: command$,
alert: connectionsTabSinks.alert,
ssb: publicTabSinks.ssb,
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/central/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import xs, {Stream} from 'xstream';
import {Reducer, Lens} from 'cycle-onionify';
import {Reducer, Lens} from '@cycle/state';
import {FeedId} from 'ssb-typescript';
import {State as PublicTabState} from './public-tab/model';
import {State as TopBarState} from './top-bar';
Expand Down
Loading

0 comments on commit 343c549

Please sign in to comment.