Skip to content

Update All The Reacts - #2124

Merged
joshaber merged 10 commits into
masterfrom
bump-all-the-reacts
Jun 28, 2017
Merged

joshaber merged 10 commits into
masterfrom
bump-all-the-reacts

Conversation

@shiftkey

@shiftkey shiftkey commented Jun 27, 2017 •

Copy link
Copy Markdown
Member

It's been a while since we bumped the react* packages, and there's been a bunch of changes to the related @types/react* packages. So let's do that.

This uncovered a bunch of changes to how the type declarations now work, and while I did love our use of void for the state type in React.Component<TProps, TState>, this confuses TypeScript as setState expects a type - even in cases when a component doesn't use it. So an empty {} isn't the exact same thing, but any accidental setState usages should fail.

The other thing that's changed is the children prop on components - React now declares this by default:

    interface Props<T> {
        children?: ReactNode;
        key?: Key;
        ref?: Ref<T>;
    }

    type ReactNode = ReactChild | ReactFragment | boolean | null | undefined;

I didn't feel great about removing the places where children was already defined, because it is no longer clear which components will render children elements. The alternative, making it explicit everywhere and aligning it with the declaration that React provides, also didn't feel great. I'll ponder on this some more before marking this as ready for review.

I'll also do a bunch of real testing to ensure nothing is now broken.

One upside: it did pick up that we had incorrectly declared an instance property for componentDidUpdate in dropdown.tsx, rather than declaring it as an instance member.

EDIT: and the signature for list.tsx's ref callback needs to take in React.Component<any, any> | null (it previously didn't).

@j-f1

j-f1 commented Jun 27, 2017

Copy link
Copy Markdown
Contributor

You could declare a global Stateless type and define it as {}.

@shiftkey

Copy link
Copy Markdown
Member Author

You could declare a global Stateless type and define it as {}.

@j-f1 while it was a methodical refactoring to get here, the net outcome was basically a find-replace. I don't think introducing a type and then including it everywhere will improve this.

Comment thread app/src/ui/lib/authentication-form.tsx Outdated

/** An array of additional buttons to render after the "Sign In" button. */
readonly additionalButtons?: ReadonlyArray<JSX.Element>
readonly additionalButtons?: ReadonlyArray<JSX.Element> | number | string | boolean| {} | null

This comment was marked as spam.

Comment thread app/src/ui/lib/button.tsx Outdated

/** The title of the button. */
readonly children?: string
readonly children?: ReadonlyArray<JSX.Element> | number | string | boolean| {} | null

This comment was marked as spam.


/** An array of additional buttons to render after the "Continue" button. */
readonly additionalButtons?: ReadonlyArray<JSX.Element>
readonly additionalButtons?: ReadonlyArray<JSX.Element> | number | string | boolean| {} | null

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/ui/lib/link-button.tsx Outdated

/** The title of the button. */
readonly children?: string
readonly children?: ReadonlyArray<JSX.Element> | number | string | boolean| {} | null

This comment was marked as spam.


/** An array of additional buttons to render after the "Sign In" button. */
readonly additionalButtons?: ReadonlyArray<JSX.Element>
readonly additionalButtons?: ReadonlyArray<JSX.Element> | number | string | boolean| {} | null

This comment was marked as spam.

}

public componentDidUpdate = () => {
public componentDidUpdate() {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

readonly saveLabel?: string

/** Additional elements that are rendered below the form. */
readonly children?: ReadonlyArray<JSX.Element>

This comment was marked as spam.

Comment thread app/src/ui/lib/errors.tsx
/**
* An Errors element with app-standard styles.
*
* Provide `children` elements to render as the content for the error element.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@joshaber joshaber left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🆒

Just a couple nits. Also needs a merge in from master.

Comment thread app/src/ui/dialog/footer.tsx Outdated
interface IDialogFooterProps {
readonly children?: ReadonlyArray<JSX.Element>
}
interface IDialogFooterProps { }

This comment was marked as spam.

Comment thread app/src/ui/lib/authentication-form.tsx Outdated

/** An array of additional buttons to render after the "Sign In" button. */
readonly additionalButtons?: ReadonlyArray<JSX.Element>
readonly additionalButtons?: ReadonlyArray<JSX.Element> | number | string | boolean | {} | null

This comment was marked as spam.

@joshaber joshaber self-assigned this Jun 28, 2017
@shiftkey

Copy link
Copy Markdown
Member Author

🍎

@joshaber
joshaber merged commit 239da8b into master Jun 28, 2017
@joshaber
joshaber deleted the bump-all-the-reacts branch June 28, 2017 23:45
@shiftkey shiftkey mentioned this pull request Aug 9, 2017
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