[BUG] TypeScript compilation does not work
See original GitHub issueEnvironment
chrome-aws-lambda
Version: 5.3.1puppeteer
/puppeteer-core
Version: 5.3.1- OS: Mac / Linux
- Node.js Version: 12.18.3
- Lambda / GCF Runtime:
nodejs12.x
Description
I’m using chrome-aws-lambda
in combination with TypeScript. I have chrome-aws-lambda
and puppeteer-core
installed.
Expected Behavior
If I use tsc
my code compiles together with aws-chrome-lambda
without errors.
Current Behavior
If I use tsc
it throws the following error:
node_modules/chrome-aws-lambda/source/index.d.ts:1:115 - error TS2307: Cannot find module 'puppeteer' or its corresponding type declarations.
1 import { BrowserOptions, DirectNavigationOptions, ElementHandle, NavigationOptions, ResourceType, Response } from 'puppeteer';
~~~~~~~~~~~
node_modules/chrome-aws-lambda/source/index.d.ts:201:41 - error TS2307: Cannot find module 'puppeteer' or its corresponding type declarations.
201 static get puppeteer(): typeof import('puppeteer');
~~~~~~~~~~~
node_modules/chrome-aws-lambda/source/index.d.ts:211:36 - error TS2304: Cannot find name 'BrowserContext'.
211 export interface Browser extends BrowserContext {
~~~~~~~~~~~~~~
node_modules/chrome-aws-lambda/source/index.d.ts:218:16 - error TS2304: Cannot find name 'Target'.
218 targets(): Target[];
~~~~~~
Steps to Reproduce
Currently I have no easy steps for reproduction of the issue. I will try to come up with one.
Possible Solution
Currently I can only compile my code with tsc
if I add "skipLibCheck": true
to my tsconfig.json
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
TypeScript Compilation/Generation not working
For ASP.Net Core 1.1 projects (at least) typescript compilation to javascript is not working. To replicate this issue create a new ASP.
Read more >typescript compiler (tsc) command not working with tsconfig
and I run tsc on command prompt, but it won't work and outputs me the syntax, example and options of how to use...
Read more >Tsconfig show typescript file not found error after moving it to ...
Issue Type: Bug When I move a typescript file from a directory into another directory or delete the file from vscode, it shows...
Read more >1058578 - Build failure: Typescript compilation fails - Monorail
The root cause is an upstream issue in the TypeScript compiler ... (https://github.com/microsoft/TypeScript/issues/37156) which has caused
Read more >Documentation - tsc CLI Options - TypeScript
Flag Type Default
‑‑allowJs boolean false
‑‑allowUmdGlobalAccess boolean false
‑‑allowUnreachableCode boolean
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
I am running into exactly the same issue as Shamshiel but with puppeteer: ^7.0.4 and chrome-aws-lambda: ^7.0.0. However if I install
@types/puppeteer@^5.4.3
indevDependencies
I still get the same error. I believe this is to do with puppeteer now exporting their own types. Is there any solution possible without adding"skipLibCheck": true
to mytsconfig.json
?@alixaxel Unfortunately this doesn’t seem to fix the issue, I am still getting the same error with the following versions.
"devDependencies": { "puppeteer": "^7.1.0", "typescript": "^4.0.3" }, "dependencies": { "aws-sdk": "^2.765.0", "chrome-aws-lambda": "^7.0.0", "puppeteer-core": "^7.1.0" }
Looking at the puppeteer changelog it’s looking like they are not going to be fixing this issue and making it worse by renaming BrowserOptions 😃 I assume this will be a case of just waiting for v8.0?