-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init translation of _Creating Types from Types
- Loading branch information
1 parent
3aac961
commit 29ee73f
Showing
1 changed file
with
12 additions
and
14 deletions.
There are no files selected for viewing
26 changes: 12 additions & 14 deletions
26
docs/documentation/zh/handbook-v2/Type Manipulation/_Creating Types from Types.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
--- | ||
title: Creating Types from Types | ||
title: 用现有类型创建新类型 | ||
layout: docs | ||
permalink: /zh/docs/handbook/2/types-from-types.html | ||
oneline: "An overview of the ways in which you can create more types from existing types." | ||
oneline: "概述如何从现有的类型创建更多的类型。" | ||
--- | ||
|
||
TypeScript's type system is very powerful because it allows expressing types _in terms of other types_. | ||
TypeScript 的类型系统非常强大,因为它允许用_其他类型_表达类型。 | ||
|
||
The simplest form of this idea is generics. Additionally, we have a wide variety of _type operators_ available to use. | ||
It's also possible to express types in terms of _values_ that we already have. | ||
这个想法最简单的形式就是泛型。此外,我们还有多种_类型操作符_可以使用。我们也可以用我们已有的_值_表达类型。 | ||
|
||
By combining various type operators, we can express complex operations and values in a succinct, maintainable way. | ||
In this section we'll cover ways to express a new type in terms of an existing type or value. | ||
通过组合不同的类型操作符,我们可以用简洁、可维护的方式表达复杂的操作和值。在本部分中,我们将介绍如何用现有的类型或值表达新的类型。 | ||
|
||
- [Generics](/docs/handbook/2/generics.html) - Types which take parameters | ||
- [Keyof Type Operator](/docs/handbook/2/keyof-types.html) - Using the `keyof` operator to create new types | ||
- [Typeof Type Operator](/docs/handbook/2/typeof-types.html) - Using the `typeof` operator to create new types | ||
- [Indexed Access Types](/docs/handbook/2/indexed-access-types.html) - Using `Type['a']` syntax to access a subset of a type | ||
- [Conditional Types](/docs/handbook/2/conditional-types.html) - Types which act like if statements in the type system | ||
- [Mapped Types](/docs/handbook/2/mapped-types.html) - Creating types by mapping each property in an existing type | ||
- [Template Literal Types](/docs/handbook/2/template-literal-types.html) - Mapped types which change properties via template literal strings | ||
- [泛型](/zh/docs/handbook/2/generics.html)——带有参数的类型 | ||
- [Keyof 类型操作符](/zh/docs/handbook/2/keyof-types.html)——使用 `keyof` 操作符创建新的类型 | ||
- [Typeof 类型操作符](/zh/docs/handbook/2/typeof-types.html)——使用 `typeof` 操作符创建新的类型 | ||
- [索引访问类型](/zh/docs/handbook/2/indexed-access-types.html)——使用 `Type['a']` 语法访问类型的子集 | ||
- [条件类型](/zh/docs/handbook/2/conditional-types.html)——类型系统中类似于 if 语句的类型 | ||
- [映射类型](/zh/docs/handbook/2/mapped-types.html)——通过映射现有类型的每个属性创建类型 | ||
- [模板字面量类型](/zh/docs/handbook/2/template-literal-types.html)——通过模板字面量字符串改变属性的映射类型 |