[BUG] Interface 'Browser' incorrectly extends interface 'BrowserContext'
See original GitHub issueEnvironment
chrome-aws-lambda
Version:5.2.0
puppeteer
/puppeteer-core
Version:5.2.1
- OS: Mac
- Node.js Version:
12.x
- Lambda / GCF Runtime:
nodejs12.x
Expected Behavior
TypeScript should compile without mismatched interface
Current Behavior
Upon compile, it seems interface Browser
isn’t typed properly.
node_modules/@types/puppeteer/index.d.ts:1814:18 - error TS2430: Interface 'Browser' incorrectly extends interface 'BrowserContext'.
The types returned by 'targets()' are incompatible between these types.
Type 'Promise<Target[]>' is missing the following properties from type 'Target[]': length, pop, push, concat, and 26 more.
1814 export interface Browser extends EventEmitter, TargetAwaiter {
Steps to Reproduce
{
"devDependencies": {
"@types/node": "^12",
"@types/puppeteer": "3.0.1",
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"aws-sdk": "^2.725.0",
"eslint": "^7.4.0",
"puppeteer": "^5.2.1",
"typescript": "^3.9.7"
},
"dependencies": {
"chrome-aws-lambda": "5.2.0",
"puppeteer-core": "5.2.1"
}
}
import chromium from "chrome-aws-lambda";
export async function example(): Promise<void> {
const browser = await chromium.puppeteer.launch({
executablePath: await chromium.executablePath,
args: chromium.args,
defaultViewport: chromium.defaultViewport,
headless: chromium.headless,
ignoreHTTPSErrors: true,
});
}
Possible Solution
I’m honestly not sure if this is a bug or I’m doing something wrong. Please advise.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Context menu items - Mozilla - MDN Web Docs
This user interface option adds one or more items to a browser context menu. This is the context menu available when a user...
Read more >Augmentations for the global scope can only be directly ...
You can indicate that the file is a module like so: export {}; declare global { namespace NodeJS { interface Global { config:...
Read more >BrowserContext (Playwright - Main Library 1.12.1 API)
public interface BrowserContext extends AutoCloseable. BrowserContexts provide a way to operate multiple independent browser sessions.
Read more >Flexible and Dynamic Test Fixtures in Playwright - Medium
To use the fixture in our tests, we extend the test object to include our fixture, and naturally, ... We can define the...
Read more >Safari Technology Preview Release Notes - Apple Developer
Fixed an issue where browser.tabs sometimes returned an incorrect URL for pinned ... If you see bugs or unexpected behavior with the interface...
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
Thanks for the extra info. Unfortunately I haven’t had a chance to look at this.
I’ll be able to spend some limited time on this starting tomorrow (it’s Friday today in Australia).
I’ll let you know how I go ASAP.
@benlongmire This should be handled now on the latest version (5.2.1).
The problem is
@types/puppeteer
is still lagging behind andpuppeteer
haven’t yet shipped their typings. 🤷🏻♂️