{"id":3935,"date":"2016-04-27T01:37:45","date_gmt":"2016-04-27T01:37:45","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3935"},"modified":"2016-04-27T01:37:45","modified_gmt":"2016-04-27T01:37:45","slug":"typings-browser-vs-main","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/typings-browser-vs-main\/","title":{"rendered":"Typings: browser vs main"},"content":{"rendered":"<p>If you set up typings, you will see &#8220;browser&#8221; and &#8220;main&#8221; in the folder that has the type bindings you&#8217;ve downloaded:<\/p>\n<pre lang=\"bash\">\nls -al typings\ntotal 16\ndrwxr-xr-x   6 gary  staff  204 Apr 26 21:40 .\ndrwxr-xr-x  10 gary  staff  340 Apr 26 21:42 ..\ndrwxr-xr-x   3 gary  staff  102 Apr 26 21:40 browser\n-rw-r--r--   1 gary  staff   62 Apr 26 21:40 browser.d.ts\ndrwxr-xr-x   3 gary  staff  102 Apr 26 21:40 main\n-rw-r--r--   1 gary  staff   59 Apr 26 21:40 main.d.ts\n<\/pre>\n<p>Each type definition file is just a wrapper that loads all the sub-files you&#8217;ve requested:<\/p>\n<pre lang=\"bash\">\nGarys-MBP:youtube gary$ diff typings\/browser.d.ts typings\/main.d.ts \n1c1\n< \/\/\/ <reference path=\"browser\/definitions\/react\/index.d.ts\" \/>\n---\n> \/\/\/ <reference path=\"main\/definitions\/react\/index.d.ts\" \/>\n<\/pre>\n<p>In fact, the actual type bindings you&#8217;ve downloaded are likely to be the same for each.<\/p>\n<p>The purpose of this is to allow the type bindings to differ between the browser and Node versions (e.g. if an API is not available or different for whatever reason). Most of the type these are the same, so it is not an issue.<\/p>\n<p>You likely want to pick just the appropriate to include, e.g.:<\/p>\n<pre lang=\"javascript\">\n\/\/\/ <reference path=\"typings\/main.d.ts\" \/> \n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Understanding the folder structure typings builds<\/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":[4],"tags":[302,387,388,557],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3935"}],"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=3935"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3935\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}