beemojs / beemo

🤖 Centralized configuration layer for dev tools. Beep boop.
https://beemo.dev
MIT License
143 stars 9 forks source link

[typescript] --reference-workspaces issue? #97

Closed williaster closed 4 years ago

williaster commented 4 years ago

We're using nimbus, built on beemo, for our monorepo vx project. We've recently started seeing CI failures due to typescript errors when e.g., package-b depends on types from package-a, and but during compilation the types from package-a are not defined:

##[error]packages/package-b/src/xxx.ts: error TS2305: Module '"../../node_modules/@vx/package-a/lib/types"' has no exported member 'YYY'.

From my understanding, monorepo typescript build order is specified by references in tsconfig.json files, and with beemo the --reference-workspaces flag constructs these dependencies from the dependency tree. Locally these reference dependencies look correct (e.g,. xychart references scale and axis, and axis references scale) and locally I don't see the typescript errors that we see in CI if I first remove all tsconfig.json and tsconfig.tsbuildinfo files in all monorepo package directories. I'm wondering if there's any way that in CI / a git workflow env these files might be cached or behave differently.

Thanks for the great library and for any thoughts! 🙌

milesj commented 4 years ago

@williaster So the order in which packages get "typed" is done by TypeScript, not Beemo. It's built into the project references layer itself.

Do you know which change caused these failures to start?

williaster commented 4 years ago

I tried to trace it down to the exact commit and was able to figure out that it was a rebase issue after publishing.

so the package I was working on referenced an old version in the monorepo, and it didn't have the type exports I was attempting to import. sorry for the back and forth, learned a lot about typescript references tho! 🙏

milesj commented 4 years ago

@williaster Awesome, glad you figured it out!