Address review: justify/refine SDK-gap casts (as unknown as)
Per human review on #1688: for each `as unknown as` in the PR, either refactor or justify with a comment naming the SDK gap (so it can inform SDK-side type improvements). - Sampling/elicit receiver-task returns: route through a typed `CreateTaskResult` so the object shape IS checked; the remaining cast to CreateMessageResult / ElicitResult is the honest SDK gap (the 2-arg setRequestHandler overload types the handler return as the spec result only, not the task-augmented variant). - `_requestHandlers` / `_progressHandlers` private-field casts: comments now name the exact missing public API (opt a handler out of result validation; keep a progress subscription alive across a resolved request). - test-server `_requestHandlers` cast: same SDK gap on the server side, noted. - serverList object->Record casts (pre-existing): documented as plain structural widening (no index signature -> TS requires the `unknown` step), not an SDK workaround. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
39362dd5ff
commit
dbb8c40245
1 changed files with 41 additions and 10 deletions
|
|
@ -355,6 +355,11 @@ export function mcpConfigToServerEntries(config: MCPConfig): ServerEntry[] {
|
|||
// `InspectorServerSettings` only.
|
||||
const inspectorFields: StoredInspectorFields = {};
|
||||
const sdkOnly: Record<string, unknown> = {};
|
||||
// Widen the typed config object to a generic record to iterate its keys.
|
||||
// `StoredMCPServer` has no index signature, so TS requires the `unknown`
|
||||
// step (`as Record<string, unknown>` alone is TS2352). This is a plain
|
||||
// structural widening, not an SDK-shape workaround. (Pre-existing pattern,
|
||||
// also at the `serverEntryToStored` / oauth-strip casts in this file.)
|
||||
for (const [k, v] of Object.entries(
|
||||
raw as unknown as Record<string, unknown>,
|
||||
)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue