Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate
src/pipetransport
to typescript (#5692)
* chore: migrate `src/pipetransport` to typescript Hit one bump in the fact that I want to share an interface across files. TypeScript only lets you import/export these if you're using ESM, not CommonJS. So the two options are: - Migrate to ESM on a per file basis as we do this migration. This won't affect the output as we output as CommonJS. - Create a global `types.d.ts` file that we'll use and then migrate to ESM after. Right now I've gone for the second option in order to not introduce more changes in one go. But if we end up finding we have lots of interfaces/types/etc that we want modules to expose, we might decide slowly introducing ESM might be a better way forwards. * Update src/types.d.ts Co-Authored-By: Mathias Bynens <mathias@qiwi.be>
- Loading branch information
1 parent
4134b54
commit e7a32a8
Showing
4 changed files
with
42 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* These types exist here until we migrate over to ESM where we can | ||
* import / export them properly from modules - TS doesn't support | ||
* exposing interfaces in CommonJS land. | ||
*/ | ||
interface PuppeteerEventListener { | ||
emitter: NodeJS.EventEmitter; | ||
eventName: string | symbol; | ||
handler: (...args: any[]) => void; | ||
} |