Tengo el siguiente código:
class Table { get pagination () { return { get item () { return { log (s : string) { console.log(s); } } } } } } class TableWithFirst extends Table { get pagination () { return { ...super.pagination, get first () { this.item.log("first"); return "first"; } } } } const t = new TableWithFirst(); t.pagination.firsty con este código, me sale el siguiente error:
[ERR]: "Executed JavaScript Failed:" [ERR]: Cannot read properties of undefined (reading 'log') ¿Cómo agrego el first getter a la pagination ? ¿Mover esa lógica a una clase es la única forma?
Si no necesita admitir navegadores más antiguos, puede cambiar el objetivo de compilación a ES2018 (o superior) para que la sintaxis extendida no se transpile.
Con respecto a TestCafe, aquí puede encontrar cómo personalizar las opciones del compilador TypeScript utilizadas por su corredor (no recogerá el archivo tsconfig estándar).