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

Typescript example doesn't work in .ts files #382

Closed
1 task done
christopherbauer opened this issue Nov 23, 2022 · 5 comments · Fixed by #398
Closed
1 task done

Typescript example doesn't work in .ts files #382

christopherbauer opened this issue Nov 23, 2022 · 5 comments · Fixed by #398
Assignees

Comments

@christopherbauer
Copy link

  • [] Asked question in discussions (I'm posting a solution)
  • Tried the troubleshooting Wiki
  • [] Followed the migration Wiki (New installation)

Describe the bug
When adding the library and following the description of how to use it for typescript, the module fails to load when running on the android emulator. However, changing the file extension from .ts => .tsx does fix it.

To Reproduce
Steps to reproduce the behavior:

  1. Create a .ts file
  2. Follow the installation and configuration methods for Typescript
  3. Try to import some exported members from the .ts file
  4. Android app crashes

Expected behavior
Android app does not crash

Screenshots
N/a

Desktop (please complete the following information):

  • OS: iOS M2
  • Browser Android
  • Version Latest

Smartphone (please complete the following information):

  • Device: Android emulator
  • OS: iOS latest
  • Browser N/a
  • Version [e.g. 22]

Additional context
Changing the file extension to .tsx fixes the issue

@github-actions
Copy link

Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/382

@christopherbauer
Copy link
Author

Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/382

Shouldn't you be tipping me since I posted the solution? 🤔

@goatandsheep
Copy link
Owner

Unfortunately I'm broke right now but this is very very helpful! I will add this to the documentation. Thank you so much!

Maybe I need to reword the issue bot to indicate that I'm open to paid consulting to fix issues instead of what it currently says.

@christopherbauer
Copy link
Author

Unfortunately I'm broke right now but this is very very helpful! I will add this to the documentation. Thank you so much!

Sorry I just thought it was a funny reply, didn't mean anything by it :)

@goatandsheep
Copy link
Owner

So to be clear, the types definition file should be .tsx?

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 a pull request may close this issue.

2 participants