fix(ESM): convert type declarations to ESM exports#3412
Open
benasher44 wants to merge 1 commit intodiegomura:masterfrom
Open
fix(ESM): convert type declarations to ESM exports#3412benasher44 wants to merge 1 commit intodiegomura:masterfrom
benasher44 wants to merge 1 commit intodiegomura:masterfrom
Conversation
|
Contributor
Author
|
Recommend viewing the diff with whitespace hidden |
cb1510a to
2b12ef3
Compare
Replace the legacy `export = ReactPDF` / `declare namespace ReactPDF`
pattern with proper ESM export declarations. The CJS-style export
assignment causes TS1203 ("Export assignment cannot be used when
targeting ECMAScript modules") for consumers using `module: NodeNext`
or `module: Node16`.
Since v4 already dropped CJS from the runtime, this aligns the type
declarations with the actual module format.
Changes:
- Remove `declare class ReactPDF` and `export = ReactPDF`
- Remove `declare namespace ReactPDF` wrapper
- Add `export` to all interfaces and type aliases (previously
non-exported namespace members)
- All `export class`, `export const`, and `export function`
declarations are unchanged (just un-indented)
2b12ef3 to
32ccddb
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the legacy
export = ReactPDF/declare namespace ReactPDFpattern inindex.d.tswith proper ESM export declarations.The CJS-style export assignment causes TS1203 for consumers using
module: NodeNextormodule: Node16:Since v4 already dropped CJS from the runtime (
feat!: drop cjs supportin #2871), this aligns the type declarations with the actual module format.Changes
declare class ReactPDFandexport = ReactPDFdeclare namespace ReactPDFwrapperexportto all interfaces and type aliases (previously non-exported namespace members)export class,export const, andexport functiondeclarations are unchanged (just un-indented)