-
Notifications
You must be signed in to change notification settings - Fork 645
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
Type create/validate to accept an instance type #2199
Type create/validate to accept an instance type #2199
Conversation
Hold off on a final review. I realized our tsconfig isn't properly typechecking tests, and this introduces a typing bug: it allows passing in a value for a view in model types. Technically this works (it just gets ignored) but I'm thinking ideally we make it fail typechecking so users avoid making that error. This is actually tough to do, but I think we can do this by marking the getters as readonly and excluding those from the instance type in I'm going to play with that idea, and if it works out, great! If it doesn't, I think I may remove the one test that's failing: Do let me know if you think the tests I've added are comprehensive enough though! Want to make sure we have confidence in this change. |
6176e94
to
e1b5068
Compare
Will rebase this after #2200 merged, which should fix the typechecking / build stuff |
e1b5068
to
f893791
Compare
@coolsoftwaretyler this is good for review now! <3 I was thinking we could also get this one in for #2201 |
Perfect! Great idea. Will take a look sometime this week and get this into the next preview release. |
Alright, looks excellent and we will get this into the v7 preview. I think we'll consider this a breaking change, even though it should mostly be backwards compatible. I think type changes are just best treated as breaks overall, in case people are relying on the old type behavior. |
What does this PR do and why?
We've had issues with typings when instantiating references
#1568 for example, and maybe even #1764.
This PR resolves that by typing
create
to accept an instance type. I've added a "kitchen sink" test for create to test both snapshots and instances.Steps to validate locally
The test added in this PR will type issues (like in above the screenshot) if you revert 6176e94.