Skip to content

In JS, C.prototype = Object.create(B.prototype) should behave like extends #22639

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

Closed
sandersn opened this issue Mar 16, 2018 · 2 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@sandersn
Copy link
Member

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.js

// from enhanced-resolve
function T() {
    this.plugins = {}
}
T.prototype.plugin = function (name, f) {
    this.plugins[name] = f
}
function R(fs) {
    T.call(this)
    this.fs = fs
}
R.prototype = Object.create(T.prototype) // should create an extends: R extends T
R.prototype.resolve = function resolve(name) {
    this.plugin(name, p => p)
}

Expected behavior:
R behaves like T is its base class: this.plugin inside resolve should be legal.

Actual behavior:
Property 'plugin' does not exist on type '{ fs: any, resolve: (name: any) => void }'

@DanielRosenwasser DanielRosenwasser added the checkJs Relates to checking JavaScript using TypeScript label Mar 16, 2018
@mhegazy mhegazy added the Suggestion An idea for TypeScript label Mar 28, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Mar 28, 2018

Duplicate of #18609

@mhegazy mhegazy marked this as a duplicate of #18609 Mar 28, 2018
@mhegazy mhegazy added Duplicate An existing issue was already created and removed Suggestion An idea for TypeScript checkJs Relates to checking JavaScript using TypeScript labels Mar 28, 2018
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jul 25, 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
Projects
None yet
Development

No branches or pull requests

4 participants