Title: JSX: a way to make all the properties of value-based elements optional · Issue #7004 · microsoft/TypeScript · GitHub
Open Graph Title: JSX: a way to make all the properties of value-based elements optional · Issue #7004 · microsoft/TypeScript
X Title: JSX: a way to make all the properties of value-based elements optional · Issue #7004 · microsoft/TypeScript
Description: It's not documented, but currently, if the JSX.ElementAttributesProperty interface is declared empty, declare namespace JSX { interface ElementAttributesProperty {} } then the element attributes type becomes same as the element instance ...
Open Graph Description: It's not documented, but currently, if the JSX.ElementAttributesProperty interface is declared empty, declare namespace JSX { interface ElementAttributesProperty {} } then the element attributes ty...
X Description: It's not documented, but currently, if the JSX.ElementAttributesProperty interface is declared empty, declare namespace JSX { interface ElementAttributesProperty {} } then the element attribute...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/7004
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JSX: a way to make all the properties of value-based elements optional","articleBody":"It's not documented, but currently, if the `JSX.ElementAttributesProperty` interface is declared empty,\n\n``` ts\ndeclare namespace JSX { interface ElementAttributesProperty {} }\n```\n\nthen the _element attributes type_ becomes same as the _element instance type_. However, if the element instance type is a class, this leads to a situation where the compiler requires that all the members of the class be represented as attributes since they're not optional (and even cannot be marked as such as the class syntax doesn't allow optional members).\n\n``` ts\nclass MyComponent {\n myProp: string;\n private myMethod(): void;\n}\nvar a = \u003cMyComponent myProp='value'/>;\n// error: Property 'myMethod' is missing in type MyComponent\n```\n\nThis prevents me from using JSX for type-checking Angular 1 templates (you can find my experiments in this area [here](https://github.com/thorn0/babel-plugin-transform-ng1-jsx)).\n\nWhat if we introduce some way to tell the compiler that not all the properties are required, but only some of them? E.g. those having a certain decorator?\n\nA related issue: #5151\n","author":{"url":"https://github.com/thorn0","@type":"Person","name":"thorn0"},"datePublished":"2016-02-10T16:01:26Z","url":"https://github.com/microsoft/TypeScript/issues/7004"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0b767c20-b04a-b343-0a21-97bcc5600543 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E4C8:240CD1:D6B72:117EFC:6B00C6E1 |
| html-safe-nonce | 41dd2c927de58cadd1a8c2498b04f4755d4ec786a22c19fa864f96d47fda9fb7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEM4OjI0MENEMTpENkI3MjoxMTdFRkM6NkIwMEM2RTEiLCJ2aXNpdG9yX2lkIjoiMzg3NTgzNjEyODE2NjcyNTM0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ecc2449de6482cbe8fb3249642bcbfc755b7e54362b7406000dc0b11b6f91e81 |
| hovercard-subject-tag | issue:132740460 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/7004/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b0bd90da6a7867860006062c00cadc2097765ff244db0150e5192c39a1131d4/microsoft/TypeScript/issues/7004 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b0bd90da6a7867860006062c00cadc2097765ff244db0150e5192c39a1131d4/microsoft/TypeScript/issues/7004 |
| og:image:alt | It's not documented, but currently, if the JSX.ElementAttributesProperty interface is declared empty, declare namespace JSX { interface ElementAttributesProperty {} } then the element attributes ty... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | thorn0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ef013399cf0a3c324bea644a685d7c1e0f06b5b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width