TypeScript in the browser

    • Install
    • Install Git
    • Create a project dir:
    1. cd your-project
    • Create tsconfig.json:
    • Create package.json.
    1. {
    2. "name": "react-typescript",
    3. "version": "0.0.0",
    4. "license": "MIT",
    5. "type": "git",
    6. "url": "https://github.com/basarat/typescript-react.git"
    7. },
    8. "scripts": {
    9. "build": "webpack ./webpack.config.js -p",
    10. },
    11. "dependencies": {
    12. "@types/react": "16.0.40",
    13. "@types/react-dom": "16.0.4",
    14. "react": "16.2.0",
    15. "react-dom": "16.2.0",
    16. "ts-loader": "4.0.1",
    17. "typescript": "2.7.2",
    18. "webpack": "4.1.1",
    19. "webpack-dev-server": "3.1.1"
    20. }
    21. }
    • Create a to bundle your modules into a single app.js file that contains all your resources:
    • public/index.html file that will be served from your webserver:
    1. <html>
    2. <body>
    3. <div id="root"></div>
    4. <script src="./build/app.js"></script>
    5. </body>
    6. </html>
    • src/app/app.tsx that is your frontend application entry point:

    Develop your amazing application

    • Do live development by running npm start.