Skip to content

lit-ui-router / TypedLitStateDeclaration

Interface: TypedLitStateDeclaration<T> ​

Defined in: packages/lit-ui-router/src/interface.ts:499

A LitStateDeclaration for state tables registered with ui-router-registry, whose components may call typed targets for states in the same table.

Checking such a table against LitStateDeclaration infers each component's render() or template body, which reads the registry, which reads the table: TypeScript reports the table as circular (TS7022). This type checks components by TypedLitViewComponent instead. Classes clear on every supported TypeScript; template functions clear on TypeScript 5.5 and later, and earlier compilers still need an explicit return type on them.

Checking by public members also admits a LitElement class from a second copy of lit, which <ui-view> cannot render; development builds warn.

Example ​

ts
const contactState = {
  name: 'contacts.contact',
  url: '/:contactId',
  component: ContactView,
} as const satisfies TypedLitStateDeclaration;

Extends ​

Type Parameters ​

Type ParameterDefault type
T extends DefaultResolvesTypeDefaultResolvesType

Properties ​

PropertyTypeDescriptionOverridesDefined in
component?TypedLitViewDeclaration<T>The Lit component to render for this state.-packages/lit-ui-router/src/interface.ts:503
views?{ [key: string]: TypedLitViewDeclaration<T>; }An optional object used to define multiple named views.StateDeclaration.viewspackages/lit-ui-router/src/interface.ts:506