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

enable stricter typescript rules #2334

Merged
merged 3 commits into from
Oct 27, 2022

Conversation

YousefED
Copy link
Contributor

This adds a few stricter Typescript rules, so that until #2172 is fixed, this package can still be consumed in apps with strict Typescript settings (#2333).

To fix the is declared but its value is never read errors, I have changed MapBoxStyles.ts to a declaration file (.d.ts)

Description

Fixes #2333

Checklist

  • I have tested this on a device/simulator for each compatible OS
  • I updated the documentation with running yarn generate in the root folder
  • I updated the typings files - if js interface was changed (index.d.ts)
  • I added/ updated a sample - if a new feature was implemented (/example)

"outDir": "lib/javascript",
"noUnusedLocals": true,
"noImplicitAny": true,
"noImplicitReturns": true,
Copy link

Choose a reason for hiding this comment

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

FYI, noImplicitReturns is unnecessary when using strict mode. You won't see this error thrown.

Strict mode includes strictNullChecks that supersedes noImplicitReturns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I've removed noImplicitAny and noImplicitThis as they are part of strict mode.

However, noImplicitReturns is not part of strict mode, so I haven't removed that one.

(I've tested the latter by removing the implicit return fix in AbstractLayer.tsx:55, the code then compiles without noImplicitReturns but breaks (as intended) when noImplicitReturns is enabled

@YousefED YousefED requested a review from jrobber October 26, 2022 18:47
@mfazekas mfazekas merged commit eca88f5 into rnmapbox:main Oct 27, 2022
@YousefED
Copy link
Contributor Author

Thanks for the quick merge! @mfazekas

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.

[Bug]: Typescript errors are getting shipped
3 participants