Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing export default #3525

Merged
merged 5 commits into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Authorized/AuthorizedRoute.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export interface IAuthorizedRouteProps extends RouteProps {
}
export { authority };

export class AuthorizedRoute extends React.Component<IAuthorizedRouteProps, any> {}
export default class AuthorizedRoute extends React.Component<IAuthorizedRouteProps, any> {}
57 changes: 44 additions & 13 deletions src/components/Charts/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
import * as numeral from 'numeral';
export { default as ChartCard } from './ChartCard';
export { default as Bar } from './Bar';
export { default as Pie } from './Pie';
export { default as Radar } from './Radar';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种写法是没有问题的,你的 ts 版本是?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.2.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该有问题吧,少了默认导出。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export { default as ChartCard } from './ChartCard'
改成 import 主要是为了下面一起导出,需要导入。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

懂了,你需要一个 default,可以保持原样然后进行default导出的。
这样可以支持 treebreak

export { default as Gauge } from './Gauge';
export { default as MiniArea } from './MiniArea';
export { default as MiniBar } from './MiniBar';
export { default as MiniProgress } from './MiniProgress';
export { default as Field } from './Field';
export { default as WaterWave } from './WaterWave';
export { default as TagCloud } from './TagCloud';
export { default as TimelineChart } from './TimelineChart';
import { default as Bar } from './Bar';
import { default as ChartCard } from './ChartCard';
import { default as Field } from './Field';
import { default as Gauge } from './Gauge';
import { default as MiniArea } from './MiniArea';
import { default as MiniBar } from './MiniBar';
import { default as MiniProgress } from './MiniProgress';
import { default as Pie } from './Pie';
import { default as Radar } from './Radar';
import { default as TagCloud } from './TagCloud';
import { default as TimelineChart } from './TimelineChart';
import { default as WaterWave } from './WaterWave';

declare const yuan: (value: number | string) => string;

export { yuan };
declare const Charts: {
yuan: (value: number | string) => string;
Bar: Bar;
Pie: Pie;
Gauge: Gauge;
Radar: Radar;
MiniBar: MiniBar;
MiniArea: MiniArea;
MiniProgress: MiniProgress;
ChartCard: ChartCard;
Field: Field;
WaterWave: WaterWave;
TagCloud: TagCloud;
TimelineChart: TimelineChart;
};

export {
Charts as default,
yuan,
Bar,
Pie,
Gauge,
Radar,
MiniBar,
MiniArea,
MiniProgress,
ChartCard,
Field,
WaterWave,
TagCloud,
TimelineChart,
};
2 changes: 2 additions & 0 deletions src/components/HeaderDropdown/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as React from 'react';
export default class HeaderDropdown extends React.Component<any, any> {}
2 changes: 1 addition & 1 deletion src/components/Login/LoginItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export interface ILoginItemProps {
buttonText?: React.ReactNode;
}

export class LoginItem extends React.Component<ILoginItemProps, any> {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job

export default class LoginItem extends React.Component<ILoginItemProps, any> {}