Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se

Vários erros na criação dos td's e tr's no NegociaçõesView

class NegociacoesView{

private _elemento: Element;

constructor(seletor: string) {

    this._elemento = document.querySelector(seletor);

}

uptade(model: Negociacoes): void{

    this._elemento.innerHTML = this.template(model);


}

template(model: Negociacoes): string {

    return `
    <table class="table table-hover table-bordered">
    <thead>
        <tr>
            <th>DATA</th>
            <th>QUANTIDADE</th>
            <th>VALOR</th>
            <th>VOLUME</th>
        </tr>
    </thead>

    <tbody>

    </tbody>
    ${model.listagem().map(negociacao =>

        {return '
        <tr>
            <td>${negociacao.data.getDate()}/${negociacao.data.getMouth() +1}/${negociacao.data.getFullYear()}</td>
            <td>${negociacao.quant}</td>
            <td>${negociacao.valor}</td>
            <td>${negociacao.valorTotal}</td>
        </tr>
        '
    }).join('')}

    <tfoot>
    </tfoot>
</table>           
    `
}

}

erros: error TS1002: Unterminated string literal. app/ts/views/NegociacoesView.ts(37,14): error TS2304: Cannot find name 'tr'. app/ts/views/NegociacoesView.ts(38,18): error TS2304: Cannot find name 'td'. app/ts/views/NegociacoesView.ts(38,22): error TS1005: ';' expected. app/ts/views/NegociacoesView.ts(38,23): error TS7027: Unreachable code detected. app/ts/views/NegociacoesView.ts(38,84): error TS1005: ';' expected. app/ts/views/NegociacoesView.ts(38,115): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'JQueryStatic'. app/ts/views/NegociacoesView.ts(38,116): error TS1110: Type expected. app/ts/views/NegociacoesView.ts(38,117): error TS1161: Unterminated regular expression literal. app/ts/views/NegociacoesView.ts(39,18): error TS2304: Cannot find name 'td'. app/ts/views/NegociacoesView.ts(39,22): error TS1005: ';' expected. app/ts/views/NegociacoesView.ts(39,40): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'JQueryStatic'. app/ts/views/NegociacoesView.ts(39,41): error TS1110: Type expected. app/ts/views/NegociacoesView.ts(39,42): error TS1161: Unterminated regular expression literal. app/ts/views/NegociacoesView.ts(40,18): error TS2304: Cannot find name 'td'. app/ts/views/NegociacoesView.ts(40,22): error TS1005: ';' expected. app/ts/views/NegociacoesView.ts(40,40): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'JQueryStatic'. app/ts/views/NegociacoesView.ts(40,41): error TS1110: Type expected. app/ts/views/NegociacoesView.ts(40,42): error TS1161: Unterminated regular expression literal. app/ts/views/NegociacoesView.ts(41,18): error TS2304: Cannot find name 'td'. app/ts/views/NegociacoesView.ts(41,22): error TS1005: ';' expected. app/ts/views/NegociacoesView.ts(41,46): error TS1110: Type expected. app/ts/views/NegociacoesView.ts(41,47): error TS1161: Unterminated regular expression literal. app/ts/views/NegociacoesView.ts(42,15): error TS1161: Unterminated regular expression literal. app/ts/views/NegociacoesView.ts(43,14): error TS1002: Unterminated string literal. nodemodules/@types/jquery/JQuery.d.ts(4137,26): error TS2304: Cannot find name 'SVGElementTagNameMap'. nodemodules/@types/jquery/JQuery.d.ts(4137,89): error TS2304: Cannot find name 'SVGElementTagNameMap'. nodemodules/@types/jquery/JQuery.d.ts(8705,29): error TS2304: Cannot find name 'SVGElementTagNameMap'. nodemodules/@types/jquery/JQuery.d.ts(8705,84): error TS2304: Cannot find name 'SVGElementTagNameMap'.

1 resposta

Oi, Emerson, tudo bem?

No template string de retorno do seu map, você está usando crase ou aspas simples? O correto é crase, pois é ela que identifica um template string, as aspas simples são lidas como se você estivesse passando uma string. Substitui e me fala se deu certo!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software