Enable React Native strict TypeScript API (#11459)

This commit is contained in:
Samuel Newman
2026-08-25 09:40:14 +03:00
committed by GitHub
parent 5f3d24efab
commit f87fdd2ea2
149 changed files with 506 additions and 623 deletions
+1 -1
View File
@@ -334,7 +334,7 @@ class MergeFeedSource_Custom extends MergeFeedSource {
feed = feed.filter(post => new Date(post.post.indexedAt) > this.minDate)
// attach source info
for (const post of feed) {
// @ts-ignore
// @ts-expect-error
post.__source = this.sourceInfo
}
return {
+5 -1
View File
@@ -1 +1,5 @@
export {unstable_batchedUpdates as batchedUpdates} from 'react-native'
import {unstable_batchedUpdates} from 'react-native'
export function batchedUpdates(fn: () => void): void {
unstable_batchedUpdates(fn, undefined)
}
+7 -7
View File
@@ -1,18 +1,18 @@
import {type ForwardedRef, useEffect, useMemo, useRef} from 'react'
import {type ScrollView} from 'react-native'
import {Platform} from 'react-native'
import {Platform, type ScrollView} from 'react-native'
import {mergeRefs} from '#/lib/merge-refs'
type Props<Scrollable extends ScrollView = ScrollView> = {
type ScrollViewInstance = React.ComponentRef<typeof ScrollView>
type Props<Scrollable extends ScrollViewInstance = ScrollViewInstance> = {
cursor?: string
outerRef?: ForwardedRef<Scrollable>
}
export function useDraggableScroll<Scrollable extends ScrollView = ScrollView>({
outerRef,
cursor = 'grab',
}: Props<Scrollable> = {}) {
export function useDraggableScroll<
Scrollable extends ScrollViewInstance = ScrollViewInstance,
>({outerRef, cursor = 'grab'}: Props<Scrollable> = {}) {
const ref = useRef<Scrollable>(null)
useEffect(() => {
+3 -3
View File
@@ -221,7 +221,7 @@ describe('useApplyPullRequestOTAUpdate', () => {
)
const buttons = jest.mocked(Alert.alert).mock.calls[0][2]
act(() => buttons?.[1].onPress?.())
void act(() => buttons?.[1].onPress?.())
await waitFor(() => expect(reloadAsync).toHaveBeenCalled())
expect(device.set).toHaveBeenCalledWith(['pendingOTAUpdate'], {
@@ -256,7 +256,7 @@ describe('useApplyPullRequestOTAUpdate', () => {
await act(() => result.current.tryApplyUpdate('pull-request-123'))
const buttons = jest.mocked(Alert.alert).mock.calls[0][2]
act(() => buttons?.[1].onPress?.())
void act(() => buttons?.[1].onPress?.())
await waitFor(() =>
expect(Alert.alert).toHaveBeenLastCalledWith(
@@ -283,7 +283,7 @@ describe('useApplyPullRequestOTAUpdate', () => {
await act(() => result.current.tryApplyUpdate('pull-request-123'))
const buttons = jest.mocked(Alert.alert).mock.calls[0][2]
act(() => buttons?.[1].onPress?.())
void act(() => buttons?.[1].onPress?.())
await waitFor(() =>
expect(Alert.alert).toHaveBeenLastCalledWith(
+1 -1
View File
@@ -452,7 +452,7 @@ export const splash = (scheme: 'light' | 'dark') => {
: require('../../../assets/splash/splash-dark.png')
return {
image: RNImage.resolveAssetSource(source).uri,
image: RNImage.resolveAssetSource(source)!.uri,
imageFullScreen: true,
imageResizeMode: 'cover',
backgroundColor: scheme === 'light' ? '#006AFF' : '#002861',
+1 -1
View File
@@ -24,6 +24,6 @@ export function isJwtExpired(token: string) {
export function isAppPassword(token: string) {
const payload = jwtDecode(token)
// @ts-ignore
// @ts-expect-error
return payload.scope === 'com.atproto.appPass'
}
+2
View File
@@ -23,6 +23,7 @@ export async function openPicker(opts?: ImagePickerOptions) {
quality: 1,
selectionLimit: 1,
...opts,
shouldDownloadFromNetwork: true,
legacy: true,
preferredAssetRepresentationMode:
UIImagePickerPreferredAssetRepresentationMode.Automatic,
@@ -63,6 +64,7 @@ export async function openUnifiedPicker({
// the `file` returned on each asset after validation instead.
base64: false,
selectionLimit: IS_IOS ? selectionCountRemaining : undefined,
shouldDownloadFromNetwork: true,
preferredAssetRepresentationMode:
UIImagePickerPreferredAssetRepresentationMode.Automatic,
videoExportPreset: VideoExportPreset.Passthrough,
+2 -6
View File
@@ -5,8 +5,7 @@ import {IS_WEB} from '#/env'
const {height: SCREEN_HEIGHT} = Dimensions.get('window')
const IFRAME_HOST = IS_WEB
? // @ts-ignore only for web
window.location.host === 'localhost:8100'
? window.location.host === 'localhost:8100'
? 'http://localhost:8100'
: 'https://bsky.app'
: __DEV__ && !process.env.JEST_WORKER_ID
@@ -154,10 +153,7 @@ export function parseEmbedPlayerFromUrl(
urlp.hostname === 'www.twitch.tv' ||
urlp.hostname === 'm.twitch.tv'
) {
const parent = IS_WEB
? // @ts-ignore only for web
window.location.hostname
: 'localhost'
const parent = IS_WEB ? window.location.hostname : 'localhost'
const [__, channelOrVideo, clipOrId, id] = urlp.pathname.split('/')