Ошибка Cannot access 'CandleChartClass' before initialization
предоставлю код по порядку:
ClassGraphReducer:
import { Charts } from '../models/Charts'; import { createSlice } from '@reduxjs/toolkit'; const initialState: Charts[] = [ new Charts(), new Charts(), new Charts(), new Charts(), new Charts(), new Charts(), new Charts(), new Charts(), new Charts(), new Charts(), ]; const ClassesGraphicsSlice = createSlice({ name: 'classes_graphics', initialState, reducers: {}, }); export default ClassesGraphicsSlice.reducer;
Кусок файла Charts, куда показывает ошибку (указывает на стркоку this.mainCanvas = new CandleChartClass(this)) :
import { IFlag } from '../../../modules/MainCanvas/helpers/DrwaingElementsHelper/GetHoverObjectOnGraph'; import { ClassDrawingElements } from '../../../entities/elements/ClassElements'; import { ClassIndicator } from '../../../models/Indicators/ClassIndicator'; import { UnionClassesIndicators } from '../../../models/Indicators/DataOfConstructorsIndicatros'; import { Notifications } from '../../../entities/elements/Notification/Notiication'; import { GraphicType } from './GraphicType'; import { getPriceChartWidth } from '../helpers/getPriceChartWidth'; import { DateChart } from '../../date-chart/models/DateChart'; import { PriceChart } from '../../price-chart/models/ClassPriceCanvas'; import { FibonacciRetracment } from '../../../entities/elements/Fibonacci/FibonacciRetracment'; import { CandleChartClass } from './../../candle-chart/models/CandleChartClass'; export class Charts { drawingElements: ClassDrawingElements; indicators: ClassIndicator[]; indicatorsOnGraphic: UnionClassesIndicators[]; mainCanvas: CandleChartClass; dateCanvas: DateChart; priceCanvas: PriceChart; notifications: Notifications; constructor() { this.indicators = []; this.indicatorsOnGraphic = []; this.dateCanvas = new DateChart(this); this.priceCanvas = new PriceChart(this); this.notifications = new Notifications(this); this.drawingElements = new ClassDrawingElements(this); this.mainCanvas = new CandleChartClass(this); }
index файл, это вообще реэкспорт компонентов react, не знаю почему он указан в ошибке:
export * from './ui/candle-chart/CandleChart'; export * from './ui/crosshair-candle-chart/CrosshairCandleChart';
Подскажите, пожалуйста, в чем ошибка ?