Closed RonPenton closed 7 years ago
Sorry to hear it's been tricky to upgrade to React 16.
As part of the ASP.NET Core 2.1 release we'll be updating all the templates and hence will figure out any details like this as part of that update process. Until then I'm afraid if you want to change your set of third-party dependencies then it will be up to you to resolve any compatibility issues. So right now I don't know what breaking changes might have been introduced in the type definitions you're trying to upgrade to, but it's something we will address when we update for 2.1. Hope that's OK!
I installed a new project using:
Since I want to use React 16, I went ahead and updated the package.json to the following versions:
These are the newest versions of all of these libraries.
Unfortunately the TypeScript fails to compile anymore. This line in Counter.tsx fails:
The compiler complains that the resulting datatype lacks the 'count' property and thus cannot be cast to Counter. I tried debugging the types of the various steps in that call, but I was unsuccessful at understanding the complexity of the types involved.
Before giving up, I added an
as any
cast beforeas typeof Counter
, to fool the compiler into letting it happen. It worked, it compiled, and the example runs.My question is: