Depois de incluir o formatador de data, esse bug começou a acontecer. O retorno do console do navegador é:
Uncaught InternalError: too much recursion
get data http://localhost:3000/js/models/negociacao.js:18
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
get data http://localhost:3000/js/models/negociacao.js:19
// essa linha se repete muitas vezes mais
O conteúdo de /js/models/negociacao.js
é
export class Negociacao {
/*
private _data: Date
private _quantidade: number
private _valor: number
constructor(data: Date, quantidade: number, valor: number) {
this._data = data
this._quantidade = quantidade
this._valor = valor
}
*/
constructor(
private _data: Date,
private _quantidade: number,
private _valor: number) {
}
// linha 19
get data(): Date {
const data = new Date(this.data.getTime())
return data
}
get quantidade():number {
return this._quantidade
}
get valor():number {
return this._valor
}
get volume():number {
return this._quantidade * this._valor
}
}