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

Backwards-compatibility issue caused by luigi-client.d.ts #462

Closed
pekura opened this issue Apr 3, 2019 · 2 comments
Closed

Backwards-compatibility issue caused by luigi-client.d.ts #462

pekura opened this issue Apr 3, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@pekura
Copy link
Contributor

pekura commented Apr 3, 2019

When you run an older app (like our sample app 0.4.9) with the current luigi client you might get this:

ERROR in src/app/app.component.ts(2,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/overview/overview.component.ts(2,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/dynamic/dynamic.component.ts(3,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/modal/modal.component.ts(10,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/project.component.ts(11,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/settings/settings.component.ts(7,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/users/groups/group-details/group-details.component.ts(3,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/users/groups/group-details/group-settings/group-settings.component.ts(2,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.
[1] src/app/project/users/groups/groups.component.ts(2,8): error TS1192: Module '"/Users/d061234/dev/luigi-compatibility-testing/core/examples/luigi-sample-angular/node_modules/@kyma-project/luigi-client/luigi-client"' has no default export.

The backwards compatibility is broken.

@pekura pekura added this to the Sprint_Swinka_11 milestone Apr 3, 2019
@pekura pekura added area/luigi bug Something isn't working labels Apr 3, 2019
@jesusreal jesusreal self-assigned this Apr 3, 2019
@jesusreal
Copy link
Contributor

jesusreal commented Apr 3, 2019

Problem description

The addition of a TypeScript Declaration File for Luigi Client (#425) makes mandatory for Typescript users updating from Luigi 0.4.10 to a newer version to do some changes due to the following issues:

Issue 1

  • if Typescript apps were using LuigiClient as a type, this is not allowed anymore, since LuigiClient is a namespace in Typescript. Here an example using LuigiClient as a type:
import LuigiClient from '@kyma-project/luigi-client';
...
export class AppComponent {
  public luigiClient: LuigiClient = LuigiClient;
...
}

Issue 2

LuigiClient cannot be imported as a default module anymore.

Solution for both issues

Users need to use destructured imports, which has become the convention for most of the libraries out there:

import { linkManager } from '@kyma-project/luigi-client';

export class AppComponent {
  public lm: linkManager = linkManager;

  constructor() {
      this.lm.navigate('overview');
  }
}

Remaining work required in Luigi source code

We need to expose types for the already exposed functions, otherwise users can do
public linkManager = ; but not public linkManager: linkManager = LuigiClient;. Draft pull request created #466.

@kwiatekus
Copy link
Contributor

kwiatekus commented Apr 4, 2019

For now we will keep the declaration file in the codebase, but not use it.
Luigi users would need to manually add it + adjust their code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants