-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
split out compiled js from typescript types and autogenerate both #2172
Conversation
@natew Thanks for doing this and I support the overall direction of compiling as part of the publish step. I'll leave it to @mfazekas to decide whether this is the direction the library can go, but a couple thoughts:
Edit: https://github.com/callstack/react-native-paper is a good example. |
@natew thanks for the PR, but we still wait for repro steps for the issue you're seeing. Metro bundler does transpile packages in Also following should be checked/verified:
BTW if you look at Same one for Also please address the failures in the CI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- needs steps to reproduce the original issue.
- check and fix ci failures
- check if our example app works just fine (and editing package file and pressing r should resuling in example with modified code. Running a tsc watch is possible but not ideal.)
- check if using package with yarn add rnmapbox/maps#main and npm install rnmapbox/maps#main works
Regarding the test failure of the pattern
I had the same thing in my now-cancelled Typescript conversion PR, and the only way I was able to fix it was adding these comments:
Perhaps you can solve it another way, but I thought this might help. |
@mfazekas it is worth noting that both of these projects use https://github.com/callstack/react-native-builder-bob, which does compile to I've also had a lot of trouble installing |
From
So I don't think for |
@mfazekas are you able to develop on this project locally, as in I think this is one of the fundamental things that makes me support this PR, to make local development more predictable. |
Sorry for drive-by PR. Honestly, part of this is just that my |
@naftalibeder but are they?! I'm mostly using yarn, and I'm usually install from GitHub, (Btw. I don't see what's the difference between |
That would be great, or
I don't really understand either, but the problem was that it was reading rnmapbox's The weird thing is that when I tried doing |
Oh I see yes version checked out from git does not have |
I have a multi-platform project where this library is used for maps on native platforms and the official JS SDK is used for web. The project uses At the moment, there is no way to tell the typescript compiler to ignore this library when building the web version since the library is included ( I'm using several libraries that are built with RN in mind (which usually means that they include JSX in JS files), but this is the only library that causes issues - because it includes raw TS files. My current workaround can be found here, it would be awesome if this step was not necessary! 🙌 |
@SkySails so is this a tsc issue?! Would rn-tsc work for you until it’s resolved in lib?! https://microsoft.github.io/rnx-kit/docs/tools/typescript-react-native-compiler |
It absolutely could've, thanks for the tip! It's been a while since I last heard of Unfortunately, I'm using fork-ts-checker-webpack-plugin, and patching it in order to use rn-tsc instead would be about as hacky as the current workaround IMO. But for those running |
Folks, just to clarify i do accept a pr that transpiles to lib dir. Provided that:
See and for reference |
@mfazekas if you insist on keeping this as-is (which some libraries that you mention seem to do indeed), I don't think there's any benefit to ship compiled JS in the first place right? I would argue it's a bit of an anti-pattern, as it causes issues like this down the line: #2333, for example if there are different typescript settings. However, I do understand that it has a benefit where you can keep referring to a github branch in package.json and everything "just works", like you explain here. I think a cleaner way to get a github/branch-referenced package working (i.e.: create an app "DemoApp" that depends on a) point Of course, the postinstall step would not be necessary when depending on a published version of rnmapbox. What do you think? |
I don't think you're right about that. The bug report that contains the concrete issue Is #2333, which is about tsc with a custom config. Tsc doesn't use the |
Depends how you look at it :) The reason this is related is that this issue (#2333) wouldn't have occured if the typescript build process would have been decoupled from this package. By keeping it like this, you're implicitly forcing consumers to:
This limits the re-usability of the library in my opinion |
We should be now doing this with |
Fixes #2140 (comment)