question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serenity/JS 3.0 - Public property cannot be named (TS 4029) in 3.0.0-rc.7 caused by #1099

See original GitHub issue

Hi @jan-molak , I open a new issue for this to keep #1099 clean. I tried to update to 3.0.0-rc.7 to test the changes from this issue. After updating I got typescript error for a lot of my PageElements similar to the issue we had in https://github.com/serenity-js/serenity-js/issues/946:

Public property 'link' of exported class has or is using name 'QuestionStatement' from external module "C:/dev/git/cgm-ch-e2e-common/e2e-serenityjs-wdio/node_modules/@serenity-js/core/lib/screenplay/Question" but cannot be named.ts(4029)

This is again, because I use classes:

import { Question } from '@serenity-js/core';
import { By, PageElement } from '@serenity-js/web';

// when not in a class all is fine
const mainFeature = () =>
    PageElement.located(By.css('.xxx')).describedAs('list of features accessible for current user');

const link = (url: string) =>
    PageElement.located(By.css(`[href="${url}"]`))
        .of(mainFeature())
        .describedAs(`the feature url of ${url}`);

export class FeatureClass {
    mainFeature = () => PageElement.located(By.css('.xxx')).describedAs('list of features accessible for current user');

    // this throws the error when used in a class
    link = (url: string) =>
        PageElement.located(By.css(`[href="${url}"]`))
            .of(this.mainFeature())
            .describedAs(`the feature url of ${url}`);

    // would probably solve the problem
    linkWorking = (url: string): Question<Promise<PageElement>> =>
        PageElement.located(By.css(`[href="${url}"]`))
            .of(this.mainFeature())
            .describedAs(`the feature url of ${url}`);
}

So while importing Question and explicitly name the return type may solve the problem, you found another solution in #946 I think?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
viper3400commented, Jan 28, 2022

Had a first look and it seems to work now. Will continue to test #1099, I expect valid results next week. Thanks, Jan!

1reaction
jan-molakcommented, Jan 28, 2022

3.0.0-rc.8 should address this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration to WDIO: Public property 'method' of exported class has or ...
Migration to WDIO: Public property 'method' of exported class has or is using ... node_modules/webdriverio/build/types" but cannot be named.ts(4029) #946.
Read more >
Serenity/JS 3.0 (RC)
Serenity/JS 3.0 is around the corner and introduces a number of new features while aiming to retain backwards compatibility of most of the...
Read more >
Facing issue, when serenity js library is included for ...
I am learning Cucumber BDD with serenity js library for reporting purpose off ... npm test > protractor-typescript-cucumber@3.0.0 pretest ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found