{"id":3912,"date":"2016-04-30T01:27:36","date_gmt":"2016-04-30T01:27:36","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3912"},"modified":"2016-04-30T01:27:36","modified_gmt":"2016-04-30T01:27:36","slug":"typescript-typings-example","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/","title":{"rendered":"TypeScript: typings example"},"content":{"rendered":"<p>Typings is a command line utility that helps you find type bindings for various libraries. Basically, it works a lot like NPM, but it only manages the mappings from library -> type. If you&#8217;ve used C\/C++, this is like a Maven\/NPM for .H (header) files. <\/p>\n<p>Let&#8217;s take an example &#8211; first, we&#8217;ll install the utility:<\/p>\n<pre lang=\"bash\">\nnpm install -g typings\n<\/pre>\n<p>Then we can search for stuff:<\/p>\n<pre lang=\"bash\">\ntypings search react\n<\/pre>\n<p>Which apparently does a &#8220;contains&#8221; search:<\/p>\n<pre>\nNAME                              SOURCE HOMEPAGE                                           DESCRIPTION UPDATED                 \ngriddle-react                     npm    https:\/\/www.npmjs.com\/package\/griddle-react                    2016-04-13T18:36:51.000Z\nmobservable-react                 dt     https:\/\/github.com\/mweststrate\/mobservable-react               2016-03-16T15:55:26.000Z\nreact                             dt     http:\/\/facebook.github.io\/react\/                               2016-04-23T06:59:14.000Z\nreact-addons-create-fragment      dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-css-transition-group dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-linked-state-mixin   dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-perf                 dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-pure-render-mixin    dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-shallow-compare      dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-test-utils           dt     http:\/\/facebook.github.io\/react\/                               2016-04-17T14:49:49.000Z\nreact-addons-transition-group     dt     http:\/\/facebook.github.io\/react\/                               2016-04-17T13:41:18.000Z\nreact-addons-update               dt     http:\/\/facebook.github.io\/react\/                               2016-03-16T15:55:26.000Z\nreact-addons-update               npm    https:\/\/www.npmjs.com\/package\/react-addons-update              2016-03-24T04:43:46.000Z\nreact-bootstrap                   dt     https:\/\/github.com\/react-bootstrap\/react-bootstrap             2016-04-23T13:55:14.000Z\nreact-bootstrap-table             dt     https:\/\/github.com\/AllenFang\/react-bootstrap-table             2016-02-04T15:58:49.000Z\nreact-cropper                     dt     https:\/\/github.com\/roadmanfong\/react-cropper                   2016-04-03T14:21:19.000Z\nreact-datagrid                    dt     https:\/\/github.com\/zippyui\/react-datagrid.git                  2016-03-16T15:55:26.000Z\nreact-day-picker                  dt     https:\/\/github.com\/gpbl\/react-day-picker                       2016-03-16T15:55:26.000Z\nreact-dnd                         dt     https:\/\/github.com\/gaearon\/react-dnd                           2016-03-16T15:55:26.000Z\nreact-dom                         dt     http:\/\/facebook.github.io\/react\/                               2016-04-12T15:40:40.000Z\n<\/pre>\n<p>You can do an exact search by name, if you know what you want:<\/p>\n<pre lang=\"bash\">\ntypings search --name react\n<\/pre>\n<p>You can then install this by running this command (note &#8220;dt&#8221; is the source, it&#8217;s optional if the source is npm, and for bash you need the apostrophes)<\/p>\n<pre lang=\"bash\">\ntypings install 'dt!react' --ambient --save\n<\/pre>\n<p>Once this works, it makes a file called &#8220;typings.json&#8221;:<\/p>\n<pre lang=\"javascript\">\n{\n  \"dependencies\": {\n    \"react\": \"registry:dt\/react#0.14.0+20160423065914\"\n  }\n}\n<\/pre>\n<p>If you get a project from another developer, you may need to run this:<\/p>\n<pre lang=\"bash\">\ntypings install\n<\/pre>\n<p>This is also a good way to fix your local libraries if you end up with duplicates or things you don&#8217;t want (first, delete the &#8220;typings folder).<\/p>\n<p>To import Typings files, you can add a reference comment at the top of your ts\/tsx file:<\/p>\n<pre lang=\"javascript\">\n\/\/\/ <reference path=\"..\/typings\/main.d.ts\"\/>\n<\/pre>\n<p>Or include it as a line in tsconfig.json:<\/p>\n<pre lang=\"javascript\">\n{\n    \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"target\": \"es5\",\n    \"jsx\": \"react\",\n    \"sourceMap\": true,\n    \"emitDecoratorMetadata\": true,\n    \"experimentalDecorators\": true,\n    \"outDir\": \"dist\"\n    },\n    \"exclude\": [\n      \"node_modules\",\n      \"dist\",\n      \"node_modules\",\n      \"typings\"\n    ],\n    \"files\": [\n      \".\/app\/index.tsx\",\n      \".\/typings\/main.d.ts\"\n    ]\n}\n<\/pre>\n<p>The &#8220;ambient&#8221; flag above is used to tell Typescript that the library you&#8217;re importing is some external one (&#8220;ambient&#8221; meaning part of the external environment).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>All the things you need to get Typings up an running for the first time<\/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,"footnotes":""},"categories":[12],"tags":[302,388,557,558],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"All the things you need to get Typings up an running for the first time\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"gary\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Gary Sieling - Software Engineer\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"TypeScript: typings example - Gary Sieling\" \/>\n\t\t<meta property=\"og:description\" content=\"All the things you need to get Typings up an running for the first time\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2016-04-30T01:27:36+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2016-04-30T01:27:36+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"TypeScript: typings example - Gary Sieling\" \/>\n\t\t<meta name=\"twitter:description\" content=\"All the things you need to get Typings up an running for the first time\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#blogposting\",\"name\":\"TypeScript: typings example - Gary Sieling\",\"headline\":\"TypeScript: typings example\",\"author\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/author\\\/gary\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/#organization\"},\"datePublished\":\"2016-04-30T01:27:36+00:00\",\"dateModified\":\"2016-04-30T01:27:36+00:00\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#webpage\"},\"articleSection\":\"How-To, javascript, node.js, typescript, typings\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.garysieling.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/category\\\/how-to\\\/#listItem\",\"name\":\"How-To\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/category\\\/how-to\\\/#listItem\",\"position\":2,\"name\":\"How-To\",\"item\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/category\\\/how-to\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#listItem\",\"name\":\"TypeScript: typings example\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#listItem\",\"position\":3,\"name\":\"TypeScript: typings example\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/category\\\/how-to\\\/#listItem\",\"name\":\"How-To\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/#organization\",\"name\":\"Gary Sieling\",\"description\":\"Software Engineer\",\"url\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/author\\\/gary\\\/#author\",\"url\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/author\\\/gary\\\/\",\"name\":\"gary\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0be925276d848ffe98a6a9dc8cf33e67?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"gary\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#webpage\",\"url\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/\",\"name\":\"TypeScript: typings example - Gary Sieling\",\"description\":\"All the things you need to get Typings up an running for the first time\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/typescript-typings-example\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/author\\\/gary\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/author\\\/gary\\\/#author\"},\"datePublished\":\"2016-04-30T01:27:36+00:00\",\"dateModified\":\"2016-04-30T01:27:36+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/\",\"name\":\"Gary Sieling\",\"description\":\"Software Engineer\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.garysieling.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"TypeScript: typings example - Gary Sieling","description":"All the things you need to get Typings up an running for the first time","canonical_url":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#blogposting","name":"TypeScript: typings example - Gary Sieling","headline":"TypeScript: typings example","author":{"@id":"https:\/\/www.garysieling.com\/blog\/author\/gary\/#author"},"publisher":{"@id":"https:\/\/www.garysieling.com\/blog\/#organization"},"datePublished":"2016-04-30T01:27:36+00:00","dateModified":"2016-04-30T01:27:36+00:00","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#webpage"},"isPartOf":{"@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#webpage"},"articleSection":"How-To, javascript, node.js, typescript, typings"},{"@type":"BreadcrumbList","@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.garysieling.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog\/category\/how-to\/#listItem","name":"How-To"}},{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog\/category\/how-to\/#listItem","position":2,"name":"How-To","item":"https:\/\/www.garysieling.com\/blog\/category\/how-to\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#listItem","name":"TypeScript: typings example"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#listItem","position":3,"name":"TypeScript: typings example","previousItem":{"@type":"ListItem","@id":"https:\/\/www.garysieling.com\/blog\/category\/how-to\/#listItem","name":"How-To"}}]},{"@type":"Organization","@id":"https:\/\/www.garysieling.com\/blog\/#organization","name":"Gary Sieling","description":"Software Engineer","url":"https:\/\/www.garysieling.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.garysieling.com\/blog\/author\/gary\/#author","url":"https:\/\/www.garysieling.com\/blog\/author\/gary\/","name":"gary","image":{"@type":"ImageObject","@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/0be925276d848ffe98a6a9dc8cf33e67?s=96&d=identicon&r=g","width":96,"height":96,"caption":"gary"}},{"@type":"WebPage","@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#webpage","url":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/","name":"TypeScript: typings example - Gary Sieling","description":"All the things you need to get Typings up an running for the first time","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.garysieling.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/#breadcrumblist"},"author":{"@id":"https:\/\/www.garysieling.com\/blog\/author\/gary\/#author"},"creator":{"@id":"https:\/\/www.garysieling.com\/blog\/author\/gary\/#author"},"datePublished":"2016-04-30T01:27:36+00:00","dateModified":"2016-04-30T01:27:36+00:00"},{"@type":"WebSite","@id":"https:\/\/www.garysieling.com\/blog\/#website","url":"https:\/\/www.garysieling.com\/blog\/","name":"Gary Sieling","description":"Software Engineer","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.garysieling.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Gary Sieling - Software Engineer","og:type":"article","og:title":"TypeScript: typings example - Gary Sieling","og:description":"All the things you need to get Typings up an running for the first time","og:url":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/","article:published_time":"2016-04-30T01:27:36+00:00","article:modified_time":"2016-04-30T01:27:36+00:00","twitter:card":"summary_large_image","twitter:title":"TypeScript: typings example - Gary Sieling","twitter:description":"All the things you need to get Typings up an running for the first time"},"aioseo_meta_data":{"post_id":"3912","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2023-02-04 16:52:35","updated":"2026-07-06 01:52:38","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.garysieling.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.garysieling.com\/blog\/category\/how-to\/\" title=\"How-To\">How-To<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tTypeScript: typings example\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.garysieling.com\/blog"},{"label":"How-To","link":"https:\/\/www.garysieling.com\/blog\/category\/how-to\/"},{"label":"TypeScript: typings example","link":"https:\/\/www.garysieling.com\/blog\/typescript-typings-example\/"}],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3912"}],"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=3912"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3912\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}