microsoft / microsoft/typespec

Http-client-js operation response on the client doesn't carry the return type

Open Beginner friendly
#11,853 0 comments 1 reaction 0 assignees View on GitHub
emitter:client:js
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

The return type is infered from the call of the dedicated function but for readability it should be good to repeat it

[Playground Link](https://typespec.io/playground/?tspconfig=ZW1pdDoKICAtICJAdHlwZXNwZWMvaHR0cC1jbGllbnQtanMiCg%3D%3D&c=QHNlcnZpY2UKbmFtZXNwYWNlIFM7CgpvcCB0ZXN0KCk6IHN0cmluZzs%3D&vs=%7B%7D)

### Actual

```ts
async test(options?: TestOptions) {
return test(this.#context, options);
}
```

```ts
export async function test(
client: SClientContext,
options?: TestOptions,
): Promise {
```

### Expected
```ts
async test(options?: TestOptions): Promise {
return test(this.#context, options);
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked TypeSpec Playground example and trace the generated client operation wrapper and its dedicated function. Check how the return type is inferred for the wrapper, then verify the generated method declares the same Promise return type shown in the expected output. Done means the client method visibly carries that return type without changing its behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.