microsoft / microsoft/typespec
Http-client-js operation response on the client doesn't carry the return type
- 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
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