Using-Typescript-with-React
与 React 一起使用 TypeScript
```typescript
function makeTea(temp: 'hot' | 'cold'): string {
return `Here is tea with temperature of ${temp}`;
}
```
在您的计算机上全局和本地安装 TypeScript。
```bash
$ npm install -g typescript
{ "compilerOptions": { "target": "ES6", "outDir": "dist", "strictNullChecks": true }, "include": [ "**/*.ts" ] }
```
我们并不总是需要在全球范围内安装 TypeScript,我们也可以在本地安装和使用它。
```bash
$ npm i typescript
```
```typescript
function makeTea(temp: 'hot' | 'cold'): string {
return `Here is tea with temperature of ${temp}`;
}
```
在您的计算机上全局和本地安装 TypeScript。
```bash
$ npm install -g typescript
{ "compilerOptions": { "target": "ES6", "outDir": "dist", "strictNullChecks": true }, "include": [ "**/*.ts" ] }
```
我们并不总是需要在全球范围内安装 TypeScript,我们也可以在本地安装和使用它。
```bash
$ npm i typescript
```
220.35KB
文件大小:
评论区