-
Notifications
You must be signed in to change notification settings - Fork 53
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
Modified getControl, getAttribute and get to return the basic type instead of undefined #294
base: gh_master
Are you sure you want to change the base?
Conversation
Hi Mathias I'm not familiar with strictest, so it is not obvious to me, what issue you are experiencing when using strictest with XDT. Is your issue with the XDT source code? Or with the generated typings? We currently generate the typing |
Agreed with @skovlund, we should not return a valid type for invalid method calls. Would it be a better solution to let them return the |
@mkholt According to the MS documentation, getControl returns an Object Collection, Object or null. Wouldn't it make sense to stick to the underlying SDK definition and at least return an XrmBaseControl, XrmBaseControl[] or null? |
@sideshowbob, it seems both My point in using |
@mkholt I see your point for resulting compile-time errors. But there are circumstances where you may explicitly want to get a control based on, say a variable that is populate at run-time. From my point of view, this prevents some generic development approaches and does not correspond with the SDK, the Types are made for. |
@sideshowbob, part of the intention behind the framework is also to provide compile-time safety. I believe you would be able to do a cast if you wish to do something unsafe, which you would then show your intention of doing by doing the cast, e.g. |
My team start adopting strictest for TypeScript. https://www.npmjs.com/package/@tsconfig/strictest
It's doesn't like undefined alot as return type.
The getAttribute and getControl have been changed to return the basic type matching the method.