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

147
Views
TypeScript: Constructor Property is declared but never used

currently studying and new to TypeScript.

I am trying to create a class and using a constructor to initiate private variables inside this class, however, I get hit with a [property name] is declared but never used.

export class CloClient extends Client {
    private identity: string[];
    private commands: { [name: string]: typeof CommandClass };
    private behaviors: { [name: string]: typeof Behavior };

    constructor(identity: string[], options: ClientOptions) {
        super(options);
        
        this.identity = identity;

        this.commands = {};
        this.behaviors = {};
    }
}

Using TypeScript 4.4.3, any suggestions?

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

0

That warning will be displayed for all properties which are declared but are never accessed.

Typescript is trying to inform you that in its current state, that property does not need to exist as it is never used during the execution of the script.

Once you access / read from the property than this warning will disappear. i.e some thing like:

if(this.identity){
... other code
}
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!