Skip to content

Commit

Permalink
Improve model selector type (#3877)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler authored Dec 27, 2024
1 parent c46329f commit 96a8ebe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions core/model/HoistModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {DefaultHoistProps, HoistBase, LoadSpecConfig, managed, PlainObject} from
import {instanceManager} from '../impl/InstanceManager';
import {Loadable, LoadSpec, LoadSupport} from '../load';
import {ModelSelector} from './';
import {Class} from 'type-fest';

/**
* Core superclass for stateful Models in Hoist. Models are used throughout the toolkit and
Expand Down Expand Up @@ -221,6 +222,4 @@ export abstract class HoistModel extends HoistBase implements Loadable {
}
}

export interface HoistModelClass<T extends HoistModel> extends Function {
prototype: T;
}
export type HoistModelClass<T extends HoistModel> = Class<T> | {prototype: Pick<T, keyof T>};
2 changes: 1 addition & 1 deletion desktop/cmp/tab/TabSwitcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from '@xh/hoist/utils/react';
import classNames from 'classnames';
import {compact, isEmpty, isFinite} from 'lodash';
import {CSSProperties, ReactElement} from 'react';
import {CSSProperties, ReactElement, KeyboardEvent} from 'react';

/**
* Component to indicate and control the active tab of a TabContainer.
Expand Down
2 changes: 1 addition & 1 deletion desktop/cmp/viewmanager/dialog/ManageDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {viewPanel} from './ViewPanel';
/**
* Default management dialog for ViewManager.
*/
export const manageDialog = hoistCmp.factory<ManageDialogModel>({
export const manageDialog = hoistCmp.factory({
displayName: 'ManageDialog',
className: 'xh-view-manager__manage-dialog',
model: uses(() => ManageDialogModel),
Expand Down
2 changes: 1 addition & 1 deletion desktop/cmp/viewmanager/dialog/ViewMultiPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {pluralize} from '@xh/hoist/utils/js';
import {every, isEmpty} from 'lodash';
import {ManageDialogModel} from './ManageDialogModel';

export const viewMultiPanel = hoistCmp.factory<ManageDialogModel>({
export const viewMultiPanel = hoistCmp.factory({
model: uses(() => ManageDialogModel),
render({model}) {
const views = model.selectedViews;
Expand Down

0 comments on commit 96a8ebe

Please sign in to comment.