{"id":1427,"date":"2018-03-02T13:37:33","date_gmt":"2018-03-02T12:37:33","guid":{"rendered":"https:\/\/blog.thecodecampus.de\/?p=1427"},"modified":"2023-12-20T19:53:23","modified_gmt":"2023-12-20T18:53:23","slug":"context-type-void-not-assignable-methods-type-observable","status":"publish","type":"post","link":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/","title":{"rendered":"The &#8216;this&#8217; context of type &#8216;void&#8217; is not assignable to method&#8217;s &#8216;this&#8217; of type &#8216;Observable<{}>&#8216;."},"content":{"rendered":"<p>If you are experiencing this error &#8211; usually something with your RxJS imports is wrong.\u00a0So you should go through them manually or simply delete all imports from RxJS in the corresponding file and let the IDE generate them again.<\/p>\n<p>Something broken could look like this:<\/p>\n<pre class=\"lang:default decode:true \">import {map} from 'rxjs\/add\/operator\/map';\r\n<\/pre>\n<p>Better working might be:<\/p>\n<pre class=\"lang:default decode:true\">import {map} from 'rxjs\/operators';\r\n<\/pre>\n<p><strong>What is happening?<\/strong><\/p>\n<p>RxJS switched from monkey patching to the import of pipeable operators (also known as lettable operators).<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4>toPromise<\/h4>\n<p>Another reason might be a falsely used toPromise(). It is no longer available as pipeable operator but is now attached to the observable directly.<\/p>\n<pre class=\"\">import {toPromise} from \"rxjs\/operator\/toPromise\";\r\n\r\nthis.sth$.pipe(map(it =&gt; it.value()), toPromise());\r\n<\/pre>\n<p>Should be:<\/p>\n<pre class=\"\">this.sth$.pipe(map(it =&gt; it.value()).toPromise());\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are experiencing this error &#8211; usually something with your RxJS imports is wrong.\u00a0So you should go through them manually or simply delete all imports from RxJS in the corresponding file and let the IDE generate them again. Something broken could look like this: import {map} from &#8216;rxjs\/add\/operator\/map&#8217;; Better working might be: import {map} [&#8230;]<br \/><a class=\"meta-big\" href=\"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/\"> READ MORE<\/a><\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,2,60],"tags":[],"class_list":["post-1427","post","type-post","status-publish","format-standard","hentry","category-angular","category-javascript","category-typescript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The &#039;this&#039; context of type &#039;void&#039; is not assignable to method&#039;s &#039;this&#039; of type &#039;Observable&#039;. - Web Development Blog<\/title>\n<meta name=\"description\" content=\"Conquer Angular challenges. Decode &#039;Context type void not assignable&#039;. Elevate clarity using Observable methods. Optimize your journey!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The &#039;this&#039; context of type &#039;void&#039; is not assignable to method&#039;s &#039;this&#039; of type &#039;Observable&#039;. - Web Development Blog\" \/>\n<meta property=\"og:description\" content=\"Conquer Angular challenges. Decode &#039;Context type void not assignable&#039;. Elevate clarity using Observable methods. Optimize your journey!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development tips and tricks - theCodeCampus Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-02T12:37:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-20T18:53:23+00:00\" \/>\n<meta name=\"author\" content=\"theCodeCampus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"theCodeCampus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/\"},\"author\":{\"name\":\"theCodeCampus\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/person\\\/276bbda2f8da73154f22fb652201cfbc\"},\"headline\":\"The &#8216;this&#8217; context of type &#8216;void&#8217; is not assignable to method&#8217;s &#8216;this&#8217; of type &#8216;Observable&#8216;.\",\"datePublished\":\"2018-03-02T12:37:33+00:00\",\"dateModified\":\"2023-12-20T18:53:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/\"},\"wordCount\":115,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\"},\"articleSection\":[\"Angular\",\"JavaScript\",\"TypeScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/\",\"name\":\"The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable'. - Web Development Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#website\"},\"datePublished\":\"2018-03-02T12:37:33+00:00\",\"dateModified\":\"2023-12-20T18:53:23+00:00\",\"description\":\"Conquer Angular challenges. Decode 'Context type void not assignable'. Elevate clarity using Observable methods. Optimize your journey!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/context-type-void-not-assignable-methods-type-observable\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The &#8216;this&#8217; context of type &#8216;void&#8217; is not assignable to method&#8217;s &#8216;this&#8217; of type &#8216;Observable&#8216;.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\",\"name\":\"Web Development tips and tricks - theCodeCampus Blog\",\"description\":\"Tips, tricks, and experiences about developing web and mobile applications with Angular, TypeScript, and Testing.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\",\"name\":\"theCodeCampus\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch.jpg\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch.jpg\",\"width\":156,\"height\":156,\"caption\":\"theCodeCampus\"},\"image\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/person\\\/276bbda2f8da73154f22fb652201cfbc\",\"name\":\"theCodeCampus\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch-96x96.jpg\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch-96x96.jpg\",\"caption\":\"theCodeCampus\"},\"description\":\"Our knowledge is not simply gained through reading - it is trained, tested and constantly being expanded. Because first and foremost, we are all developers at W11K. The know-how that we acquire here as developers, consultants and information architects flows immediately into our training courses and articles for theCodeCampus.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/showcase\\\/thecodecampus\\\/\"],\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable'. - Web Development Blog","description":"Conquer Angular challenges. Decode 'Context type void not assignable'. Elevate clarity using Observable methods. Optimize your journey!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/","og_locale":"en_US","og_type":"article","og_title":"The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable'. - Web Development Blog","og_description":"Conquer Angular challenges. Decode 'Context type void not assignable'. Elevate clarity using Observable methods. Optimize your journey!","og_url":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/","og_site_name":"Web Development tips and tricks - theCodeCampus Blog","article_published_time":"2018-03-02T12:37:33+00:00","article_modified_time":"2023-12-20T18:53:23+00:00","author":"theCodeCampus","twitter_card":"summary_large_image","twitter_misc":{"Written by":"theCodeCampus","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/#article","isPartOf":{"@id":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/"},"author":{"name":"theCodeCampus","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/person\/276bbda2f8da73154f22fb652201cfbc"},"headline":"The &#8216;this&#8217; context of type &#8216;void&#8217; is not assignable to method&#8217;s &#8216;this&#8217; of type &#8216;Observable&#8216;.","datePublished":"2018-03-02T12:37:33+00:00","dateModified":"2023-12-20T18:53:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/"},"wordCount":115,"commentCount":0,"publisher":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#organization"},"articleSection":["Angular","JavaScript","TypeScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/","url":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/","name":"The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable'. - Web Development Blog","isPartOf":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#website"},"datePublished":"2018-03-02T12:37:33+00:00","dateModified":"2023-12-20T18:53:23+00:00","description":"Conquer Angular challenges. Decode 'Context type void not assignable'. Elevate clarity using Observable methods. Optimize your journey!","breadcrumb":{"@id":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.thecodecampus.de\/blog\/context-type-void-not-assignable-methods-type-observable\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.thecodecampus.de\/blog\/"},{"@type":"ListItem","position":2,"name":"The &#8216;this&#8217; context of type &#8216;void&#8217; is not assignable to method&#8217;s &#8216;this&#8217; of type &#8216;Observable&#8216;."}]},{"@type":"WebSite","@id":"https:\/\/www.thecodecampus.de\/blog\/#website","url":"https:\/\/www.thecodecampus.de\/blog\/","name":"Web Development tips and tricks - theCodeCampus Blog","description":"Tips, tricks, and experiences about developing web and mobile applications with Angular, TypeScript, and Testing.","publisher":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.thecodecampus.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.thecodecampus.de\/blog\/#organization","name":"theCodeCampus","url":"https:\/\/www.thecodecampus.de\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch.jpg","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch.jpg","width":156,"height":156,"caption":"theCodeCampus"},"image":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/person\/276bbda2f8da73154f22fb652201cfbc","name":"theCodeCampus","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch-96x96.jpg","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch-96x96.jpg","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch-96x96.jpg","caption":"theCodeCampus"},"description":"Our knowledge is not simply gained through reading - it is trained, tested and constantly being expanded. Because first and foremost, we are all developers at W11K. The know-how that we acquire here as developers, consultants and information architects flows immediately into our training courses and articles for theCodeCampus.","sameAs":["https:\/\/www.linkedin.com\/showcase\/thecodecampus\/"],"url":"https:\/\/www.thecodecampus.de\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/1427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/comments?post=1427"}],"version-history":[{"count":5,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/1427\/revisions"}],"predecessor-version":[{"id":2626,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/1427\/revisions\/2626"}],"wp:attachment":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/media?parent=1427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/categories?post=1427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/tags?post=1427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}