Skip to main content

Function: declarePeerDependency()

declarePeerDependency<Plan>(name, config?): NormalizedPeerDependency<Plan>

Used to declare a peer dependency of a plan in a type-safe way, requires the type parameter. The most common use case for peer dependencies is to avoid a direct import dependency, so you would want to use a type import or the import type (shown in below examples).

Type Parameters

Plan extends AnyLexicalPlan = never

Parameters

name: Plan["name"]

The plan's name

config?: Partial<LexicalPlanConfig<Plan>>

An optional config override

Returns

NormalizedPeerDependency<Plan>

NormalizedPeerDependency

Example

export const PeerPlan = definePlan({
name: 'PeerPlan',
peerDependencies: [
declarePeerDependency<typeof import("foo").FooPlan>("foo"),
declarePeerDependency<typeof import("bar").BarPlan>("bar", {config: "bar"}),
],
});

Defined in

definePlan.ts:184