Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The JavaScript Workshop

You're reading from   The JavaScript Workshop Learn to develop interactive web applications with clean and maintainable JavaScript code

Arrow left icon
Product type Paperback
Published in Nov 2019
Publisher Packt
ISBN-13 9781838641917
Length 802 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (8):
Arrow left icon
Jahred Love Jahred Love
Author Profile Icon Jahred Love
Jahred Love
Alonzo L. Hosford Alonzo L. Hosford
Author Profile Icon Alonzo L. Hosford
Alonzo L. Hosford
Florian Sloot Florian Sloot
Author Profile Icon Florian Sloot
Florian Sloot
Daniel Rosenbaum Daniel Rosenbaum
Author Profile Icon Daniel Rosenbaum
Daniel Rosenbaum
Philip Kirkbride Philip Kirkbride
Author Profile Icon Philip Kirkbride
Philip Kirkbride
Nick Turner Nick Turner
Author Profile Icon Nick Turner
Nick Turner
Gaurav Mehla Gaurav Mehla
Author Profile Icon Gaurav Mehla
Gaurav Mehla
Joseph Labrecque Joseph Labrecque
Author Profile Icon Joseph Labrecque
Joseph Labrecque
+4 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Getting to Know JavaScript 2. Working with JavaScript FREE CHAPTER 3. Programming Fundamentals 4. JavaScript Libraries and Frameworks 5. Beyond the Fundamentals 6. Understanding Core Concepts 7. Popping the Hood 8. Browser APIs 9. Working with Node.js 10. Accessing External Resources 11. Creating Clean and Maintainable Code 12. Using NextGeneration JavaScript 13. JavaScript Programming Paradigms 14. Understanding Functional Programming 15. Asynchronous Tasks Appendix

12. Using Next-Generation JavaScript

Activity 12.01: Creating a Project to Recognize and Compile TypeScript Files

Solution:

  1. The first step is to create a new project directory, then cd into it, and initialize it for npm:
    mkdir my_app
    cd my_app
    npm init
  2. Next, install Parcel as a global library:
    npm install -g parcel
  3. Now, you will need to install TypeScript, which you can also save as a global library:
    npm install -g typescript
  4. To generate the configuration for TypeScript, you simply need to call the TypeScript CLI tool, tsc, and pass it the --init flag:
    tsc --init

    If all went well, you should be presented with a message such as the following:

    message TS6071: Successfully created a tsconfig.json file.

    You should also find a new tsconfig.json file in the root of your project folder.

  5. Next, create a directory called src and place an index.ts file within it. Add the following code as the file's content:
    const message:string = "Hello, World!";
    console...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime