Skip to content

Add support for custom primitive-ish types#689

Merged
mweststrate merged 4 commits intomasterfrom
custom-types
Mar 14, 2018
Merged

Add support for custom primitive-ish types#689
mweststrate merged 4 commits intomasterfrom
custom-types

Conversation

@mweststrate
Copy link
Copy Markdown
Member

As discussed in #673

Copy link
Copy Markdown
Contributor

@robinfehr robinfehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking awesome :) left a note about the isValidSnapshot.


isValidSnapshot(value: any, context: IContext): IValidationResult {
if (this.options.isTargetType(value)) return typeCheckSuccess()
const typeError: string = this.options.isValidSnapshot(value)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think transpiled to js one could return true / false => the typeError within the error message would be Invalid value for type '${this.name}': true

also isValidSnapshot does imply that one should return a boolean.

maybe we could make that a bit more expressive to avoid confusion.

@mweststrate mweststrate merged commit 6828b75 into master Mar 14, 2018
@xaviergonz xaviergonz deleted the custom-types branch December 29, 2018 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants