This repository was archived by the owner on Jan 16, 2022. It is now read-only.
Upgraded Typescript to 3.6.3#145
Merged
juanpicado merged 2 commits intoverdaccio:masterfrom Oct 2, 2019
tmkn:chore/tscupgrade
Merged
Upgraded Typescript to 3.6.3#145juanpicado merged 2 commits intoverdaccio:masterfrom tmkn:chore/tscupgrade
juanpicado merged 2 commits intoverdaccio:masterfrom
tmkn:chore/tscupgrade
Conversation
Codecov Report
@@ Coverage Diff @@
## master #145 +/- ##
=======================================
Coverage 84.12% 84.12%
=======================================
Files 92 92
Lines 926 926
Branches 166 151 -15
=======================================
Hits 779 779
- Misses 128 132 +4
+ Partials 19 15 -4
Continue to review full report at Codecov.
|
Member
|
Great explanation @tmkn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates TypeScript to 3.6.3.
The improved typechecking of 3.6 highlighted 2 issues.
1 was easy to fix by using built in types, the 2nd one was a little more delicate as the material ui typings are not great/wrong.
Namely the
withWidthhoc. Due to the way the typings where written they show up as optional properties on the component itself. So when you instantiate the component you can optionally pass in awidthprop. Which of course doesn't make sense since it is injected by the hoc automatically.This behaviour makes it so that inside your component
widthhas the typeBreakpoint | undefined._.As such you can't directly pass it on to
isWidthUp('sm', width)as it expectsBreakpointbut as said the hoc prop is (incorrectly) typed asBreakpoint | undefined. This needs to be fixed in material ui.So for the time being I had to overrule the compiler and disable the eslint no null assertion test for this line to fix the wrong hoc
widthprop type from material ui:sWidthUp('sm', width!).Since I saw other places where eslint rules where occasionally disabled I felt confident to also do it here rather than to do an explicit null check in the code (Since there is nothing wrong with the actual code to begin with).
I also needed to add
@typescript-eslint/parseras the parser foreslintThe default parser(espree) only supports
typescript< 3.6. .@typescript-eslint/parserin the meantime is now the preferred parser fortypescript.e: I also added a setting for vscode so that it uses the typescript version from the package.json rather than the built in from vscode.