Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate/typescript: Project shifted to Typescript #251

Open
wants to merge 20 commits into
base: integrate/typescript
Choose a base branch
from

Conversation

dev-sna
Copy link
Collaborator

@dev-sna dev-sna commented Dec 19, 2018

No description provided.

import { getFullname, makeQueryStringTransformable } from '../../utils/utils';

it('Shoud check if getFullname util works', () => {
expect(getFullname({ firstName: 'Jack', lastName: 'John' })).toEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is in it good to have file that contain data-> user1: {firstName: "abc",lastName:"xyz", fullName: "abc xyz"}?

'Jack John'
);
expect(getFullname({ firstName: 'Jack' })).toEqual('Jack');
expect(getFullname({ firstName: '', lastName: '' })).toEqual('-');
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we expect fullname to be '-' if firstname and lastname is empty?

Choose a reason for hiding this comment

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

Because the util method is written this way.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you think if thats the case we need to fix util method instead of hack test?

Choose a reason for hiding this comment

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

We display a '-' when nothing is provided. If we need to change the util, an issue can be created with the requirement.

class CommentBox extends Component {
type Props = SubmitVoid;

class CommentBox extends Component<Props> {
Copy link
Contributor

Choose a reason for hiding this comment

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

if this component does not have a state we can change it to dump or stateless functional component. If it has state we need to define type for state

return (
<ul className="commentList">
{props.comments.map(comment => (
<CommentListItem comment={comment} key={comment.id} />
<CommentListItem comment={comment} />
Copy link
Contributor

Choose a reason for hiding this comment

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

does not this produce an error after removing key ?

Choose a reason for hiding this comment

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

This was duplicated. In the container and the component to be rendered. I kept it only in the component. Won't throw a warning.

Choose a reason for hiding this comment

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

Accidentally removed the key. Should have removed from the Item. Done.

comment: Comment
};

class CommentListItem extends Component<Props> {
Copy link
Contributor

Choose a reason for hiding this comment

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

make it functional component if does not have state

eventID: string
};

class CommentsBlock extends Component<Props> {
Copy link
Contributor

Choose a reason for hiding this comment

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

make it functional component if does not have state

description: string,
};

const DescriptionContainer = (props: Props) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

its not logically correct container can not be stateless functional component

Choose a reason for hiding this comment

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

If the container doesn't require any state, why shouldn't it be a functional component?

@@ -89,7 +94,7 @@ class DropSearch extends Component<Props, State> {
* - and pass either undefined or extracted object to prop (handleSearchChange method)
* @returns undefined.
*/
handleSearchChange = (e: SyntheticEvent<HTMLButtonElement>) => {
handleSearchChange = e => {
Copy link
Contributor

Choose a reason for hiding this comment

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

can not we add event type here?

Choose a reason for hiding this comment

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

We don't need to add types to everything in our app. Mostly the model should be restricted with types. Including redux logic and component state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants