Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Upgraded Typescript to 3.6.3 #145

Merged
merged 2 commits into from Oct 2, 2019
Merged

Upgraded Typescript to 3.6.3 #145

merged 2 commits into from Oct 2, 2019

Conversation

tmkn
Copy link
Contributor

@tmkn tmkn commented Oct 1, 2019

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 a width 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 type Breakpoint | undefined ._.
As such you can't directly pass it on to isWidthUp('sm', width) as it expects Breakpoint but as said the hoc prop is (incorrectly) typed as Breakpoint | 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 for eslint
The default parser(espree) only supports typescript < 3.6. . @typescript-eslint/parser in the meantime is now the preferred parser for typescript.

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.

@codecov-io
Copy link

Codecov Report

Merging #145 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           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
Impacted Files Coverage Δ
src/components/Search/Search.tsx 100% <ø> (ø) ⬆️
src/components/NotFound/NotFound.tsx 46.15% <0%> (ø) ⬆️
src/components/Header/Header.tsx 89.47% <0%> (ø) ⬆️
src/components/Install/Install.tsx 83.33% <0%> (ø) ⬆️
src/components/DetailSidebar/DetailSidebar.tsx 89.47% <0%> (ø) ⬆️
...mponents/RegistryInfoDialog/RegistryInfoDialog.tsx 66.66% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 584f4c1...91eccee. Read the comment docs.

Copy link
Member

@juanpicado juanpicado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job ! 🚀

@juanpicado
Copy link
Member

Great explanation @tmkn

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request hacktoberfest 🎃
Projects
None yet
3 participants