chore: update easy readme (#12446)

This commit is contained in:
JarvisArt 2022-07-06 12:08:15 +08:00 committed by GitHub
parent cd6ad1c45a
commit eddde5dd38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 110 additions and 29 deletions

View File

@ -2,7 +2,7 @@
組み込みの型ユーティリティ`Pick<T, K>`を使用せず、`T`から`K`のプロパティを抽出する型を実装します。
例えば
例えば
```ts
interface Todo {

View File

@ -4,7 +4,7 @@ Implement the built-in `Pick<T, K>` generic without using it.
Constructs a type by picking the set of properties `K` from `T`
For example
For example:
```ts
interface Todo {

View File

@ -2,7 +2,7 @@
組み込みの型ユーティリティ`Readonly<T>`を使用せず、`T` のすべてのプロパティを読み取り専用にする型を実装します。実装された型のプロパティは再割り当てできません。
例えば
例えば
```ts
interface Todo {

View File

@ -5,7 +5,7 @@ Implement the built-in `Readonly<T>` generic without using it.
Constructs a type with all properties of T set to readonly, meaning the properties of the constructed type cannot be reassigned.
For example
For example:
```ts
interface Todo {

View File

@ -2,7 +2,7 @@
タプルを受け取り、その各値のkey/valueを持つオブジェクトの型に変換する型を実装します。
例えば
例えば
```ts
const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const

View File

@ -2,7 +2,7 @@
Give an array, transform into an object type and the key/value must in the given array.
For example
For example:
```ts
const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const

View File

@ -2,7 +2,7 @@
配列`T`を受け取り、その最初のプロパティの型を返す`First<T>`を実装します。
例えば
例えば
```ts
type arr1 = ['a', 'b', 'c']

View File

@ -3,7 +3,7 @@
Implement a generic `First<T>` that takes an Array `T` and returns it's first element's type.
For example
For example:
```ts
type arr1 = ['a', 'b', 'c']

View File

@ -2,7 +2,7 @@
タプル`T`を受け取り、そのタプルの長さを返す型`Length<T>`を実装します。
例えば
例えば
```ts
type tesla = ['tesla', 'model 3', 'model X', 'model Y']

View File

@ -2,7 +2,7 @@
For given a tuple, you need create a generic `Length`, pick the length of the tuple
For example
For example:
```ts
type tesla = ['tesla', 'model 3', 'model X', 'model Y']

View File

@ -2,4 +2,10 @@
組み込みの型ユーティリティ`Exclude <T, U>`を使用せず、`U`に割り当て可能な型を`T`から除外する型を実装します。
例えば:
```ts
type Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c'
```
<!--info-footer-start--><br><a href="../../README.ja.md" target="_blank"><img src="https://img.shields.io/badge/-%E6%88%BB%E3%82%8B-grey" alt="戻る"/></a> <a href="https://tsch.js.org/43/answer/ja" target="_blank"><img src="https://img.shields.io/badge/-%E8%A7%A3%E7%AD%94%E3%82%92%E5%85%B1%E6%9C%89-teal" alt="解答を共有"/></a> <a href="https://tsch.js.org/43/solutions" target="_blank"><img src="https://img.shields.io/badge/-%E8%A7%A3%E7%AD%94%E3%82%92%E7%A2%BA%E8%AA%8D-de5a77?logo=awesome-lists&logoColor=white" alt="解答を確認"/></a> <!--info-footer-end-->

View File

@ -2,4 +2,10 @@
`T`에서 `U`에 할당할 수 있는 타입을 제외하는 내장 제네릭 `Exclude<T, U>`를 이를 사용하지 않고 구현하세요.
예시:
```ts
type Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c'
```
<!--info-footer-start--><br><a href="../../README.ko.md" target="_blank"><img src="https://img.shields.io/badge/-%EB%8F%8C%EC%95%84%EA%B0%80%EA%B8%B0-grey" alt="돌아가기"/></a> <a href="https://tsch.js.org/43/answer/ko" target="_blank"><img src="https://img.shields.io/badge/-%EC%A0%95%EB%8B%B5%20%EA%B3%B5%EC%9C%A0%ED%95%98%EA%B8%B0-teal" alt="정답 공유하기"/></a> <a href="https://tsch.js.org/43/solutions" target="_blank"><img src="https://img.shields.io/badge/-%EC%A0%95%EB%8B%B5%20%EB%B3%B4%EA%B8%B0-de5a77?logo=awesome-lists&logoColor=white" alt="정답 보기"/></a> <!--info-footer-end-->

View File

@ -1,7 +1,13 @@
<!--info-header-start--><h1>Exclude <img src="https://img.shields.io/badge/-easy-7aad0c" alt="easy"/> <img src="https://img.shields.io/badge/-%23built--in-999" alt="#built-in"/></h1><blockquote><p>by Zheeeng <a href="https://github.com/zheeeng" target="_blank">@zheeeng</a></p></blockquote><p><a href="https://tsch.js.org/43/play" target="_blank"><img src="https://img.shields.io/badge/-Take%20the%20Challenge-3178c6?logo=typescript&logoColor=white" alt="Take the Challenge"/></a> &nbsp;&nbsp;&nbsp;<a href="./README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-gray" alt="简体中文"/></a> <a href="./README.ja.md" target="_blank"><img src="https://img.shields.io/badge/-%E6%97%A5%E6%9C%AC%E8%AA%9E-gray" alt="日本語"/></a> <a href="./README.ko.md" target="_blank"><img src="https://img.shields.io/badge/-%ED%95%9C%EA%B5%AD%EC%96%B4-gray" alt="한국어"/></a> </p><!--info-header-end-->
Implement the built-in Exclude<T, U>
> Exclude from T those types that are assignable to U
For example:
```ts
type Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c'
```
<!--info-footer-start--><br><a href="../../README.md" target="_blank"><img src="https://img.shields.io/badge/-Back-grey" alt="Back"/></a> <a href="https://tsch.js.org/43/answer" target="_blank"><img src="https://img.shields.io/badge/-Share%20your%20Solutions-teal" alt="Share your Solutions"/></a> <a href="https://tsch.js.org/43/solutions" target="_blank"><img src="https://img.shields.io/badge/-Check%20out%20Solutions-de5a77?logo=awesome-lists&logoColor=white" alt="Check out Solutions"/></a> <!--info-footer-end-->

View File

@ -3,6 +3,13 @@
> 欢迎 PR 改进翻译质量。
实现内置的Exclude <T, U>类型,但不能直接使用它本身。
>从联合类型T中排除U的类型成员来构造一个新的类型。
> 从联合类型T中排除U的类型成员来构造一个新的类型。
例如:
```ts
type Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c'
```
<!--info-footer-start--><br><a href="../../README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E8%BF%94%E5%9B%9E%E9%A6%96%E9%A1%B5-grey" alt="返回首页"/></a> <a href="https://tsch.js.org/43/answer/zh-CN" target="_blank"><img src="https://img.shields.io/badge/-%E5%88%86%E4%BA%AB%E4%BD%A0%E7%9A%84%E8%A7%A3%E7%AD%94-teal" alt="分享你的解答"/></a> <a href="https://tsch.js.org/43/solutions" target="_blank"><img src="https://img.shields.io/badge/-%E6%9F%A5%E7%9C%8B%E8%A7%A3%E7%AD%94-de5a77?logo=awesome-lists&logoColor=white" alt="查看解答"/></a> <!--info-footer-end-->

View File

@ -1,7 +1,14 @@
<!--info-header-start--><h1>Awaited <img src="https://img.shields.io/badge/-%E5%88%9D%E7%B4%9A-7aad0c" alt="初級"/> <img src="https://img.shields.io/badge/-%23promise-999" alt="#promise"/> <img src="https://img.shields.io/badge/-%23built--in-999" alt="#built-in"/></h1><blockquote><p>by Maciej Sikora <a href="https://github.com/maciejsikora" target="_blank">@maciejsikora</a></p></blockquote><p><a href="https://tsch.js.org/189/play/ja" target="_blank"><img src="https://img.shields.io/badge/-%E6%8C%91%E6%88%A6%E3%81%99%E3%82%8B-3178c6?logo=typescript&logoColor=white" alt="挑戦する"/></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"><img src="https://img.shields.io/badge/-English-gray" alt="English"/></a> <a href="./README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-gray" alt="简体中文"/></a> <a href="./README.ko.md" target="_blank"><img src="https://img.shields.io/badge/-%ED%95%9C%EA%B5%AD%EC%96%B4-gray" alt="한국어"/></a> </p><!--info-header-end-->
Promise ライクな型が内包する型をどのように取得すればよいでしょうか。
例えば、`Promise<ExampleType>`という型がある場合、どのようにして ExampleType を取得すればよいでしょうか。
例えば:`Promise<ExampleType>`という型がある場合、どのようにして ExampleType を取得すればよいでしょうか。
```ts
type ExampleType = Promise<string>
type Result = <MyAwaited<ExampleType> // string
```
> この問題の元記事は [original article](https://dev.to/macsikora/advanced-typescript-exercises-question-1-45k4) by [@maciejsikora](https://github.com/maciejsikora) です。

View File

@ -1,6 +1,14 @@
<!--info-header-start--><h1>Awaited <img src="https://img.shields.io/badge/-%EC%89%AC%EC%9B%80-7aad0c" alt="쉬움"/> <img src="https://img.shields.io/badge/-%23promise-999" alt="#promise"/> <img src="https://img.shields.io/badge/-%23built--in-999" alt="#built-in"/></h1><blockquote><p>by Maciej Sikora <a href="https://github.com/maciejsikora" target="_blank">@maciejsikora</a></p></blockquote><p><a href="https://tsch.js.org/189/play/ko" target="_blank"><img src="https://img.shields.io/badge/-%EB%8F%84%EC%A0%84%ED%95%98%EA%B8%B0-3178c6?logo=typescript&logoColor=white" alt="도전하기"/></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"><img src="https://img.shields.io/badge/-English-gray" alt="English"/></a> <a href="./README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-gray" alt="简体中文"/></a> <a href="./README.ja.md" target="_blank"><img src="https://img.shields.io/badge/-%E6%97%A5%E6%9C%AC%E8%AA%9E-gray" alt="日本語"/></a> </p><!--info-header-end-->
Promise와 같은 타입에 감싸인 타입이 있을 때, 안에 감싸인 타입이 무엇인지 어떻게 알 수 있을까요? 예를 들어 `Promise<ExampleType>`이 있을 때, `ExampleType`을 어떻게 얻을 수 있을까요?
Promise와 같은 타입에 감싸인 타입이 있을 때, 안에 감싸인 타입이 무엇인지 어떻게 알 수 있을까요?
예시: 들어 `Promise<ExampleType>`이 있을 때, `ExampleType`을 어떻게 얻을 수 있을까요?
```ts
type ExampleType = Promise<string>
type Result = <MyAwaited<ExampleType> // string
```
> 출처: [original article](https://dev.to/macsikora/advanced-typescript-exercises-question-1-45k4) by [@maciejsikora](https://github.com/maciejsikora)

View File

@ -1,6 +1,14 @@
<!--info-header-start--><h1>Awaited <img src="https://img.shields.io/badge/-easy-7aad0c" alt="easy"/> <img src="https://img.shields.io/badge/-%23promise-999" alt="#promise"/> <img src="https://img.shields.io/badge/-%23built--in-999" alt="#built-in"/></h1><blockquote><p>by Maciej Sikora <a href="https://github.com/maciejsikora" target="_blank">@maciejsikora</a></p></blockquote><p><a href="https://tsch.js.org/189/play" target="_blank"><img src="https://img.shields.io/badge/-Take%20the%20Challenge-3178c6?logo=typescript&logoColor=white" alt="Take the Challenge"/></a> &nbsp;&nbsp;&nbsp;<a href="./README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-gray" alt="简体中文"/></a> <a href="./README.ja.md" target="_blank"><img src="https://img.shields.io/badge/-%E6%97%A5%E6%9C%AC%E8%AA%9E-gray" alt="日本語"/></a> <a href="./README.ko.md" target="_blank"><img src="https://img.shields.io/badge/-%ED%95%9C%EA%B5%AD%EC%96%B4-gray" alt="한국어"/></a> </p><!--info-header-end-->
If we have a type which is wrapped type like Promise. How we can get a type which is inside the wrapped type? For example if we have `Promise<ExampleType>` how to get ExampleType?
If we have a type which is wrapped type like Promise. How we can get a type which is inside the wrapped type?
For example: if we have `Promise<ExampleType>` how to get ExampleType?
```ts
type ExampleType = Promise<string>
type Result = <MyAwaited<ExampleType> // string
```
> This question is ported from the [original article](https://dev.to/macsikora/advanced-typescript-exercises-question-1-45k4) by [@maciejsikora](https://github.com/maciejsikora)

View File

@ -2,7 +2,13 @@
假如我们有一个 Promise 对象,这个 Promise 对象会返回一个类型。在 TS 中,我们用 Promise<T> 中的 T 来描述这个 Promise 返回的类型。请你实现一个类型,可以获取这个类型。
比如:`Promise<ExampleType>`,请你返回 ExampleType 类型。
例如:`Promise<ExampleType>`,请你返回 ExampleType 类型。
```ts
type ExampleType = Promise<string>
type Result = <MyAwaited<ExampleType> // string
```
> 这个挑战来自于 [@maciejsikora](https://github.com/maciejsikora) 的文章:[original article](https://dev.to/macsikora/advanced-typescript-exercises-question-1-45k4)

View File

@ -3,7 +3,7 @@
条件値`C``C`が truthy である場合の戻り値の型`T``C`が falsy である場合の戻り値の型`F`を受け取る`If`を実装します。
条件値`C``true``false`のどちらかであることが期待されますが、`T``F` は任意の型をとることができます。
例えば
例えば
```ts
type A = If<true, 'a', 'b'>; // expected to be 'a'

View File

@ -2,7 +2,7 @@
实现一个 `IF` 类型,它接收一个条件类型 `C` ,一个判断为真时的返回类型 `T` ,以及一个判断为假时的返回类型 `F``C` 只能是 `true` 或者 `false` `T``F` 可以是任意类型。
举例:
例如:
```ts
type A = If<true, 'a', 'b'> // expected to be 'a'

View File

@ -2,7 +2,7 @@
JavaScript の`Array.concat`関数を型システムに実装します。この型は 2 つの引数を受け取り、受け取ったイテレータの要素を順に含む新しい配列を返します。
例えば
例えば
```ts
type Result = Concat<[1], [2]>; // expected to be [1, 2]

View File

@ -2,7 +2,7 @@
Implement the JavaScript `Array.concat` function in the type system. A type takes the two arguments. The output should be a new array that includes inputs in ltr order
For example
For example:
```ts
type Result = Concat<[1], [2]> // expected to be [1, 2]

View File

@ -2,7 +2,7 @@
在类型系统里实现 JavaScript 内置的 `Array.concat` 方法,这个类型接受两个参数,返回的新数组类型应该按照输入参数从左到右的顺序合并为一个新的数组。
举例,
例如:
```ts
type Result = Concat<[1], [2]> // expected to be [1, 2]

View File

@ -2,7 +2,7 @@
JavaScriptの`Array.include`関数を型システムに実装します。この型は、2 つの引数を受け取り、`true``false`を出力しなければなりません。
例えば
例えば
```ts
type isPillarMen = Includes<['Kars', 'Esidisi', 'Wamuu', 'Santana'], 'Dio'> // expected to be `false`

View File

@ -2,7 +2,7 @@
Implement the JavaScript `Array.includes` function in the type system. A type takes the two arguments. The output should be a boolean `true` or `false`.
For example
For example:
```ts
type isPillarMen = Includes<['Kars', 'Esidisi', 'Wamuu', 'Santana'], 'Dio'> // expected to be `false`

View File

@ -2,7 +2,7 @@
在类型系统里实现 JavaScript 的 `Array.includes` 方法,这个类型接受两个参数,返回的类型要么是 `true` 要么是 `false`
举例来说,
例如:
```ts
type isPillarMen = Includes<['Kars', 'Esidisi', 'Wamuu', 'Santana'], 'Dio'> // expected to be `false`

View File

@ -2,7 +2,7 @@
```Array.push```のジェネリックバージョンを実装します。
例えば
例えば
```typescript
type Result = Push<[1, 2], '3'> // [1, 2, '3']

View File

@ -2,7 +2,7 @@
Implement the generic version of ```Array.push```
For example
For example:
```typescript
type Result = Push<[1, 2], '3'> // [1, 2, '3']

View File

@ -2,7 +2,7 @@
在类型系统里实现通用的 ```Array.push``` 。
举例如下,
例如:
```typescript
type Result = Push<[1, 2], '3'> // [1, 2, '3']

View File

@ -2,7 +2,7 @@
```Array.unshift```の型バージョンを実装します。
例えば
例えば
```typescript
type Result = Unshift<[1, 2], 0> // [0, 1, 2,]

View File

@ -2,7 +2,7 @@
Implement the type version of ```Array.unshift```
For example
For example:
```typescript
type Result = Unshift<[1, 2], 0> // [0, 1, 2,]

View File

@ -2,7 +2,7 @@
实现类型版本的 ```Array.unshift```。
举例,
例如:
```typescript
type Result = Unshift<[1, 2], 0> // [0, 1, 2,]

View File

@ -2,5 +2,12 @@
組み込みの型ユーティリティ`Parameters<T>`を使用せず、`T`からタプル型を構築する型を実装します。
例えば:
```ts
const foo = (arg1: string, arg2: number): void => {}
type FunctionParamsType = MyParameters<foo> // [arg1: string, arg2: number]
```
<!--info-footer-start--><br><a href="../../README.ja.md" target="_blank"><img src="https://img.shields.io/badge/-%E6%88%BB%E3%82%8B-grey" alt="戻る"/></a> <a href="https://tsch.js.org/3312/answer/ja" target="_blank"><img src="https://img.shields.io/badge/-%E8%A7%A3%E7%AD%94%E3%82%92%E5%85%B1%E6%9C%89-teal" alt="解答を共有"/></a> <a href="https://tsch.js.org/3312/solutions" target="_blank"><img src="https://img.shields.io/badge/-%E8%A7%A3%E7%AD%94%E3%82%92%E7%A2%BA%E8%AA%8D-de5a77?logo=awesome-lists&logoColor=white" alt="解答を確認"/></a> <!--info-footer-end-->

View File

@ -2,5 +2,12 @@
내장 제네릭 `Parameters<T>`를 이를 사용하지 않고 구현하세요.
예시:
```ts
const foo = (arg1: string, arg2: number): void => {}
type FunctionParamsType = MyParameters<foo> // [arg1: string, arg2: number]
```
<!--info-footer-start--><br><a href="../../README.ko.md" target="_blank"><img src="https://img.shields.io/badge/-%EB%8F%8C%EC%95%84%EA%B0%80%EA%B8%B0-grey" alt="돌아가기"/></a> <a href="https://tsch.js.org/3312/answer/ko" target="_blank"><img src="https://img.shields.io/badge/-%EC%A0%95%EB%8B%B5%20%EA%B3%B5%EC%9C%A0%ED%95%98%EA%B8%B0-teal" alt="정답 공유하기"/></a> <a href="https://tsch.js.org/3312/solutions" target="_blank"><img src="https://img.shields.io/badge/-%EC%A0%95%EB%8B%B5%20%EB%B3%B4%EA%B8%B0-de5a77?logo=awesome-lists&logoColor=white" alt="정답 보기"/></a> <!--info-footer-end-->

View File

@ -2,5 +2,12 @@
Implement the built-in Parameters<T> generic without using it.
For example:
```ts
const foo = (arg1: string, arg2: number): void => {}
type FunctionParamsType = MyParameters<foo> // [arg1: string, arg2: number]
```
<!--info-footer-start--><br><a href="../../README.md" target="_blank"><img src="https://img.shields.io/badge/-Back-grey" alt="Back"/></a> <a href="https://tsch.js.org/3312/answer" target="_blank"><img src="https://img.shields.io/badge/-Share%20your%20Solutions-teal" alt="Share your Solutions"/></a> <a href="https://tsch.js.org/3312/solutions" target="_blank"><img src="https://img.shields.io/badge/-Check%20out%20Solutions-de5a77?logo=awesome-lists&logoColor=white" alt="Check out Solutions"/></a> <!--info-footer-end-->

View File

@ -2,6 +2,12 @@
实现内置的 Parameters<T> 类型,而不是直接使用它,可参考[TypeScript官方文档](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype)。
例如:
```ts
const foo = (arg1: string, arg2: number): void => {}
type FunctionParamsType = MyParameters<foo> // [arg1: string, arg2: number]
```
<!--info-footer-start--><br><a href="../../README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E8%BF%94%E5%9B%9E%E9%A6%96%E9%A1%B5-grey" alt="返回首页"/></a> <a href="https://tsch.js.org/3312/answer/zh-CN" target="_blank"><img src="https://img.shields.io/badge/-%E5%88%86%E4%BA%AB%E4%BD%A0%E7%9A%84%E8%A7%A3%E7%AD%94-teal" alt="分享你的解答"/></a> <a href="https://tsch.js.org/3312/solutions" target="_blank"><img src="https://img.shields.io/badge/-%E6%9F%A5%E7%9C%8B%E8%A7%A3%E7%AD%94-de5a77?logo=awesome-lists&logoColor=white" alt="查看解答"/></a> <!--info-footer-end-->