Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not exist properties when inheritance #37452

Closed
PixelT opened this issue Nov 1, 2017 · 1 comment
Closed

Not exist properties when inheritance #37452

PixelT opened this issue Nov 1, 2017 · 1 comment
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@PixelT
Copy link

PixelT commented Nov 1, 2017

I have written a small code with inheritance:

The result is:

'Property 'name' does not exist on type' (x2)
'Property 'age' does not exist on type'

The suggestion also doesn't show this inheritance properties:

For example, on PHPStorm:

Example code to reproduce issue:

// @ts-check
function Person(name, surname, age) {
    this.name = {
        name,
        surname
    };
    this.age = age;
}

Person.prototype.info = function () {
    console.log('Person data: ' + this.name.name + ' ' + this.name.surname + ', ' + this.age);
}

function Teacher(name, surname, age, subject) {
    Person.call(this, name, surname, age);
    this.subject = subject;
}
Teacher.prototype = Object.create(Person.prototype);
Teacher.prototype.constructor = Teacher;

Teacher.prototype.info = function() {
    console.log('Teacher data: ' + this.name.name + ' ' + this.name.surname + ', ' + this.age);
}

var x = new Person('Johny', 'Walker', 30);
var z = new Teacher('Johny2', 'Walker2', 55);
@mjbvz
Copy link
Collaborator

mjbvz commented Nov 8, 2017

This issue was moved to microsoft/TypeScript#19842

@mjbvz mjbvz closed this as completed Nov 8, 2017
@mjbvz mjbvz added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Nov 8, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants