{"id":521,"date":"2016-01-28T11:53:00","date_gmt":"2016-01-28T11:53:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/typescript\/2016\/01\/28\/announcing-typescript-1-8-beta\/"},"modified":"2024-07-02T10:18:04","modified_gmt":"2024-07-02T18:18:04","slug":"announcing-typescript-1-8-beta","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/typescript\/announcing-typescript-1-8-beta\/","title":{"rendered":"Announcing TypeScript 1.8 Beta"},"content":{"rendered":"<p>Today we are releasing a beta of TypeScript 1.8. There are quite a lot of changes coming in the 1.8 release, so please check them out and<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/github.com\/microsoft\/typescript\/issues\" target=\"_blank\" rel=\"noopener\">send us your feedback<\/a>. TypeScript 1.8 beta is available for<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/download.microsoft.com\/download\/6\/D\/8\/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA\/TS1.8.1-Beta-TS-master.20160126.1\/TypeScript_Dev14Full.exe\" target=\"_blank\" rel=\"noopener\">Visual Studio 2015<\/a>, NuGet (<a href=\"http:\/\/blogs.msdn.com\/controlpanel\/blogs\/(https:\/\/www.nuget.org\/packages\/Microsoft.TypeScript.Compiler\/\" target=\"_blank\" rel=\"noopener\">Compiler<\/a><span class=\"Apple-converted-space\">\u00a0<\/span>and<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/blogs.msdn.com\/controlpanel\/blogs\/(https:\/\/www.nuget.org\/packages\/Microsoft.TypeScript.MSBuild\/\" target=\"_blank\" rel=\"noopener\">MSBuild task<\/a>),<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"https:\/\/www.npmjs.com\/package\/typescript\" target=\"_blank\" rel=\"noopener\">npm<\/a>, and straight from the<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/releases\" target=\"_blank\" rel=\"noopener\">source<\/a>.<\/p>\n<p>For npm users, make sure to use the following command:<\/p>\n<p><span style=\"font-family: courier new,courier;\">&gt; npm install -g typescript@beta<\/span><\/p>\n<p>You can also get TypeScript 1.8 beta in VS Code by downloading the above npm package and updating your <span style=\"font-family: courier new,courier;\"><code>.vscode\/settings.json<\/code><\/span> with the following:<\/p>\n<div class=\"highlight highlight-source-json\">\n<pre><span style=\"font-family: courier new,courier;\"><span class=\"pl-s\" style=\"color: #333399;\"><span class=\"pl-pds\">\"<\/span>typescript.tsdk<span class=\"pl-pds\">\"<\/span><\/span>: <span class=\"pl-s\" style=\"color: #993300;\"><span class=\"pl-pds\">\"<\/span>\/some\/path\/to\/node_modules\/typescript\/lib<span class=\"pl-pds\">\"<\/span><\/span><\/span><\/pre>\n<\/div>\n<h2>JavaScript in TypeScript Compilation<\/h2>\n<p>In TypeScript 1.8, the TypeScript compiler can now consume JavaScript files alongside TypeScript files. To enable this feature, just add the compiler flag <code>--allowJs<\/code> or add <code>\"allowJs\": true<\/code> to <code>compilerOptions<\/code> in <code>tsconfig.json<\/code>. This is awesome for several reasons:<\/p>\n<h3>Converting JavaScript projects to TypeScript<\/h3>\n<p>At times, the conversion process from JavaScript to TypeScript could be menacing for big projects. While it\u2019s project specific, simply converting all <code>.js<\/code> files to <code>.ts<\/code> files may yield a fairly large number of compilation errors at times, making the conversion a bit unfriendly. However, by allowing JavaScript files into the TypeScript compiler, it is now possible to convert one file at a time while still compiling your entire project all together. This allows developers to be in full control of where and how they want to carry out the conversion making converting sizable projects much more manageable.<\/p>\n<h3>Using 3rd party JavaScript libraries is easier<\/h3>\n<p>In order to utilize JavaScript libraries in your TypeScript projects, developers have to include a type definition (.d.ts) file so that the TypeScript compiler knows what you\u2019re doing at compile time and the JavaScript engine knows what to use at runtime. Typically, this is fine unless you want to bundle your external JavaScript libraries with the JavaScript emitted by your TypeScript compilation. Until now, to address this problem, developers needed a third party bundler such as webpack or browserify. With TypeScript 1.8, you can simply include these 3rd party JavaScript libraries in your compilation and they will follow your emitted JavaScript wherever it goes. Source maps included!<\/p>\n<h3>Trivial JavaScript manipulation<\/h3>\n<p>With JavaScript in TypeScript compilation, the TypeScript compiler can now emit JavaScript files in all the same ways that TypeScript files can. This includes ES3\/ES5, different module types, and bundling. For example, for a quick ES6 to ES5 downlevel conversion using the TypeScript compiler, you just need the following command:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre><span class=\"pl-k\">&gt;<\/span> tsc --allowJs --outDir out target_file.js<\/pre>\n<\/div>\n<h2>Expanded JSX Support<\/h2>\n<p>After much <a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/issues\/3788\">community discussion<\/a>, TypeScript 1.8 brings a few key improvements to enhance the state of art TSX\/JSX support.<\/p>\n<h3>Custom JSX Factories<\/h3>\n<p>While React has paved the way, JSX syntax is not only tied to React. As such, a JSX factory should be able to be overridden from the default <code>React<\/code> factory. Using the new compiler flag <code>--reactNamespace &lt;factory_name&gt;<\/code> in combination with <code>--jsx react<\/code>, TSX authors can now control the emit of the factory name.<\/p>\n<h3>Stateless functional components<\/h3>\n<p>Stateless functional components are a new concept with React 0.14, however they are already seeing very healthy adoption. Starting with TypeScript 1.8, we support stateless functional components in TSX files.<\/p>\n<p><span style=\"font-family: courier new,courier;\"><span class=\"pl-k\" style=\"color: #993366;\">interface<\/span> <span style=\"color: #333399;\">GreeterProps<\/span> {<\/span>\n<span style=\"font-family: courier new,courier;\">\u00a0\u00a0\u00a0 name<span class=\"pl-k\">:<\/span> string;<\/span>\n<span style=\"font-family: courier new,courier;\">}<\/span><\/p>\n<p><span style=\"font-family: courier new,courier;\"><span class=\"pl-k\" style=\"color: #993366;\">class <\/span><span class=\"pl-en\" style=\"color: #333399;\">Greeter <\/span><span class=\"pl-k\" style=\"color: #993366;\">extends <\/span><span class=\"pl-en\" style=\"color: #333399;\">React<\/span>.<span class=\"pl-smi\" style=\"color: #333399;\">Component<\/span><span class=\"pl-k\">&lt;<\/span><span style=\"color: #333399;\">GreeterProps<\/span>, {}<span class=\"pl-k\">&gt;<\/span> {<\/span>\n<span style=\"font-family: courier new,courier;\"><span class=\"pl-en\" style=\"color: #333399;\">\u00a0\u00a0\u00a0 render<\/span>() {<\/span>\n<span style=\"font-family: courier new,courier;\"><span class=\"pl-k\" style=\"color: #993366;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return <\/span><span class=\"pl-k\">&lt;<\/span>div<span class=\"pl-k\">&gt;<\/span>Hello, {<span class=\"pl-v\" style=\"color: #ff6600;\">this<\/span>.<span class=\"pl-smi\">props<\/span>.<span class=\"pl-c1\" style=\"color: #000000;\">name<\/span>}<span class=\"pl-k\">&lt;<\/span><span class=\"pl-k\">\/<\/span>div<span class=\"pl-k\">&gt;<\/span>;<\/span>\n<span style=\"font-family: courier new,courier;\">\u00a0\u00a0\u00a0 }\u00a0\u00a0 <\/span>\n<span style=\"font-family: courier new,courier;\">}<\/span><\/p>\n<p><span class=\"pl-c\" style=\"color: #339966; font-family: courier new,courier;\">\/\/stateless functional component SimpleGreeter<\/span>\n<span style=\"font-family: courier new,courier;\"><span class=\"pl-k\" style=\"color: #993366;\">let <\/span><span class=\"pl-en\" style=\"color: #333399;\"><span style=\"color: #000000;\">SimpleGreeter <span class=\"pl-k\">=<\/span> ({<span class=\"pl-smi\">name<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-s\" style=\"color: #000080;\"><span class=\"pl-pds\">&#8216;<\/span>world<span class=\"pl-pds\">&#8216;<\/span><\/span>}) <span class=\"pl-k\">=&gt;<\/span> <span class=\"pl-k\">&lt;<\/span><span style=\"color: #800080;\">div<\/span><span class=\"pl-k\">&gt;<\/span>Hello, {name}<span class=\"pl-k\">&lt;<\/span><span class=\"pl-k\">\/<\/span><span style=\"color: #800080;\">div<\/span><span class=\"pl-k\">&gt;<\/span>;<\/span><\/span><\/span><\/p>\n<h3>Syntax highlighting in VS 2015<\/h3>\n<p>With the TypeScript 1.8 update in Visual Studio, JSX tags will now get classified and colorized improving the readability of the code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/8546.jsxSample.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4347\" src=\"https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/8546.jsxSample.png\" alt=\"Image 8546 jsxSample\" width=\"886\" height=\"339\" srcset=\"https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/8546.jsxSample.png 886w, https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/8546.jsxSample-300x115.png 300w, https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/8546.jsxSample-768x294.png 768w\" sizes=\"(max-width: 886px) 100vw, 886px\" \/><\/a><\/p>\n<h2>TypeScript NuGet Packges<\/h2>\n<p>A long-standing request from some of our users has been to provide an official TypeScript NuGet package to improve the ease of acquisition. Starting with TypeScript 1.8 beta, we will be distributing the TypeScript compiler and the MSBuild task as a NuGet package with every release! Links to the respective packages are below:<\/p>\n<p><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.TypeScript.Compiler\/\">TypeScript compiler<\/a><\/p>\n<p><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.TypeScript.MSBuild\/\">TypeScript MSBuild task<\/a><\/p>\n<p>In addition to these official releases, we will also be hosting the nightly build of TypeScript on MyGet. These are not supported builds, but feel free to check them out and let us know what you think. You can find the builds <a href=\"https:\/\/www.myget.org\/users\/typescriptteam\">here<\/a>.<\/p>\n<h2>Chakra Core + TypeScript<\/h2>\n<p>We are always looking for ways to improve the performance of the TypeScript compiler, so when <a href=\"https:\/\/blogs.windows.com\/msedgedev\/2016\/01\/13\/chakracore-now-open\/\">Chakra Core<\/a> was released a few weeks ago, we jumped at the opportunity to test it out. Below is a chart of the compilation times for each engine over different size repositories. We found ChakraCore achieved significantly reduced compilation times, outperforming the previous version of Chakra that we were using by 5-20% and Node by 10-50%! Based on these improvements, we have switched to using ChakraCore when possible.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/1055.chakraCorePerf.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4348\" src=\"https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/1055.chakraCorePerf.png\" alt=\"Image 1055 chakraCorePerf\" width=\"1270\" height=\"652\" srcset=\"https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/1055.chakraCorePerf.png 1270w, https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/1055.chakraCorePerf-300x154.png 300w, https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/1055.chakraCorePerf-1024x526.png 1024w, https:\/\/devblogs.microsoft.com\/typescript\/wp-content\/uploads\/sites\/11\/2016\/01\/1055.chakraCorePerf-768x394.png 768w\" sizes=\"(max-width: 1270px) 100vw, 1270px\" \/><\/a><\/p>\n<h2>And More!<\/h2>\n<p>TypeScript 1.8 includes several more features like F-Bounded polymorphism, string literal types, etc. If you want to deep dive on these and other features coming in 1.8, check out our <a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/wiki\/What%27s-new-in-TypeScript#typescript-18-upcoming\">what\u2019s new page<\/a>. As always, we encourage you to weigh in on the future of TypeScript by browsing our <a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/issues\">existing issues<\/a>, throwing us a <a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pulls\">pull request<\/a>, or just hanging out with the team on <a href=\"https:\/\/gitter.im\/microsoft\/typescript\">gitter<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we are releasing a beta of TypeScript 1.8. There are quite a lot of changes coming in the 1.8 release, so please check them out and\u00a0send us your feedback. TypeScript 1.8 beta is available for\u00a0Visual Studio 2015, NuGet (Compiler\u00a0and\u00a0MSBuild task),\u00a0npm, and straight from the\u00a0source. For npm users, make sure to use the following command: [&hellip;]<\/p>\n","protected":false},"author":380,"featured_media":1797,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-521","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-typescript"],"acf":[],"blog_post_summary":"<p>Today we are releasing a beta of TypeScript 1.8. There are quite a lot of changes coming in the 1.8 release, so please check them out and\u00a0send us your feedback. TypeScript 1.8 beta is available for\u00a0Visual Studio 2015, NuGet (Compiler\u00a0and\u00a0MSBuild task),\u00a0npm, and straight from the\u00a0source. For npm users, make sure to use the following command: [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/posts\/521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/users\/380"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/comments?post=521"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/posts\/521\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/media\/1797"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/media?parent=521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/categories?post=521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/tags?post=521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}