Typescript codecept.conf.ts autoLogin Parameter 'I' implicitly has an 'any' type.
See original GitHub issueWhat are you trying to achieve?
Use autoLogin with the typescript-boilerplate and autoLogin plugin including the proxy object “I”.
What do you get instead?
Provide test source code if related
This is my repro project:
It is the typescript-boilerplate, with the autoLogin config added from the official documentation here.
Details
- CodeceptJS version: 3.3.3 (same issue with v. 3.3.4)
- NodeJS Version: 16.10.0
- Operating System: Windows 10
- playwright
- Configuration file:
require('ts-node/register')
const { setHeadlessWhen } = require('@codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// HEADLESS=true npx codecept run
setHeadlessWhen(process.env.HEADLESS);
exports.config = {
tests: './tests/**_test.ts',
output: './output',
helpers: {
Playwright: {
url: 'https://github.com',
show: false,
windowSize: '1200x900',
browser: 'chromium'
},
CustomHelper: {
require: './CustomHelper.ts'
}
},
bootstrapAll: require('./presettings.ts').bootstrapAll,
bootstrap: require('./presettings.ts').bootstrap,
teardownAll: require('./presettings').teardownAll,
teardown: require('./presettings').teardown,
include: {
loginPage: './loginPage.ts',
homePage: './homePage.ts'
},
name: 'typescript-boilerplate',
plugins: {
autoLogin: {
enabled: true,
saveToFile: true,
inject: 'loginAs', // use `loginAs` instead of login
users: {
user: {
login: (I) => {
I.amOnPage('/login');
I.fillField('email', 'user@site.com');
I.fillField('password', '123456');
I.click('Login');
},
check: (I) => {
I.amOnPage('/');
I.see('User', '.navbar');
},
},
admin: {
login: (I) => {
I.amOnPage('/login');
I.fillField('email', 'admin@site.com');
I.fillField('password', '123456');
I.click('Login');
},
check: (I) => {
I.amOnPage('/');
I.see('Admin', '.navbar');
},
},
}
},
retryFailedStep: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
parameter implicitly has an 'any' type - Stack Overflow
First, to make typescript tolerate parameters without declaring their type, edit the tsconfig.json // disable this rule: // "strict": true, ...
Read more >Parameter 'X' implicitly has an 'any' type in TypeScript
The "Parameter 'X' implicitly has an 'any' type" error occurs when a function's parameter has an implicit type of `any`. To solve the...
Read more >How to use the autoLogin() plugin with TypeScript testing #3105
I'm trying to use the autoLogin plugin within a TypeScript test suite. I copied the examples from the documentation, but it doesn't seem...
Read more >A Fix To Typescript TS7006: Parameter 'xxxx' Implicitly Has An ...
In this article, you will learn about a fix to Typescript TS7006: Parameter 'xxxx' Implicitly Has An 'Any' Type.
Read more >Releases - CodeceptJS
Added TS types for helpers config: Playwright; Puppeteer; WebDriver; REST. Added TypeScript option for installation via codeceptjs init to initialize new ...
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 FreeTop 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
Top GitHub Comments
Good point. Config file was not actually parsed as TS file so you got this error.
This should be resolved in 3.3.5 where config file can be written in pure TS.
Please update once it is released
@nicostubi
You are right, and to be honest I could not find any good TypeScript way to customize actor as we do in JS. So in 3.3.5 when you create a TS project there will be no custom actor created. You should use PageObjects instead.
So currently this limitation still there but not a critical one.
Probably some internal API should be changed to make it work fluently in TypeScript