Skip to content

Fix WinRT JavaScript runtime-class interface input typing - #208

Open
leileizhang (lei9444) wants to merge 3 commits into
mainfrom
lei9444-fix-js-interface-input-typing
Open

leileizhang (lei9444) wants to merge 3 commits into
mainfrom
lei9444-fix-js-interface-input-typing

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

WinRT runtime classes merge overload names while standalone interfaces retain explicit WinMD aliases. Native StorageFile inputs work with FileIO, but strict TypeScript rejects StorageFile as IStorageFile and StorageFolder as IStorageFolder because the class declarations lack those aliases.

Fix

Retain original instance-method aliases during JavaScript projection and emit real JS methods with matching declarations after overload merging. Aliases preserve the declaring interface, vtable slot, conversion, and async behavior. Existing class dispatchers, interface aliases, and .as(...) views remain unchanged; existing public members win name collisions. No input-type widening, native ABI/production runtime behavior, Python, or release/version changes.

A separate CI prerequisite accepts trailing commas in the existing test-hook stub macro and formats two invocations for hosted rustfmt. Its native argument tokens and function bodies are unchanged. Test paths are canonicalized to handle hosted runner short-name aliases without weakening destination checks.

Verification

  • TypeScript 5.9.3 --strict --skipLibCheck false: the original natural FileIO/copy repro fails before and passes after. Positive file/folder/IStorageItem/IBuffer/IStringable inputs, legacy names and explicit views pass; unrelated Uri and wrong file/folder inputs remain rejected.
  • Real isolated-file roundtrips on ARM64 and x64: CJS/ESM, five independent/incremental generation selections, all copy/move alias shapes and existing overloads, AbortSignals, and compiled direct-module/package consumers. Existing Storage class bodies and standalone interface output compare unchanged; classes intentionally gain aliases.
  • Generator units/snapshots and execution traces verify aliases, original slots/QI, numeric merges, and collision precedence. Formatting, lint, and two-architecture test-hook compilation pass.
  • Exact head 6258cc1950d0058aef02ec99a6be107e7db43558: Build, mixed-language coverage, and Python artifact verification all pass, including the hosted x64 strict-TS/native matrix. Release publication remains skipped.

leileizhang (lei9444) and others added 2 commits October 1, 2026 22:22
Keep existing class overload dispatchers while retaining metadata-projected interface aliases as real methods so StorageFile and StorageFolder satisfy their interface input types.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Accept optional trailing commas and format the two existing macro calls required by hosted Rust 1.99. Generated native signatures and behavior are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 86.93% 82.48% 86.65% regions
Python aggregate 72.34% n/a 39.42% branches
Python runtime 98.17% n/a 94.57% branches
Generated Python WinRT projections 71.07% n/a 33.5% branches
Generated Python WinRT implementations 71.97% n/a 46.3% branches
JavaScript aggregate 21.6% 24.93% 57.61% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 22.64% 18.43% 54.84% branches
Generated WinRT implementations 45.99% 59.19% 60.97% branches
Generated Classic COM projections 11.52% 23.97% 53.4% branches

View workflow run and download full HTML/LCOV/XML reports

Compare real filesystem paths rather than hosted runner short-name spellings, and canonicalize the consumer root so strict TypeScript sees one path identity.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant