Open
Description
Why are StateObject and StateDeclaration so decoupled? Wouldn't it make sense for StateObject to have StateDeclaration as a generic, so I can cast types properly?
example:
type RouteDefinition = Readonly<
Ng2StateDeclaration & {
menuContent?: {
component: new (..._: any[]) => {};
};
data?: {
title: string;
presentationType?: string;
tabs?: {
label: string;
value: string;
component: new (..._: any[]) => {};
data?: {
title: string;
};
visible?: () => boolean;
permissionsRequired?: PermissionKey[];
params?: {
[s: string]: any;
};
}[];
};
squash?: boolean;
permissionKey?: PermissionKey;
visible?: () => boolean;
url?: string;
resolve?: any;
params?: { [s: string]: any };
}
>;
The below errors because RouteDefinition isn't compatible with StateObject, which I understand... but that's where I get stuck.
const requiresPermissionCriteria: HookMatchCriteria = {
to: (state: RouteDefinition) => {
targetState = state.name;
permissionKey = state.data?.permissionKey;
return state.data?.permissionKey;
},
};
Metadata
Metadata
Assignees
Labels
No labels