Skip to content

Commit 810f60a

Browse files
committed
chore: add docstrings for Type and Optional
1 parent c9c50f3 commit 810f60a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ type ParseOptions = {
464464
mode: "passthrough" | "strict" | "strip";
465465
};
466466

467+
/**
468+
* A base class for all concreate validators/parsers.
469+
*/
467470
abstract class Type<Output = unknown> extends AbstractType<Output> {
468471
nullable(): Type<null | Output> {
469472
return union(nullSingleton, this);
@@ -514,6 +517,13 @@ abstract class Type<Output = unknown> extends AbstractType<Output> {
514517
}
515518
}
516519

520+
/**
521+
* A validator/parser marked as "optional", signifying that their value can
522+
* be missing from the parsed object.
523+
*
524+
* As such optionals can only be used as property validators within
525+
* object validators.
526+
*/
517527
class Optional<Output = unknown> extends AbstractType<Output | undefined> {
518528
readonly name = "optional";
519529

0 commit comments

Comments
 (0)