This repository has been archived by the owner on Jan 16, 2022. It is now read-only.
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
withWidth
hoc. 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 awidth
prop. Which of course doesn't make sense since it is injected by the hoc automatically.This behaviour makes it so that inside your component
width
has the typeBreakpoint | undefined
._.As such you can't directly pass it on to
isWidthUp('sm', width)
as it expectsBreakpoint
but 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
width
prop 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/parser
as the parser foreslint
The default parser(espree) only supports
typescript
< 3.6. .@typescript-eslint/parser
in 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.