Add moduleSuffixes to tsconfig (#11146)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-07-16 22:47:53 +03:00
committed by GitHub
parent a8b963b357
commit 007c21fa8e
82 changed files with 628 additions and 201 deletions
+13
View File
@@ -0,0 +1,13 @@
/*
* Used ONLY by the Android typecheck pass (tsconfig.check.android.json) - it
* is excluded from the other passes and has no runtime effect.
*
* react-native-device-attest's Android variant implements only the Play
* Integrity statics, so the iOS-only getDeviceCheckToken (whose app call
* site is IS_IOS-guarded) fails to resolve under .android module suffixes.
* Pin the module to its platform-neutral base class, which declares the
* full API surface.
*/
declare module 'react-native-device-attest' {
export {DeviceAttestBase as default} from 'react-native-device-attest/build/DeviceAttestBase'
}
+102
View File
@@ -0,0 +1,102 @@
/*
* Used ONLY by the web typecheck pass (tsconfig.check.web.json) - it is
* excluded from the other passes and has no runtime effect.
*
* Some packages publish .web.d.ts declarations that diverge from the API
* the app is written against (or, worse, raw TypeScript sources that break
* under `moduleSuffixes: [".web", ""]`), so this pins them to their native
* declarations. react-native-svg has the same problem, handled by deleting
* its divergent web declarations in patches/react-native-svg@15.12.1.patch
* so resolution falls through to the native ones.
*/
/*
* Side-effect CSS imports in .web files are handled by the bundler.
*/
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.
*/
declare module 'expo-file-system' {
import {
Directory as ExpoFileSystemDirectory,
File as ExpoFileSystemFile,
} from 'expo-file-system/build/ExpoFileSystem.types'
export {
type DirectoryCreateOptions,
type DirectoryInfo,
type DownloadOptions,
EncodingType,
type FileCreateOptions,
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'
import {PathUtilities} from 'expo-file-system/build/pathUtilities'
export class Paths extends PathUtilities {
static get cache(): Directory
static get bundle(): Directory
static get document(): Directory
static get appleSharedContainers(): Record<string, Directory>
static get totalDiskSpace(): number
static get availableDiskSpace(): number
static info(...uris: string[]): ExpoPathInfo
}
export class File extends ExpoFileSystemFile implements Blob {
constructor(...uris: (string | File | Directory)[])
get parentDirectory(): Directory
get extension(): string
get name(): string
readableStream(): ReadableStream<Uint8Array<ArrayBuffer>>
writableStream(): WritableStream<Uint8Array<ArrayBufferLike>>
arrayBuffer(): Promise<ArrayBuffer>
stream(): ReadableStream<Uint8Array<ArrayBuffer>>
slice(start?: number, end?: number, contentType?: string): Blob
}
export class Directory extends ExpoFileSystemDirectory {
constructor(...uris: (string | File | Directory)[])
get parentDirectory(): Directory
list(): (Directory | File)[]
get name(): string
createFile(name: string, mimeType: string | null): File
createDirectory(name: string): Directory
}
}
/*
* expo-image-manipulator's web declarations export the module class where
* the native ones export an instance, hiding instance methods such as
* `manipulate` from `typeof ImageManipulator`. Mirror the native surface.
*/
declare module 'expo-image-manipulator' {
import {type ImageManipulator as ImageManipulatorModule} from 'expo-image-manipulator/build/ImageManipulator.types'
export const ImageManipulator: ImageManipulatorModule
export {
manipulateAsync,
useImageManipulator,
} from 'expo-image-manipulator/build/ImageManipulator'
export {
type Action,
type ActionCrop,
type ActionExtent,
type ActionFlip,
type ActionResize,
type ActionRotate,
FlipType,
type ImageResult,
SaveFormat,
type SaveOptions,
} from 'expo-image-manipulator/build/ImageManipulator.types'
export {type ImageManipulatorContext} from 'expo-image-manipulator/build/ImageManipulatorContext'
export {type ImageRef} from 'expo-image-manipulator/build/ImageRef'
}