Final implementation
New types
-
Added the
MergePackages
utility. It simply removes thename
property from each package and returns the intersection of all of them, as specified in the implementation proposal. It is exported fromfrontity/types
.import { MergePackages, Derived } from "frontity/types"; import Source from "@frontity/source/types"; import Router from "@frontity/router/types"; interface MyPackage { state: { // Derived prop that depends on source and router packages. someProp: Derived<Packages>; }; } // All packages merged together. type Packages = MergePackages<Source, Router, MyPackage>;
-
Moved the
frontity
namespace fromPackage
to the newFrontity
interface. Now, if you need to access properties likestate.frontity.url
,state.frontity.rendering
, etc. you have to importFrontity
fromfrontity/types
and include it inMergePackages
as any other package.import { Frontity, MergePackages, Derived } from "frontity/types"; interface MyPackage { state: { // Derived prop that depends on the frontity namespace. someProp: Derived<Packages>; }; } // All packages merged together. type Packages = MergePackages<Frontity, MyPackage>;
Other changes
- Adapted all packages to use
MergePackages
andFrontity
types if needed. - Refactored the
Settings
type to improve package types resolution.