typescript 5分钟内输入TypeScript。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript 5分钟内输入TypeScript。相关的知识,希望对你有一定的参考价值。

# Transpile hello.ts

```bash
$ tsc.ts hello.ts
```

> You should have `hello.js` afterwards
<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="hello.js"></script>
    </head>
    <body>
        <button onclick="sayHello()">Say Hello</button>
    </body>
</html>
class Student {
    fullName: string;
    constructor(public firstName: string, public middleInitial: string, public lastName: string) {
        this.fullName = firstName + " " + middleInitial + " " + lastName;
    }
}

interface Person {
    firstName: string;
    lastName: string;
}

function hello(person: Person) {
    return "Hello, " + person.firstName + " " + person.lastName;
}

function sayHello() {
    var user = new Student("Nasrul", "Hazim", "Mohamad");
    alert(hello(user));
}

以上是关于typescript 5分钟内输入TypeScript。的主要内容,如果未能解决你的问题,请参考以下文章

2018-05-09 5分钟入门CTS-尝鲜中文版TypeScript

如何在1分钟内学会“TypeScript”

5分钟了解TypeScript

干货如何5分钟内解决实时输入仿真(超简单)

linux下awk查找日志文件5分钟内是不是出现某个关键字

VScode搭建TypeScript开发环境