Skip to content

Re-export map_iterable_async from octane/tsrx-iterable for @tsrx/core 0.3 #1291

Closed

Description

@leonidaz

Summary

@tsrx/core 0.3.0 changes how the shared type-only transform lowers a @for body that contains an await (tsrx-org/tsrx#212). It emits await __map_iterable_async(…) and imports the helper from the platform's forOfIterableHelper. Octane sets that to octane/tsrx-iterable, which re-exports only map_iterable. That subpath should also re-export map_iterable_async when Octane moves to @tsrx/core 0.3.

This affects only the editor's virtual TSX. Octane's runtime compiler never imports octane/tsrx-iterable, and it rejects async components anyway.

What happens without the export

export async function rows(items: number[]) @{
  @for (const item of items) {
    <li>{await Promise.resolve(item)}</li>
  }
}

With core 0.3.0 and Octane's platform descriptor, the virtual TSX becomes:

import { map_iterable_async as __map_iterable_async } from 'octane/tsrx-iterable';

export async function rows(items: number[]) {
	return await __map_iterable_async(items, async (item) => {
		return <li>{await Promise.resolve(item)}</li>;
	});
}

Type-checking that shape against a module that exports only map_iterable reports:

  • TS2724 on the generated import: has no exported member named 'map_iterable_async'. Did you mean 'map_iterable'?
  • TS7006 Parameter 'item' implicitly has an 'any' type, which maps back to the authored loop binding. item also loses its type on hover.

Core 0.2.x reported TS1308 ('await' expressions are only allowed within async functions) at the await instead, because the loop callback wasn't async.

Change

  • Re-export map_iterable_async from src/tsrx-iterable.ts. @tsrx/core/runtime/iterable exports it from 0.3.0 on.
  • Add it to the ./tsrx-iterable required exports in scripts/verify-dist.mjs#L603.
  • Add a Volar/typecheck test: an async function with an await in a @for body produces no TS2724 or TS7006, and item keeps its element type.

This belongs with the upcoming upgrade to tsrx 0.3.

With the export, these functions type-check cleanly, so the editor reports nothing for them. That matches what it does today for an await in component setup code: Octane's "declared async" error appears only at build time.

Checked against Octane a95c2dc (current main) and core's createJsxTransform from tsrx main, using Octane's platform descriptor. The TS2724/TS7006 pair comes from type-checking the emitted shape against a module that exports only map_iterable. The Octane suite wasn't run.

Activity

  1. added
    agent-authored
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredtooling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions