提交 13c510e1 编写于 作者: Q qiang

docs: UTS type alias

上级 0b6837d7
# type(Type Aliases) # type(Type Aliases)
使用类型别名可以为任何类型命名。 使用类型别名可以为任何类型命名。类型别名不支持在局部作用域内定义。
## 一般用法 ## 一般用法
使用 `type` 关键字来定义类型别名。 使用 `type` 关键字来定义类型别名。
```ts ```ts
type str = string type Str = string
type num = number type Fn = () => void
const str: Str = 'test'
const fn: Fn = () => {}
``` ```
使用类型别名不会创建类型的副本,他和原始类型保持同一份引用。 使用类型别名不会创建类型的副本,他和原始类型保持同一份引用。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册