-
Notifications
You must be signed in to change notification settings - Fork 9
Use rescript@v10 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -126,30 +126,30 @@ function toReason(nestedLevelOpt, error) { | |
case /* UnexpectedValue */2 : | ||
break; | ||
case /* TupleSize */3 : | ||
return "Expected Tuple with " + reason.expected.toString() + " items, received " + reason.received.toString(); | ||
return "Expected Tuple with " + reason.expected.toString() + " items, received " + reason.received.toString() + ""; | ||
case /* ExcessField */4 : | ||
return "Encountered disallowed excess key \"" + reason._0 + "\" on an object. Use Deprecated to ignore a specific field, or S.Record.strip to ignore excess keys completely"; | ||
case /* InvalidUnion */5 : | ||
var lineBreak = "\n" + " ".repeat((nestedLevel << 1)); | ||
var lineBreak = "\n" + " ".repeat((nestedLevel << 1)) + ""; | ||
var array = reason._0.map(function (error) { | ||
var reason = toReason(nestedLevel + 1, error); | ||
var nonEmptyPath = error.path; | ||
var $$location = nonEmptyPath.length !== 0 ? "Failed at " + formatPath(nonEmptyPath) + ". " : ""; | ||
return "- " + $$location + reason; | ||
return "- " + $$location + "" + reason + ""; | ||
}); | ||
var reasons = Array.from(new Set(array)); | ||
return "Invalid union with following errors" + lineBreak + reasons.join(lineBreak); | ||
return "Invalid union with following errors" + lineBreak + "" + reasons.join(lineBreak) + ""; | ||
|
||
} | ||
return "Expected " + reason.expected + ", received " + reason.received; | ||
return "Expected " + reason.expected + ", received " + reason.received + ""; | ||
} | ||
|
||
function toString(error) { | ||
var match = error.operation; | ||
var operation = match ? "parsing" : "serializing"; | ||
var reason = toReason(undefined, error); | ||
var pathText = formatPath(error.path); | ||
return "[ReScript Struct]" + " Failed " + operation + " at " + pathText + ". Reason: " + reason; | ||
return "[ReScript Struct] Failed " + operation + " at " + pathText + ". Reason: " + reason + ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here it joined to string values on compile-time, that's super cool! |
||
} | ||
|
||
function classify(struct) { | ||
|
@@ -260,6 +260,9 @@ function makeUnexpectedTypeError(input, struct) { | |
case /* JSSymbol */4 : | ||
received = "Symbol"; | ||
break; | ||
case /* JSBigInt */5 : | ||
received = "BigInt"; | ||
break; | ||
|
||
} | ||
} | ||
|
@@ -1272,7 +1275,7 @@ function min$1(struct, maybeMessage, thanValue) { | |
if (value >= thanValue) { | ||
return ; | ||
} else { | ||
return Belt_Option.getWithDefault(maybeMessage, "Number must be greater than or equal to " + thanValue.toString()); | ||
return Belt_Option.getWithDefault(maybeMessage, "Number must be greater than or equal to " + thanValue.toString() + ""); | ||
} | ||
}; | ||
return refine(struct, refiner, refiner, undefined); | ||
|
@@ -1283,7 +1286,7 @@ function max$1(struct, maybeMessage, thanValue) { | |
if (value <= thanValue) { | ||
return ; | ||
} else { | ||
return Belt_Option.getWithDefault(maybeMessage, "Number must be lower than or equal to " + thanValue.toString()); | ||
return Belt_Option.getWithDefault(maybeMessage, "Number must be lower than or equal to " + thanValue.toString() + ""); | ||
} | ||
}; | ||
return refine(struct, refiner, refiner, undefined); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started adding empty strings around values in template literal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't seem to repro:
gives
Would you open an issue with a self-contained repro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created an issue rescript-lang/rescript#5521