Skip to content

Typescript TS1170 error with the SDK on Typescript > 5.7.0 #4183

@davidfestal

Description

@davidfestal

Describe the bug

Issue #4013 has been closed and considered fixed, but when using tsc@5.7.3 and @module-federation/sdk@0.21.2, I still get the error when running typescript compilation with the --skipLibCheck false option (required for my use-case):

node_modules/@module-federation/runtime-core/node_modules/@module-federation/sdk/dist/src/constant.d.ts:10:14 - error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.

10     readonly [NameTransformSymbol.AT]: "scope_";
                ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@module-federation/runtime-core/node_modules/@module-federation/sdk/dist/src/constant.d.ts:11:14 - error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.

11     readonly [NameTransformSymbol.HYPHEN]: "_";
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@module-federation/runtime-core/node_modules/@module-federation/sdk/dist/src/constant.d.ts:12:14 - error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.

12     readonly [NameTransformSymbol.SLASH]: "__";
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 3 errors in the same file, starting at: node_modules/@module-federation/runtime-core/node_modules/@module-federation/sdk/dist/src/constant.d.ts:10

Is there anything I am missing, or is the fix of the issue mentioned above only a partial fix, or incorrectly reflected in the last published types ?

FTR this is fixed with the given yarn patch on version 0.21.2 :

`diff --git a/dist/src/constant.d.ts b/dist/src/constant.d.ts
index e1366a27b825cc54cfa07b7cefde3df894018702..111da427fd8775c687e652d56e26c9e85509c7c6 100644
--- a/dist/src/constant.d.ts
+++ b/dist/src/constant.d.ts
@@ -2,9 +2,9 @@ export declare const FederationModuleManifest = "federation-manifest.json";
export declare const MANIFEST_EXT = ".json";
export declare const BROWSER_LOG_KEY = "FEDERATION_DEBUG";
export declare const NameTransformSymbol: {

  • AT: string;
  • HYPHEN: string;
  • SLASH: string;
  • readonly AT: unique symbol;
  • readonly HYPHEN: unique symbol;
  • readonly SLASH: unique symbol;
    };
    export declare const NameTransformMap: {
    readonly [NameTransformSymbol.AT]: "scope_";`

Reproduction

  • Include the @module-federation/sdk@0.21.2 as a dependency in your project, use it in the code, and run yarn tsc --skipLibCheck false

Used Package Manager

yarn

System Info

System:
    OS: macOS 26.0.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 494.31 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.19.0 - /opt/homebrew/opt/node@20/bin/node
    Yarn: 4.8.1 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - /opt/homebrew/opt/node@20/bin/npm
  Browsers:
    Chrome: 142.0.7444.60
    Firefox: 140.4.0
    Safari: 26.0.1

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions