ReviewOS

home-lang/home

feat(interop): implement the `.d.hm` and `.d.ts` loaders so calls across Home ↔ TypeScript are type-checked

#786
Open chris opened this 8 days ago ·
8 days ago

Problem

Both declaration loaders are stubs that return error.NotImplemented, even though the resolver already accepts .hm, .home and .d.hm. The Home checker swallows import errors and types imported namespaces as Void, so no cross-module call is checked, and HM1001 (cross-frontend type mismatch) is never emitted. TS_PARITY_PLAN.md promises two-way checked imports.

Evidence (origin/main @ d4b219507)

Scope

  • Implement d_hm.Loader (Home decls → TS checker types) and d_ts.Loader (TS decls → Home types).
  • Define the type mapping (numbers, strings, Result/optional ↔ union with undefined, structs ↔ object types).
  • Emit HM1001 on a cross-frontend mismatch.

Acceptance criteria

  • A .ts file calling a Home function with a wrong argument type gets an error.
  • A .home file calling a TS export with a wrong argument type gets an error.
  • Round-trip tests for the type mapping.

Depends on: #779 Part of #814.

Sign in to comment on this issue.