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 dll bug and add typescript typings #3892

Merged
merged 2 commits into from
Apr 2, 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 config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const plugins: IPlugin[] = [
? {
dll: {
include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
exclude: ['@babel/runtime'],
exclude: ['@babel/runtime', 'netlify-lambda'],
},
hardSource: false,
}
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"functions:build": "npm run generateMock && netlify-lambda build ./lambda",
"functions:run": "npm run generateMock && cross-env NODE_ENV=dev netlify-lambda serve ./lambda",
"generateMock": "node ./scripts/generateMock",
"lint": "eslint --ext .js src mock tests && npm run lint:style && npm run lint:prettier",
"lint": "npm run lint:js && npm run lint:ts && npm run lint:style && npm run lint:prettier",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js",
"lint-staged:ts": "tslint",
Expand Down Expand Up @@ -80,6 +80,7 @@
"devDependencies": {
"@types/classnames": "^2.2.7",
"@types/history": "^4.7.2",
"@types/lodash": "^4.14.123",
"@types/react": "^16.8.1",
"@types/react-document-title": "^2.0.3",
"@types/react-dom": "^16.0.11",
Expand Down Expand Up @@ -107,6 +108,7 @@
"lint-staged": "^8.1.1",
"merge-umi-mock-data": "^1.0.4",
"mockjs": "^1.0.1-beta3",
"netlify-lambda": "^1.4.3",
"prettier": "^1.16.4",
"slash2": "^2.0.0",
"stylelint": "^9.10.1",
Expand All @@ -123,8 +125,7 @@
"umi-plugin-ga": "^1.1.3",
"umi-plugin-pro-block": "^1.3.0",
"umi-plugin-react": "^1.7.2",
"umi-types": "^0.2.0",
"netlify-lambda": "^1.4.3"
"umi-types": "^0.2.0"
},
"optionalDependencies": {
"puppeteer": "^1.12.1"
Expand Down
2 changes: 1 addition & 1 deletion src/components/GlobalHeader/RightContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class GlobalHeaderRight extends Component<GlobalHeaderRightProps>
<NoticeIcon
className={styles.action}
count={currentUser && currentUser.unreadCount}
onItemClick={(item, tabProps) => {
onItemClick={(item: NoticeItem, tabProps: any) => {
console.log(item, tabProps); // tslint:disable-line no-console
this.changeReadState(item as NoticeItem);
}}
Expand Down
12 changes: 0 additions & 12 deletions src/components/HeaderDropdown/index.d.ts

This file was deleted.

4 changes: 4 additions & 0 deletions src/components/HeaderDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { DropDownProps } from 'antd/es/dropdown';
import classNames from 'classnames';
import styles from './index.less';

declare type OverlayFunc = () => React.ReactNode;

export interface HeaderDropdownProps extends DropDownProps {
overlayClassName?: string;
overlay: React.ReactNode | OverlayFunc;
placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter';
}

const HeaderDropdown: React.FC<HeaderDropdownProps> = ({ overlayClassName: cls, ...restProps }) => (
Expand Down
15 changes: 0 additions & 15 deletions src/components/HeaderSearch/index.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/components/SettingDrawer/BlockCheckbox.d.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/components/SettingDrawer/index.d.ts

This file was deleted.

69 changes: 69 additions & 0 deletions src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,73 @@ declare module '*.tiff';
declare module 'rc-animate';
declare module 'omit.js';
declare module 'react-copy-to-clipboard';
declare module 'react-fittext';
declare module '@antv/data-set';
declare module 'nzh/cn';
declare var APP_TYPE: string;
declare module 'memoize-one' {
function memoizeOne<T extends (...args: any[]) => any>(
resultFn: T,
isEqual?: (a: any, b: any, index: number) => boolean,
): T;
export default memoizeOne;
}

declare module 'ant-design-pro' {
import { Component } from 'react';
export interface NoticeIconTabProps<T extends NoticeIconData = NoticeIconData> {
className?: string;
count?: number;
emptyText?: React.ReactNode;
emptyImage?: string;
list?: T[];
showClear?: boolean;
showViewMore?: boolean;
style?: React.CSSProperties;
title?: string;
}

export type NoticeIconTabComponent<T extends NoticeIconData = NoticeIconData> = React.FC<
NoticeIconTabProps<T>
>;

export interface NoticeIconData {
avatar?: string | React.ReactNode;
clickClose?: boolean;
description?: React.ReactNode;
datetime?: React.ReactNode;
extra?: React.ReactNode;
key?: string | number;
read?: boolean;
style?: React.CSSProperties;
title?: React.ReactNode;
[key: string]: any;
}

export interface NoticeIconProps<T extends NoticeIconData = NoticeIconData> {
count?: number;
bell?: React.ReactNode;
className?: string;
loading?: boolean;
onClear?: (tabTitle?: string) => void;
onItemClick?: (item: T, tabProps: NoticeIconProps<T>) => void;
onViewMore?: (tabProps: NoticeIconProps<T>, e: React.MouseEvent) => void;
onTabChange?: (tabTile?: string) => void;
style?: React.CSSProperties;
onPopupVisibleChange?: (visible: boolean) => void;
popupVisible?: boolean;
locale?: {
emptyText: string;
clear: string;
viewMore: string;
[key: string]: string;
};
clearClose?: boolean;
}

export default class NoticeIcon<T extends NoticeIconData = NoticeIconData> extends Component<
NoticeIconProps<T>
> {
static Tab: NoticeIconTabComponent;
}
}