Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Angular 14 cannot find Namespace 'NodeJS'

can’t initialize the interval variable

onStartGame(){
    this.interval = setInterval (() => {
        this.intervalFired.emit(this.lastno + 1);
        this.lastno++;
    }, 1000);
}

Angular program to see at console.log with start and stop clicks in Angular 14

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

the problem is that you probably have

interval?: NodeJS.Timeout

that is only while running in an NodeJs environment, when in browser that is not correct value anymore, so instead to maintain the type you can do this.

interval?: ReturnType<typeof setInterval>

this will work regardless if browser or nodejs

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading