-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
fix: use correct export syntax in typings #127
Conversation
@alixaxel any chance of getting a review on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@G-Rath For me, the export = Chromium;
is always yielding errors:
For the first (chromiumDefault
) case:
index.d.ts(20, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
And for the second one (chromiumStar
);
This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.ts(2497)
Do you experience the same?
@@ -1,17 +1,20 @@ | |||
import { Browser, BrowserFetcher, ChromeArgOptions, ConnectOptions, FetcherOptions, LaunchOptions } from 'puppeteer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@G-Rath I guess this is no longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, weird wonder why my IDE didn't flag it 🤔
}; | ||
static get executablePath(): Promise<string> | ||
static get headless(): boolean; | ||
static get puppeteer(): typeof import('puppeteer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@G-Rath Nicely done. 👍
@alixaxel yes, because it's a commonjs export, so you need
You can see this comment for some more info on what the import/export syntaxes compile into/from :) |
This should be merged before #126.
Also to export things like the interfaces, they'll need to be wrapped in a namespace:
In TS
module.exports
syntax is represented byexport =
.The current typings will work fine if you use the default import syntax, but will fail at runtime if you use star/namespace syntax.
By using the proper export syntax, doing
import * as chromium from 'chrome-aws-lambda';
will result in an error: