Browse Source

Add types for warning

pull/14309/head
ztplz 6 years ago
committed by 偏右
parent
commit
ab2dd31087
  1. 4
      components/_util/warning.tsx
  2. 2
      components/drawer/index.tsx
  3. 2
      components/select/index.tsx
  4. 1
      package.json
  5. 2
      typings/custom-typings.d.ts

4
components/_util/warning.tsx

@ -1,6 +1,6 @@
import warning from 'warning';
import * as warning from 'warning';
const warned: { [msg: string]: boolean } = {};
const warned: Record<string, boolean> = {};
export default (valid: boolean, message: string): void => {
if (!valid && !warned[message]) {
warning(false, message);

2
components/drawer/index.tsx

@ -2,7 +2,7 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import RcDrawer from 'rc-drawer';
import createReactContext, { Context } from 'create-react-context';
import warning from 'warning';
import * as warning from 'warning';
import classNames from 'classnames';
import Icon from '../icon';
import { withConfigConsumer, ConfigConsumerProps } from '../config-provider';

2
components/select/index.tsx

@ -4,7 +4,7 @@ import RcSelect, { Option, OptGroup } from 'rc-select';
import classNames from 'classnames';
import { ConfigConsumer, ConfigConsumerProps, RenderEmptyHandler } from '../config-provider';
import omit from 'omit.js';
import warning from 'warning';
import * as warning from 'warning';
import Icon from '../icon';
import { tuple } from '../_util/type';

1
package.json

@ -98,6 +98,7 @@
"@types/react-dom": "^16.0.11",
"@types/react-intl": "^2.3.14",
"@types/react-slick": "^0.23.2",
"@types/warning": "^3.0.0",
"@yesmeck/offline-plugin": "^5.0.5",
"ansi-styles": "^3.2.1",
"antd-theme-generator": "^1.1.4",

2
typings/custom-typings.d.ts

@ -14,8 +14,6 @@ declare module 'rc-util*';
declare module 'shallowequal';
declare module 'warning';
declare module 'css-animation*';
declare module 'rc-select';

Loading…
Cancel
Save