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

133
Views
angular rxjs subscriptions

i am declaring a subscription in Angular like this:

counterSubscription: Subscription

and it is giving me this error:

Property 'counterSubscription' has no initializer and is not definitely assigned in the constructor.

So what could be the initial value of a Subscription please?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

If you are initializing your subscription in an angular lifecycle hook, like ngOnInit, you can use the Definite Assignment Assertion Operator ! to inform TypeScript that the variable will be initialized.

counterSubscription!: Subscription;
over 4 years ago · Santiago Trujillo Report

0

You can also add strictPropertyInitialization: false rule to your tsconfig.json to disable this behaviour.

over 4 years ago · Santiago Trujillo 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!