{"id":2936,"date":"2022-10-13T17:23:38","date_gmt":"2022-10-13T15:23:38","guid":{"rendered":"https:\/\/ekiwi.de\/?p=2936"},"modified":"2022-10-13T17:24:03","modified_gmt":"2022-10-13T15:24:03","slug":"react-fehler-type-is-not-assignable-property-does-not-exist-on-type-intrinsicattributes","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/2936\/react-fehler-type-is-not-assignable-property-does-not-exist-on-type-intrinsicattributes\/","title":{"rendered":"React-Fehler: Type is not assignable, property does not exist on type &#8218;IntrinsicAttributes &#038; &#8230;&#8216;"},"content":{"rendered":"<p>React-Fehlermeldung, Type ist not assignable bei \u00dcbergabe von &#8222;Props&#8220;.<\/p>\n<p><!--more--><\/p>\n<p>Heute hatte ich folgende sch\u00f6ne Fehlermeldung beim \u00dcbergeben von Properties in eine Komponente.<\/p>\n<pre>\r\nTS2322: Type '{ status: IStatus; }' is not assignable to type 'IntrinsicAttributes & GlobalConsts'.   Property 'status' does not exist on type 'IntrinsicAttributes & GlobalConsts'.\r\n<\/pre>\n<p>Die Fehlermeldung \u00e4u\u00dferte sich so beim Zuweisen:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/10\/react_error_1.png\" alt=\"\" width=\"735\" height=\"112\" class=\"alignnone size-full wp-image-2937\" srcset=\"\/wp-content\/uploads\/2022\/10\/react_error_1.png 735w, \/wp-content\/uploads\/2022\/10\/react_error_1-300x46.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<p>Meine &#8222;Funktion&#8220; bzw. Komponente sah so aus. Dies funktioniert so nicht.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/10\/react_error_2.png\" alt=\"\" width=\"637\" height=\"66\" class=\"alignnone size-full wp-image-2938\" srcset=\"\/wp-content\/uploads\/2022\/10\/react_error_2.png 637w, \/wp-content\/uploads\/2022\/10\/react_error_2-300x31.png 300w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/p>\n<p>Die &#8222;props&#8220; d\u00fcrfen nicht vom Typ sein, welche \u00fcber \u00fcbergeben. Stattdessen m\u00fcssen wir die &#8222;props&#8220; und die Subtypen so festlegen.<\/p>\n<pre>\r\nfunction HomePage(props: {status: IStatus })\r\n<\/pre>\n<p>Dann klappt es auch schon. <\/p>","protected":false},"excerpt":{"rendered":"<p>React-Fehlermeldung, Type ist not assignable bei \u00dcbergabe von &#8222;Props&#8220;.<\/p>\n","protected":false},"author":1,"featured_media":2260,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[15,13],"tags":[44,561,786],"class_list":["post-2936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-programmierung","tag-javascript","tag-react","tag-typescrript"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=2936"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2936\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/2260"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=2936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=2936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=2936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}