{"action":"created","issue":{"url":"https://api.github.com/repos/borisyankov/DefinitelyTyped/issues/4472","labels_url":"https://api.github.com/repos/borisyankov/DefinitelyTyped/issues/4472/labels{/name}","comments_url":"https://api.github.com/repos/borisyankov/DefinitelyTyped/issues/4472/comments","events_url":"https://api.github.com/repos/borisyankov/DefinitelyTyped/issues/4472/events","html_url":"https://github.com/borisyankov/DefinitelyTyped/issues/4472","id":81650804,"number":4472,"title":"React 0.13.1 CreateElement - Error TS2345","user":{"login":"dho825","id":1889625,"avatar_url":"https://avatars.githubusercontent.com/u/1889625?v=3","gravatar_id":"","url":"https://api.github.com/users/dho825","html_url":"https://github.com/dho825","followers_url":"https://api.github.com/users/dho825/followers","following_url":"https://api.github.com/users/dho825/following{/other_user}","gists_url":"https://api.github.com/users/dho825/gists{/gist_id}","starred_url":"https://api.github.com/users/dho825/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dho825/subscriptions","organizations_url":"https://api.github.com/users/dho825/orgs","repos_url":"https://api.github.com/users/dho825/repos","events_url":"https://api.github.com/users/dho825/events{/privacy}","received_events_url":"https://api.github.com/users/dho825/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-05-27T22:23:11Z","updated_at":"2015-05-30T14:40:55Z","closed_at":null,"body":"There are a few examples where extending React.Component<P,S>{...} whereby *if* the props specified by the parent do not exactly match the corresponding propTypes interface of the component, the resulting call to React.createElement(<component>, {}) throws this error: ```error TS2345: Argument of type 'typeof [some component name]' is not assignable to parameter of type 'string'.``` (DOMElement example, but similar errors occur with ReactElement, etc.)\r\n\r\nI'm going to reference https://github.com/bparadie/fluxts-todomvc as it is basically a port of the Todo tutorial by Facebook.\r\n\r\nIn **TodoTextInput.react.jsx** you see that the main component extends ReactComponent (a wrapper extension over React.Component). If I understand correctly:\r\n```\r\nclass TodoTextInput extends ReactComponent<any,TodoTextInputState> {\r\n\r\n  static propTypes: React.ValidationMap<TodoState> =  {\r\n    className: ReactPropTypes.string,\r\n    id: ReactPropTypes.string,\r\n    placeholder: ReactPropTypes.string,\r\n    onSave: ReactPropTypes.func.isRequired,\r\n    value: ReactPropTypes.string\r\n  };\r\n```\r\nshould be:\r\n```\r\nclass TodoTextInput extends ReactComponent<TodoTextInputProps,TodoTextInputState> {\r\n\r\n  static propTypes: React.ValidationMap<TodoTextInputProps> =  {\r\n    className: ReactPropTypes.string,\r\n    id: ReactPropTypes.string,\r\n    placeholder: ReactPropTypes.string,\r\n    onSave: ReactPropTypes.func.isRequired,\r\n    value: ReactPropTypes.string\r\n  };\r\n```\r\nBut if you try to compile this, you will get the error stated above. This is (from my testing) due to the fact that the implementations of this in **Header.react.tsx** and **TodoItem.react.tsx** do not pass in ALL the props when rendering the component. \r\n\r\nI believe this rests in the implementation of ```React.createElement```. While simply replacing the actual interface with \"any\" allows the build without throwing the exception, it doesn't seem like the \"TS way\".\r\n\r\nIs there a reason why TS throws this error when ALL the props are not specified? Even if they are optional, the compiler complains. It makes it useless to create a defaultProps property...\r\n\r\n**Edit:** adding references to commiters: @vsiao , @ggarek , @jbrantly so (I think) they get a little notification...this repo is pretty broad, so hoping this helps narrow the focus to the key contributors to this section"},"comment":{"url":"https://api.github.com/repos/borisyankov/DefinitelyTyped/issues/comments/107048282","html_url":"https://github.com/borisyankov/DefinitelyTyped/issues/4472#issuecomment-107048282","issue_url":"https://api.github.com/repos/borisyankov/DefinitelyTyped/issues/4472","id":107048282,"user":{"login":"jbrantly","id":196944,"avatar_url":"https://avatars.githubusercontent.com/u/196944?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrantly","html_url":"https://github.com/jbrantly","followers_url":"https://api.github.com/users/jbrantly/followers","following_url":"https://api.github.com/users/jbrantly/following{/other_user}","gists_url":"https://api.github.com/users/jbrantly/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrantly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrantly/subscriptions","organizations_url":"https://api.github.com/users/jbrantly/orgs","repos_url":"https://api.github.com/users/jbrantly/repos","events_url":"https://api.github.com/users/jbrantly/events{/privacy}","received_events_url":"https://api.github.com/users/jbrantly/received_events","type":"User","site_admin":false},"created_at":"2015-05-30T14:40:55Z","updated_at":"2015-05-30T14:40:55Z","body":"OK! After much head banging, I believe I figured out the issue. \"Simply\" upgrade to TypeScript 1.5 :) I think the type argument matching was failing due to this: Microsoft/TypeScript#1446. I upgraded the project to use TS 1.5 and the issue went away.\r\n\r\nJust some notes on upgrading to TS 1.5: See ivogabe/gulp-typescript#91 for changing gulp-typescript and you will need to delete some stuff out of node.d.ts like `WeakMap`, `Set`, etc that I'm guessing TS 1.5 removed from the ES5 target."}}