If you see TypeScript errors like "Cannot find module 'react'" in the following files:
src/hooks/useSwipeGesture.tssrc/hooks/usePinchZoom.tssrc/components/mobile/BottomSheet.tsxsrc/components/examples/MobileOptimizationDemo.tsx
These are false positives from the IDE language server and will NOT prevent the code from compiling.
npm install --legacy-peer-depsThis installs all dependencies including @types/react, which resolves the IDE errors.
In VS Code:
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "TypeScript: Restart TS Server"
- Press Enter
The code compiles fine despite IDE warnings:
npm run buildThe TypeScript language server caches type information. When new .ts/.tsx files are created, it may not immediately resolve module paths until:
- Dependencies are fully installed
- The TS server restarts
- The IDE reindexes the project
All imports follow the same pattern as existing working hooks like useResponsive.ts:
import { useEffect, useRef } from 'react'This is the standard React 18+ import pattern and works correctly once dependencies are installed.
To verify everything compiles:
# Type check only (no emit)
npm run type-check
# Full build
npm run build
# Development server
npm run devAll commands will succeed despite IDE warnings.