Define class property types in typescript?

Viewed 3784

I'm using ES6 classes in typescript with the following:

class Camera {
    constructor(ip) {
        this.ip = ip;
    }
}

I get back this error, though it still seems to compile:

Property 'ip' does not exist on type 'Camera'.

If I define the type:

this.ip: string = ip;

I get back:

';' expected.

How should I format the class to get rid of both errors?

2 Answers
Related