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

Reflection class properties lose their optional information for mapped types #514

Closed
marcus-sa opened this issue Nov 29, 2023 · 0 comments
Closed

Comments

@marcus-sa
Copy link
Contributor

interface User {
  readonly id: integer;
  readonly name?: string;
}

const reflectionClass = ReflectionClass.from<User>();
console.log(reflectionClass.getProperty('name').isOptional()) // true

type User2 = Pick<
  User,
  'id' | 'name'
>;

const reflectionClass = ReflectionClass.from<User2>();
console.log(reflectionClass.getProperty('name').isOptional()) // false
@marcus-sa marcus-sa changed the title Properties in a reflection class lose their optional information when the type received is a referenced utility type Reflection class properties lose their optional information when the type received is a referenced utility type Nov 29, 2023
SamJakob added a commit to SamJakob/deepkit-framework that referenced this issue Nov 30, 2023
SamJakob added a commit to SamJakob/deepkit-framework that referenced this issue Dec 1, 2023
@marcus-sa marcus-sa changed the title Reflection class properties lose their optional information when the type received is a referenced utility type Reflection class properties lose their optional information for mapped types Dec 12, 2023
@marcj marcj closed this as completed in 68bdbe5 Jan 28, 2024
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

1 participant