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

Better Readonly Type Management #6

Open
helmturner opened this issue Mar 23, 2023 · 0 comments
Open

Better Readonly Type Management #6

helmturner opened this issue Mar 23, 2023 · 0 comments

Comments

@helmturner
Copy link
Member

The meta and bsonSchema instance properties are immutable, as are schemas in general. The types. however, do not correctly reflect the mutability of everything. The desired behavior is as follows:

  • meta and bsonSchema properties are readonly, as are all nested properties
  • attempting to set meta or bsonSchema, or assign to any nested property, should be prevented by TypeScript
  • The parse result types inferred by B.Type should NOT be readonly
  • An object schema built from another object schema's meta.shape property should behave and be typed just like a default instance of the original schema
  • There should be as few readonly or Readonly<> repetitions in the tooltip as is necessary to achieve the above goals

It may be necessary to create Meta and BsonSchema classes to achieve this in a way that is both type-safe and ergonomic.

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