You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: http-client-js client options use endpoint when the server parameter has another name #12352
When the @server parameter is not named endpoint, the options interface still declares endpoint, but the context factory reads the real parameter name from the options. The emitted client does not type-check, and the option cannot be set through the declared type.
Reproduction
Emitted with @typespec/http-client-js (default options).
reproClientContext.ts(15,23): error TS2339: Property 'baseUrl' does not exist on type 'ReproClientOptions'.
Expected: the options interface declares the server parameters by their names (baseUrl?: string).
Versions:@typespec/compiler 1.17.0, @typespec/http 1.17.0, @typespec/http-client-js 0.16.3. Also reproduced with the emitter built from main (721154b).
The JS client emitter hardcodes endpoint in the generated options interface but reads the actual @server parameter name when constructing request parameters. A custom name such as baseUrl therefore produces invalid TypeScript and cannot be configured through the declared options type.
The affected component is @typespec/http-client-js client-context/options generation. The likely cause is that the options interface generation assumes the conventional endpoint property while context initialization correctly derives baseUrl from server parameter metadata. The two generated surfaces must use the same parameter names. Searches for the error, custom server-parameter names, and endpoint option generation found no strong duplicate.
📝 Suggested next steps
Generate option properties from the declared @server parameters rather than a hardcoded endpoint property.
Add an emitter test using a custom server parameter name and verify the emitted client type-checks.
Activity
github-actions commentedon Oct 22, 2026
🎯 Issue Triage
The JS client emitter hardcodes
endpointin the generated options interface but reads the actual@serverparameter name when constructing request parameters. A custom name such asbaseUrltherefore produces invalid TypeScript and cannot be configured through the declared options type.Category: Bug
Area:
emitter:client:js🔗 [Playground Reproduction]((typespec.io/redacted)
📋 Reproduction code
🔍 Analysis
The affected component is
@typespec/http-client-jsclient-context/options generation. The likely cause is that the options interface generation assumes the conventionalendpointproperty while context initialization correctly derivesbaseUrlfrom server parameter metadata. The two generated surfaces must use the same parameter names. Searches for the error, custom server-parameter names, and endpoint option generation found no strong duplicate.📝 Suggested next steps
@serverparameters rather than a hardcodedendpointproperty.guishiw commentedon Oct 30, 2026
Hi, I’d like to work on this issue. I’ve reproduced the problem and completed a proposed fix.