Closed LukasHeimann closed 1 year ago
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.
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 (https://github.com/microsoft/TypeScript/pull/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?
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...
@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?
Describe the bug
@sapui5/types
bundles@types/qunit@2.5.4
. 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.jsOverriding 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:
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.