yanlele / TypeScript-learning

学习typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

学习TypeScript

目录

起步

首先要安装typescript:
npm install -g typescript

配置文件: tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "typeRoots": [
      "/node_modules/@type",
      "/typings/modules"
    ],
    "allowJs": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "book/12、学习TypeScript/dist",
    "baseUrl": "."
  },
  "include": [
    "book/12、学习TypeScript/src/**/*"
  ],
  "exclude": [
    "/node_modules"
  ]
}

编写好的TS文件直接运行命令行 tsc 就可以直接打包了。

其他

踩坑记录

  • 1、关于静态方法和静态变量的问题;
    在一个类中。类里面的静态方法, 是不能调用这个类本身的属性的。但是可以调用静态属性。

申明文件

项目配置

About

学习typescript


Languages

Language:TypeScript 99.3%Language:JavaScript 0.7%