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 tscinconsumer/
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
consumerandproducerviayarn dev, you can see that in spite of the Typescript error, the import works, as it logsadded 10, 20in the console. - In
consumer/@mf-types/federation_provider/apis.d.ts, the remote types are correctly generated. Alsoconsumer/@mf-types/index.d.tscorrectly 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:

