react-redux-typescript-realworld-app icon indicating copy to clipboard operation
react-redux-typescript-realworld-app copied to clipboard

Question about namespace declarations

Open batusai513 opened this issue 5 years ago • 3 comments

Hi, I'am checking this repo for resources on how to estructure a TS project and I saw something interesting, https://github.com/piotrwitek/react-redux-typescript-realworld-app/blob/master/src/services/types.d.ts you are declaring all your types inside a namespace, I was trying to replicate this on my app created with create-react-app but I'm getting a module not found error, so I wanted to ask how do you make those namespace declarations import works in here.

Thanks

batusai513 avatar May 25 '19 11:05 batusai513

That's a good question, I'm facing the same issue when trying to replicate this setup using the latest CRA ([email protected]). Any hints on how to fix that?

michalpopek avatar Aug 25 '19 18:08 michalpopek

You must be doing something differently, please check and use the same exact syntax.
Please do not try to change the structure or file extensions, keep everything the same. Only when you have it working you can experiment and change things one by one to find out where is the problem.

piotrwitek avatar Sep 20 '19 21:09 piotrwitek

I think the tricky part is that types are declared and exported in many places, not only in /services, but also in /store. So if they will be only in one place it will not work. It has to be in both. This might be related: https://stackoverflow.com/questions/59864992/local-project-module-not-found/59867006#59867006 .

senpl avatar Jan 23 '20 07:01 senpl