-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
ts-check Issue with inline style attributes on JSX component not assignable #18744
Comments
This is just a case of the more general problem: const x = { value: "lit" };
const y: { value: "lit" } = x; // Error The problem is that since |
This issue surfaces in TypeScript code as well and is unrelated to The error stems from the fact that See also #11465 |
This is not specific to The recommendation here is to add a type annotation on your declaration to guide the compiler to inferring the literal types, e.g.: /** @type {{search: React.CSSProperties}} */
const styles = {
search: {
position: "relative",
}
} |
Ah, great, should I keep this open or close it then? |
There are a few of elk of #16389 around. we have no plans on changing the design at this point. we already had multiple iterations on how literal types are inferred and the current design seems to be the best compromise we can reach. |
Sounds good. Closing! |
TypeScript Version: 2.4.1
Code
Expected behavior:
Everything should be 👌
Actual behavior:
Getting a type error...
The text was updated successfully, but these errors were encountered: