# Types Type errors are divided into two types: fixed error code errors and scenario-related errors. ## Fixed error code errors This type of error can be clearly captured in the code, and a fixed error code is assigned to each error. The error code consists of the error type and ID, such as `TYPE-001`. ### Error code list - [TYPE-001](#type-001) ## TYPE-001

Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.

  • Error Code: TYPE-001
### Reasons When compiling TS types for exposed (`exposes`) files, the current project's `tsconfig.json` is used. Missing compiler options may cause the type build to fail. ### Solutions 1. Remove tsconfig.json `incremental` and `tsBuildInfoFile` from the `cmd` command. 2. Run the `cmd` from the error message in terminal and fix the file or `tsconfig` based on the output. If you want to ignore TS type checking errors, set [`compilerOptions.noCheck`](https://www.typescriptlang.org/tsconfig/#noCheck) to `true` in `tsconfig.json` (requires TS 5.5+). If the `cmd` runs without error but you still get a TS compile failure, check the `exposes` field in `ModuleFederationPlugin`: ```ts title="[modern|rspack|rsbuild|webpack].config.[js,ts]" new ModuleFederationPlugin({ ... // Make sure both key and value start with "./" exposes: { './Foo': './src/<path-to-file>/Foo.tsx' }, ... }) ``` ## Scenario-related errors This type of error is generated based on the user's specific scenario and has no fixed error code. The error message and handling method will vary depending on the scenario. ### Generated type contains aliases **Phenomenon description** The type generated by the producer contains aliases and cannot be processed normally in the consumer. **How ​​to solve** 1. Install [typescript-transform-paths](https://www.npmjs.com/package/typescript-transform-paths) and [ts-patch](https://www.npmjs.com/package/ts-patch) 2. Apply `typescript-transform-paths` in `tsconfig.json` ```diff { "compilerOptions": { + "plugins": [ + { "transform": "typescript-transform-paths" }, + { + "transform": "typescript-transform-paths", + "afterDeclarations": true + } + ], }, } ``` 3. Set [dts.generateTypes.compilerInstance](/configure/dts.md#compilerinstance) to `tspc`(`ts-patch` cli) 4. Regenerate types ### Generated types not updating when working behind a local proxy **Phenomenon description** The types generated by the producer are successfully generated, the consumer log shows that the types are successfully processed, but the `@mf-types` directory does not update. The issue can be a proxy configuration problem not allowing the resource to be downloaded. **How ​​to solve** 1. Check if the `@mf-types` directory is generated in the `dist` directory of the producer. 2. Check your proxy log for any errors related to `TLS` or `SSL`. 3. Adapt your proxy configuration to add `TLS` certification for your local environment. 4. In some scenarios this is not working. An alternative is, to define the environment variable `NODE_TLS_REJECT_UNAUTHORIZED=0` to ignore the `TLS` or `SSL` errors. This will allow the `@mf-types.zip` to be properly handled. :::danger Important note Only set NODE\_TLS\_REJECT\_UNAUTHORIZED=0 in your local development environment. It is not meant for production use. If you go this route, please make sure to commit the generated types to your repository. :::