tsconfig fixes

This commit is contained in:
Evan Kaloudis
2021-08-13 16:06:42 -04:00
parent ee83f06f49
commit 607b84429b
24 changed files with 76 additions and 111 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ export default class Eclair {
});
}
setTimeout(
id => {
(id: string) => {
delete calls[id];
},
9000,
+1 -1
View File
@@ -58,7 +58,7 @@ export default class DropdownSetting extends React.Component<
{title}
</Text>
<Picker
selectedValue={selectedValue}
selectedValue={`${selectedValue}`}
onValueChange={(itemValue: string) =>
onValueChange(itemValue)
}
+2 -6
View File
@@ -15,10 +15,8 @@ import isEmpty from 'lodash/isEmpty';
import { inject, observer } from 'mobx-react';
import FeeStore from './../stores/FeeStore';
import SettingsStore from './../stores/SettingsStore';
interface FeeTableProps {
SettingsStore: SettingsStore;
FeeStore: FeeStore;
setFee: (value: string) => void;
}
@@ -27,7 +25,7 @@ interface FeeTableState {
collapsed: boolean;
}
@inject('SettingsStore', 'FeeStore')
@inject('FeeStore')
@observer
export default class FeeTable extends React.Component<
FeeTableProps,
@@ -80,10 +78,8 @@ export default class FeeTable extends React.Component<
render() {
const { collapsed } = this.state;
const { FeeStore, SettingsStore, setFee } = this.props;
const { FeeStore, setFee } = this.props;
const { dataFrame, loading } = FeeStore;
const { settings } = SettingsStore;
const { theme } = settings;
const df = dataFrame;
let headers: any;
+2 -2
View File
@@ -195,7 +195,7 @@ export default class ChannelPicker extends React.Component<
return (
<>
<ListItem
title={channelTitle}
title={`${channelTitle}`}
subtitle={`${
!item.isActive
? `${localeString(
@@ -363,7 +363,7 @@ export default class ChannelPicker extends React.Component<
</TouchableOpacity>
) : (
<Picker
selectedValue={selectedValue}
selectedValue={`${selectedValue}`}
onValueChange={(itemValue: string) => {
if (itemValue === 'No selection') {
this.clearSelection();
+1 -1
View File
@@ -309,7 +309,7 @@ export default class UTXOPicker extends React.Component<
</Text>
) : (
<Picker
selectedValue={selectedValue}
selectedValue={`${selectedValue}`}
onValueChange={(itemValue: string) => {
if (itemValue === 'No selection') {
this.clearSelection();
+4 -3
View File
@@ -59,7 +59,7 @@ export default class Invoice extends BaseModel {
return 'Invoice';
}
@computed public get getTimestamp(): string {
@computed public get getTimestamp(): string | number {
return (
this.paid_at ||
this.creation_date ||
@@ -121,7 +121,7 @@ export default class Invoice extends BaseModel {
);
}
@computed public get getDate(): string {
@computed public get getDate(): string | number | Date {
return this.isPaid
? this.settleDate
: DateTimeUtils.listDate(
@@ -154,7 +154,8 @@ export default class Invoice extends BaseModel {
@computed public isExpired(): boolean {
if (this.expiry) {
return (
new Date().getTime() / 1000 > this.creation_date + this.expiry
new Date().getTime() / 1000 >
Number(this.creation_date) + Number(this.expiry)
);
}
+2 -2
View File
@@ -42,11 +42,11 @@ export default class Payment extends BaseModel {
return localeString('views.Payment.title');
}
@computed public get getTimestamp(): string {
@computed public get getTimestamp(): string | number {
return this.creation_date || this.created_at || this.timestamp || 0;
}
@computed public get getDate(): string {
@computed public get getDate(): string | Date {
return DateTimeUtils.listDate(
this.creation_date || this.created_at || this.timestamp || 0
);
+2 -2
View File
@@ -24,7 +24,7 @@ export default class Transaction extends BaseModel {
return localeString('general.transaction');
}
@computed public get getTimestamp(): string {
@computed public get getTimestamp(): string | number {
return this.time_stamp || 0;
}
@@ -32,7 +32,7 @@ export default class Transaction extends BaseModel {
return DateTimeUtils.listFormattedDate(this.time_stamp || 0);
}
@computed public get getDate(): string {
@computed public get getDate(): string | Date {
return DateTimeUtils.listDate(this.time_stamp || 0);
}
+6 -3
View File
@@ -12,6 +12,7 @@ import TransactionsStore from './TransactionsStore';
import { localeString } from './../utils/LocaleUtils';
interface ActivityFilter {
[index: string]: any;
lightning: boolean;
onChain: boolean;
channels: boolean;
@@ -83,7 +84,7 @@ export default class ActivityStore {
await this.paymentsStore.getPayments();
await this.transactionsStore.getTransactions();
await this.invoicesStore.getInvoices();
const activity = [];
const activity: any = [];
const payments = this.paymentsStore.payments;
const transactions = this.transactionsStore.transactions;
const invoices = this.invoicesStore.invoices;
@@ -94,7 +95,7 @@ export default class ActivityStore {
payments.concat(transactions).concat(invoices)
);
// sort activity by timestamp
const sortedActivity = activity.sort((a, b) =>
const sortedActivity = activity.sort((a: any, b: any) =>
a.getTimestamp < b.getTimestamp ? 1 : -1
);
@@ -111,7 +112,9 @@ export default class ActivityStore {
onChain: true,
channels: true,
sent: true,
received: true
received: true,
startDate: null,
endDate: null
};
};
-1
View File
@@ -1,7 +1,6 @@
import { action, observable } from 'mobx';
import RESTUtils from './../utils/RESTUtils';
import Base64Utils from './../utils/Base64Utils';
import SignMessage from './../views/Settings/SignMessage';
export default class MessageSignStore {
@observable public loading: boolean = false;
+2 -4
View File
@@ -21,8 +21,6 @@
"*" : ["typings/*"]
}
},
"files": [
"node_modules/typescript/lib/lib.es6.d.ts"
],
"exclude": ["node_modules", "typings"]
"exclude": ["node_modules"],
"include": ["backends/*", "components/*", "models/*", "stores/*", "utils/*", "views/*", "typings/*"]
}
+4
View File
@@ -0,0 +1,4 @@
declare module "*.svg" {
const content: any;
export default content;
}
+4 -4
View File
@@ -1,17 +1,17 @@
const dateFormat = require('dateformat');
class DateTimeUtils {
listDate = (timestamp: number | string) =>
listDate = (timestamp: number | string | Date) =>
new Date(Number(timestamp) * 1000);
listFormattedDate = (
timestamp: number | string,
timestamp: number | string | Date,
format: string = "ddd, mmm d 'yy, HH:MM:ss Z"
) => {
try {
const date = this.listDate(timestamp);
return dateFormat(date, format);
return dateFormat(date, format).toString();
} catch (error) {
return timestamp || 'N/A';
return timestamp.toString() || 'N/A';
}
};
+1 -1
View File
@@ -37,7 +37,7 @@ class PrivacyUtils {
const { lurkerMode } = settings;
if (!lurkerMode) return input;
let output = '';
let output: string = '';
const length = fixedLength || (input && input.toString().length) || 1;
const wordlist = numberSet ? numbers : alphabet;
+6 -4
View File
@@ -4,7 +4,7 @@ export function themeColor(themeString: string): any {
const { settings } = stores.settingsStore;
const { theme } = settings;
const Light = {
const Light: { [key: string]: any } = {
background: 'white',
secondary: '#f0f0f0',
text: 'black',
@@ -25,7 +25,7 @@ export function themeColor(themeString: string): any {
// TODO: pick outbound and inbound colors for light and junkie themes
};
const Dark = {
const Dark: { [key: string]: any } = {
background: '#1f2328',
secondary: '#2b3037',
text: 'white',
@@ -38,7 +38,7 @@ export function themeColor(themeString: string): any {
inbound: '#FFF0CA'
};
const Junkie = {
const Junkie: { [key: string]: any } = {
background: 'rgb(51, 51, 51)',
secondary: 'rgb(191, 0, 28)',
text: 'white',
@@ -51,7 +51,9 @@ export function themeColor(themeString: string): any {
'rgb(51, 51, 51)',
'rgb(51, 51, 51)'
],
separator: 'darkgray'
separator: 'darkgray',
outbound: '#FFD93F',
inbound: '#FFF0CA'
};
switch (theme) {
+1 -1
View File
@@ -1,5 +1,5 @@
import Tor, { RequestMethod } from 'react-native-tor';
const tor = Tor({ bootstrapTimeoutMs: 35000 });
const tor = Tor();
const doTorRequest = async <T extends RequestMethod>(
url: string,
method: T,
+6 -15
View File
@@ -6,7 +6,7 @@ import {
TouchableOpacity,
View
} from 'react-native';
import { Avatar, Button, Header, Icon, ListItem } from 'react-native-elements';
import { Button, Header, Icon, ListItem } from 'react-native-elements';
import { inject, observer } from 'mobx-react';
import DateTimeUtils from './../utils/DateTimeUtils';
import PrivacyUtils from './../utils/PrivacyUtils';
@@ -15,7 +15,6 @@ import { themeColor } from './../utils/ThemeUtils';
import ActivityStore from './../stores/ActivityStore';
import UnitsStore from './../stores/UnitsStore';
import SettingsStore from './../stores/SettingsStore';
import Filter from './../images/SVG/Filter On.svg';
@@ -23,10 +22,9 @@ interface ActivityProps {
navigation: any;
ActivityStore: ActivityStore;
UnitsStore: UnitsStore;
SettingsStore: SettingsStore;
}
@inject('ActivityStore', 'UnitsStore', 'SettingsStore')
@inject('ActivityStore', 'UnitsStore')
@observer
export default class Activity extends React.Component<ActivityProps, {}> {
async UNSAFE_componentWillMount() {
@@ -54,20 +52,13 @@ export default class Activity extends React.Component<ActivityProps, {}> {
};
render() {
const {
navigation,
ActivityStore,
UnitsStore,
SettingsStore
} = this.props;
const { getAmount, units } = UnitsStore;
const { navigation, ActivityStore, UnitsStore } = this.props;
const { getAmount } = UnitsStore;
const {
loading,
filteredActivity,
getActivityAndFilter
} = ActivityStore;
const { settings } = SettingsStore;
const { lurkerMode } = settings;
const CloseButton = () => (
<Icon
@@ -104,10 +95,10 @@ export default class Activity extends React.Component<ActivityProps, {}> {
) : !!filteredActivity && filteredActivity.length > 0 ? (
<FlatList
data={filteredActivity}
renderItem={({ item }) => {
renderItem={({ item }: { item: any }) => {
let displayName = item.model;
let subTitle = item.model;
let rightTitle = ' ';
let rightTitle: any = ' ';
if (
item.model ===
localeString('views.Invoice.title')
+16 -35
View File
@@ -1,31 +1,17 @@
import * as React from 'react';
import {
ActivityIndicator,
FlatList,
StyleSheet,
Switch,
Text,
View
} from 'react-native';
import { Avatar, Button, Header, Icon, ListItem } from 'react-native-elements';
import Channel from './../models/Channel';
import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
import { Button, Header, Icon, ListItem } from 'react-native-elements';
import { inject, observer } from 'mobx-react';
const hash = require('object-hash');
import DateTimeUtils from './../utils/DateTimeUtils';
import PrivacyUtils from './../utils/PrivacyUtils';
import { localeString } from './../utils/LocaleUtils';
import { themeColor } from './../utils/ThemeUtils';
import DatePicker from 'react-native-date-picker';
import ActivityStore from './../stores/ActivityStore';
import UnitsStore from './../stores/UnitsStore';
import SettingsStore from './../stores/SettingsStore';
interface ActivityFilterProps {
navigation: any;
ActivityStore: ActivityStore;
UnitsStore: UnitsStore;
SettingsStore: SettingsStore;
}
interface ActivityFilterState {
@@ -35,7 +21,7 @@ interface ActivityFilterState {
workingEndDate: any;
}
@inject('ActivityStore', 'UnitsStore', 'SettingsStore')
@inject('ActivityStore')
@observer
export default class ActivityFilter extends React.Component<
ActivityFilterProps,
@@ -44,26 +30,20 @@ export default class ActivityFilter extends React.Component<
state = {
setStartDate: false,
setEndDate: false,
workingStartDate: null,
workingEndDate: null
workingStartDate: undefined,
workingEndDate: undefined
};
renderSeparator = () => <View style={styles.separator} />;
render() {
const {
navigation,
ActivityStore,
UnitsStore,
SettingsStore
} = this.props;
const { navigation, ActivityStore } = this.props;
const {
setStartDate,
setEndDate,
workingStartDate,
workingEndDate
} = this.state;
const { getAmount, units } = UnitsStore;
const {
loading,
setFilters,
@@ -82,8 +62,6 @@ export default class ActivityFilter extends React.Component<
startDate,
endDate
} = filters;
const { settings } = SettingsStore;
const { lurkerMode } = settings;
const CloseButton = () => (
<Icon
@@ -188,8 +166,8 @@ export default class ActivityFilter extends React.Component<
this.setState({
setStartDate: false,
setEndDate: false,
workingStartDate: null,
workingEndDate: null
workingStartDate: undefined,
workingEndDate: undefined
});
}}
buttonStyle={{ backgroundColor: 'orange' }}
@@ -291,9 +269,10 @@ export default class ActivityFilter extends React.Component<
<Switch
value={item.value}
onValueChange={() => {
let newFilters = filters;
newFilters[item.var] = !filters[
item.var
let newFilters: any = filters;
const index = `${item.var}`;
newFilters[index] = !filters[
index
];
setFilters(newFilters);
}}
@@ -317,7 +296,9 @@ export default class ActivityFilter extends React.Component<
</ListItem>
</>
)}
keyExtractor={(item, index) => `${item.model}-${index}`}
keyExtractor={(item: any, index: any) =>
`${item.model}-${index}`
}
ItemSeparatorComponent={this.renderSeparator}
onEndReachedThreshold={50}
refreshing={loading}
+1 -5
View File
@@ -401,11 +401,7 @@ export default class OpenChannel extends React.Component<
/>
</View>
<View style={styles.button}>
<FeeTable
setFee={this.setFee}
FeeStore={FeeStore}
SettingsStore={SettingsStore}
/>
<FeeTable setFee={this.setFee} FeeStore={FeeStore} />
</View>
</View>
</ScrollView>
-1
View File
@@ -477,7 +477,6 @@ export default class Send extends React.Component<SendProps, SendState> {
<View style={styles.feeTableButton}>
<FeeTable
setFee={this.setFee}
SettingsStore={SettingsStore}
FeeStore={FeeStore}
/>
</View>
+2 -9
View File
@@ -13,16 +13,14 @@ import { localeString } from './../utils/LocaleUtils';
import TransactionsStore from './../stores/TransactionsStore';
import LnurlPayStore from './../stores/LnurlPayStore';
import SettingsStore from './../stores/SettingsStore';
interface SendingLightningProps {
navigation: any;
TransactionsStore: TransactionsStore;
LnurlPayStore: LnurlPayStore;
SettingsStore: SettingsStore;
}
@inject('TransactionsStore', 'LnurlPayStore', 'SettingsStore')
@inject('TransactionsStore', 'LnurlPayStore')
@observer
export default class SendingLightning extends React.Component<
SendingLightningProps,
@@ -53,12 +51,7 @@ export default class SendingLightning extends React.Component<
}
render() {
const {
TransactionsStore,
LnurlPayStore,
SettingsStore,
navigation
} = this.props;
const { TransactionsStore, LnurlPayStore, navigation } = this.props;
const {
loading,
error,
+6 -7
View File
@@ -195,13 +195,7 @@ export default class Settings extends React.Component<
const lurkerLabel = `Lurking ${PrivacyUtils.getLover()} Mode: hides sensitive values`;
return (
<ScrollView
style={{
flex: 1,
backgroundColor: themeColor('background'),
color: themeColor('text')
}}
>
<ScrollView style={styles.scrollView}>
<Header
leftComponent={<BackButton />}
centerComponent={{
@@ -477,6 +471,11 @@ export default class Settings extends React.Component<
}
const styles = StyleSheet.create({
scrollView: {
flex: 1,
backgroundColor: themeColor('background'),
color: themeColor('text')
},
error: {
color: 'red'
},
+3 -3
View File
@@ -55,7 +55,7 @@ export default class Nodes extends React.Component<NodesProps, {}> {
.replace('http://', '')
: item.port
? `${item.host}:${item.port}`
: item.host;
: item.host || 'Unknown';
const title = PrivacyUtils.sensitiveValue(
displayName,
@@ -78,7 +78,7 @@ export default class Nodes extends React.Component<NodesProps, {}> {
return (
<React.Fragment>
<ListItem
title={title}
title={`${title}`}
leftElement={Node(
`data:image/png;base64,${data}`
)}
@@ -114,7 +114,7 @@ export default class Nodes extends React.Component<NodesProps, {}> {
selectedNode === index ||
(!selectedNode && index === 0)
? `Active | ${implementation}`
: implementation
: `${implementation}`
}
containerStyle={{
borderBottomWidth: 0,
+3
View File
@@ -188,6 +188,9 @@ const styles = StyleSheet.create({
error: {
color: 'red'
},
button: {
padding: 5
},
form: {
paddingTop: 20,
paddingLeft: 5,