BridgeJS: support imports of JS `Promise` as `async` Swift by MaxDesiatov · Pull Request #707 · swiftwasm/JavaScriptKit

Supersedes #486.

Provides a motivating example with fetchWeatherData() test. The full end-to-end flow works:

  1. TypeScript interface WeatherData { temperature: number; description: string; humidity: number; };
  2. Function fetchWeatherData(city: string): Promise<WeatherData>;
  3. JS returns Promise.resolve({ temperature: 15.5, description: "Cloudy", humidity: 80 });
  4. Swift awaits and gets a typed WeatherData struct with .temperature, .description, .humidity properties;
  5. No Foundation, no Codable, no manual JSValue unwrapping for this and analogous functions backed by fetch(...).json().

Compatible with Embedded Swift.

Additionally, @JSFunction now supports async effects.