{"id":1799,"date":"2021-04-10T12:07:43","date_gmt":"2021-04-10T12:07:43","guid":{"rendered":"https:\/\/gauravw.com\/blog\/?p=1799"},"modified":"2021-04-10T12:07:46","modified_gmt":"2021-04-10T12:07:46","slug":"typescript","status":"publish","type":"post","link":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/","title":{"rendered":"TypeScript"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Issues with JavaScript<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Var a = \u201cgaurav\u201d; var a; var a = 1;<br>We aren\u2019t definitning what kind of value a is so it becomes difficult for further manipulations. <strong>Type safety<\/strong> is an issue.<\/li><li>function&nbsp; sum( var , var b ) { return a + b}<br>sum(2 , 3); sum ( 2, 3, 4); both return same thing no error is reported.<br>sum(2) also executes only the output is different. This is at runtime. We need to know these things at compile time.<\/li><li>var person = {\u201cname\u201d : \u201c\u201dgaurav\u201d };&nbsp;<br>person.age = 24;<br>The next statement dynamically adds this to my object.<br>Expectation is it shouldn\u2019t be redefined by this statement \u2013 this can be tricky when working in large projects.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Advent of TypeScript&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To address the problem, a language was thought of which could be converted to JS. This process of converting from one language to the other language is called <strong>transpilation.&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So essentially all TS code is converted into JS code in dev time and at runtime the JS code is executed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">TypeScript is run using NodeJs which can run the JS code. Node is a JS runtime built on top of Chrome\u2019s V8 JS engine. [using the exe downloaded].<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The typescript compiler\/transpiler can be installed using&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>npm install typescript<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">which will transpile it into JS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, node is used twice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To compile use the command : <strong>tsc [filename].ts<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Defining types&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">TS uses postfix type annotation for defining the type.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">var a : number;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Besides the regular types, there is something called a tuple.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An object that has multiple types in fixed order.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Var myTuple&nbsp; : [number, boolean] ;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">myTuple = [2, true];<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;<strong>Type Erasure<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">During transpilation, the type information which is there in TS is taken off when it is changed to JS. So ,this info will help you only during compile time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For functions, the same rules are applicable,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, functions can also set a return type and method parameter types which get taken off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Implicit Typing<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even if you don\u2019t tell the type of a variable, during assignment it will implicitly understand it during assignment<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Var a = 10; (Is assumed a no)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Var a;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">a = function () { return \u201chii\u201d; } \/\/doesn\u2019t use implicit here because it has to be on the same line for that.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Any<\/strong> -&gt; Var a : any; (can take any type of value)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Union<\/strong> -&gt; Var a : number | Boolean ; ( can take only number or boolean)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Error behaviour<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In case, there is an issue relating to the incorrect type of value assigned to the variable, it will still compile in JS. This is because the type information doesn\u2019t impact generation of JS. The type info is only for developers help.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Function optional &amp; default param<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">function ( var a: number , var b ?) \u2013 optional param always has to be last<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">function (var a, var b =2) \u2013 default value for b \u2013 so it acts as optional as well<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Class<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are classes in TypeScript. After compilation, they get transformed to <strong>IIFE<\/strong> using the module pattern.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can have only <strong>one constructor<\/strong> because even method overloading is not allowed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Object orientedness&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is a super keyword, this keyword, inheritance of classes and interfaces, member visibility etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also a concept of <strong>duck typing<\/strong> \u2013 so if a structure looks like a duck, quacks like a duck, it is a duck.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the below example someObj has the same structure as the Person interface so it is assumed as a type of it. Therefore, the compiler doesn\u2019t give any error.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Short notation for constructor<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Constructor (private name:string, private age:number) {}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Is equivalent to<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">private name:string;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">private age:number;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Constructor (private name:string, private age:number) {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">this. name=name;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">this. age = age;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To define constants use <strong>readonly (<\/strong>equivalent to const in java<strong>). <\/strong>This property can be assigned value only during declaration or in constructor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are <strong>enums <\/strong>too which are converted to functions with an array of values in js.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Export<\/strong> \u2013 to use the class in other modules<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you import this class it will run this .ts file<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Issues with JavaScript Var a = \u201cgaurav\u201d; var a; var a = 1;We aren\u2019t definitning what kind of value a is so it becomes difficult for further manipulations. Type safety is an issue. function&nbsp; sum( var , var b ) { return a + b}sum(2 , 3); sum ( 2, 3, 4); both return same [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[97],"tags":[],"class_list":["post-1799","post","type-post","status-publish","format-standard","hentry","category-tech-learnings"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>TypeScript &#187; Gaurav Wadhwani<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"TypeScript &#187; Gaurav Wadhwani\" \/>\n<meta property=\"og:description\" content=\"Issues with JavaScript Var a = \u201cgaurav\u201d; var a; var a = 1;We aren\u2019t definitning what kind of value a is so it becomes difficult for further manipulations. Type safety is an issue. function&nbsp; sum( var , var b ) { return a + b}sum(2 , 3); sum ( 2, 3, 4); both return same [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/\" \/>\n<meta property=\"og:site_name\" content=\"Gaurav Wadhwani\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-10T12:07:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-10T12:07:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM\" \/>\n<meta name=\"author\" content=\"Gaurav Wadhwani\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gaurav Wadhwani\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/\"},\"author\":{\"name\":\"Gaurav Wadhwani\",\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/#\\\/schema\\\/person\\\/9a05a9c3487f35f6b4577c6956cf252e\"},\"headline\":\"TypeScript\",\"datePublished\":\"2021-04-10T12:07:43+00:00\",\"dateModified\":\"2021-04-10T12:07:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/\"},\"wordCount\":664,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/#\\\/schema\\\/person\\\/9a05a9c3487f35f6b4577c6956cf252e\"},\"image\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lh4.googleusercontent.com\\\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM\",\"articleSection\":[\"Tech Learnings\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/\",\"url\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/\",\"name\":\"TypeScript &#187; Gaurav Wadhwani\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lh4.googleusercontent.com\\\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM\",\"datePublished\":\"2021-04-10T12:07:43+00:00\",\"dateModified\":\"2021-04-10T12:07:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/lh4.googleusercontent.com\\\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM\",\"contentUrl\":\"https:\\\/\\\/lh4.googleusercontent.com\\\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/2021\\\/04\\\/typescript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"TypeScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/\",\"name\":\"Gaurav Wadhwani\",\"description\":\"Where I write \\\/ scribble\",\"publisher\":{\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/#\\\/schema\\\/person\\\/9a05a9c3487f35f6b4577c6956cf252e\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/gauravw.com\\\/blog\\\/#\\\/schema\\\/person\\\/9a05a9c3487f35f6b4577c6956cf252e\",\"name\":\"Gaurav Wadhwani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g\",\"caption\":\"Gaurav Wadhwani\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g\"},\"sameAs\":[\"http:\\\/\\\/gauravw.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"TypeScript &#187; Gaurav Wadhwani","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:\/\/gauravw.com\/blog\/2021\/04\/typescript\/","og_locale":"en_US","og_type":"article","og_title":"TypeScript &#187; Gaurav Wadhwani","og_description":"Issues with JavaScript Var a = \u201cgaurav\u201d; var a; var a = 1;We aren\u2019t definitning what kind of value a is so it becomes difficult for further manipulations. Type safety is an issue. function&nbsp; sum( var , var b ) { return a + b}sum(2 , 3); sum ( 2, 3, 4); both return same [&hellip;]","og_url":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/","og_site_name":"Gaurav Wadhwani","article_published_time":"2021-04-10T12:07:43+00:00","article_modified_time":"2021-04-10T12:07:46+00:00","og_image":[{"url":"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM","type":"","width":"","height":""}],"author":"Gaurav Wadhwani","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Gaurav Wadhwani","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#article","isPartOf":{"@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/"},"author":{"name":"Gaurav Wadhwani","@id":"https:\/\/gauravw.com\/blog\/#\/schema\/person\/9a05a9c3487f35f6b4577c6956cf252e"},"headline":"TypeScript","datePublished":"2021-04-10T12:07:43+00:00","dateModified":"2021-04-10T12:07:46+00:00","mainEntityOfPage":{"@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/"},"wordCount":664,"commentCount":0,"publisher":{"@id":"https:\/\/gauravw.com\/blog\/#\/schema\/person\/9a05a9c3487f35f6b4577c6956cf252e"},"image":{"@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#primaryimage"},"thumbnailUrl":"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM","articleSection":["Tech Learnings"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/","url":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/","name":"TypeScript &#187; Gaurav Wadhwani","isPartOf":{"@id":"https:\/\/gauravw.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#primaryimage"},"image":{"@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#primaryimage"},"thumbnailUrl":"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM","datePublished":"2021-04-10T12:07:43+00:00","dateModified":"2021-04-10T12:07:46+00:00","breadcrumb":{"@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#primaryimage","url":"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM","contentUrl":"https:\/\/lh4.googleusercontent.com\/Zoj3BsbzUxIVAIYMbMGU1_7UENjZkVdPx-2djbuW2JhY0lKyhyjHxz_RznJiYmE0nkw-Vfw92g-7dLo9HUdtVCeXAAUGYS0x0t_oJ0VM4_XiQg1YzblY2d8_gVJzLtOMu_Kq_zM"},{"@type":"BreadcrumbList","@id":"https:\/\/gauravw.com\/blog\/2021\/04\/typescript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gauravw.com\/blog\/"},{"@type":"ListItem","position":2,"name":"TypeScript"}]},{"@type":"WebSite","@id":"https:\/\/gauravw.com\/blog\/#website","url":"https:\/\/gauravw.com\/blog\/","name":"Gaurav Wadhwani","description":"Where I write \/ scribble","publisher":{"@id":"https:\/\/gauravw.com\/blog\/#\/schema\/person\/9a05a9c3487f35f6b4577c6956cf252e"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gauravw.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/gauravw.com\/blog\/#\/schema\/person\/9a05a9c3487f35f6b4577c6956cf252e","name":"Gaurav Wadhwani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g","caption":"Gaurav Wadhwani"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/788ed9666a6c4e011516ae9c744df4be274dcf933161c99a4ec7e06311d2d416?s=96&d=mm&r=g"},"sameAs":["http:\/\/gauravw.com"]}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/posts\/1799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/comments?post=1799"}],"version-history":[{"count":1,"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/posts\/1799\/revisions"}],"predecessor-version":[{"id":1801,"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/posts\/1799\/revisions\/1801"}],"wp:attachment":[{"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/media?parent=1799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/categories?post=1799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gauravw.com\/blog\/wp-json\/wp\/v2\/tags?post=1799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}