-
Notifications
You must be signed in to change notification settings - Fork 90
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
[]
passes Record
check
#32
Comments
The corresponding static type failure is type ConfigType = { x?: string }
const foo: ConfigType = []
// ^^^ Type 'undefined[]' has no properties in common with type '{ x?: string; }'. Are you saying you'd like a corresponding runtime check to this? |
Yes, sorry I omitted that part. I'm using So the full sample code would be: ConfigType.check(JSON.parse(`[]`)) |
Just to be clear, though, this type of check would not flag an error if your type ConfigType = { x?: boolean, length: number }
const foo: ConfigType = [] This works in the static type system because |
Ok, so if this is by design I'll close this. I have already added an extra check to verify that it's an object. So that seems settled then. |
I have a type like the following specified:
Unfortunately running the following code succeeds without error:
The text was updated successfully, but these errors were encountered: