You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, unknown attributes are allowed in component tag.
For example, this code is valid.
constMyComponent=defineComponent({props: {msg: String},setup(props){return()=><div>{props.msg}</div>;
}});constParentComponent=defineComponent({setup(){return()=><MyComponentmsg="Hello"foo={1}/>; // foo is not defined, but allowed.}});
But this breaks type-safety (for example, TypeScript can't detect misspelling of optional prop name), and there is no way to disable this.
I think it would be nice if unknown attributes are denied by default, and some escape-hatches are provided.
What does the proposed API look like?
In TypeScript, deny unknown attributes by default.
And allow to pass unknown attributes via special attribute (something like attrs)
What problem does this feature solve?
Currently, unknown attributes are allowed in component tag.
For example, this code is valid.
But this breaks type-safety (for example, TypeScript can't detect misspelling of optional prop name), and there is no way to disable this.
I think it would be nice if unknown attributes are denied by default, and some escape-hatches are provided.
What does the proposed API look like?
In TypeScript, deny unknown attributes by default.
And allow to pass unknown attributes via special attribute (something like
attrs
)And provide optional type definition like below. Unknown attributes are allowed again by importing this.
The text was updated successfully, but these errors were encountered: