Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

resolvetype.md

32 lines1.1 KB

Type Alias: ResolveType<TExplicit, TSchema, TFallback>

type ResolveType<TExplicit, TSchema, TFallback> = unknown extends TExplicit ? [TSchema] extends [never] ? TFallback : InferSchemaOutput<TSchema> : TExplicit extends object ? TExplicit : Record<string, unknown>;

Defined in: packages/db/src/types.ts:64

Helper type to determine the final type based on priority:

  1. Explicit generic TExplicit (if not 'unknown')
  2. Schema output type (if schema provided)
  3. Fallback type TFallback

Type Parameters

• TExplicit

• TSchema extends StandardSchemaV1 = never

• TFallback extends object = Record<string, unknown>

Remarks

This type is used internally to resolve the collection item type based on the provided generics and schema. Users should not need to use this type directly, but understanding the priority order helps when defining collections.