Skip to content

Commit

Permalink
fix: ts error
Browse files Browse the repository at this point in the history
  • Loading branch information
mumiao committed Dec 21, 2020
1 parent dd2577d commit 456168c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/components/tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import { Tab, ITab, tabItemClassName } from './tab';
import './style.scss';

export type TabsType = 'line' | 'card';
export interface ITabsProps<T>{
export interface ITabsProps<T> {
closable?: boolean;
data: (ITab<T>)[];
data: ITab<T>[];
activeTab?: string;
type?: TabsType;
onCloseTab?: (key?: string) => void;
onMoveTab?: (tabs: (ITab<T>)[]) => void;
onMoveTab?: (tabs: ITab<T>[]) => void;
onSelectTab?: (key?: string) => void;
}

Expand Down Expand Up @@ -59,7 +59,7 @@ export function Tabs<T>(props: ITabsProps<T>) {
)}
>
<div className={tabsHeader}>
{data?.map((tab: (ITab<T>), index: number) => {
{data?.map((tab: ITab<T>, index: number) => {
return (
<Tab
active={activeTab === tab.key}
Expand Down Expand Up @@ -91,4 +91,4 @@ export function Tabs<T>(props: ITabsProps<T>) {
</div>
</DndProvider>
);
};
}
6 changes: 3 additions & 3 deletions src/components/tabs/tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ITab<T> {
label?: React.ReactNode;
tip?: string | React.ReactNode;
renderPanel?: React.ReactNode;
data?: T
data?: T;
}

export interface ITabEvent {
Expand All @@ -36,7 +36,7 @@ export interface ITabEvent {
export const tabClassName = prefixClaName('tab');
export const tabItemClassName = getBEMElement(tabClassName, 'item');

export function Tab<T> (props: ITab<T> & ITabEvent) {
export function Tab<T>(props: ITab<T> & ITabEvent) {
const {
closable,
index,
Expand Down Expand Up @@ -120,4 +120,4 @@ export function Tab<T> (props: ITab<T> & ITabEvent) {
)}
</div>
);
};
}
2 changes: 1 addition & 1 deletion src/extensions/search/searchPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class SearchPane extends React.Component<
value: `hello javascript ${key}`,
path: 'desktop/molecule/editor1',
language: 'javascript',
}
},
};
console.log('open editor:', tabData);
editorService.open(tabData, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const activityBarService = container.resolve<IActivityBarService>(
const explorerService = container.resolve<IExplorerService>(ExplorerService);
const sidebarService = container.resolve<ISidebarService>(SidebarService);
const menuBarService = container.resolve<IMenuBarService>(MenuBarService);
const editorService = container.resolve<IEditorService<any>>(EditorService);
const editorService = container.resolve<IEditorService>(EditorService);
const statusBarService = container.resolve<IStatusBarService>(StatusBarService);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/services/workbench/editorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
IEditorGroup,
} from 'mo/model';

export interface IEditorService<T> extends Component<IEditor<T>> {
export interface IEditorService<T = any> extends Component<IEditor<T>> {
/**
* Open a new tab in indicated group instance
* @param tab Tab data
Expand Down
3 changes: 1 addition & 2 deletions src/workbench/editor/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ function renderEditorGroup(
});
return (
<div className={groupClassName} key={`group-${group.id}`}>
<Tabs
<dataType>
<Tabs<dataType>
closable={true}
type="card"
data={tabs}
Expand Down
2 changes: 1 addition & 1 deletion stories/workbench/0-Workbench.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../demo.scss';

export const IDEDemo = () => (
<MoleculeProvider extensions={customExtensions} locales={[]}>
<Workbench/>
<Workbench />
</MoleculeProvider>
);

Expand Down

0 comments on commit 456168c

Please sign in to comment.