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

Types are wrong - break with TS v4 #742

Closed
enspandi opened this issue Feb 7, 2023 · 2 comments
Closed

Types are wrong - break with TS v4 #742

enspandi opened this issue Feb 7, 2023 · 2 comments

Comments

@enspandi
Copy link

enspandi commented Feb 7, 2023

When running a project with typescript v4 I'm getting these errors:

... is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.
Click here
../../node_modules/ember-link/test-support/test-link.d.ts:4:5 - error TS2610: 'isActive' is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.

4     isActive: boolean;
      ~~~~~~~~

../../node_modules/ember-link/test-support/test-link.d.ts:5:5 - error TS2610: 'isActiveWithoutQueryParams' is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.

5     isActiveWithoutQueryParams: boolean;
      ~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/ember-link/test-support/test-link.d.ts:6:5 - error TS2610: 'isActiveWithoutModels' is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.

6     isActiveWithoutModels: boolean;
      ~~~~~~~~~~~~~~~~~~~~~

../../node_modules/ember-link/test-support/test-link.d.ts:7:5 - error TS2610: 'isEntering' is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.

7     isEntering: boolean;
      ~~~~~~~~~~

../../node_modules/ember-link/test-support/test-link.d.ts:8:5 - error TS2610: 'isExiting' is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.

8     isExiting: boolean;
      ~~~~~~~~~

../../node_modules/ember-link/test-support/test-link.d.ts:9:5 - error TS2610: 'url' is defined as an accessor in class 'Link', but is overridden here in 'TestLink' as an instance property.

9     url: string;
      ~~~

Checking https://www.npmjs.com/package/ember-link?activeTab=explore the generated typescript definition file is not compatible with TS v4: test-support/test-support/test-link.d.ts

It should actually be like this:

import Transition from '@ember/routing/-private/transition';
import { Link } from 'ember-link';

export default class TestLink extends Link {
    get isActive(): boolean;
    get isActiveWithoutQueryParams(): boolean;
    get isActiveWithoutModels(): boolean;
    get isEntering(): boolean;
    get isExiting(): boolean;
    get url(): string;
    onTransitionTo?(): void;
    onReplaceWith?(): void;
    get qualifiedRouteName(): string;
    transitionTo(event?: Event): Transition;
    replaceWith(event?: Event): Transition;
    private _preventTransitionOut;
    private _createDummyTransition;
}

Can we pls either patch the test-link.d.ts and publish new version or upgrade typescript to v4?

@gossi
Copy link
Collaborator

gossi commented Apr 4, 2023

The current solution is to "patch" it locally:

diff --git a/node_modules/ember-link/test-support/test-link.d.ts b/node_modules/ember-link/test-support/test-link.d.ts
index 4f6bcca..1c0421e 100644
--- a/node_modules/ember-link/test-support/test-link.d.ts
+++ b/node_modules/ember-link/test-support/test-link.d.ts
@@ -1,11 +1,17 @@
 import Transition from '@ember/routing/-private/transition';
 import { Link } from 'ember-link';
 export default class TestLink extends Link {
+    // @ts-expect-error
     isActive: boolean;
+    // @ts-expect-error
     isActiveWithoutQueryParams: boolean;
+    // @ts-expect-error
     isActiveWithoutModels: boolean;
+    // @ts-expect-error
     isEntering: boolean;
+    // @ts-expect-error
     isExiting: boolean;
+    // @ts-expect-error
     url: string;
     onTransitionTo?(): void;
     onReplaceWith?(): void;

@gossi
Copy link
Collaborator

gossi commented Jun 6, 2023

I gonna close, as this is considered fixed with release of v2.1.0

@gossi gossi closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants