Skip to content

Commit

Permalink
fix: yagr & indicator types fixes (#64)
Browse files Browse the repository at this point in the history
* fix(Yagr plugin): fix types

* fix(Indicator plugin): fix types
  • Loading branch information
korvin89 authored Nov 18, 2022
1 parent ba4f2ad commit 479c552
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 176 deletions.
4 changes: 2 additions & 2 deletions src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export {YagrPlugin} from './yagr';
export type {Yagr, YagrWidgetData, YagrWidgetProps} from './yagr/types';
export type {Yagr, YagrWidgetData} from './yagr/types';
export {IndicatorPlugin} from './indicator';
export type {IndicatorWidgetData, IndicatorWidgetProps} from './indicator/types';
export type {IndicatorWidgetData} from './indicator/types';
export {HighchartsPlugin} from './highcharts';
export type {HighchartsWidgetData} from './highcharts/types';
5 changes: 3 additions & 2 deletions src/plugins/indicator/renderer/IndicatorItem.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react';
import block from 'bem-cn-lite';
import type {IndicatorWidgetProps, IndicatorWidgetDataItem} from '../types';
import type {ChartKitProps} from '../../../types';
import type {IndicatorWidgetDataItem} from '../types';

const b = block('chartkit-indicator');

export const IndicatorItem = (
props: IndicatorWidgetDataItem & {
defaultColor?: string;
formatNumber?: IndicatorWidgetProps['formatNumber'];
formatNumber?: ChartKitProps<'indicator'>['formatNumber'];
},
) => {
const {formatNumber, content, color, defaultColor, size, title, nowrap} = props;
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/indicator/renderer/IndicatorWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import {isEmpty} from 'lodash';
import {i18n} from '../../../i18n';
import {CHARTKIT_ERROR_CODE, ChartKitError} from '../../../libs';
import {CHARTKIT_SCROLLABLE_NODE_CLASSNAME} from '../../../constants';
import type {ChartKitWidgetRef} from '../../../types';
import type {IndicatorWidgetProps} from '../types';
import type {ChartKitWidgetRef, ChartKitProps} from '../../../types';
import {IndicatorItem} from './IndicatorItem';

import './IndicatorWidget.scss';

const b = block('chartkit-indicator');

const IndicatorWidget = React.forwardRef<ChartKitWidgetRef | undefined, IndicatorWidgetProps>(
const IndicatorWidget = React.forwardRef<ChartKitWidgetRef | undefined, ChartKitProps<'indicator'>>(
// _ref needs to avoid this React warning:
// "forwardRef render functions accept exactly two parameters: props and ref"
function IndicatorWidgetInner(props, _ref) {
Expand Down
8 changes: 0 additions & 8 deletions src/plugins/indicator/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type {ChartKitFormatNumber} from '../../types';

export type IndicatorWidgetDataItem = {
content: {
current: {
Expand All @@ -16,9 +14,3 @@ export type IndicatorWidgetData = {
data?: IndicatorWidgetDataItem[];
defaultColor?: string;
};

export type IndicatorWidgetProps = {
data: IndicatorWidgetData;
onLoad?: () => void;
formatNumber?: ChartKitFormatNumber;
};
Loading

0 comments on commit 479c552

Please sign in to comment.