Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Multiple typescript errors occur when project specific tsconfig contain stricter rules #2528

Closed
mattijsf opened this issue Jan 6, 2023 · 1 comment

Comments

@mattijsf
Copy link
Member

mattijsf commented Jan 6, 2023

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS, Android

@rnmapbox/maps version

10.0.0-beta.62

Standalone component to reproduce

Not relevant. See Steps to reproduce.

Observed behavior and steps to reproduce

  1. npx react-native init MapboxV10TS --template react-native-template-typescript
  2. cd MapboxV10TS
  3. yarn add @rnmapbox/maps@10.0.0-beta.62
  4. open App.tsx
    • Add import MapboxGL from "@rnmapbox/maps";
    • Save
  5. npx tsc --noEmit (observe that there are no errors)
  6. open tsconfig.json
    • Add "noUncheckedIndexedAccess": true to compilerOptions
    • Save
  7. npx tsc --noEmit:
Found 13 errors in 4 files.

Errors  Files
     8  node_modules/@rnmapbox/maps/javascript/components/Camera.tsx:384
     2  node_modules/@rnmapbox/maps/javascript/requestAndroidLocationPermissions.ts:8
     2  node_modules/@rnmapbox/maps/javascript/utils/BridgeValue.ts:68
     1  node_modules/@rnmapbox/maps/javascript/utils/deprecation.ts:36

Expected behavior

Changes to project local typescript configuration should not impact files imported from node_modules

Notes / preliminary analysis

Some might say to use skipLibCheck: true or to add an exclude section to compilerOptions. This will not work since due to:
https://github.com/Microsoft/TypeScript/wiki/FAQ#why-is-a-file-in-the-exclude-list-still-picked-up-by-the-compiler

And the reason that these errors occur is because index.d.ts is importing .ts[x] files instead of definition files which causes the compiler to include them during compilation.

Additional links and references

No response

@mfazekas
Copy link
Contributor

Should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants