• Complain

Dr. Axel Rauschmayer - Tackling TypeScript

Here you can read online Dr. Axel Rauschmayer - Tackling TypeScript full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Dr. Axel Rauschmayer Tackling TypeScript

Tackling TypeScript: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Tackling TypeScript" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Dr. Axel Rauschmayer: author's other books


Who wrote Tackling TypeScript? Find out the surname, the name of the author of the book and a list of all author's works by series.

Tackling TypeScript — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Tackling TypeScript" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Tackling TypeScript
Tackling TypeScript

Dr. Axel Rauschmayer

2020

Tackling TypeScript
1About this book

  • 1.1
  • 1.2
  • 1.3
  • 1.4
  • 1.5
  • 1.6
  • 1.7

1.1Where is the homepage of this book?

The homepage of Tackling TypeScript is exploringjs.com/tackling-ts/

1.2What is in this book?

This book consists of two parts:

  • Part 1 is a quick start for TypeScript that teaches you the essentials quickly.
  • Part 2 digs deeper into the language and covers many important topics in detail.

This book is not a reference, it is meant to complement the official TypeScript handbook.

Required knowledge: You must know JavaScript. If you want to refresh your knowledge: My book JavaScript for impatient programmers is free to read online.

1.3What do I get for my money?

If you buy this book, you get:

  • The current content in four DRM-free versions:
    • PDF file
    • ZIP archive with ad-free HTML
    • EPUB file
    • MOBI file
  • Any future content that is added to this edition. How much I can add depends on the sales of this book.
1.4How can I preview the content?

On the homepage of this book, there are extensive previews for all versions of this book.

1.5How do I report errors?
  • The HTML version of this book has a link to comments at the end of each chapter.
  • They jump to GitHub issues, which you can also access directly.
1.6What do the notes with icons mean?

Picture 1Reading instructions

Explains how to best read the content (in which order, what to omit, etc.).

Picture 2External content

Points to additional, external, content.

Picture 3Git repository

Mentions a relevant Git repository.

Picture 4Tip

Gives a tip.

Picture 5Question

Asks and answers a question (think FAQ).

Picture 6Warning

Warns about a pitfall, etc.

Picture 7Details

Provides additional details, similar to a footnote.

1.7Acknowledgements

People who contributed to this book are acknowledged in the chapters.

2Why TypeScript?

  • 2.1
    • 2.1.1
    • 2.1.2
    • 2.1.3
    • 2.1.4
    • 2.1.5
    • 2.1.6
  • 2.2
  • 2.3
    • 2.3.1
    • 2.3.2

You can skip this chapter if you are already sure that you will learn and use TypeScript.

If you are still unsure this chapter is my sales pitch.

2.1The benefits of using TypeScript
2.1.1More errors are detected statically (without running code)

While you are editing TypeScript code in an integrated development environment, you get warnings if you mistype names, call functions incorrectly, etc.

Consider the following two lines of code:

funcc() ;

For the second line, we get this warning:

Cannot find name 'funcc'. Did you mean 'func'?

Another example:

const result = a + b ;

This time, the error message for the last line is:

Operator '+' cannot be applied to types 'number' and 'boolean'.
2.1.2Documenting parameters is good practice anyway

Documenting parameters of functions and methods is something that many people do, anyway:

}

Specifying the types via {number} and {string} is not required, but the descriptions in English mention them, too.

If we use TypeScripts notation to document types, we get the added benefit of this information being checked for consistency:

}
2.1.3TypeScript provides an additional layer of documentation

Whenever I migrate JavaScript code to TypeScript, Im noticing an interesting phenomenon: In order to find the appropriate types for parameters for a function or method, I have to check where it is invoked. That means that static types give me information locally that I otherwise have to look up elsewhere.

And I do indeed find it easier to understand TypeScript code bases than JavaScript code bases: TypeScript provides an additional layer of documentation.

This additional documentation also helps when working in teams because it is clearer how code is to be used and TypeScript often warns us if we are doing something wrong.

2.1.4Type definitions for JavaScript improve auto-completion

If there are type definitions for JavaScript code, then editors can use them to improve auto-completion.

An alternative to using TypeScripts syntax, is to provide all type information via JSDoc comments like we did at the beginning of this chapter. In that case, TypeScript can also check code for consistency and generate type definitions. For more information, see chapter Type Checking JavaScript Files in the TypeScript handbook.

2.1.5TypeScript makes refactorings safer

Refactorings are automated code transformations that many integrated development environments offer.

Renaming methods is an example of a refactoring. Doing so in plain JavaScript can be tricky because the same name might refer to different methods. TypeScript has more information on how methods and types are connected, which makes renaming methods safer there.

2.1.6TypeScript can compile new features to older code

TypeScript tends to quickly support ECMAScript stage 4 features (such features are scheduled to be included in the next ECMAScript version). When we compile to JavaScript, the compiler option --target lets us specify the ECMAScript version that the output is compatible with. Then any incompatible feature (that was introduced later) will be compiled to equivalent, compatible code.

Note that this kind of support for older ECMAScript versions does not require TypeScript or static typing: The JavaScript compiler Babel does it too, but it compiles JavaScript to JavaScript.

2.2The downsides of using TypeScript
  • It is an added layer on top of JavaScript: more complexity, more things to learn, etc.
  • It introduces a compilation step when writing code.
  • npm packages can only be used if they have static type definitions.
    • These days, many packages either come with type definitions or there are type definitions available for them on DefinitelyTyped. However, especially the latter can occasionally be slightly wrong, which leads to issues that you dont have without static typing.
  • Getting static types right is occasionally difficult. My recommendation here is to keep things as simple as possible for example: Dont overdo generics and type variables.
2.3TypeScript myths
2.3.1TypeScript code is heavyweight
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Tackling TypeScript»

Look at similar books to Tackling TypeScript. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Tackling TypeScript»

Discussion, reviews of the book Tackling TypeScript and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.