Repository navigation
test(p2-shim): exercise instantiation generic types - #2233
Merged
vados-cosmonic merged 2 commits intoOct 11, 2026
Merged
vados-cosmonic merged 2 commits into
vados-cosmonic merged 2 commits into
Conversation
Collaborator
|
Ah nice catch @eduardomourar thanks for submitting this, this should prevent this from happening again Code looks good to me (outside of the fmt failure) but once you're done I'm happy to review and merge this! |
eduardomourar
force-pushed
the
fix/preview2-shim-instantiation-types
branch
from
October 9, 2026 09:42
fa89755 to
dd1fe4c
Compare
eduardomourar
marked this pull request as ready for review
October 9, 2026 09:42
eduardomourar
requested review from
andreiltd and
vados-cosmonic
as code owners
October 9, 2026 09:42
vados-cosmonic
approved these changes
Oct 11, 2026
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
@bytecodealliance/preview2-shim/instantiationhas three related typing bugs that make the documented versioned-import workflow unusable:WASIShimConfig,SandboxConfig,GetImportObjectArgs,WASIImportObject, andVersionedWASIImportObjectwere declared withoutexportintypes/instantiation.d.ts, so consumers can't name them (TS2459/TS2305).getImportObject's version generic lived only on a dead duplicate class declaration intypes/; the implementation that's actually emitted todist/common/instantiation.d.tshad no generic at all, so passingasVersionand a type argument together failed (TS2558)../instantiationexport'stypescondition pointed at./dist/common/*.d.ts, where*is a literal filename rather than a pattern — it only resolved by accidental fallback to the.jstarget.Changes
types/instantiation.d.ts; drop the dead duplicateWASIShimclass declaration there.getImportObjectimplementation insrc/common/instantiation.ts, inferringVfromasVersioninstead of requiring it twice; re-export the public types so they survive intodist/../instantiationtypescondition to point directly atdist/common/instantiation.d.ts.test/types.ts+test/fixtures/types/instantiation-generics/) that compiles the documented versioned-import snippet and fails with the original errors against the pre-fix code.