-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
134 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
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
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
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,4 +1,4 @@ | ||
/** | ||
* @title 배열의 요소 타입을 추론하는 타입. | ||
* @title Type for Inferring the Element Type of an Array. | ||
*/ | ||
export type ElementOf<T extends Array<any>> = T extends Array<infer Element> ? Element : never; |
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,9 +1,13 @@ | ||
/** | ||
* 구현 방법 | ||
* Implementation method | ||
*/ | ||
type Expression<X> = <T>() => T extends X ? 1 : 2; | ||
|
||
/** | ||
* @title 두 타입이 동일한 타입인지 확인하기 위한 타입 | ||
* @title Type for Checking if Two Types are Equal. | ||
* | ||
* The `Equal<X, Y>` type uses conditional types and a helper type `Expression<X>` | ||
* to determine if two types `X` and `Y` are the same. It returns `true` if they are | ||
* equal, and `false` otherwise. | ||
*/ | ||
export type Equal<X, Y> = Expression<X> extends Expression<Y> ? true : false; |
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
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
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
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,4 +1,14 @@ | ||
/** | ||
* @title `any` 타입을 검증하는 타입. | ||
* @title Type for checking if a type is `any`. | ||
* | ||
* This type uses a conditional check to determine if the provided type `T` is `any`. | ||
* - It works by checking if the type `T` extends from a condition that results in `true` when `T` is `any`, and `false` otherwise. | ||
* - If `T` is `any`, it resolves to `true`, otherwise it resolves to `false`. | ||
* | ||
* Example usage: | ||
* ```ts | ||
* type Test1 = IsAny<any>; // true | ||
* type Test2 = IsAny<string>; // false | ||
* ``` | ||
*/ | ||
export type IsAny<T> = 0 extends 1 & T ? true : false; |
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