-
Notifications
You must be signed in to change notification settings - Fork 33
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
RFC: refactor to one class with multiple implementable interfaces #144
Comments
Posted to stackoverflow with a more general example: https://stackoverflow.com/questions/60365193/typescript-how-to-correctly-type-a-member-of-abstract-generic-class-based-on-p |
refactor/composition-of-interfaces-over-inheritance created, WIP and broken |
Just to link related issues, this would solve #133 |
This is a major architecture change which is brought without any breaking change 😄! We've split up the code base in 2: Old one and new one. The old one hasn't moved at all but is now deprecated (not removed yet!). You can keep using the old one for a bit and have a smooth/incremental update to use the new API. Few changes that you have to note with the new API: - Only works with Angular 9 or more - The app needs to have Ivy activated (this is because we use `ɵmarkDirty` internally. If it ever gets removed we'll probably have to ask to provide the `ChangeDetectorRef` but we were able to around this for now!) - We got rid of inheritance 🙌 - Form errors on a FormArray are now an object instead of an array. Previously the array contained null values on all the fields without any error. It's now an object containing only the ones with errors and you can access them using the index Please start upgrading to the new API as soon as possible as we stop supporting the old API as of today and will remove it in a near release. This closes #171 for the major architectural changes and also the following issues as a result: - closes #82 - closes #86 - closes #93 - closes #133 - closes #143 - closes #144 - closes #149 - closes #160 - closes #168
🎉 This issue has been resolved in version 5.2.0-feat-rewrite.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Agreed |
This is a major architecture change which is brought without any breaking change 😄! We've split up the code base in 2: Old one and new one. The old one hasn't moved at all but is now deprecated (not removed yet!). You can keep using the old one for a bit and have a smooth/incremental update to use the new API. Few changes that you have to note with the new API: - Only works with Angular 9 or more - The app needs to have Ivy activated (this is because we use `ɵmarkDirty` internally. If it ever gets removed we'll probably have to ask to provide the `ChangeDetectorRef` but we were able to around this for now!) - We got rid of inheritance 🙌 - Form errors on a FormArray are now an object instead of an array. Previously the array contained null values on all the fields without any error. It's now an object containing only the ones with errors and you can access them using the index Please start upgrading to the new API as soon as possible as we stop supporting the old API as of today and will remove it in a near release. This closes #171 for the major architectural changes and also the following issues as a result: - closes #82 - closes #86 - closes #93 - closes #133 - closes #143 - closes #144 - closes #149 - closes #160 - closes #168
This is a major architecture change which is brought without any breaking change 😄! We've split up the code base in 2: Old one and new one. The old one hasn't moved at all but is now deprecated (not removed yet!). You can keep using the old one for a bit and have a smooth/incremental update to use the new API. Few changes that you have to note with the new API: - Only works with Angular 9 or more - The app needs to have Ivy activated (this is because we use `ɵmarkDirty` internally. If it ever gets removed we'll probably have to ask to provide the `ChangeDetectorRef` but we were able to around this for now!) - We got rid of inheritance 🙌 - Form errors on a FormArray are now an object instead of an array. Previously the array contained null values on all the fields without any error. It's now an object containing only the ones with errors and you can access them using the index Please start upgrading to the new API as soon as possible as we stop supporting the old API as of today and will remove it in a near release. This closes #171 for the major architectural changes and also the following issues as a result: - closes #82 - closes #86 - closes #93 - closes #133 - closes #143 - closes #144 - closes #149 - closes #160 - closes #168
🎉 This issue has been resolved in version 5.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Currently we have a bit of a proliferation of classes that can be inherited, and potentially more to be introduced with @maxime1992’s idea of enforcing better typesafety on non-remap components.
I think now with the more expressive typescript conditionals we can be much more clever with interfaces and go for a composition model where the consumer class might need the base class only with a single interface in and out, or need a combination of a bunch of different features that ngxsubform would need to access, which could be declared and made typesafe through multiple implementable interfaces.
This would be a major breaking change, and we should consider an angular style migration to auto update consumer classes if possible.
I’ve made some progress on the types here:
https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=55&pc=13#code/JYOwLgpgTgZghgYwgAgEoQLZwA4GED2G2+IE4APAeFPgDYCS408SANMgGL5QaOSyIIAPmQBvALAAoZMizYAFADc4tAFzIqYGgyYCkASnVcefZoIDcUgL5SpYAJ7YUAUQAeWxGGO9dLCOQAVdlwRAF5kAOQIdzIAEwBnNEwcAiISMjBKdlAYaE4RAH5OZHVcS0kpBFo4eMSAOQBzVwBlAFcAI29U4lIKTW1TPWExKRkGiC9uDAA1FVaIeUNkNw8ESZNfQXIwAAtgeOCSLTpBvxEJaRlkKAnWqBBkVpBYiBhQCFjkGq+Qe3KZGwVS77dByRbqXb7ZBQ0EpQg9DLkOC-djI+znUZXG5gO4PeC0eIob5o-7IQGYsD4fonTZIeSYmTKNTLdxQTzeU5bSEHDRHAa04SYpbUnT8PwjS4yYAwZDybkAOhByQU+n0EquWNu92QCrBTP0pIBtkl1y1DyZpMB5MkoDFgmQAFl8C9RWYkOrkDB8Ph1PEtKAGuVrba3SgOQKPe04FBff6QIHrMaqjVEs1gERaBAuvD0uAojFnvUmm1OlNurnMk6XZykOdrcnakk5Nm0r0wPnIIXkI0Wh0WwiKFWIK6hkJMensJmMBlErC8Dm2+QhyO-Oxw3bax69Sp1MuaxAluvQx6ZNjcWJkFGY8gAEQ7G9ky2JoEIEh+2Q4JyfcKkADuyDTDMszLBcMkWeVKRFfd5FET1vXUG84AfKwDUqN92zkL8ACZkB-CB-znfsK3AyC+RpDcFlgq8EKQslUJfdCOzZNZcOQP8AInTMiLbcDxnWGY5gWejXxAd9olWMAcLwgjlW4sD9HlPjvFmWh5kWcopHE5iwHlL18HKLTPCw+Ur3KIA
The text was updated successfully, but these errors were encountered: