We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
foo?: boolean
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
Following code
// main.ts import Vue from 'vue'; import { defineComponent } from '@vue/composition-api'; let bool = false; Vue.extend({ props: { foo: Boolean }, mounted () { bool = this.foo; // No error }, }); defineComponent({ props: { foo: Boolean }, setup (props) { bool = props.foo; // <!--- Error }, });
throws a TS error:
Type 'undefined' is not assignable to type 'boolean'. 18 | props: { foo: Boolean }, 19 | setup (props) { > 20 | bool = props.foo; | ^ 21 | }, 22 | });
The text was updated successfully, but these errors were encountered:
This looks like the correct behaviour to me.
Sorry, something went wrong.
Doesn't look for me, if prop is not passed its value is bool: https://codepen.io/jkarczm/pen/VwKOEzp
Is not the correct behaviour, if Boolean is passed, it will be implicit converted to false if not provided
Boolean
false
fix(types): optional Boolean prop types #636 (#678)
a081227
that can be closed i guess?
No branches or pull requests
Following code
throws a TS error:
The text was updated successfully, but these errors were encountered: