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

Nobody has claimed this yet.

Assessment

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

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.

Description

emitter:client:js

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

Playground Link

Actual
  async test(options?: TestOptions) {
    return test(this.#context, options);
  }
export async function test(
  client: SClientContext,
  options?: TestOptions,
): Promise<string> {
Expected
  async test(options?: TestOptions): Promise<string> {
    return test(this.#context, options);
  }
Dominant language
Java
Stars
5.9k
Forks
395
Avg merge
1d 21h
Merged PRs (30d)
105

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/typespec

All issues in microsoft/typespec

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.