-
Notifications
You must be signed in to change notification settings - Fork 8
Week 7 Demo #15
Week 7 Demo #15
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice 👍
I've left just a single comment.
When it comes to typing Redux, I always feel like balancing on a line what should be typed and what may not. But I think you did the right amount. You may also explore if some helper types like ThunkAction
or Reducer
would simplify the code a bit more, but it's not a big deal anyway.
src/components/Layout/index.tsx
Outdated
@@ -1,11 +1,16 @@ | |||
import React, { Fragment } from 'react' | |||
import React, { Fragment, SFC } from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the arrival of the hooks SFC
became obsolete, because functional components are not necessarily stateless anymore. Please use the new FunctionalComponent
or FC
type. 👍
You can read more here: DefinitelyTyped/DefinitelyTyped#30364
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I knew about this stuff but completely forgot which one is deprecated 😄
import * as routes from '../../routes' | ||
|
||
import { Wrapper, Header, HeaderSection, HeaderLink } from './styled' | ||
|
||
const Layout = ({ isAuthenticated, children, dataTestId }) => ( | ||
type Props = ReturnType<typeof mapStateToProps> & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
I ran into several issues though running yarn lint:js
Unable to resolve path to module '../../components/Layout' import/no-unresolved
This might be fixed by adding eslint-import-resolver-typescript, or maybe there is a better way, idk- There is an error with
import/named
rule, when exporting types (for example ProductType). Could be fixed with installingeslint-plugin-import
(version 2.17 and higher). But to be honest this probably should be fixed oncode-quality-tools
instead. But not sure when this is going to happen.
package.json
Outdated
"eslint --fix", | ||
"prettier --write", | ||
"stylelint", | ||
"tsc --skipLibCheck", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe yarn type-check
instead? So there both scripts are in sync?
No description provided.