cloudflare / cloudflare/workers-rs

[BUG] RPC Method Proxy Issues: Export and Usability

Open
#858 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.7k
Forks
429
Avg merge
20h 28m
Merged PRs (30d)
7

Description

RPC methods are being proxied, which makes usage difficult. In the index.d.ts file, export is specified, but the generated index.js exports a Proxy. This also causes a "not found" error, similar to the example. RPC methods should be moved outside the proxy.

https://github.com/cloudflare/workers-rs/blob/490c6c9082e06db5e29a6d622f37893628191396/worker-build/src/js/shim.js#L113

lib.rs:
```rust
#[wasm_bindgen]
pub async fn greet()
```
build/index.d.ts:
```ts
export function greet(): void;
```
demo.ts:
```ts
import {greet} from "./build/index.js" //throw error not found greet
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.