Overview

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. You can find the specified page based on the error code to understand the cause of the error and the solution.

Error code list

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 and ts-patch

  2. Apply typescript-transform-paths in tsconfig.json

{
"compilerOptions": {
+ "plugins": [
+ { "transform": "typescript-transform-paths" },
+ {
+ "transform": "typescript-transform-paths",
+ "afterDeclarations": true
+ }
+ ],
},
}
  1. Set dts.generateTypes.compilerInstance to tspc(ts-patch cli)
  2. 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.
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.