Windows 10: Announcing TypeScript 2.5

Discus and support Announcing TypeScript 2.5 in Windows 10 News to solve the problem; Today we’re happy to bring you TypeScript 2.5! If you’ve readour RC announcement, we’ve got a few new items that we’re proud to highlight! If you’re... Discussion in 'Windows 10 News' started by Brink, Aug 30, 2017.

  1. Brink
    Brink New Member

    Announcing TypeScript 2.5


    We might want to declare a variable namedxyzwhose type is tied to to the type ofbar. The correct way to write this would be using an indexed access type:
    Code: // Get the type of the property named 'bar' off of 'Foo'. var xyz: Foo["bar"][/quote]
    but we might accidentally writevar xyz: Foo.bar. TypeScript now can now suggest the correct one in many cases.


    Announcing TypeScript 2.5 [​IMG]


    JSDoc type assertion support in JavaScript files

    In TypeScript 2.4, we introduced the ability to get type-checking in JavaScript files so that users can more easily migrate to TypeScript, and have an easier experience with certain more lightweight projects. Taking advantage of this is as simple as adding a// @ts-checkat the top of your.jsfile, or turning on thecheckJsflag in youttsconfig.json‘scompilerOptions.

    One thing that it lacked was the ability to “cast” or “assert” the type of an expression. This is important for situations where you know a little more than the type-checker and need to tell it so. To come up with a trivial example, let’s take the following JavaScript code:
    Code: // @ts-check var foo = Math.random() ? "hello" : 100; foo.toUpperCase(); // ~~~~~~~~~~~ // Error! Property 'toUpperCase' does not exist on type 'string | number'.[/quote]
    TypeScript correctly indicates that we might be calling a method that doesn’t exist onnumbers. If we wanted to get around this so we can easily get our runtime error, we could write a JSDoc type assertion:
    Code: // Works! var bar = /** @type {string} */ (foo); bar.toUpperCase();[/quote]
    The syntax is/** @type {YOUR_TYPE_HERE} */ (someParenthesizedExpression).

    Keep in mind that if you’ve enabled JavaScript checking on a file, invalid type assertions will still get caught:
    Code: var clearlyNumber = /** @type {string} */ (100); // ~~~~~~~~~~~~~~ // Error! Type 'number' cannot be converted to type 'string'.[/quote]
    Optionalcatchclauses

    Thanks to work byTingan Ho, TypeScript 2.5 brings a new ECMAScript-bound feature for making catch clauses optional. Much of the time, you’ll find yourself writing atry/catchbut not really caring about the thrown error. For example:
    Code: [let contents; try { contents = fs.readFileSync(".config_file").toString('utf8'); } catch (unusedError) { // File might not exist, just fall back to some defaults. contents = createDefaultContents(); }[/quote]
    Notice thatunusedErroris never referenced in the above example. Barring philosophical issues about whether it’s appropriate to ignore the error, we can make our code a little cleaner by taking advantage of the fact that thecatchvariable is now optional.
    Code: let contents; try { contents = fs.readFileSync(".config_file").toString('utf8'); } catch { // File might not exist, just fall back to some defaults. contents = createDefaultContents(); }[/quote]
    Deduplicated and redirected packages

    When importing using theNodemodule resolution strategy in TypeScript 2.5, the compiler will now check whether files originate from “identical” packages. If a file originates from a package with apackage.jsoncontaining the samenameandversionfields 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 containprivatemembers that cause them to be structurally incompatible.

    As a nice bonus, this can also reduce the memory and runtime footprint of the compiler and language service by avoiding loading.d.tsfiles from duplicate packages.

    The --preserveSymlinks compiler flag

    TypeScript 2.5 brings thepreserveSymlinksflag, which parallels the behavior ofthe--preserve-symlinksflag in Node.js. This flag also exhibits the opposite behavior to Webpack’sresolve.symlinksoption (i.e. setting TypeScript’spreserveSymlinkstotrueparallels setting Webpack’sresolve.symlinkstofalse, and vice-versa).

    In this mode, references to modules and packages (e.g.imports and/// <reference type="..." />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’ll defer tothe documentation on the Node.js website.

    Enjoy!

    We hope our work in TypeScript 2.5 will make you happier and more productive. If it did, let us know on Twitter with the#iHeartTypeScripthashtag.

    Out team appreciates any sort of feedback on how we can improve. Feel free to let us know about any issues you run into or helpful ideas you think might make TypeScript even better to useon our GitHub issue tracker.

    As for what’s next, we’ve caught most of what’s new on this blog post, but you can always check out ourwhat’s new in TypeScriptpage on our wiki for some more details, and keep an eye onour Roadmapthat highlights our current plans and is frequently updated.

    Thanks for reading and happy hacking!

    [/quote]
    Source: Announcing TypeScript 2.5 | TypeScript

    :)
     
    Brink, Aug 30, 2017
    #1

  2. Windows Explorer crashing

    I tried removing the Windows Security Update and after a reboot, problem still occurs when file explorer sees a typescript file. File explorer crashes.
     
    norricorp10, Aug 30, 2017
    #2
  3. adg82439 Win User
    munich public transport on Google Maps

    yesterday munich announced the public transport plan and time table and routing to be available on google.



    my message about it was accompanied by a german screenshot - and because of the the german part it was deleted from the board.







    As PT 2.5 is available in betalabs i thought it will be have full support for munich public transport.





    does anyone know wether or when this will come to symbian?
     
    adg82439, Aug 30, 2017
    #3
Thema:

Announcing TypeScript 2.5

Loading...
  1. Announcing TypeScript 2.5 - Similar Threads - Announcing TypeScript

  2. Windows Magnifer - Why does Read From here feature keeps announcing "EA Work Window"

    in Windows 10 Gaming
    Windows Magnifer - Why does Read From here feature keeps announcing "EA Work Window": Hello! I'm stumped and confused and could use some help and assistance. The issue I'm having is when launching Windows Magnifier and selecting either the Read From Here button or using CTRL + ALT + Left Click - Magnifier announces `EA Work Window.` This is the name of my...
  3. Windows Magnifer - Why does Read From here feature keeps announcing "EA Work Window"

    in Windows 10 Software and Apps
    Windows Magnifer - Why does Read From here feature keeps announcing "EA Work Window": Hello! I'm stumped and confused and could use some help and assistance. The issue I'm having is when launching Windows Magnifier and selecting either the Read From Here button or using CTRL + ALT + Left Click - Magnifier announces `EA Work Window.` This is the name of my...
  4. Announcing TypeScript 3.3

    in Windows 10 News
    Announcing TypeScript 3.3: Today we’re happy to announce the availability of TypeScript 3.3! If you’re unfamiliar with TypeScript, it’s a language that brings static type-checking to JavaScript so that you can catch issues before you even run your code – or before you even save your file. It also...
  5. Announcing TypeScript 3.3 Release Candidate

    in Windows 10 News
    Announcing TypeScript 3.3 Release Candidate: Today we’re happy to announce the availability of our release candidate (RC) of TypeScript 3.3. Our hope is to collect feedback and early issues to ensure our final release is simple to pick up and use right away. To get started using the RC, you can get it through NuGet, or...
  6. Announcing TypeScript 3.0

    in Windows 10 News
    Announcing TypeScript 3.0: TypeScript 3.0 is here! Today marks a new milestone in the TypeScript journey, serving JavaScript users everywhere. If you’re unfamiliar with TypeScript, it’s not too late to learn about it now! TypeScript is an extension of JavaScript that aims to bring static types to...
  7. Announcing TypeScript 2.5 RC

    in Windows 10 News
    Announcing TypeScript 2.5 RC: Today we’re happy to announce our RC of TypeScript 2.5. To get started with the latest stable version of TypeScript, you can grab it through NuGet, or use the following command with npm: npm install -g typescript@rc Visual Studio 2015 users (who have Update 3) can...
  8. Announcing TypeScript 2.7

    in Windows 10 News
    Announcing TypeScript 2.7: Today we’re proud to announce the release of TypeScript 2.7! If you’re not familiar with TypeScript, it’s a language that brings optional static types to JavaScript by building on JavaScript itself. Running TypeScript code through its compiler emits clean readable...
  9. Announcing JavaScript extension TypeScript 2.2 update

    in Windows 10 News
    Announcing JavaScript extension TypeScript 2.2 update: Today our team is happy to present our latest release with TypeScript 2.2!For those who haven’t yet heard of it, TypeScript is a simple extension to JavaScript to add optional types along with all the new ECMAScript features. TypeScript builds on the ECMAScript standard and...
  10. Announcing TypeScript 2.1

    in Windows 10 News
    Announcing TypeScript 2.1: We spread ourselves thin, but this is the moment you’ve been awaiting – TypeScript 2.1 is here! For those who are unfamiliar, TypeScript is a language that brings you all the new features of JavaScript, along with optional static types. This gives you an editing experience...