Fix ts warnings

This commit is contained in:
xmflsct 2023-02-11 22:04:32 +01:00
parent fcc53672fa
commit b679c0760f
19 changed files with 46 additions and 46 deletions

View File

@ -8,6 +8,7 @@ export default (): ExpoConfig => ({
slug: 'tooot',
scheme: 'tooot',
version,
// @ts-ignore
extra: { environment: process.env.ENVIRONMENT },
privacy: 'hidden',
ios: {

View File

@ -370,7 +370,7 @@ PODS:
- RCTTypeSafety
- React-Core
- ReactCommon/turbomodule/core
- react-native-segmented-control (2.2.2):
- react-native-segmented-control (2.4.0):
- React-Core
- React-perflogger (0.71.2)
- React-RCTActionSheet (0.71.2):
@ -571,7 +571,7 @@ DEPENDENCIES:
- "react-native-paste-input (from `../node_modules/@mattermost/react-native-paste-input`)"
- react-native-quick-base64 (from `../node_modules/react-native-quick-base64`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- "react-native-segmented-control (from `../node_modules/@react-native-community/segmented-control`)"
- "react-native-segmented-control (from `../node_modules/@react-native-segmented-control/segmented-control`)"
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
@ -722,7 +722,7 @@ EXTERNAL SOURCES:
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-segmented-control:
:path: "../node_modules/@react-native-community/segmented-control"
:path: "../node_modules/@react-native-segmented-control/segmented-control"
React-perflogger:
:path: "../node_modules/react-native/ReactCommon/reactperflogger"
React-RCTActionSheet:
@ -831,7 +831,7 @@ SPEC CHECKSUMS:
react-native-paste-input: fb7156dc75960c9895ddd9b9d68eeb874c9f323a
react-native-quick-base64: e657e9197e61b60a9dec49807843052b830da254
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-segmented-control: 65df6cd0619b780b3843d574a72d4c7cec396097
react-native-segmented-control: 06607462630512ff8eef652ec560e6235a30cc3e
React-perflogger: c7ccda3d1d1da837f7ff4e54e816022a6803ee87
React-RCTActionSheet: 01c125aebbad462a24228f68c584c7a921d6c28e
React-RCTAnimation: 5277a9440acffc4a5b7baa6ae3880fe467277ae6

View File

@ -573,8 +573,9 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmflsct.app.tooot;
PRODUCT_NAME = tooot;
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc com.xmflsct.app.tooot";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "tooot-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_PRECOMPILE_BRIDGING_HEADER = YES;
@ -612,8 +613,9 @@
PRODUCT_BUNDLE_IDENTIFIER = com.xmflsct.app.tooot;
PRODUCT_NAME = tooot;
PROVISIONING_PROFILE_SPECIFIER = "match AppStore com.xmflsct.app.tooot";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "tooot-Bridging-Header.h";
SWIFT_PRECOMPILE_BRIDGING_HEADER = YES;
SWIFT_VERSION = 5.0;

View File

@ -31,9 +31,9 @@
"@react-native-clipboard/clipboard": "^1.11.1",
"@react-native-community/blur": "^4.3.0",
"@react-native-community/netinfo": "9.3.7",
"@react-native-community/segmented-control": "^2.2.2",
"@react-native-firebase/app": "^17.1.0",
"@react-native-menu/menu": "^0.7.3",
"@react-native-segmented-control/segmented-control": "^2.4.0",
"@react-navigation/bottom-tabs": "^6.5.4",
"@react-navigation/native": "^6.1.3",
"@react-navigation/native-stack": "^6.9.9",

View File

@ -18,16 +18,15 @@ import ThemeManager from '@utils/styles/ThemeManager'
import * as Localization from 'expo-localization'
import * as SplashScreen from 'expo-splash-screen'
import React, { useCallback, useEffect, useState } from 'react'
import { LogBox, Platform } from 'react-native'
import { Platform } from 'react-native'
import { GestureHandlerRootView } from 'react-native-gesture-handler'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { enableFreeze } from 'react-native-screens'
import i18n from './i18n'
import Screens from './screens'
Platform.select({
android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
})
log('log', 'App', 'delay splash')
SplashScreen.preventAutoHideAsync()
dev()
sentry()
@ -36,9 +35,6 @@ audio()
push()
enableFreeze(true)
log('log', 'App', 'delay splash')
SplashScreen.preventAutoHideAsync()
const App: React.FC = () => {
log('log', 'App', 'rendering App')
const [appIsReady, setAppIsReady] = useState(false)

View File

@ -1,6 +1,6 @@
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { forwardRef, RefObject } from 'react'
import React, { ForwardedRef, forwardRef } from 'react'
import { Platform, TextInput, TextInputProps, View } from 'react-native'
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated'
import { EmojisState } from './Emojis/Context'
@ -35,7 +35,7 @@ const ComponentInput = forwardRef(
isFocused,
...props
}: Props,
ref: RefObject<TextInput>
ref: ForwardedRef<TextInput>
) => {
const { colors, mode } = useTheme()

View File

@ -1,11 +1,11 @@
import { useHeaderHeight } from '@react-navigation/elements'
import { StyleConstants } from '@utils/styles/constants'
import { forwardRef, PropsWithChildren, RefObject } from 'react'
import { ForwardedRef, forwardRef, PropsWithChildren } from 'react'
import { KeyboardAvoidingView, Platform, ScrollView } from 'react-native'
import { SafeAreaView } from 'react-native-safe-area-context'
export const ModalScrollView = forwardRef(
({ children }: PropsWithChildren, ref: RefObject<ScrollView>) => {
({ children }: PropsWithChildren, ref: ForwardedRef<ScrollView>) => {
const headerHeight = useHeaderHeight()
return (

View File

@ -177,7 +177,7 @@ const TimelineRefresh: React.FC<Props> = ({
flRef.current?.scrollToOffset({ offset: scrollY.value - 15, animated: true })
}
await new Promise(promise => setTimeout(promise, 64))
await new Promise<void>(promise => setTimeout(promise, 64))
queryClient.setQueryData<
InfiniteData<
PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]>

View File

@ -103,7 +103,7 @@ const TimelineActions: React.FC = () => {
cancelButtonIndex: 2,
...androidActionSheetStyles(colors)
},
(selectedIndex: number) => {
selectedIndex => {
switch (selectedIndex) {
case 0:
mutation.mutate({

View File

@ -129,7 +129,7 @@ const chooseAndUploadAttachment = async ({
for (const media of result) {
const requiredMedia = media as Required<Asset>
uploadAttachment({ composeDispatch, media: requiredMedia })
await new Promise(res => setTimeout(res, 500))
await new Promise<void>(res => setTimeout(res, 500))
}
}

View File

@ -1,6 +1,6 @@
import { HeaderRight } from '@components/Header'
import Timeline from '@components/Timeline'
import SegmentedControl from '@react-native-community/segmented-control'
import SegmentedControl from '@react-native-segmented-control/segmented-control'
import { NativeStackScreenProps } from '@react-navigation/native-stack'
import { TabPublicStackParamList } from '@utils/navigation/navigators'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
@ -49,11 +49,12 @@ const Root: React.FC<NativeStackScreenProps<TabPublicStackParamList, 'Tab-Public
useEffect(() => {
navigation.setOptions({
headerTitle: () => (
// @ts-ignore
<SegmentedControl
appearance={mode}
values={routes.map(({ title }) => title)}
selectedIndex={segment}
onChange={({ nativeEvent }) => {
onChange={({ nativeEvent }: any) => {
setSegment(nativeEvent.selectedSegmentIndex)
setGlobalStorage('app.prev_public_segment', segments[nativeEvent.selectedSegmentIndex])
}}

View File

@ -3,7 +3,7 @@ import menuShare from '@components/contextMenu/share'
import { HeaderLeft, HeaderRight } from '@components/Header'
import Timeline from '@components/Timeline'
import TimelineDefault from '@components/Timeline/Default'
import SegmentedControl from '@react-native-community/segmented-control'
import SegmentedControl from '@react-native-segmented-control/segmented-control'
import { useQueryClient } from '@tanstack/react-query'
import { TabSharedStackScreenProps } from '@utils/navigation/navigators'
import { useAccountQuery } from '@utils/queryHooks/account'
@ -182,11 +182,12 @@ const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>
<AccountAttachments />
</View>
{!data?.suspended ? (
// @ts-ignore
<SegmentedControl
appearance={mode}
values={[t('shared.account.toots.default'), t('shared.account.toots.all')]}
selectedIndex={segment}
onChange={({ nativeEvent }) => {
onChange={({ nativeEvent }: any) => {
setSegment(nativeEvent.selectedSegmentIndex)
switch (nativeEvent.selectedSegmentIndex) {
case 0:

View File

@ -85,7 +85,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
for (let [] of Array(
Math.ceil(ancestorsCache.current.length / PREV_PER_BATCH)
).entries()) {
await new Promise(promise => setTimeout(promise, 64))
await new Promise<void>(promise => setTimeout(promise, 64))
queryClient.setQueryData<{ pages: { body: Mastodon.Status[] }[] }>(
queryKey.local,
old => {

View File

@ -1,4 +1,3 @@
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import TabSharedAccount from '@screens/Tabs/Shared/Account'
import TabSharedAccountInLists from '@screens/Tabs/Shared/AccountInLists'
import TabSharedAttachments from '@screens/Tabs/Shared/Attachments'
@ -11,7 +10,7 @@ import TabSharedUsers from '@screens/Tabs/Shared/Users'
import React from 'react'
import TabSharedFilter from './Filter'
const TabShared = ({ Stack }: { Stack: ReturnType<typeof createNativeStackNavigator> }) => {
const TabShared = ({ Stack }: { Stack: any }) => {
return (
<Stack.Group>
<Stack.Screen

View File

@ -1,3 +1,3 @@
import { AccountV0 } from "./v0";
export { AccountV0 as StorageAccount }
export type { AccountV0 as StorageAccount }

View File

@ -1,3 +1,3 @@
import { GlobalV0 } from "./v0";
import { GlobalV0 } from './v0'
export { GlobalV0 as StorageGlobal }
export type { GlobalV0 as StorageGlobal }

View File

@ -11,7 +11,6 @@ export const versionStorageGlobal = storage.global.getNumber('version.global')
export async function migrateFromAsyncStorage(): Promise<void> {
log('log', 'Migration', 'Migrating...')
const start = global.performance.now()
const unwrapPushData = (setting: { value: boolean } | boolean | undefined): boolean =>
typeof setting === 'object' ? setting.value : typeof setting === 'boolean' ? setting : true
@ -176,6 +175,5 @@ export async function migrateFromAsyncStorage(): Promise<void> {
storage.global.set('version.global', 0)
const end = global.performance.now()
log('log', 'Migration', `Migrated in ${end - start}ms`)
log('log', 'Migration', 'Migrated')
}

View File

@ -9,16 +9,18 @@
"react-native"
],
"lib": [
"es2019"
"esnext"
],
"allowJs": false,
"jsx": "react-native",
"noEmit": true,
"isolatedModules": true,
"strict": true,
"strictFunctionTypes": false,
"moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"traceResolution": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"skipLibCheck": true,

View File

@ -3069,16 +3069,6 @@ __metadata:
languageName: node
linkType: hard
"@react-native-community/segmented-control@npm:^2.2.2":
version: 2.2.2
resolution: "@react-native-community/segmented-control@npm:2.2.2"
peerDependencies:
react: ">=16.0"
react-native: ">=0.62"
checksum: 2b691a8a1c3b1afc4262d8c27c64b9af14d075198cd1873a6d8abbcea93f9f2fcca00355a31e281350f07d2d48dee9d3020e20eb82ef61901134e3aaba2f833e
languageName: node
linkType: hard
"@react-native-firebase/app@npm:^17.1.0":
version: 17.1.0
resolution: "@react-native-firebase/app@npm:17.1.0"
@ -3103,6 +3093,16 @@ __metadata:
languageName: node
linkType: hard
"@react-native-segmented-control/segmented-control@npm:^2.4.0":
version: 2.4.0
resolution: "@react-native-segmented-control/segmented-control@npm:2.4.0"
peerDependencies:
react: ">=16.0"
react-native: ">=0.62"
checksum: a7d6b243116bf1aa8e98dc0514f83a169c2e3881ec5b435bf8eab2fc2c125b7b15a53d81c1d46ab5889950cb6f5c1351708b5a3f7c5759421c0fdb73839fce3a
languageName: node
linkType: hard
"@react-native/assets@npm:1.0.0":
version: 1.0.0
resolution: "@react-native/assets@npm:1.0.0"
@ -11585,9 +11585,9 @@ __metadata:
"@react-native-clipboard/clipboard": ^1.11.1
"@react-native-community/blur": ^4.3.0
"@react-native-community/netinfo": 9.3.7
"@react-native-community/segmented-control": ^2.2.2
"@react-native-firebase/app": ^17.1.0
"@react-native-menu/menu": ^0.7.3
"@react-native-segmented-control/segmented-control": ^2.4.0
"@react-navigation/bottom-tabs": ^6.5.4
"@react-navigation/native": ^6.1.3
"@react-navigation/native-stack": ^6.9.9