-
Notifications
You must be signed in to change notification settings - Fork 164
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
Typescript issue after upgrading to v4 (.1) #271
Comments
You shouldn't have to add the ! operator. Take a look at a typescript example here: https://github.com/dsuryd/dotNetify/tree/master/Demo/React/HelloWorld.WebPack |
If you enable
I suspect increasing numbers of typescript devs will want strictNullChecks. |
Thanks. I'll put in the backlog for supporting the |
I was struggling to understand (from my massively distant understanding of your code) why dotnetify.connect couldn't/didn't work. Surely the codebase knows which flavour it is running? |
The intent for |
Should be resolved with v4.1.1. |
Excellent, thank you. I can confirm that 4.1.1 allows me to write the code I expected |
I have a react component class using dotnetify. To avoid getting too far behind, I've upgraded dotnetify to 4.1, and typescript has started complaining. My component has a vm member, which I have changed to IDotnetifyVM from the old dotnetifyVM; this is fine. However when I try to initialise it with
this.vm = dotnetify.react.connect('vmname',this)
then I get a warning that react may be undefined and need to use
this.vm = dotnetify.react!.connect('vmname',this)
instead. This seems to be a messy workaround (although clearly not the end of the world). Is there a preferred way of doing it? I had a guess at
this.vm = dotnetify.connect('vmname',this)
but that fails to hook up the events.What's the "preferred" way of doing this now in a typescript world?
The text was updated successfully, but these errors were encountered: