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
@modelschemas/client RateCard type does not fit evaluateCard from @modelschemas/rate-card #494
The RateCard from @modelschemas/client does not fit evaluateCard from @modelschemas/rate-card. Both are 0.2.1. The client's type is generated from OpenAPI (price: unknown, tables: { [key: string]: unknown }). The evaluator's type has price: RateCardPrice and tables: Record<string, Table>.
error TS2345: Argument of type '.../@modelschemas/client/dist/generated/types.gen").RateCard'
is not assignable to parameter of type '.../@modelschemas/rate-card/dist/card").RateCard'.
So a caller must cast, or parse every card with rateCardSchema (which needs zod), to price a card that the client just returned. TanStack AI's docs page (TanStack/ai#1308, docs/advanced/model-prices.md) parses with rateCardSchema for this reason.
Ask
Make the two types one type. For example, the client re-exports RateCard from @modelschemas/rate-card, or the OpenAPI schema for pricing is generated from rateCardSchema.
Keep RateCard | CompactPricing | null on list rows, but let a caller narrow it to a card that evaluateCard accepts with no cast.
Acceptance
The snippet above type-checks with no as and no rateCardSchema call.
getModel on a detail row returns a pricing that evaluateCard accepts directly.
Activity
Client: type served pricing as rate-card's RateCard (#494)
Client: export rate-card's RateCard as the client's RateCard (#494)
Client: stop exporting the generated RateCard types (#494)
Spec: write the RateCard components from the rate-card zod schema (#494)
Spec: write CompactPricing, PricingRange, ModelReasoning and ChatRequ…
Spec: meta on every converted zod schema; descriptions only where the…
Spec: throw on a missing RateCard currency, check assignability both …
Spec: write RateCard components from the rate-card zod schema (#498)