Skip to content

fix: remove unused imports (RefObject, Int32)#663

Merged
gre merged 1 commit into
gre:masterfrom
gadcam:fix/unused-imports
Jun 24, 2026
Merged

fix: remove unused imports (RefObject, Int32)#663
gre merged 1 commit into
gre:masterfrom
gadcam:fix/unused-imports

Conversation

@gadcam

@gadcam gadcam commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Two imports in the library source are declared but never used:

  • RefObject in src/index.tsx — only React.RefObject (the qualified form) is referenced
  • Int32 in src/specs/NativeRNViewShot.ts
node_modules/react-native-view-shot/src/index.tsx(3,3): error TS6133: 'RefObject' is declared but its value is never read.
node_modules/react-native-view-shot/src/specs/NativeRNViewShot.ts(3,9): error TS6133: 'Int32' is declared but its value is never read.

skipLibCheck does not help here since these are .tsx/.ts source files, not .d.ts.

These imports are declared but never used, which triggers TS6133 errors
for consumers that type-check the library source (via the package's
"react-native" export condition pointing to src/) with noUnusedLocals
enabled.

- src/index.tsx: drop unused `RefObject` (only `React.RefObject` is used)
- src/specs/NativeRNViewShot.ts: drop unused `Int32`
@gadcam gadcam force-pushed the fix/unused-imports branch from d12f0c9 to 4595666 Compare June 24, 2026 16:39

@gre gre left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@gre gre merged commit ee6cfda into gre:master Jun 24, 2026
9 of 10 checks passed
gre pushed a commit that referenced this pull request Jun 24, 2026
The package's `react-native` export condition resolves consumers to the
raw `src/*.tsx` source. Strict consumer tsconfigs then type-check our
source and surface TS6133 ("declared but never read") on any unused
import — and `skipLibCheck` cannot suppress it because these are
`.tsx`/`.ts`, not `.d.ts`.

Enabling these flags in our own tsconfig makes `npm run type-check`
(already gating CI) catch the same class of error before publish, so it
can never reach consumers again.

Fails on current master (unused `RefObject` in src/index.tsx and `Int32`
in src/specs/NativeRNViewShot.ts); goes green once those imports are
removed (#663).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants