示例工程 01-orientation

01-orientation/01-hello-types/README.md

markdown · 0.6 KB

运行:01 · hello-types

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

# 01 · hello-types
 
**演示**:带类型标注的函数编译成普通 JS,浏览器与 Node 看到的都只是值。
**运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开
`http://localhost:8080/examples/01-orientation/01-hello-types/`;开 Console。
**预期控制台输出**:
```text
Hello, Ada (#1)
Hello, Linus (#2)
```
**类型检查**:`node node_modules/typescript/bin/tsc -p examples/01-orientation/01-hello-types/tsconfig.json --noEmit`
**注意**:需 `http://` 协议;`file://` 下 `type="module"` 会被 CORS 拦下。