ds300 / react-native-typescript-transformer

Seamlessly use TypeScript with React Native
MIT License
657 stars 50 forks source link

Question: reliability issues #30

Closed almostintuitive closed 6 years ago

almostintuitive commented 6 years ago

Hi,

We've switched to using this for our slightly larger codebase, and encountered various, indeterministic errors when importing from local modules.

I know this is a very vague ticket, just want to record this issue. We've reverted back to the original setup - using tsc --watch. (we were using es2015 modules, and the recommended configuration)

Has anyone else encountered weird issues? We had local modules imported as undefined, which we couldn't resolve.

I think this may be connected to how transpileModule vs tsc works, but I could be easily wrong.

ds300 commented 6 years ago

Has anyone else encountered weird issues?

This is the first I'm hearing. Previous issue reports have been quite concrete and to do with configuration rather than bugs.

We had local modules imported as undefined, which we couldn't resolve.

This symptom is normally caused by cyclical dependencies, for what it's worth. Though no idea why they'd be introduced in a nondeterministic way by react-native-typescript-transformer. Probably a race condition somewhere. Are you using Hot Module Replacement? Are you on the latest version of RN?

I think this may be connected to how transpileModule vs tsc works, but I could be easily wrong.

Could be. I'd love to help debug if you can share reproducing code with me.

almostintuitive commented 6 years ago

Thank you for your response!:)

Regarding cyclical dependencies: you may be right, we do have quite a few - but it never seem to be a problem previously, when we were using tsc itself. I really hoped I never have to worry about them ever again! Is this something we need to consider when using react-native-typescript-transformer ?

ds300 commented 6 years ago

Not that I'm aware of, but then I've never transitioned a project with complicated inter-module dependencies from tsc to react-native-typescript-transformer before :D

Have you observed the issues when doing a standalone build? Or only when running the packager in watch mode?

almostintuitive commented 6 years ago

I have only tried running the packaged in watch mode.

It'll be quite hard to share the source code & also I'm really not sure how to reproduce this as an isolated issue at this moment. Happy to do some kind of pair programming session in the meantime, while I'll try to figure out how to reproduce it!

ds300 commented 6 years ago

Sure pair programming would be good. Looks like you're also based in London, so we could even do it in person to reduce friction, if you're comfortable with that?

almostintuitive commented 6 years ago

Sure:) When would be good for you? if you prefer email, then: mark.szulyovszky@gmail.com :)

Thank you!!

ds300 commented 6 years ago

We resolved this today. There was in fact a cyclical dependency issue. It might be that TypeScript is able to emit code that works around certain cyclical dependencies when operating on a program level with tsc, but not when operating at a module level with transpileModule, as is done in react-native-typescript-transformer. It's worth mentioning that the problem turned out to be deterministic.

I'll add a note to the README about possible introduction of cyclical dependencies when transitioning an existing TS codebase from tsc to react-native-typescript-transformer, and then close this issue.

Thanks @itchingpixels for your help :pray:

almostintuitive commented 6 years ago

thank you for your help identifying this issue!:) On Sun, 1 Oct 2017 at 23:36, David Sheldrick notifications@github.com wrote:

We resolved this today. There was in fact a cyclical dependency issue. It might be that TypeScript is able to emit code that works around certain cyclical dependencies when operating on a program level with tsc, but not when operating at a module level with transpileModule, as is done in react-native-typescript-transformer. It's worth mentioning that the problem turned out to be deterministic.

I'll add a note to the README about possible introduction of cyclical dependencies when transitioning an existing TS codebase from tsc to react-native-typescript-transformer, and then close this issue.

Thanks @itchingpixels https://github.com/itchingpixels for your help 🙏

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ds300/react-native-typescript-transformer/issues/30#issuecomment-333412029, or mute the thread https://github.com/notifications/unsubscribe-auth/AFKlYBSZGgXsMDKKG5cPdnmPwDvxpr3Zks5soBPqgaJpZM4PkKMK .