playwright
playwright copied to clipboard
[Bug]: Property `screen` does not exist on type `PlaywrightTestOptions`
Version
1.45.0
Steps to reproduce
- Clone https://github.com/silverwind/playwright-screen
- Run
npm i && npx tsc
Expected behavior
No error
Actual behavior
Typescript error:
playwright.config.ts:10:9 - error TS2353: Object literal may only specify known properties, and 'screen' does not exist in type 'UseOptions<PlaywrightTestOptions & CustomProperties<{}>, PlaywrightWorkerOptions & CustomProperties<{}>>'.
10 screen: {width: 1920, height: 1080},
~~~~~~
node_modules/playwright/types/test.d.ts:113:3
113 use?: UseOptions<TestArgs, WorkerArgs>;
~~~
The expected type comes from property 'use' which is declared here on type 'Project<PlaywrightTestOptions & CustomProperties<{}>, PlaywrightWorkerOptions & CustomProperties<{}>>'
Additional context
The object in use is a copy of what @playwright/test currently exports as devices["Desktop Chrome"]:
{
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.26 Safari/537.36',
viewport: { width: 1280, height: 720 },
screen: { width: 1920, height: 1080 }, // <- unknown property
deviceScaleFactor: 1,
isMobile: false,
hasTouch: false,
defaultBrowserType: 'chromium'
}
screen needs to be either removed if it's unused or be added to PlaywrightTestOptions.
Environment
System:
OS: macOS 14.5
CPU: (16) arm64 Apple M3 Max
Memory: 1.95 GB / 48.00 GB
Binaries:
Node: 22.3.0 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.8.1 - /opt/homebrew/bin/npm
pnpm: 9.4.0 - ~/.npm-global/bin/pnpm
bun: 1.1.16 - /opt/homebrew/bin/bun
IDEs:
VSCode: 1.89.1 - /opt/homebrew/bin/code
Languages:
Bash: 5.2.26 - /opt/homebrew/bin/bash
npmPackages:
@playwright/test: 1.45.0 => 1.45.0