According to the module federation guide,
loadRemote
should return the inferred types for the supplied remote, but it doesn't. The returned promise always resolves an unknown
.
- Call yarn in
consumer/
andproducer/
- Call
yarn tsc
inconsumer/
Typescript checks should pass
Typescript fails with the following message
src/bootstrap.ts:6:25 - error TS18046: 'module' is of type 'unknown'.
remote.then((module) => module.add)
~~~~~~
- If you start both
consumer
andproducer
viayarn dev
, you can see that in spite of the Typescript error, the import works, as it logsadded 10, 20
in the console. - In
consumer/@mf-types/federation_provider/apis.d.ts
, the remote types are correctly generated. Alsoconsumer/@mf-types/index.d.ts
correctly has generated the correct module declarations forloadRemote
. - Curiously, the IDE (in my case IntelliJ U) prompts the correct types:
but the Typescript compiler in the IDE complains: