Skip to content
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

update createDefaultCodec to handle Unknown types correctly #35

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

abrantesarthur
Copy link
Member

Related Issues

  • [none]

Security Implications

[none]

System Availability

[none]

@abrantesarthur abrantesarthur changed the title update createDefaultCodec to handle literal types correctly update createDefaultCodec to handle Unknown types correctly Jan 19, 2025
@@ -117,7 +117,7 @@ export const createDefaultCodec = <C extends t.Mixed>(
}

// The default of an object type is an empty object
if (codec instanceof t.ObjectType) {
if (codec instanceof t.ObjectType || codec instanceof t.UnknownType) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to be UnknownRecord, since UnknownType is for unknown

Copy link
Member Author

Choose a reason for hiding this comment

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

Interestingly, if I do codec instanceof t.RecordType I get error Right-hand side of 'instanceof' is not callable

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