Skip to content

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

Merged
yuit merged 2 commits into
masterfrom
master-fix13526
Feb 22, 2017
Merged

[Master] Fix13526 allow JSX attributes to be union type#14216
yuit merged 2 commits into
masterfrom
master-fix13526

Conversation

@yuit
Copy link
Copy Markdown
Contributor

@yuit yuit commented Feb 21, 2017

Fix #13526

}
}

let a = <AddressComp postalCode='T1B 0L3' street="vancouver" country="CA" />
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

lndigo commented Feb 22, 2017

Any idea what I'm doing wrong?
error

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Feb 22, 2017

What version of TS are you using ?

@lndigo
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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