-
Notifications
You must be signed in to change notification settings - Fork 27
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
Folder structure of @sapui5/types is wrong #461
Comments
I think this is similar to this one which is known and documented: ui5-community/generator-ui5-ts-app-fcl#5 |
Thanks for the hint @lemaiwo. It is similar indeed. |
@rasmk First, if you check the actual content of That folder is only created on your own system during installation of project dependencies (npm install) in cases where your application has a duplicate dependency to packages which are also required by @sapui5/types (in your case Second, the presence of this folder is only a problem when your application project sets So your choices are to either
The whole topic is a bit complex, I know, but essentially both, the It's all also described in https://sap.github.io/ui5-typescript/known-issues.html |
Thanks for the detailed explanation @akudev. I see the challenges you are facing. I have a CAP/MTA project with npm workspaces enabled. Which brings the npm dependencies to node_modules folder of the root project. The mentioned workaround with types does not seem to work in the workspace project. For now my solution is to keep the references harmonized, so that node_modules folder is not created. While I have my workarounds, is node_modules subfolder needed in any circumstances inside @sapui5/types? Or is it just a side-effect? |
Yeah, I get it that concrete usage scenarios are also often more complex than one would think, just like it is the case on our provider side.
The
I see. Yes, as result the same applies: two different jQuery types versions are required.
Umm... maybe try a relative path when the package is not in the default location With your approach, there is one thing I would like to mention: once the unwanted node_modules folder is there, it's not so easy to get rid of it. Just bringing the version numbers in sync again does not remove it. You really have to delete it and delete package-lock.json, then it should work. |
Thanks for the hint @akudev You can keep the issue open if you like to follow it up or close it. I am good with what I have. |
Alright. I'm closing it, as there isn't anything we can do to prevent the creation of the folder by npm under the mentioned circumstances and the options are documented. |
When
@sapui5/types
is referred to fromtypeRoots
intsconfig.json
, runningtsc
command (my tsconfig.json is below) produces an error:According to this TS issue: microsoft/TypeScript#27956 (comment), each subfolder of the folder that is referred to from
typeRoots
should containindex.d.ts
file (directly beneath).@sapui5/types has the following type structure:
Clearly,
node_modules
does not follow this requirement. This causes the trouble described above.If I manually pull
jquery
subfolder two levels up and removenode_modules
thetsc
runs without any problem.My
tsconfig.json
file is like below. It is a fiori app being a part of CAP project with npm workspaces enabled. Therefore it refers tonode_modules
of the main project folder.Expected behavior
The working folder structure should be flat, like:
Actually, it would be a good idea to rename types subfolder to sapui5 then, to make it clear, what it is about.
But this is a matter of taste, also not critical.
The text was updated successfully, but these errors were encountered: