fix(features): keep the installed composers typed with two features (09-01)
flatMap over the installed-module union, the route-registry cast and the non-distributive locale types all failed once a second feature was installed. A unit test installs a differently shaped second feature into a copy of src and runs the app typecheck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
926f448fce
commit
30cf71b249
@@ -16,15 +16,17 @@ import { INSTALLED_PRODUCT_FEATURES } from "./installed-product-manifest.ts";
|
||||
|
||||
export const INSTALLED_FEATURE_CONTRACTS = INSTALLED_PRODUCT_FEATURES;
|
||||
|
||||
type InstalledFeatureContract = (typeof INSTALLED_FEATURE_CONTRACTS)[number];
|
||||
|
||||
// 09-01. The registries keep composeUniqueRecord's own type, the intersection
|
||||
// of every record. The former cast to `PLATFORM & InstalledFeatureContract[...]`
|
||||
// was an intersection with a union once two features were installed, which
|
||||
// kept only the route keys common to both.
|
||||
export const ROUTE_REGISTRY = composeUniqueRecord(
|
||||
[
|
||||
PLATFORM_ROUTE_REGISTRY,
|
||||
...INSTALLED_FEATURE_CONTRACTS.map((contract) => contract.routes),
|
||||
],
|
||||
() => "route registry",
|
||||
) as typeof PLATFORM_ROUTE_REGISTRY & InstalledFeatureContract["routes"];
|
||||
);
|
||||
|
||||
export const ROUTE_RUNTIME_CONTRACT = composeUniqueRecord(
|
||||
[
|
||||
@@ -34,8 +36,7 @@ export const ROUTE_RUNTIME_CONTRACT = composeUniqueRecord(
|
||||
),
|
||||
],
|
||||
() => "route runtime contract",
|
||||
) as typeof PLATFORM_ROUTE_RUNTIME_CONTRACT &
|
||||
InstalledFeatureContract["routeRuntimeContracts"];
|
||||
);
|
||||
|
||||
export const API_OPERATIONS = composeApiOperations(
|
||||
INSTALLED_FEATURE_CONTRACTS.map((contract) => contract.apiOperations),
|
||||
|
||||
Reference in New Issue
Block a user