You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
We have a project where some classes need an instance of a Xrm.XrmStatic object for its constructor.
When trying to use a instance of XrmMock.XrmStaticMock (supplied by XrmMock.Initialize) we get the following error:
error TS2345: Argument of type 'XrmStaticMock' is not assignable to parameter of type 'XrmStatic'. The types of 'Navigation.openFile' are incompatible between these types. Type '(file: FileDetails, openFileOptions: OpenFileOptions) => void' is not assignable to type '(file: FileDetails, openFileOptions?: OpenFileOptions) => void'. Types of parameters 'openFileOptions' and 'openFileOptions' are incompatible. Type 'Xrm.Navigation.OpenFileOptions' is not assignable to type 'XrmEnum.OpenFileOptions'.
When fixing this by rewriting the modules implimentation of XrmMock.XrmStaticMock.NavigationStaticMock one gets a similar error about the sidePanes Object missing from the AppMock class compared to the App calss.
For us the fix was to simply use the static Xrm object instead of an explicitly declared variable, but I thought I would leave this here in case others would run into this issue. Also becaus it explicitly states XrmStatickMock impliments XrmStatic.
the constructor of the tested class in question looked like this:
Issue:
We have a project where some classes need an instance of a
Xrm.XrmStatic
object for its constructor.When trying to use a instance of
XrmMock.XrmStaticMock
(supplied byXrmMock.Initialize
) we get the following error:error TS2345: Argument of type 'XrmStaticMock' is not assignable to parameter of type 'XrmStatic'. The types of 'Navigation.openFile' are incompatible between these types. Type '(file: FileDetails, openFileOptions: OpenFileOptions) => void' is not assignable to type '(file: FileDetails, openFileOptions?: OpenFileOptions) => void'. Types of parameters 'openFileOptions' and 'openFileOptions' are incompatible. Type 'Xrm.Navigation.OpenFileOptions' is not assignable to type 'XrmEnum.OpenFileOptions'.
When fixing this by rewriting the modules implimentation of
XrmMock.XrmStaticMock.NavigationStaticMock
one gets a similar error about thesidePanes
Object missing from theAppMock
class compared to theApp
calss.For us the fix was to simply use the static Xrm object instead of an explicitly declared variable, but I thought I would leave this here in case others would run into this issue. Also becaus it explicitly states
XrmStatickMock
implimentsXrmStatic
.the constructor of the tested class in question looked like this:
the code that threw errors was similar to this:
and this now works for us:
The text was updated successfully, but these errors were encountered: