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

[Question] need some packages if using with TypeScript #1049

Closed
mmktomato opened this issue Feb 17, 2020 · 2 comments
Closed

[Question] need some packages if using with TypeScript #1049

mmktomato opened this issue Feb 17, 2020 · 2 comments

Comments

@mmktomato
Copy link

I found I need to install @types/node and @types/debug to build an application which uses Playwright and TypeScript.

Versions

  • Playwright: 0.11.1
  • Node: v10.18.1
  • OS: Ubuntu 18.04

What I did

$ npm init -y
$ npm install -S playwright
$ npm install -D typescript
$ echo "import * as playwright from 'playwright';" > index.ts
$ npx tsc --outDir ./dist --lib es2015,dom ./index.ts

Then I met some errors.

node_modules/playwright-core/lib/frames.d.ts:17:23 - error TS2688: Cannot find type definition file for 'node'.

17 /// <reference types="node" />
                         ~~~~

node_modules/playwright-core/lib/frames.d.ts:88:54 - error TS2503: Cannot find namespace 'NodeJS'.

88     readonly _networkIdleTimers: Map<LifecycleEvent, NodeJS.Timer>;
                                                        ~~~~~~
\node_modules/playwright-core/lib/helper.d.ts:17:23 - error TS2688: Cannot find type definition file for 'debug'.

17 /// <reference types="debug" />
                         ~~~~~

(snip)

Solution?

tsc goes well if I install @types/node and @types/debug.

$ npm install -D @types/node @types/debug
$ npx tsc --outDir ./dist --lib es2015,dom ./index.ts
$ cat ./dist/index.js 
"use strict";
exports.__esModule = true;

Question

Should this be documented in somewhere?
If so, could you point me where to write? I will send a PR.
(I think Code Transpilation Issues in troubleshooting.md would be good.)

@JoelEinbinder
Copy link
Contributor

Thanks for the heads up. Currently we are using the d.ts files that typescript generates for us, but this is intended as a temporary measure. Generating our own d.ts which filter our private methods should fix this. #6

@mmktomato
Copy link
Author

I understand. Thanks for hard working!

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

No branches or pull requests

2 participants