博客
关于我
【TS基础】介绍 、安装、编译
阅读量:615 次
发布时间:2019-03-13

本文共 718 字,大约阅读时间需要 2 分钟。

TypeScript的介绍和安装编译指南

TypeScript由微软开发,它是一种开源的编程语言。它是JavaScript的超集,完全兼容ES6/ES5规范,同时扩展了JavaScript的语法功能。

TypeScript在设计上借鉴了后端语言如Java和C#,支持面向对象编程,因此非常适合用于大型企业级应用开发。

虽然TypeScript最初由微软开发,但它现在得到了社区的广泛支持。例如,Angular框架、Vue和React等主流前端框架都支持TypeScript。此外,Node.js生态系统中也流行使用TypeScript。

安装与编译

安装TypeScript可以选择以下几种方法:

  • 使用npm安装:

    npm install -g typescript

  • 使用cnpm安装:

    cnpm install -g typescript

  • 使用yarn安装:

    yarn global add typescript

  • 如果你使用cnpm(建议在Windows环境下使用),请先安装cnpm:

    npm install -g cnpm --registry=https://registry.npm.taobao.org

    如果你希望手动编译,可以使用命令:

    tsc 文件名

    Visual Studio Code支持自动编译TypeScript文件。你只需执行以下步骤:

  • 初始化tsconfig.json:

    tsc --init

  • 启用"tsc:监视-tsconfig.json"任务,这样VSCode会自动编译your TypeScript文件。

  • 通过这些方法,你可以轻松设置TypeScript开发环境,开始你的 tuyệt vời开发之旅!

    转载地址:http://nxjaz.baihongyu.com/

    你可能感兴趣的文章
    npm安装 出现 npm ERR! code ETIMEDOUT npm ERR! syscall connect npm ERR! errno ETIMEDOUT npm ERR! 解决方法
    查看>>
    npm安装crypto-js 如何安装crypto-js, python爬虫安装加解密插件 找不到模块crypto-js python报错解决丢失crypto-js模块
    查看>>
    npm安装教程
    查看>>
    npm报错Cannot find module ‘webpack‘ Require stack
    查看>>
    npm报错Failed at the node-sass@4.14.1 postinstall script
    查看>>
    npm报错fatal: Could not read from remote repository
    查看>>
    npm报错File to import not found or unreadable: @/assets/styles/global.scss.
    查看>>
    npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
    查看>>
    npm淘宝镜像过期npm ERR! request to https://registry.npm.taobao.org/vuex failed, reason: certificate has ex
    查看>>
    npm版本过高问题
    查看>>
    npm的“--force“和“--legacy-peer-deps“参数
    查看>>
    npm的安装和更新---npm工作笔记002
    查看>>
    npm的常用配置项---npm工作笔记004
    查看>>
    npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
    查看>>
    npm编译报错You may need an additional loader to handle the result of these loaders
    查看>>
    npm设置淘宝镜像、升级等
    查看>>
    npm设置源地址,npm官方地址
    查看>>
    npm设置镜像如淘宝:http://npm.taobao.org/
    查看>>
    npm配置安装最新淘宝镜像,旧镜像会errror
    查看>>
    NPM酷库052:sax,按流解析XML
    查看>>