-
Notifications
You must be signed in to change notification settings - Fork 35
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
<input> value and other properties should accept more types #43
Comments
Thanks for your issue! This plugin uses properties and types from interface HTMLInputElement extends HTMLElement {
...
value: string
max: string;
maxLength: number;
min: string;
minLength: number;
...
} Typescript TSJSlib-generator seems to be generating these files based on IDL. For example I'm already patching some of these types but I have problems finding an overview of properties accepting other types than described in the IDL. Do you know if there exists a clear overview, or if it's safe to assume that eg. all properties of type If not I plan on patching the type of each built in property manually when I get the time :-) |
This actually might be a good question to bring up to @DanielRosenwasser and the TypeScript team. Since so many DOM setters perform type coercion, and so accept any number of types, what should their real types be? input.value = 5; is perfectly fine JavaScript... |
I think this ties back into having separate read types and write types, which I'm personally not opposed to if we can think it through. Putting together a short issue that we can track might be helpful if one doesn't already exist. |
@DanielRosenwasser did you ever put together a tracker issue for this? |
I filed an upstream issue for this. |
Looks like the underlying TypeScript support is in place as of v4.3: microsoft/TypeScript#42425 |
Right now a binding like:
Will report errors on the
value
andmax
bindings ifcurrentValue
andmax
are numbers. But an input handles this just fine. This may be something that needs to be updated in the typings, but maybe there's something to be done in the plugin?The text was updated successfully, but these errors were encountered: