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 #19842

Closed
mjbvz opened this issue Nov 8, 2017 · 1 comment
Closed

Not exist properties when inheritance #19842

mjbvz opened this issue Nov 8, 2017 · 1 comment
Labels
Duplicate An existing issue was already created VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 8, 2017

From @PixelT on November 1, 2017 23:36

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);

Copied from original issue: microsoft/vscode#37452

@mjbvz mjbvz self-assigned this Nov 8, 2017
@mjbvz mjbvz added VS Code Tracked There is a VS Code equivalent to this issue and removed typescript labels Nov 8, 2017
@mjbvz mjbvz removed their assignment Nov 8, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 8, 2017

Possible dup of #13206

@mhegazy mhegazy added the Duplicate An existing issue was already created label Nov 8, 2017
@mhegazy mhegazy closed this as completed Nov 8, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants