lint and typecheck fixes

This commit is contained in:
Oleksii Bulenok
2026-07-30 18:05:34 +02:00
parent 3a08e1a488
commit 5d95a91437
16 changed files with 113 additions and 39 deletions
+3 -6
View File
@@ -2,7 +2,7 @@ import {lazy, useState} from 'react'
import {View} from 'react-native'
// @ts-expect-error missing types
import QRCode from 'react-native-qrcode-styled'
import type ViewShot from 'react-native-view-shot'
import {type ViewShotRef} from 'react-native-view-shot'
import {Trans} from '@lingui/react/macro'
import {Logo} from '#/view/icons/Logo'
@@ -14,10 +14,7 @@ import {IS_WEB} from '#/env'
import {app} from '#/lexicons'
import * as bsky from '#/types/bsky'
const LazyViewShot = lazy(
// @ts-expect-error dynamic import
() => import('react-native-view-shot/src/index'),
)
const LazyViewShot = lazy(() => import('react-native-view-shot'))
export function QrCode({
starterPack,
@@ -26,7 +23,7 @@ export function QrCode({
}: {
starterPack: app.bsky.graph.defs.StarterPackView
link: string
ref: React.Ref<ViewShot>
ref: React.Ref<ViewShotRef>
}) {
const {record} = starterPack
+2 -2
View File
@@ -1,6 +1,6 @@
import {Suspense, useRef, useState} from 'react'
import {View} from 'react-native'
import type ViewShot from 'react-native-view-shot'
import {type ViewShotRef} from 'react-native-view-shot'
import {requestPermissionsAsync, saveToLibraryAsync} from 'expo-media-library'
import * as Sharing from 'expo-sharing'
import {msg} from '@lingui/core/macro'
@@ -38,7 +38,7 @@ export function QrCodeDialog({
const [isSaveProcessing, setIsSaveProcessing] = useState(false)
const [isCopyProcessing, setIsCopyProcessing] = useState(false)
const ref = useRef<ViewShot>(null)
const ref = useRef<ViewShotRef>(null)
const getCanvas = (base64: string): Promise<HTMLCanvasElement> => {
return new Promise(resolve => {
@@ -1,6 +1,6 @@
import {Suspense, useRef} from 'react'
import {Pressable, View} from 'react-native'
import type ViewShot from 'react-native-view-shot'
import {type ViewShotRef} from 'react-native-view-shot'
import {setStringAsync} from 'expo-clipboard'
import {requestPermissionsAsync, saveToLibraryAsync} from 'expo-media-library'
import {useLingui} from '@lingui/react/macro'
@@ -41,7 +41,7 @@ export function InviteFriendsDialogInner({
const {currentAccount} = useSession()
const profileQuery = useProfileQuery({did: currentAccount?.did})
const [themeKey, setThemeKey] = useInviteThemeKey()
const captureRef = useRef<ViewShot>(null)
const captureRef = useRef<ViewShotRef>(null)
const theme = getInviteTheme(themeKey)
const variant = t.name === 'light' ? theme.light : theme.dark
@@ -2,7 +2,7 @@ import {lazy} from 'react'
import {View} from 'react-native'
// @ts-expect-error missing types
import QRCode from 'react-native-qrcode-styled'
import type ViewShot from 'react-native-view-shot'
import {type ViewShotRef} from 'react-native-view-shot'
import {Image} from 'expo-image'
import {LinearGradient} from 'expo-linear-gradient'
@@ -12,10 +12,7 @@ import {hexToRgb, rgbToHex} from '#/alf/util/colorGeneration'
import {Text} from '#/components/Typography'
import {type InviteThemeVariant} from '../themes'
const LazyViewShot = lazy(
// @ts-expect-error dynamic import
() => import('react-native-view-shot/src/index'),
)
const LazyViewShot = lazy(() => import('react-native-view-shot'))
const CARD_WIDTH = 278
const CARD_GRADIENT_PADDING = 12
@@ -37,7 +34,7 @@ export function ThemedQrCard({
shareUrl: string
handle: string
avatarUri?: string
captureRef: React.Ref<ViewShot>
captureRef: React.Ref<ViewShotRef>
}) {
const t = useTheme()
return (
+40 -8
View File
@@ -18,27 +18,42 @@ declare module '*.css'
/*
* expo-file-system's declarations build File/Directory on top of
* `./ExpoFileSystem`, which remaps to a web shim whose classes are empty.
* The fully-typed base classes live in ExpoFileSystem.types (no .web
* sibling), so mirror the FileSystem.d.ts wrapper classes on top of those.
* As of SDK 57 the fully-typed base classes live in
* internal/NativeFileSystem.types (no .web sibling), so mirror the File.d.ts
* and Directory.d.ts wrapper classes on top of those.
*/
declare module 'expo-file-system' {
import {
Directory as ExpoFileSystemDirectory,
File as ExpoFileSystemFile,
} from 'expo-file-system/build/ExpoFileSystem.types'
NativeFileSystemDirectory as ExpoFileSystemDirectory,
NativeFileSystemFile as ExpoFileSystemFile,
} from 'expo-file-system/build/internal/NativeFileSystem.types'
export {
type DirectoryCreateOptions,
type DirectoryInfo,
type DownloadOptions,
EncodingType,
type FileCreateOptions,
FileHandle,
type FileHandle,
type FileInfo,
type FileWriteOptions,
type InfoOptions,
type PathInfo,
} from 'expo-file-system/build/ExpoFileSystem.types'
import {type PathInfo as ExpoPathInfo} from 'expo-file-system/build/ExpoFileSystem.types'
} from 'expo-file-system/build/FileSystem.types'
import {type PathInfo as ExpoPathInfo} from 'expo-file-system/build/FileSystem.types'
import {
type WatchEvent,
type WatchOptions,
type WatchSubscription,
} from 'expo-file-system/build/FileSystemWatcher.types'
import {
type DownloadTask,
type UploadTask,
} from 'expo-file-system/build/NetworkTasks'
import {
type DownloadTaskOptions,
type UploadOptions,
type UploadResult,
} from 'expo-file-system/build/NetworkTasks.types'
import {PathUtilities} from 'expo-file-system/build/pathUtilities'
export class Paths extends PathUtilities {
@@ -59,8 +74,21 @@ declare module 'expo-file-system' {
readableStream(): ReadableStream<Uint8Array<ArrayBuffer>>
writableStream(): WritableStream<Uint8Array<ArrayBufferLike>>
arrayBuffer(): Promise<ArrayBuffer>
json(): Promise<unknown>
formData(): ReturnType<Response['formData']>
stream(): ReadableStream<Uint8Array<ArrayBuffer>>
slice(start?: number, end?: number, contentType?: string): Blob
upload(url: string, options?: UploadOptions): Promise<UploadResult>
createUploadTask(url: string, options?: UploadOptions): UploadTask
static createDownloadTask(
url: string,
destination: File | Directory,
options?: DownloadTaskOptions,
): DownloadTask
watch(
callback: (event: WatchEvent<File>) => void,
options?: WatchOptions,
): WatchSubscription
}
export class Directory extends ExpoFileSystemDirectory {
@@ -70,6 +98,10 @@ declare module 'expo-file-system' {
get name(): string
createFile(name: string, mimeType: string | null): File
createDirectory(name: string): Directory
watch(
callback: (event: WatchEvent<File | Directory>) => void,
options?: WatchOptions,
): WatchSubscription
}
}
@@ -7,15 +7,12 @@ import {
useRef,
} from 'react'
import {View} from 'react-native'
import type ViewShot from 'react-native-view-shot'
import {type ViewShotRef} from 'react-native-view-shot'
import {useAvatar} from '#/screens/Onboarding/StepProfile/index'
import {atoms as a} from '#/alf'
const LazyViewShot = lazy(
// @ts-expect-error dynamic import
() => import('react-native-view-shot/src/index'),
)
const LazyViewShot = lazy(() => import('react-native-view-shot'))
const SIZE_MULTIPLIER = 5
@@ -28,7 +25,7 @@ export interface PlaceholderCanvasRef {
export const PlaceholderCanvas = forwardRef<PlaceholderCanvasRef, {}>(
function PlaceholderCanvas({}, ref) {
const {avatar} = useAvatar()
const viewshotRef = useRef<ViewShot>(null)
const viewshotRef = useRef<ViewShotRef>(null)
const Icon = avatar.placeholder.component
const styles = useMemo(
+1 -2
View File
@@ -95,8 +95,7 @@ export function StepInfo({
tldtsRef.current = tldts
})
// This will get used in the avatar creator a few steps later, so lets preload it now
// @ts-expect-error - valid path
void import('react-native-view-shot/src/index')
void import('react-native-view-shot')
}, [])
const onNextPress = () => {
+1 -1
View File
@@ -567,7 +567,7 @@ export const ComposePost = ({
FileSystem.Paths.cache,
tempFileName,
)
sourceFile.copy(tempFile)
await sourceFile.copy(tempFile)
logger.debug('restoreVideo: copied to temp file', {
source: videoInfo.uri,
temp: tempFile.uri,
@@ -50,7 +50,7 @@ export async function saveMediaToLocal(
try {
const sourceFile = new File(normalizedSource)
sourceFile.copy(destFile)
await sourceFile.copy(destFile)
// Update cache after successful save
mediaExistsCache.set(localRefPath, true)
} catch (error) {