Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently use type alias instead of interface #153

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Component/AppBarMoreMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
import { Platform } from 'react-native';
import { Appbar, Menu, useTheme } from 'react-native-paper';

interface Props {
type Props = {
children: React.ReactNode,
visible: boolean,
setVisible: (visible: boolean) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Component/CustomScrollView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react';
import { ScrollView } from 'react-native-gesture-handler';

interface Props {
type Props = {
children: ReactNode
}

Expand Down
2 changes: 1 addition & 1 deletion src/Helper/AmountHelper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NumberFormatSettings } from '../redux/features/displaySettings/displaySettingsSlice';

export interface DividedAmount {
export type DividedAmount = {
dividedAmount: number
remainingAmount: number,
}
Expand Down
2 changes: 1 addition & 1 deletion src/Hooks/useConnectionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useState } from 'react';
import { API } from 'ynab';
import { LoadingStatus } from '../Helper/LoadingStatus';

export interface ConnectionStatus {
export type ConnectionStatus = {
status: LoadingStatus,
error?: {
id: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Hooks/useEditableBudgetsInProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { addProfile, BudgetInProfile, Profile, ProfileToCreate, selectProfile, u
import { useAppDispatch } from './useAppDispatch';
import { useAppSelector } from './useAppSelector';

export interface EditableBudgetInProfile {
export type EditableBudgetInProfile = {
budgetId?: string,
name?: string,
debtorAccountId?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Navigation/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DevelopmentSettingsScreen } from '../Screens/Settings/DevelopmentSettin
import { Appbar, useTheme } from 'react-native-paper';
import { Keyboard } from 'react-native';

interface Props {
type Props = {
initialRouteName: keyof StackParameterList,
}

Expand Down
2 changes: 1 addition & 1 deletion src/Navigation/ScreenParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ynab from 'ynab';
import { StackNavigationProp, StackScreenProps } from '@react-navigation/stack';
import { CategoryCombo } from '../redux/features/categoryCombos/categoryCombosSlice';

interface BasicData {
type BasicData = {
payer: {
budgetId: string,
accountId: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/AmountsScreen/AmountView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CategoryInput } from './CategoryInput';
import { MyStackNavigationProp, StackParameterList } from '../../Navigation/ScreenParameters';
import { selectCategoryCombos } from '../../redux/features/categoryCombos/categoryCombosSlice';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
key: number,
index: number,
amountText: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/AmountsScreen/AmountsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useNavigationSettings } from '../../Hooks/useNavigationSettings';

type ScreenName = 'Amounts';

interface UserInterfaceAmountEntry {
type UserInterfaceAmountEntry = {
amountText: string,
memo: string,
payerCategoryId?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/AmountsScreen/CategoryInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StyleSheet, View } from 'react-native';
import { ScreenNames } from '../../Navigation/ScreenNames';
import { MyStackNavigationProp, StackParameterList } from '../../Navigation/ScreenParameters';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
label: string,
text: string,
budgetId: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/AmountsScreen/SplitPercentInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import { TextInput } from 'react-native-paper';

interface Props {
type Props = {
payerCategoryChosen: boolean,
debtorCategoryChosen: boolean,
splitPercentToPayer: number | undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/AmountsScreen/SubAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MyStackNavigationProp, StackParameterList } from '../../Navigation/Scre
import { ScreenNames } from '../../Navigation/ScreenNames';
import { useAmountConversion } from '../../Hooks/useAmountConversion';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
value: string,
setValue: (newValue: string) => void,
navigation: MyStackNavigationProp<T>,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/CalculationHistoryScreen/HistoryListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback } from 'react';
import { List } from 'react-native-paper';

interface Props {
type Props = {
calculation: string,
selectCalculation: (calculation: string) => void,
navigateBack: () => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/CalculatorScreen/CalculatorKeyboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { KeyboardNumberButton } from './KeyboardNumberButton';
import { useAppSelector } from '../../Hooks/useAppSelector';
import { selectNumberFormatSettings } from '../../redux/features/displaySettings/displaySettingsSlice';

interface Props {
type Props = {
onDigitPress: (digit: number) => void
onDecimalSeparatorPress: () => void
onOperatorAddPress: () => void
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/CalculatorScreen/KeyboardButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Text } from 'react-native-paper';
import React from 'react';
import { ColorValue, Pressable, StyleSheet } from 'react-native';

interface Props {
type Props = {
value: string,
color: ColorValue,
onPress: () => void
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/CalculatorScreen/KeyboardNumberButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import { KeyboardButton } from './KeyboardButton';

interface Props {
type Props = {
number: number
onPress: (number: number) => void
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/CategoryScreen/CategoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { selectCategoryGroups, selectCategories, selectInternalMasterCategoryGro
import { useAppSelector } from '../../Hooks/useAppSelector';
import { CategoryListItem } from './CategoryListItem';

interface Props {
type Props = {
categoryNameFilter: string,
budgetId: string,
onCategorySelect: (categoryId: string) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/CategoryScreen/CategoryListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { List } from 'react-native-paper';
import { useAppSelector } from '../../Hooks/useAppSelector';
import { selectCategory } from '../../redux/features/ynab/ynabSlice';

interface Props {
type Props = {
budgetId: string,
categoryId: string,
onCategorySelect: (categoryId: string) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/InitialScreen/AccessTokenListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useAutomaticConnectionTest } from '../../Hooks/useAutomaticConnectionTe
import { ScreenNames } from '../../Navigation/ScreenNames';
import { MyStackNavigationProp, StackParameterList } from '../../Navigation/ScreenParameters';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
navigation: MyStackNavigationProp<T>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/Screens/InitialScreen/ProfileListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ScreenNames } from '../../Navigation/ScreenNames';
import { StackParameterList, MyStackNavigationProp } from '../../Navigation/ScreenParameters';
import { selectProfiles } from '../../redux/features/profiles/profilesSlice';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
navigation: MyStackNavigationProp<T>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/DataTableCellView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';

interface Props {
type Props = {
children: React.ReactNode,
alignRight?: boolean,
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/MemoDataTableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
import { DataTable, IconButton } from 'react-native-paper';
import { DataTableCellView } from './DataTableCellView';

interface Props {
type Props = {
memo: string | null | undefined,
triggerMemoDisplay: (memo: string) => void,
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/MemoModalPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
import { StyleSheet } from 'react-native';
import { Portal, Modal, useTheme, Text } from 'react-native-paper';

interface Props {
type Props = {
visible: boolean,
toggleVisible: () => void,
memo: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/MultiLineTextDataTableCellView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { DataTableCellView } from './DataTableCellView';
import { Text } from 'react-native-paper';

interface Props {
type Props = {
text: string | undefined,
}

Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/SaveFAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FAB } from 'react-native-paper';
import { StyleSheet } from 'react-native';
import { LoadingStatus } from '../../Helper/LoadingStatus';

interface Props {
type Props = {
saveStatus: LoadingStatus,
save: () => void,
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/SaveTransactionListSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SubTransactionsDataTable } from './SubTransactionsDataTable';
import { MultiLineTextDataTableCellView } from './MultiLineTextDataTableCellView';
import { useAmountConversion } from '../../Hooks/useAmountConversion';

interface Props {
type Props = {
saveTransaction: SaveTransaction,
sectionTitle: string,
budgetId: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/SubTransactionDataTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useAppSelector } from '../../Hooks/useAppSelector';
import { MemoDataTableCell } from './MemoDataTableCell';
import { MultiLineTextDataTableCellView } from './MultiLineTextDataTableCellView';

interface Props {
type Props = {
budgetId: string,
subTransaction: SaveSubTransaction,
displayMemoCell: boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SaveScreen/SubTransactionsDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SaveSubTransaction } from 'ynab';
import { MemoModalPortal } from './MemoModalPortal';
import { SubTransactionDataTableRow } from './SubTransactionDataTableRow';

interface Props {
type Props = {
budgetId: string,
subTransactions: SaveSubTransaction[],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { List } from 'react-native-paper';
import { useAppSelector } from '../../Hooks/useAppSelector';
import { selectCategoryCombo } from '../../redux/features/categoryCombos/categoryCombosSlice';

interface Props {
type Props = {
categoryComboId: string,
onSelect: (categoryComboId: string) => void,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HelperText, TextInput } from 'react-native-paper';
import { LoadingStatus } from '../../../Helper/LoadingStatus';
import { ConnectionStatus } from './AccessTokenScreen';

interface Props {
type Props = {
token: string,
setToken: (token: string) => void,
connectionStatus: ConnectionStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ICON_SAVE = 'check';
const ICON_CONNECTION_SUCCESS = 'check';
const ICON_CONNECTION_ERROR = 'alert-circle';

export interface ConnectionStatus {
export type ConnectionStatus = {
status: LoadingStatus,
error?: {
id: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { selectProfiles } from '../../../redux/features/profiles/profilesSlice';
import { useAppSelector } from '../../../Hooks/useAppSelector';
import { ChooseCategoryListItem } from './ChooseCategoryListItem';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
navigation: MyStackNavigationProp<T>,
name: string,
setName: (name: string) => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MyStackNavigationProp, StackParameterList } from '../../../Navigation/S
import { selectBudgetById, selectCategories } from '../../../redux/features/ynab/ynabSlice';
import { useAppSelector } from '../../../Hooks/useAppSelector';

interface Props<T extends keyof StackParameterList> {
type Props<T extends keyof StackParameterList> = {
budgetId: string,
budgetDisplayName: string | undefined,
navigation: MyStackNavigationProp<T>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useAppSelector } from '../../../Hooks/useAppSelector';
import { StyleSheet } from 'react-native';
import { useAppDispatch } from '../../../Hooks/useAppDispatch';

interface Props {
type Props = {
visible: boolean,
toggleVisible: () => void,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ChooseBudgetListItem } from './ChooseBudgetListItem';
import { EditableBudgetInProfile } from './CreateProfilesScreen/CreateProfileScreen';
import { ProfileBudgetDetailInput } from './ProfileBudgetDetailInput';

interface Props {
type Props = {
editableBudgetInProfile: EditableBudgetInProfile,
setEditableBudgetInProfile: Updater<EditableBudgetInProfile>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/Settings/Profiles/BudgetSelectModalPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { selectBudgets } from '../../../redux/features/ynab/ynabSlice';
import { useAppSelector } from '../../../Hooks/useAppSelector';
import { Budget } from '../../../YnabApi/YnabApiWrapper';

interface Props {
type Props = {
visible: boolean,
toggleVisible: () => void,
selectedBudgetId?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/Settings/Profiles/ChooseBudgetListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { selectBudgets } from '../../../redux/features/ynab/ynabSlice';
import { useAppSelector } from '../../../Hooks/useAppSelector';
import { BudgetSelectModalPortal } from './BudgetSelectModalPortal';

interface Props {
type Props = {
selectedBudgetId?: string,
selectBudgetId: (budgetId: string) => void,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type ScreenName = 'CreateProfile';
const SCREEN_TITLE = 'Add Profile';
const ICON_SAVE = 'check';

export interface EditableBudgetInProfile {
export type EditableBudgetInProfile = {
budgetId?: string,
name?: string,
debtorAccountId?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/Settings/Profiles/ProfileBudgetDetailInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { selectActiveAccounts, selectBudgetById } from '../../../redux/features/
import { useAppSelector } from '../../../Hooks/useAppSelector';
import { Account } from '../../../YnabApi/YnabApiWrapper';

interface Props {
type Props = {
budgetId: string,
displayName?: string,
setDisplayName: (name: string) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SplittingScreen/AccountRadioSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useCallback, useEffect } from 'react';
import { Account } from '../../YnabApi/YnabApiWrapper';
import { Keyboard } from 'react-native';

interface Props {
type Props = {
accounts: Account[],
selectedAccountId: string,
setSelectedAccountId: (id: string) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SplittingScreen/PayerBudgetRadioSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Keyboard } from 'react-native';
import { useAppSelector } from '../../Hooks/useAppSelector';
import { selectBudgets } from '../../redux/features/ynab/ynabSlice';

interface Props {
type Props = {
profile: Profile,
payerBudgetIndex: number,
setPayerBudgetIndex: (index: number) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/Screens/SplittingScreen/TotalAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StyleSheet } from 'react-native';
import { TextInput } from 'react-native-paper';
import { useAmountConversion } from '../../Hooks/useAmountConversion';

interface Props {
type Props = {
value: string,
setValue: (newValue: string) => void,
}
Expand Down
4 changes: 2 additions & 2 deletions src/YnabApi/BuildSaveTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { convertHumanAmountToApiAmount, divideApiAmount } from '../Helper/Amount
import { BasicData } from '../Navigation/ScreenParameters';
import * as ynab from 'ynab';

interface SaveTransactions {
type SaveTransactions = {
payer: ynab.SaveTransaction,
debtor: ynab.SaveTransaction
}

interface AmountEntry {
type AmountEntry = {
amount: number,
memo: string,
payerCategoryId?: string,
Expand Down
Loading