{"id":1105,"date":"2017-08-17T17:53:38","date_gmt":"2017-08-17T17:53:38","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/typescript\/?p=1105"},"modified":"2019-02-20T10:45:49","modified_gmt":"2019-02-20T17:45:49","slug":"announcing-typescript-2-5-rc","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/typescript\/announcing-typescript-2-5-rc\/","title":{"rendered":"Announcing TypeScript 2.5 RC"},"content":{"rendered":"<div style=\"font-size: 16px\">\n<h2>Announcing TypeScript 2.5 RC<\/h2>\n<p>Today we&#8217;re happy to announce our RC of TypeScript 2.5. To get started with the latest stable version of TypeScript, you can grab it<span>\u00a0<\/span><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.TypeScript.MSBuild\">through NuGet<\/a>, or use the following command with npm:<\/p>\n<div class=\"highlight highlight-source-shell\">\n<pre>npm install -g typescript@rc<\/pre>\n<\/div>\n<p>Visual Studio 2015 users (who have<span>\u00a0<\/span><a href=\"https:\/\/www.visualstudio.com\/en-us\/news\/releasenotes\/vs2015-update3-vs\">Update 3<\/a>)<span>\u00a0<\/span><a href=\"http:\/\/download.microsoft.com\/download\/6\/D\/8\/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA\/2.5.0-TS-release-dev14update3-20170816.2\/TypeScript_Dev14Full.exe\">can install TypeScript 2.5 RC from here<\/a>, and Visual Studio 2017 users using version 15.2 or later will be able to get TypeScript<span>\u00a0<\/span><a href=\"http:\/\/download.microsoft.com\/download\/7\/0\/A\/70A6AC0E-8934-4396-A43E-445059F430EA\/2.5.0-TS-release-dev14update3-20170816.2\/TypeScript_SDK.exe\">by simply installing it from here<\/a>.<\/p>\n<p>While TypeScript 2.5 will be available for other editors soon, in the meantime you can configure<span>\u00a0<\/span><a href=\"https:\/\/code.visualstudio.com\/Docs\/languages\/typescript#_using-newer-typescript-versions\">Visual Studio Code<\/a><span>\u00a0<\/span>and<span>\u00a0<\/span><a href=\"https:\/\/github.com\/Microsoft\/TypeScript-Sublime-Plugin\/#note-using-different-versions-of-typescript\">Sublime Text<\/a><span>\u00a0<\/span>to use a newer version.<span>\u00a0<\/span><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/wiki\/TypeScript-Editor-Support\">Other editors<\/a><span>\u00a0<\/span>may have different approaches to trying TypeScript 2.5 RC out.<\/p>\n<p>Let&#8217;s dive in and get an overview of what&#8217;s coming in TypeScript 2.5!<\/p>\n<h2><a href=\"https:\/\/gist.github.com\/DanielRosenwasser\/caa1c02f1c462d78da656bf47ae2dd0c#optional-catch-binding-parameters\" id=\"user-content-optional-catch-binding-parameters\" class=\"anchor\"><\/a>Optional<span>\u00a0<\/span><code style=\"color: #a31515;font-size: 29px\">catch<\/code><span>\u00a0<\/span>binding parameters<\/h2>\n<p>There are times when coding where you expect something might fail by throwing an error, but where you might not care what that error is. For example:<\/p>\n<div class=\"highlight highlight-source-ts\">\n<pre><span style=\"color: #0000ff\">let<\/span> contents;\n<span style=\"color: #0000ff\">try<\/span> {\n    <span class=\"pl-smi\">contents<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-smi\">fs<\/span>.<span class=\"pl-en\">readFileSync<\/span>(<span style=\"color: #a31515\"><span class=\"pl-pds\">'<\/span>.config_file<span class=\"pl-pds\">'<\/span><\/span>).<span class=\"pl-c1\">toString<\/span>(<span style=\"color: #a31515\"><span class=\"pl-pds\">'<\/span>utf8<span class=\"pl-pds\">'<\/span><\/span>);\n}\n<span style=\"color: #0000ff\">catch<\/span> (<span class=\"pl-smi\">unusedError<\/span>) {\n    <span style=\"color: #148A14\">\/\/ File might not exist, just fall back to some defaults.<\/span>\n    <span class=\"pl-smi\">contents<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-en\">createDefaultContents<\/span>();\n}<\/pre>\n<\/div>\n<p>Notice that<span>\u00a0<\/span><code>unusedError<\/code><span>\u00a0<\/span>is never referenced in the above example. TypeScript 2.5 introduces a late-stage ECMAScript feature to make the<span>\u00a0<\/span><code>catch<\/code><span>\u00a0<\/span>binding optional in<span>\u00a0<\/span><code>try<\/code>\/<code>catch<\/code><span>\u00a0<\/span>statements. That means we can just omit<span>\u00a0<\/span><code>unusedError<\/code><span>\u00a0<\/span>altogether:<\/p>\n<div class=\"highlight highlight-source-ts\">\n<pre><span style=\"color: #0000ff\">let<\/span> contents;\n<span style=\"color: #0000ff\">try<\/span> {\n    <span class=\"pl-smi\">contents<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-smi\">fs<\/span>.<span class=\"pl-en\">readFileSync<\/span>(<span style=\"color: #a31515\"><span class=\"pl-pds\">'<\/span>.config_file<span class=\"pl-pds\">'<\/span><\/span>).<span class=\"pl-c1\">toString<\/span>(<span style=\"color: #a31515\"><span class=\"pl-pds\">'<\/span>utf8<span class=\"pl-pds\">'<\/span><\/span>);\n}\n<span style=\"color: #0000ff\">catch<\/span> {\n    <span style=\"color: #148A14\">\/\/ File might not exist, just fall back to some defaults.<\/span>\n    <span class=\"pl-smi\">contents<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-en\">createDefaultContents<\/span>();\n}<\/pre>\n<\/div>\n<p>Thanks to<span>\u00a0<\/span><a href=\"https:\/\/github.com\/tinganho\">Tingan Ho<\/a><span>\u00a0<\/span>for his contribution on this feature!<\/p>\n<h2><a href=\"https:\/\/gist.github.com\/DanielRosenwasser\/caa1c02f1c462d78da656bf47ae2dd0c#deduplicated-and-redirected-packages\" id=\"user-content-deduplicated-and-redirected-packages\" class=\"anchor\"><\/a>Deduplicated and redirected packages<\/h2>\n<p>When importing using the<span>\u00a0<\/span><code>Node<\/code><span>\u00a0<\/span>module resolution strategy in TypeScript 2.5, the compiler will now check whether files originate from &#8220;identical&#8221; packages. If a file originates from a package with a<span>\u00a0<\/span><code>package.json<\/code><span>\u00a0<\/span>containing the same<span>\u00a0<\/span><code>name<\/code><span>\u00a0<\/span>and<span>\u00a0<\/span><code>version<\/code><span>\u00a0<\/span>fields as a previously encountered package, then TypeScript will redirect itself to the top-most package. This helps resolve problems where two packages might contain identical declarations of classes, but which contain<span>\u00a0<\/span><code>private<\/code><span>\u00a0<\/span>members that cause them to be structurally incompatible. It also reduces the memory and runtime footprint of the compiler and language service.<\/p>\n<h2><a href=\"https:\/\/gist.github.com\/DanielRosenwasser\/caa1c02f1c462d78da656bf47ae2dd0c#the---preservesymlinks-compiler-flag\" id=\"user-content-the---preservesymlinks-compiler-flag\" class=\"anchor\"><\/a>The<span>\u00a0<\/span><code style=\"color: #a31515;font-size: 29px\">--preserveSymlinks<\/code><span>\u00a0<\/span>compiler flag<\/h2>\n<p>TypeScript 2.5 brings the<span>\u00a0<\/span><code>preserveSymlinks<\/code><span>\u00a0<\/span>flag, which parallels the behavior of<span>\u00a0<\/span><a href=\"https:\/\/nodejs.org\/api\/cli.html#cli_preserve_symlinks\">the<span>\u00a0<\/span><code>--preserve-symlinks<\/code><span>\u00a0<\/span>flag in Node.js<\/a>. This flag also exhibits the opposite behavior to Webpack&#8217;s<span>\u00a0<\/span><code>resolve.symlinks<\/code><span>\u00a0<\/span>option (i.e. setting TypeScript&#8217;s<span>\u00a0<\/span><code>preserveSymlinks<\/code><span>\u00a0<\/span>to<span>\u00a0<\/span><code>true<\/code><span>\u00a0<\/span>parallels setting Webpack&#8217;s<span>\u00a0<\/span><code>resolve.symlinks<\/code><span>\u00a0<\/span>to<span>\u00a0<\/span><code>false<\/code>, and vice-versa).<\/p>\n<p>In this mode, references to modules and packages (e.g.<span>\u00a0<\/span><code>import<\/code>s and<span>\u00a0<\/span><code>\/\/\/ &lt;reference type=\"...\" \/&gt;<\/code><span>\u00a0<\/span>directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to. For a more concrete example, we&#8217;ll defer to<span>\u00a0<\/span><a href=\"https:\/\/nodejs.org\/api\/cli.html#cli_preserve_symlinks\">the documentation on the Node.js website<\/a>.<\/p>\n<h2><a href=\"https:\/\/gist.github.com\/DanielRosenwasser\/caa1c02f1c462d78da656bf47ae2dd0c#what-next\" id=\"user-content-what-next\" class=\"anchor\"><\/a>What next?<\/h2>\n<p>While we&#8217;ll continue to improve TypeScript before the full 2.5 release, we also have a few other ideas for TypeScript 2.6 that are under way. Some things we&#8217;ll be working on in the meantime are improvements to TypeScript&#8217;s<span>\u00a0<\/span><code>--watch<\/code><span>\u00a0<\/span>mode, and integration with other tools that have file-watching functionality. Our aim is to ensure that as codebases grow larger, TypeScript can give lightning-fast turnaround between the time that you save a file, and the time that you can reload your project. You can keep an eye on<span>\u00a0<\/span><a href=\"https:\/\/github.com\/Microsoft\/TypeScript\/pull\/17669\">our pull request for changes to<span>\u00a0<\/span><code>--watch<\/code><\/a><span>\u00a0<\/span>for the work we&#8217;ve done so far.<\/p>\n<p>Thanks for reading, and we hope you give our release candidate a try!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Announcing TypeScript 2.5 RC Today we&#8217;re happy to announce our RC of TypeScript 2.5. To get started with the latest stable version of TypeScript, you can grab it\u00a0through NuGet, or use the following command with npm: npm install -g typescript@rc Visual Studio 2015 users (who have\u00a0Update 3)\u00a0can install TypeScript 2.5 RC from here, and Visual [&hellip;]<\/p>\n","protected":false},"author":381,"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-1105","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-typescript"],"acf":[],"blog_post_summary":"<p>Announcing TypeScript 2.5 RC Today we&#8217;re happy to announce our RC of TypeScript 2.5. To get started with the latest stable version of TypeScript, you can grab it\u00a0through NuGet, or use the following command with npm: npm install -g typescript@rc Visual Studio 2015 users (who have\u00a0Update 3)\u00a0can install TypeScript 2.5 RC from here, and Visual [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/posts\/1105","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\/381"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/comments?post=1105"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/posts\/1105\/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=1105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/categories?post=1105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/typescript\/wp-json\/wp\/v2\/tags?post=1105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}