Serenity/JS 3.0 - Public property cannot be named (TS 4029) in 3.0.0-rc.7 caused by #1099
See original GitHub issueHi @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:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Had a first look and it seems to work now. Will continue to test #1099, I expect valid results next week. Thanks, Jan!
3.0.0-rc.8 should address this issue