{"id":3988,"date":"2016-04-29T14:15:47","date_gmt":"2016-04-29T14:15:47","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3988"},"modified":"2016-04-29T14:15:47","modified_gmt":"2016-04-29T14:15:47","slug":"fixing-typescript-error-cannot-find-module-categories","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-typescript-error-cannot-find-module-categories\/","title":{"rendered":"Fixing typescript error: Cannot find module &#8216;.\/categories&#8217;."},"content":{"rendered":"<p>If you try to import a js file you&#8217;ve written, you may get an error like this:<\/p>\n<pre>\nCannot find module '.\/categories'.\n<\/pre>\n<p>Doing something like this:<\/p>\n<pre lang=\"javascript\">\nimport * as categories from \".\/categories\";\n<\/pre>\n<p>In this case I have a file called &#8220;categories.js&#8221;.<\/p>\n<p>The easiest way to fix this is to rename the file to &#8220;categories.ts&#8221;. Otherwise, Typescript things you might need a type mapping (the other way to fix this is to add a .d.ts file for your other library, so it has a type mapping)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fixing a typescript error importing local files<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[302,557],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3988"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3988"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3988\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}