Skip to content

[Master] Fix13526 allow JSX attributes to be union type #14216

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

Merged
merged 2 commits into from
Feb 22, 2017
Merged

Conversation

yuit
Copy link
Contributor

@yuit yuit commented Feb 21, 2017

Fix #13526

}
}

let a = <AddressComp postalCode='T1B 0L3' street="vancouver" country="CA" />
Copy link
Member

Choose a reason for hiding this comment

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

this postal code is in Medicine Hat not Vancouver

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤣

@yuit yuit merged commit 31c4ad1 into master Feb 22, 2017
@yuit yuit deleted the master-fix13526 branch February 22, 2017 19:01
@lndigo
Copy link

lndigo commented Feb 22, 2017

Any idea what I'm doing wrong?
error

@mhegazy
Copy link
Contributor

mhegazy commented Feb 22, 2017

What version of TS are you using ?

@lndigo
Copy link

lndigo commented Feb 22, 2017

2.3.0-dev.20170222
I left it in the screenshot to verify that I have it loaded for the current workspace.

@yuit
Copy link
Contributor Author

yuit commented Feb 22, 2017

@lndigo thanks for trying it out! The change just got in today. The fix will be in tomorrow Typescript@next :)

@lndigo
Copy link

lndigo commented Feb 23, 2017

I don't believe it is working with higher order components. I'm getting error TS2322, type xxx is not assignable to type yyy.

Version: 2.3.0-dev.20170223

interface Address {
  street: string;
  country: string;
}

interface CanadianAddress extends Address {
    postalCode: string;
}

interface AmericanAddress extends Address {
    zipCode: string;
}

type Properties = CanadianAddress | AmericanAddress;

interface AddressHocProps {
    properties:Properties;
}

export class AddressComp extends React.Component<Properties, void> {
  public render() {
    return null;
  }
}

export class AddressHoc extends React.Component<AddressHocProps,void>{
    render(){
        //error ts2322
        return <AddressComp {...this.props.properties} />
    }
}

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants