-
Notifications
You must be signed in to change notification settings - Fork 95
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
[ui5-tooling-transpile]: module paths in .gen.d.ts
files are not rewritten to absolute paths
#1150
Comments
Interesting fun fact - which I have forgotten so far - I also correct the gen.d.ts files in the build: I convert the relative module path into an absolute path and I move the declare statement to the top: import { PropertyBindingInfo } from "sap/ui/base/ManagedObject";
import { $ControlSettings } from "sap/ui/core/Control";
declare module "./SimpleControl" {
/**
* Interface defining the settings object used in constructor calls
*/
interface $SimpleControlSettings extends $ControlSettings { becomes declare module "ui5/ecosystem/demo/simpletsapp/control/SimpleControl" {
import { PropertyBindingInfo } from "sap/ui/base/ManagedObject";
import { $ControlSettings } from "sap/ui/core/Control";
/**
* Interface defining the settings object used in constructor calls
*/
interface $SimpleControlSettings extends $ControlSettings { If we would fix this in the WDYT? Should we talk about that? |
@stabpd - I found a very trivial solution for this issue which is independent from the interface generation. I already rewrite the imports but not for the control interface files. I fully misunderstood that point and I now do the rewrite of the imports in general. @akudev - with that change a modification of the |
Having the absolute paths generated in the interface-generator may have the benefit that the native |
@petermuessig Confirmed solution via Thank you very much! |
Describe the bug
Relative module import paths in
.gen.d.ts
files are not rewritten to absolute paths. (in contrast to other.d.ts
files)This seems to be an older regression that could easily be fixed, although I do not know if other things might break. (see additional info)
The current behaviour breaks types of 2nd level custom controls in our lib package because the 1st level custom control's relative import path cannot be resolved from 2nd level custom control's transpiled
.gen.d.ts
file.That results in 1st level custom control's settings properties not being known.
To Reproduce
mylib
two custom controls, inheriting from each other
generate interfaces via
@ui5/ts-interface-generator
build via
@ui5/cli
andui5-tooling-transpile-task
release types package with
d.ts
,gen.d.ts
files, e.g. asmylibtypes
myapp
depending onmylibtypes
package for making types known (real world lib also releases js files of course)⚠ When instantiating the 2nd level custom control, neither 1st level custom control's settings, nor ui5 base control's settings are known.
Expected behavior
I'd expect the import to be transpiled to the absolute path.
Additional context
The import rewrite in
packages/ui5-tooling-transpile/lib/task.js
was initially applied to all.d.ts
files. (see 6ec501c / #743)Only later, in some dependencies update fix commit, were
.gen.d.ts
files excluded.But I cannot see why. Neither the PR, nor the code document why that change was done.
(see PR diff / #754)
Reverting that change to
packages/ui5-tooling-transpile/lib/task.js
to apply import rewrite to all.d.ts
files again, fixes the issue for me.It might also fix another issue. (see SAP/ui5-typescript#431)
But I do not know if the change was intentional and if other stuff might break.
Please let me know if you need additional info or an mvp repo.
The text was updated successfully, but these errors were encountered: