redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

RTK Query hook losing type after exporting

Open nickwang0808 opened this issue 2 years ago • 3 comments

We have 2 repos, common contains the RTK query stuff, app uses the query hook exported from common.

image with in the common repo, everything is working as expected

However when importing it into the app repo, the type is lost image

Unsure what the issue is, both are using "@reduxjs/toolkit": "^1.8.1",

Appreciate any help, thanks!

nickwang0808 avatar Apr 08 '22 23:04 nickwang0808

Huh, weird. Unfortunately I don't think we're going to have any way to investigate this without seeing a repo that demonstrates the problem.

markerikson avatar Apr 08 '22 23:04 markerikson

Huh, weird. Unfortunately I don't think we're going to have any way to investigate this without seeing a repo that demonstrates the problem.

let me try to setup a demo repo real quick

nickwang0808 avatar Apr 08 '22 23:04 nickwang0808

Maybe it would be helpful for someone. I've faced the same problem and in my case, it was simply solved by adding

"references": [
   { "path": PATH_TO_MY_COMMON_PACKAGE }
]

to tsconfig.json in the app

flast1k avatar Jul 07 '22 19:07 flast1k