Skip to content

Commit

Permalink
🏷️ Improve types definition to shortly
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Jul 3, 2021
1 parent 3e3e777 commit b4a538b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions common/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ type InitString<T extends string> = T extends `${infer F}${infer R}`
*/
type Init<T extends string | readonly unknown[]> = T extends string
? InitString<T>
: T extends readonly never[] | []
? []
: T extends readonly [...infer I, unknown]
? I
: T
Expand Down
2 changes: 0 additions & 2 deletions common/last.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ type LastString<T extends string> = T extends `${infer L}${infer R}`
*/
type Last<T extends string | readonly unknown[]> = T extends string
? LastString<T>
: T extends never[] | []
? undefined
: T extends readonly [...infer _, infer L]
? L
: T[T['length']] | undefined
Expand Down
2 changes: 0 additions & 2 deletions common/tail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ type Tail<T extends string | readonly unknown[]> = T extends string
: T extends ''
? ''
: string
: T extends readonly never[] | []
? []
: T extends readonly [unknown, ...infer R]
? R
: T
Expand Down

0 comments on commit b4a538b

Please sign in to comment.