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

138
Views
How to extend a parent's property in child

I have the following code:

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.first

and with this code, I get the error below:

[ERR]: "Executed JavaScript Failed:" 
[ERR]: Cannot read properties of undefined (reading 'log') 

How do I add first getter to pagination? Is moving that logic into a class the only way?

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

0

If you don't need to support older browsers you can change compilation target to ES2018 (or higher) so spread syntax won't be transpiled.

Playground


Regarding TestCafe, here you can find how to customize typescript compiler options used by its runner (it won't pick up standard tsconfig file).

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!