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

Can't inherit getter/setter and function #806

Closed
2 of 4 tasks
CodyTseng opened this issue Jul 30, 2022 · 2 comments
Closed
2 of 4 tasks

Can't inherit getter/setter and function #806

CodyTseng opened this issue Jul 30, 2022 · 2 comments

Comments

@CodyTseng
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Can't inherit getter/setter and function.

import { PickType } from "@nestjs/mapped-types";

class A {
  foo: number;

  bar: number;

  get baz() {
    return this.foo;
  }
}

class B extends PickType(A, ['foo', 'baz']) {}

const b = new B();
b.foo = 1;

console.log(b.baz); // undefined

Minimum reproduction code

https://github.com/CodyTseng/example/blob/master/mapped-types/index.js

Steps to reproduce

No response

Expected behavior

Can inherit getter/setter and function.

import { PickType } from "@nestjs/mapped-types";

class A {
  foo: number;

  bar: number;

  get baz() {
    return this.foo;
  }
}

class B extends PickType(A, ['foo', 'baz']) {}

const b = new B();
b.foo = 1;

console.log(b.baz); // 1

Package version

1.1.0

Node.js version

16.14.2

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@hug0b
Copy link

hug0b commented Dec 21, 2022

I think it would be useful to preserve at least getters because it seems that it's not currently the case.

@CodyTseng
Copy link
Author

I think it would be useful to preserve at least getters because it seems that it's not currently the case.

I searched the previous issues and found that @kamilmysliwiec explicitly said that this feature will not be added #480, so I closed this issue 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants