Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Compilation Errors: 'Uint8Array' is Not Generic in uuid Package #2959

Closed
Sn0w3y opened this issue Jan 8, 2025 · 3 comments
Closed

Comments

@Sn0w3y
Copy link
Contributor

Sn0w3y commented Jan 8, 2025

Description

Description

When attempting to build the Angular project, the TypeScript compiler fails due to incorrect usage of Uint8Array in the type definitions of the uuid package. The errors indicate that Uint8Array is being treated as a generic type, which is invalid in TypeScript.


Error Details

× Failed to compile.
✔ Browser application bundle generation complete.

66 unchanged chunks

Build at: 2025-01-08T06:28:30.993Z - Hash: c915a44ab19f3024 - Time: 6673ms

Error: node_modules/uuid/dist/cjs/parse.d.ts:1:39 - error TS2315: Type ‘Uint8Array’ is not generic.

1 declare function parse(uuid: string): Uint8Array;
                                       ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/uuid/dist/cjs/v35.d.ts:2:53 - error TS2315: Type ‘Uint8Array’ is not generic.

2 export declare function stringToBytes(str: string): Uint8Array;
                                                   ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/uuid/dist/cjs/v35.d.ts:6:166 - error TS2315: Type ‘Uint8Array’ is not generic.

6 export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array;

                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~

× Failed to compile.

Expected Behavior

The Angular project should compile successfully without TypeScript errors related to the uuid package, resulting in a build output in the specified www directory.


Environment


Additional Information


Possible Solutions Attempted

  1. Skipped Library Type Checking:

    • Modified tsconfig.json to include:
      {
        "compilerOptions": {
          // ... other options ...
          "skipLibCheck": true
        }
      }
    • Result: Build succeeded without TypeScript errors, but this masks underlying type issues.
  2. Attempted to Align uuid Package Versions:

    • Considered using the overrides field in package.json to force a single uuid version.
    • Challenges: Potential incompatibilities with dependencies expecting different uuid versions.
  3. Explored Updating or Patching Affected Packages:


References

See here:

uuidjs/uuid#856

Screenshots

No response

Operating System

No response

How to reproduce the Error?

Steps to Reproduce

  1. Clone the Repository:

    git clone https://github.com/OpenEMS/OpenEMS.git
    cd OpenEMS/ui
  2. Clean Install Dependencies:

    rm -rf node_modules package-lock.json
    npm cache clean --force
    npm install --legacy-peer-deps
  3. Run Build:

    npx ng build -c "openems,openems-backend-prod,prod" --output-path=www
@sfeilmeier
Copy link
Contributor

Is this with current develop; I saw this only here yesterday: #2957

@Sn0w3y
Copy link
Contributor Author

Sn0w3y commented Jan 8, 2025

I can not get it to work - no matter what i do npm always uses 11.0.4 - i guess it is not in the develop branch - you're right !

@Sn0w3y
Copy link
Contributor Author

Sn0w3y commented Jan 10, 2025

@sfeilmeier fixed in 11.0.5 FYI

uuidjs/uuid@24ac2fd

@Sn0w3y Sn0w3y closed this as completed Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants