Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda