Skip to content

Bundled versions of @types/qunit outdated #394

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

Closed
LukasHeimann opened this issue May 10, 2023 · 4 comments
Closed

Bundled versions of @types/qunit outdated #394

LukasHeimann opened this issue May 10, 2023 · 4 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@LukasHeimann
Copy link

Describe the bug
@sapui5/types bundles @types/[email protected]. However, UI5 really includes QUnit 2.18.0, see https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js

Overriding this seems impossible. When I manually try to set a different version in my package.json's devDependencies, I get an error message likely due to conflicting type declarations:

error TS2688: Cannot find type definition file for 'node_modules'.
  The file is in the program because:
    Entry point for implicit type library 'node_modules'

This is especially an issue, as when using karma in script mode, you have to supply QUnit yourself, and that could be an even newer version (2.19, for example): https://github.com/SAP/karma-ui5/tree/main#script-mode

Expected behavior
Dependencies of @sapui5/types match the actually bundled dependencies, or allow overrides.

@akudev
Copy link
Contributor

akudev commented May 10, 2023

Umm..., no, actually UI5 includes QUnit 2.3.2, see:
https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/thirdparty/qunit-2.js#L2
What you linked, is the copy of QUnit 1, which is on 1.18.0.

As we cannot bundle types for both major versions, we decided for the newer version 2 and there we chose the latest patch of the closest available minor version (@types/qunit starts only with version 2.5.0, there is no 2.3.x available).

So what we bundle is the best possible choice from our perspective. (as also written here)

The error you quote might stem from the fact that typeRoots are used in the configuration and one of the conflicting qunit type versions was placed by npm into a folder below the UI5 types. The background of this issue is explained in more detail here.

About opting out of the supplied version of the qunit types, see here.

@akudev akudev closed this as completed May 10, 2023
@akudev akudev self-assigned this May 10, 2023
@akudev akudev added the invalid This doesn't seem right label May 10, 2023
@LukasHeimann
Copy link
Author

Oh, sorry, my bad. I was confused about UI5 bundling both major versions.

With TypeScript 5.1, the handling of typeRoots seems to have changed (microsoft/TypeScript#51715), though, and the solution you linked now produces an error:

    "moduleResolution": "node",
    "typeRoots": [
      "./node_modules/@types",
    ],
    "types": [
        "@sapui5/types",
        "jquery"
    ],
error TS2688: Cannot find type definition file for '@sapui5/types'.
  The file is in the program because:
    Entry point of type library '@sapui5/types' specified in compilerOptions

  tsconfig.json:16:9
    16         "@sapui5/types",
               ~~~~~~~~~~~~~~~
    File is entry point of type library specified here.

I will try to look into it, but it seems one can't have @sapui5/types in the types array anymore... Are you aware of this, @akudev? Should I open a separate issue?

@LukasHeimann
Copy link
Author

Okay, it seems to work when I just use

    "moduleResolution": "node",
    "types": [
        "@sapui5/types",
        "jquery"
    ],

I don't know why, but I'm probably fine with it just working now...

@akudev
Copy link
Contributor

akudev commented Jun 5, 2023

@LukasHeimann Hm, this sounds a bit strange, doesn't it? In both cases, the @sapui5/types are referenced via "types" (not "typeRoots"). 1.) this shouldn't be affected by the TS 5.1 "typeRoots" changes and 2.) if having them as "types" is a problem, why does the second one work fine?

When I switched the helloworld sample to TS 5.1 and @sapui5/types, I had no such problem. Does the error come back when you add the "typeRoots" setting again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants