## Search Terms [read types and write types], [read type] ## Suggestion Many DOM APIs have setters that coerce values to strings. Using these APIs in perfectly valid ways will result in type warnings: ```ts const input = document.createElement('input'); input.type = 'range'; input.max = 42; // Type '42' is not assignable to type 'string'. ``` These APIs could be more accurately described if getters and setters could have different types, like: ```ts interface HTMLInputElement extends HTMLElement { /** * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. */ get max(): string; set max(v: any); } ``` ## Related Issues https://github.com/microsoft/TypeScript/issues/590 https://github.com/microsoft/TypeScript/issues/814 ## Use Cases Use DOM APIs :) Also see: https://github.com/runem/lit-analyzer/issues/43 ## Examples Shown above ## Checklist My suggestion meets these guidelines: * [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code * [x] This wouldn't change the runtime behavior of existing JavaScript code * [x] This could be implemented without emitting different JS based on the types of the expressions * [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.) * [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).