[Master] Fix13526 allow JSX attributes to be union type#14216
Merged
Conversation
sandersn
approved these changes
Feb 22, 2017
| } | ||
| } | ||
|
|
||
| let a = <AddressComp postalCode='T1B 0L3' street="vancouver" country="CA" /> |
Member
There was a problem hiding this comment.
this postal code is in Medicine Hat not Vancouver
|
Any idea what I'm doing wrong? |
Contributor
|
What version of TS are you using ? |
|
2.3.0-dev.20170222 |
Contributor
Author
|
@lndigo thanks for trying it out! The change just got in today. The fix will be in tomorrow Typescript@next :) |
|
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} />
}
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #13526