{"id":3925,"date":"2016-04-27T01:20:21","date_gmt":"2016-04-27T01:20:21","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3925"},"modified":"2020-04-12T00:15:55","modified_gmt":"2020-04-12T00:15:55","slug":"fixing-typescript-error-2","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-typescript-error-2\/","title":{"rendered":"Fixing Typescript\/JavaScript error: TS1128: Declaration or statement expected."},"content":{"rendered":"<pre>index.tsx(11,1): error TS1128: Declaration or statement expected.\n<\/pre>\n<p>If you write a Typescript app, you can get the following error:<\/p>\n<p>For example, the following code triggers this:<\/p>\n<pre lang=\"javascript\">namespace app {\n  interface IMessage {\n    id: string\n  }\n\n  class TestApp extends React.Component<imessage, {}=\"\"> {\n    public render() {\n      }\n    } \n  } \n}\n<\/imessage,><\/pre>\n<p>In this case this is caused by having an extra closing bracket.<\/p>\n<p>An easy way to fix this style of problem is to use a better text editor, like Visual Studio code, and install ESLint, which will warn you if you screw up in this fashion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fixing a simple typescript compilation error<\/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,387,388,557],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3925"}],"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=3925"}],"version-history":[{"count":1,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3925\/revisions"}],"predecessor-version":[{"id":6591,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3925\/revisions\/6591"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}