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

[BUG] @playwright/test type errors using latest TypeScript nightly #13161

Closed
mjbvz opened this issue Mar 29, 2022 · 1 comment · Fixed by #13193
Closed

[BUG] @playwright/test type errors using latest TypeScript nightly #13161

mjbvz opened this issue Mar 29, 2022 · 1 comment · Fixed by #13193
Assignees

Comments

@mjbvz
Copy link

mjbvz commented Mar 29, 2022

Context:

  • Playwright Version: @playwright/test 1.20.1
  • Operating System: MacOS
  • Node.js version: 16
  • Browser: NA
  • Extra: NA

Repo

  1. Install latest TS nightly build (tested with 4.7.0-dev.20220329)
  2. Install @playwright/test 1.20.1
  3. In a TS file with strict null checks enabled, write:
import * as playwright from '@playwright/test';
  1. Try compiling

Describe the bug

This produces the following compile errors:

matb@mjbmbp16 san % npx tsc -p tsconfig.json
node_modules/@playwright/test/types/test.d.ts:2682:57 - error TS2344: Type 'T' does not satisfy the constraint 'KeyValue'.

2682   extend<T, W extends KeyValue = {}>(fixtures: Fixtures<T, W, TestArgs, WorkerArgs>): TestType<TestArgs & T, WorkerArgs & W>;
                                                             ~

  node_modules/@playwright/test/types/test.d.ts:2682:10
    2682   extend<T, W extends KeyValue = {}>(fixtures: Fixtures<T, W, TestArgs, WorkerArgs>): TestType<TestArgs & T, WorkerArgs & W>;
                  ~
    This type parameter probably needs an `extends object` constraint.

node_modules/@playwright/test/types/test.d.ts:2693:72 - error TS2344: Type 'Args' does not satisfy the constraint 'KeyValue'.

2693 type TestFixtureValue<R, Args> = Exclude<R, Function> | TestFixture<R, Args>;
                                                                            ~~~~

  node_modules/@playwright/test/types/test.d.ts:2693:26
    2693 type TestFixtureValue<R, Args> = Exclude<R, Function> | TestFixture<R, Args>;
                                  ~~~~
    This type parameter probably needs an `extends object` constraint.

node_modules/@playwright/test/types/test.d.ts:2694:76 - error TS2344: Type 'Args' does not satisfy the constraint 'KeyValue'.

2694 type WorkerFixtureValue<R, Args> = Exclude<R, Function> | WorkerFixture<R, Args>;
                                                                                ~~~~

  node_modules/@playwright/test/types/test.d.ts:2694:28
    2694 type WorkerFixtureValue<R, Args> = Exclude<R, Function> | WorkerFixture<R, Args>;
                                    ~~~~
    This type parameter probably needs an `extends object` constraint.


Found 3 errors in the same file, starting at: node_modules/@playwright/test/types/test.d.ts:2682

This may be another case of microsoft/TypeScript#48468

@rwoll
Copy link
Member

rwoll commented Mar 29, 2022

Thanks for the report. I repro'd with typescript@4.7.0-dev.20220329.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants