chore(mobile): fix pre-existing type-check errors - #128
Conversation
apps/mobile type-check was RED on main with 20 errors across 16 files: SafeAreaView / GestureHandlerRootView "style" prop "does not exist", and an implicitly-any "pressed" arg in bulk-action-bar-v2.tsx. Root cause: react-native is installed under apps/mobile/node_modules while react-native-safe-area-context and react-native-gesture-handler hoist to the repo-root node_modules. With moduleResolution "bundler", those hoisted libs resolve their `import ... from "react-native"` by walking UP from the repo root and never find react-native (it lives down in apps/mobile/node_modules), so their .d.ts files fail to resolve RN. That makes `NativeSafeAreaViewProps extends ViewProps` and `GestureHandlerRootViewProps` lose `style`, and the gesture-handler Pressable render-prop arg degrade to any. Fix: map "react-native" / "react-native/*" in apps/mobile/tsconfig.json to the actual install location so every consumer .d.ts resolves a single RN type surface. No app code changes, no casts, no suppressions. "pressed" now infers boolean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
Correct root-cause fix for the 20 pre-existing type-check errors. Adding react-native / react-native/* path mappings to apps/mobile/tsconfig.json is exactly the right lever: it tells tsc where react-native actually lives (workspace-local node_modules) so hoisted packages like react-native-safe-area-context and react-native-gesture-handler can resolve their own ViewProps imports, restoring the missing style prop and the inferred boolean type on the gesture-handler pressed arg. No app code touched, no suppressions, no casts — purely a config fix per Code Standard #1.
|



What
Fixes the pre-existing
apps/mobiletype-check failures onmain.npm run type-checkwas RED with 20 errors across 16 files in otherwise-untouched code:SafeAreaView(react-native-safe-area-context) —Property 'style' does not exist on type '... & NativeSafeAreaViewProps & ...'(14 screens)GestureHandlerRootView(react-native-gesture-handler) — samestyleerror (app/_layout.tsx)components/habits/bulk-action-bar-v2.tsx—Binding element 'pressed' implicitly has an 'any' type(5 occurrences)These were blocking type-check validation for in-flight UI PRs (surfaced while implementing #116).
Root cause
Not 16 separate code bugs — one module-resolution failure manifesting everywhere:
react-nativeis installed underapps/mobile/node_modules, whilereact-native-safe-area-contextandreact-native-gesture-handlerhoist to the repo-rootnode_modules. UndermoduleResolution: "bundler", whentscchecks those hoisted libraries'.d.tsfiles, theirimport { ViewProps } from "react-native"is resolved by walking up from the repo root — which never findsreact-native(it lives down inapps/mobile/node_modules).--traceResolutionconfirms:Module name 'react-native' was not resolved(15 times, all from the two hoisted libs).With RN's types unresolved,
NativeSafeAreaViewProps extends ViewPropsandGestureHandlerRootViewPropslosestyle, and gesture-handlerPressable's render-prop callback arg degrades to implicitany. The app code was always correct.Fix
Map
react-native/react-native/*inapps/mobile/tsconfig.jsonto the actual install location, so every consumer.d.tsresolves a single RN type surface:Root-cause config fix per Code Standard #1 — no app-code changes, no casts, no
any, no@ts-ignore/eslint-disable. Verifiedpressednow infersboolean(not silentlyany) via a deliberate type-mismatch probe.Validation (in worktree)
turbo run type-check— GREEN, all 3 workspaces (mobile + web + shared), 0 errorsturbo run lint— GREEN (no--fixneeded)apps/mobileunit tests — 361 passed / 81 filesNo
Closes— no tracked issue.🤖 Generated with Claude Code