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

fix: use export type when exporting types #1874

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

renchap
Copy link
Contributor

@renchap renchap commented Sep 16, 2022

Summary

If you built your app using esbuild (for example using @rnx-kit/metro-serializer-esbuild), then it complains that the imports do not exist for type imports.

Marking them explicitely as types fixes this issue, in addition to removing those import/exports from non-TS builds.

I also transformed them from an import + export statements to an export … from … statement.

Test Plan

This has been tested in my own app which uses the esbuild serializer mentioned above.

It only changes type exports, so no actual behaviour changes are expected

What's required for testing (prerequisites)?

Having an app using the esbuild serializer

What are the steps to reproduce (after prerequisites)?

Compatibility

Not relevant

Checklist

Not relevant

If you built your app using `esbuild` (for example using `@rnx-kit/metro-serializer-esbuild`), then it complains that the imports do not exist for type imports.

Marking them explicitely as types fixes this issue, in addition to
removing those import/exports from non-TS builds.

I also transformed them from an import + export statements to an `export … from …` statement.
Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

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

LGTM 🎉 Thanks for your contribution!

@WoLewicki WoLewicki merged commit f734301 into software-mansion:main Sep 27, 2022
@tido64
Copy link
Contributor

tido64 commented Jan 20, 2023

@WoLewicki, can we backport this to the 12.x branch? If yes, what is the process? I'd be happy to do it myself.

WoLewicki pushed a commit that referenced this pull request Jan 31, 2023
If you built your app using `esbuild` (for example using [`@rnx-kit/metro-serializer-esbuild`](https://microsoft.github.io/rnx-kit/docs/tools/metro-serializer-esbuild)), then it complains that the imports do not exist for type imports.

Marking them explicitely as types fixes this issue, in addition to removing those import/exports from non-TS builds.

I also transformed them from an import + export statements to an `export … from …` statement.
@renchap renchap deleted the fix-type-exports branch December 22, 2023 14:47
WoLewicki pushed a commit that referenced this pull request Jan 3, 2024
…`tsc` (#2197)


This is the same issue as the one I fixed last year in #1874

To prevent this from occurring again, I enabled the `isolatedModules`
Typescript option which will warn when you export non-value identifiers
without using `export type`, which will break transpilation processes
what work on a per-file basis. You can find a [more detailed explanation
in Typescript's
doc](https://www.typescriptlang.org/tsconfig#isolatedModules)
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.

3 participants