Skip to content

Commit

Permalink
fix(Exact): grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
zorji committed Jul 9, 2022
1 parent d98ff45 commit 3126317
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/exact.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type {KeysOfUnion} from './internal';

/**
Extract the element of an array that also works for array union.
If T is not an array, returns never.
This creates a type-safe way to access the element type of unknown type.
Extracts the element of an array that also works for array union.
Returns `never` if T is not an array.
It creates a type-safe way to access the element type of `unknown` type.
*/
type ArrayElement<T> = T extends unknown[] ? T[0] : never;

/**
Extract the object field type if T is an object and K is a key of T, otherwise returns never.
This creates a type-safe way to access the key-value of unknown type.
Extracts the object field type if T is an object and K is a key of T, returns `never` otherwise.
It creates a type-safe way to access the member type of `unknown` type.
*/
type ObjectValue<T, K> = K extends keyof T ? T[K] : never;

Expand Down

0 comments on commit 3126317

Please sign in to comment.