import { QueryApi } from "../src/query-api"; const api = new QueryApi(); // 示例 1: args 的 value 是 string 类型 api.post( { path: "/users", metadata: { args: { name: "John", email: "john@example.com" } } }, { pos: "someValue", // ✅ TypeScript 会推断 pos 应该是 string 类型 other: "data" } ); // 示例 2: args 的 value 是 number 类型 api.post( { path: "/products", metadata: { args: { id: 123, price: 99.99 } } }, { pos: 456, // ✅ TypeScript 会推断 pos 应该是 number 类型 other: "data" } ); // 示例 3: args 的 value 是混合类型 api.post( { path: "/orders", metadata: { args: { orderId: 123, status: "pending", total: 99.99 } } }, { pos: "status", // ✅ TypeScript 会推断 pos 可以是 string 或 number // pos: 999, // 这也是合法的 other: "data" } ); // 示例 4: 没有 metadata 或 args api.post( { path: "/test" }, { pos: undefined, // ✅ pos 类型为 never,只能是 undefined other: "data" } );