Skip to content

Commit

Permalink
fix(asString) return type now compatible with older TS
Browse files Browse the repository at this point in the history
  • Loading branch information
tohagan committed Jan 24, 2020
1 parent 8a99362 commit 1d40970
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const asSuccess = <V>(r: Result<V, any>, log?: Logger): boolean => {
*
* @param r Validation result
*/
export const asString = <V>(r: Result<V, any>): string? => {
export const asString = <V>(r: Result<V, any>): string | null => {
if (r.ok !== true) {
return r.error.message;
}
Expand Down
2 changes: 1 addition & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ export class Validator<A> {
/**
* Run the validator and return null on success, or string containing a formatted error.
*/
asString = (data: unknown): string? => Result.asString(this.check(data));
asString = (data: unknown): string | null => Result.asString(this.check(data));

/**
* Run the validator and return true on success, or false on failure.
Expand Down

0 comments on commit 1d40970

Please sign in to comment.