fix(esm-shim): match typings to actual exports#2013
Open
greymoth-jp wants to merge 1 commit into
Open
Conversation
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.
The hand-written
types/index.d.tsfor@rollup/plugin-esm-shimdoes not match what the package actually exports.src/index.tsexposes the plugin as both a named and a default export, and re-exports theOutputtype:The typings only declare the default, under the stale name
commonjsShim, and omit the namedesmShimexport. As a resultimport { esmShim } from '@rollup/plugin-esm-shim'does not type-check even though it works at runtime.This is the same typings/exports drift that #1985 fixed for
@rollup/plugin-swc. Every other plugin with a named export already declares it in its typings (swc, babel, wasm, node-resolve, html, dynamic-import-vars); esm-shim is the one that was left out.Changes:
esmShimexport and give the default its real name, matching the shape fix(swc): fix typings to match actual exports #1985 landed (export function swc(...): Plugin; export default swc;)Outputtype, whichsrc/index.tsalready re-exports from./typestest:tstype testpnpm --filter @rollup/plugin-esm-shim test:tsreportshas no exported member 'esmShim'on the current typings and passes with this change.