Skip to content

Commit 77436e8

Browse files
krisnyeclaude
andcommitted
refactor(ecs): drop Database.Plugin.ToComputedDb
With computed factories now seeing the base plugin's resolved computeds, the computed-erased alias no longer mirrors the factory context — the db a factory receives is no longer `computed: unknown`. Its only residual use (strip computed to break a type cycle) is speculative, has no consumer, and is a near-duplicate of ToDatabase; the rare call site can write `Omit<ToDatabase<P>, 'computed'>` inline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 780781c commit 77436e8

1 file changed

Lines changed: 0 additions & 32 deletions

File tree

packages/data/src/ecs/database/database.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -318,38 +318,6 @@ export namespace Database {
318318
export const combine = combinePlugins;
319319
export type ToDatabase<P extends Database.Plugin> = Database.FromPlugin<P>;
320320
export type ToStore<P extends Database.Plugin> = Store<FromSchemas<RemoveIndex<P['components']>>, FromSchemas<RemoveIndex<P['resources']>>, RemoveIndex<P['archetypes']>>;
321-
/**
322-
* `ToDatabase<P>` with the computed surface erased (`computed: unknown`).
323-
*
324-
* Use this to alias a plugin's database in a context that must not depend
325-
* on the fully-resolved computed-values type — e.g. to break a type cycle,
326-
* or in a module that never reads `db.computed`. It replaces the hand-rolled
327-
* `Omit` that reconstructs the same shape:
328-
*
329-
* ```ts
330-
* // ❌ hand-reconstructs the framework's contract
331-
* type CoreStateDatabase = Omit<Database.Plugin.ToDatabase<typeof coreStatePlugin>, 'computed'>;
332-
*
333-
* // ✅ first-class contract
334-
* type CoreStateDatabase = Database.Plugin.ToComputedDb<typeof coreStatePlugin>;
335-
* ```
336-
*
337-
* Note: this is *not* the db a computed factory receives. A factory of a
338-
* plugin that `extends` a base sees that base's already-resolved computeds
339-
* (so it can compose on them); the factory's own in-progress siblings stay
340-
* hidden. When you want that fully-resolved surface, use `ToDatabase<P>`.
341-
*/
342-
export type ToComputedDb<P extends Database.Plugin> = Database<
343-
FromSchemas<RemoveIndex<P['components']>>,
344-
FromSchemas<RemoveIndex<P['resources']>>,
345-
RemoveIndex<P['archetypes']>,
346-
ToTransactionFunctions<RemoveIndex<P['transactions']>>,
347-
StringKeyof<P['systems']>,
348-
ToActionFunctions<RemoveIndex<P['actions']>>,
349-
FromServiceFactories<RemoveIndex<P['services']>>,
350-
unknown,
351-
RemoveIndex<P['indexes']>
352-
>;
353321
/**
354322
* The plugin's store as seen *inside a transaction body* — i.e. `ToStore<P>`
355323
* plus the `userId` field added by the transaction dispatcher. Use this

0 commit comments

Comments
 (0)