Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
JavaScript identify whether this is a valid JS class or not?

I am trying to convert React.js project to a next.js project.

I have this udf-compatible-datafeed.js file

import * as tslib_1 from "tslib";
import { UDFCompatibleDatafeedBase } from "./udf-compatible-datafeed-base";
import { QuotesProvider } from "./quotes-provider";
import { Requester } from "./requester";
var UDFCompatibleDatafeed = /** @class */ (function (_super) {
    tslib_1.__extends(UDFCompatibleDatafeed, _super);
    function UDFCompatibleDatafeed(datafeedURL, intradayFeedUrl, realTimeFeedUrl, enableLogging) {
        var _this = this;
        var requester = new Requester();
        var quotesProvider = new QuotesProvider(datafeedURL, requester);
        _this = _super.call(this, datafeedURL, intradayFeedUrl, realTimeFeedUrl, quotesProvider, requester, enableLogging) || this;
        return _this;
    }
    return UDFCompatibleDatafeed;
})(UDFCompatibleDatafeedBase);
export default UDFCompatibleDatafeed;

Then inside my TVChartContainer.jsx file

 const UDFCompatibleDatafeed = await import("./datafeeds/udf/src/udf-compatible-datafeed.js");
        console.log("UDFCompatibleDatafeed", UDFCompatibleDatafeed);
 console.log("3...");

       

        const widgetOptions = {
            //debug: true,
            symbol: this.props.symbol,
            // BEWARE: no trailing slash is expected in feed URL
            datafeed: new UDFCompatibleDatafeed(
                this.props.datafeedUrl,
                this.props.intradayUrl,
                this.props.realTimeUrl,
                this.props.enableLogging
            ),
            interval: this.props.interval,
           
        };

This is my console logout put

enter image description here

And I am getting an error

TypeError: UDFCompatibleDatafeed is not a constructor

How do we identify whether this is a valid JS class or not?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think just removing new will do the trick. you are returning a function, not a class.

datafeed: UDFCompatibleDatafeed(...)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!