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

[Fix] Support Flow type spread #2446

Merged
merged 1 commit into from Oct 16, 2019

Conversation

@moroine
Copy link
Contributor

commented Oct 5, 2019

This PR aims to support type spread like:

// @flow
import * as React from 'react';

type DefaultProps = {|
  foo: number,
|}

type Props = {
  bar: string,
};

function MyComponent(props: Props) {}

MyComponent.defaultProps = {
  foo: 42,
};

This PR also fixes #2138

Fixes #2138.
@ljharb ljharb added the flow label Oct 8, 2019
@moroine moroine requested a review from ljharb Oct 9, 2019
@moroine

This comment has been minimized.

Copy link
Contributor Author

commented Oct 9, 2019

What's your opinion about trying to resolve types from external files, or add an option to warn when type can't be resolved

@ljharb

This comment has been minimized.

Copy link
Collaborator

commented Oct 12, 2019

@moroine i'm not a flow user, so i'm not sure. what do you think?

@ljharb
ljharb approved these changes Oct 12, 2019
@moroine

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2019

@ljharb I think it can be a good idea to warn first, as I discover that limitation only when reading the code.

@ljharb ljharb force-pushed the moroine:feature/support-type-spread branch from f72490c to 11dc56b Oct 16, 2019
@ljharb ljharb merged commit 11dc56b into yannickcr:master Oct 16, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.02%) to 97.521%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.