Consider this Deck.NET example:
https://deck.net/c573f345024a1b1cf1331cb5b1608d4d
When calling a static, generic method located in another class, we have the option to use using static to avoid having to name the class, and we have the option to omit the generic type argument if the compiler can infer it.
When doing either of these things (or both of them), Bridge passes the type using Bridge.global.<TYPE> rather than just <TYPE>. I honestly have no idea what this means, since I am not aware of the internals of Bridge itself, but this causes a problem when the type does not exist on Bridge.global.
In my case, when using Retyped.electron, I pass the Retyped.electron.Electron.BrowserWindow type to a function like this, and when using Retyped.electron, there is not a member Bridge.global.Electron as is expected by the generated code, which causes the error:
To see this in action, you can:
For now, I will workaround this issue by explicitly naming the generic argument and class name when calling these functions with Retyped types, but it would be nice to know if this is a bug or something that I am doing wrong in my own code when it comes to using Retyped.
https://deck.net/c573f345024a1b1cf1331cb5b1608d4d
When calling a static, generic method located in another class, we have the option to use using static to avoid having to name the class, and we have the option to omit the generic type argument if the compiler can infer it.
When doing either of these things (or both of them), Bridge passes the type using Bridge.global.<TYPE> rather than just <TYPE>. I honestly have no idea what this means, since I am not aware of the internals of Bridge itself, but this causes a problem when the type does not exist on Bridge.global.
In my case, when using Retyped.electron, I pass the Retyped.electron.Electron.BrowserWindow type to a function like this, and when using Retyped.electron, there is not a member Bridge.global.Electron as is expected by the generated code, which causes the error:
Cannot read property 'BrowserWindow' of undefined
To see this in action, you can:
- Download and extract the official Bridge Electron Sample: https://github.com/bridgedotnet/Widg...ive/master.zip
- Run yarn install and then yarn start inside of the dist folder to make sure the app is running correctly
- Then, close the app and open the dist/App.js file
- Navigate to the CreateSplashScreen function and a line of code console.log(Object.keys(Bridge.global)); right before return splash;
- Run the app again using yarn start
- In the console, you will see that Bridge.global does not contain an Electron key
For now, I will workaround this issue by explicitly naming the generic argument and class name when calling these functions with Retyped types, but it would be nice to know if this is a bug or something that I am doing wrong in my own code when it comes to using Retyped.
Comment