Title: request: Turn off required properties check in TSX context · Issue #12016 · microsoft/TypeScript · GitHub
Open Graph Title: request: Turn off required properties check in TSX context · Issue #12016 · microsoft/TypeScript
X Title: request: Turn off required properties check in TSX context · Issue #12016 · microsoft/TypeScript
Description: I want to turn off required properties check in TSX context with using skate.js http://skate.js.org/ And, I don't want to turn of type checking about properties. cc/ Bradley Ayers (@bradleyayers) do you interested in this issue? TypeScri...
Open Graph Description: I want to turn off required properties check in TSX context with using skate.js http://skate.js.org/ And, I don't want to turn of type checking about properties. cc/ Bradley Ayers (@bradleyayers) d...
X Description: I want to turn off required properties check in TSX context with using skate.js http://skate.js.org/ And, I don't want to turn of type checking about properties. cc/ Bradley Ayers (@bradleyayer...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/12016
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"request: Turn off required properties check in TSX context","articleBody":"I want to turn off required properties check in TSX context with using skate.js http://skate.js.org/\r\nAnd, I don't want to turn of type checking about properties.\r\n\r\ncc/ @bradleyayers do you interested in this issue?\r\n\r\n**TypeScript Version:** 2.0.6\r\n\r\n**Code**\r\n\r\nReproduce code is here.\r\nhttps://gist.github.com/vvakame/e7a230fa558763e225b58d57b459f64d\r\n\r\nsummary\r\n\r\n```ts\r\ndeclare global {\r\n namespace JSX {\r\n interface ElementAttributesProperty {\r\n '': any;\r\n }\r\n }\r\n}\r\n```\r\n\r\n```ts\r\ndeclare module \"skatejs\" {\r\n export class Component extends HTMLElement {\r\n }\r\n}\r\n```\r\n\r\n```ts\r\nconst ComponentA = skate.define(\"x-component-a\", class ComponentA extends skate.Component {\r\n myCounter = 0;\r\n\r\n ...\r\n}\r\n\r\nskate.define(\"x-main\", class Main extends skate.Component {\r\n render(elem: this): JSX.Element {\r\n return (\r\n // tsc raise a lot of errors!\r\n // error TS2324: Property 'ATTRIBUTE_NODE' is missing in type 'ComponentA'.\r\n // error TS2324: Property 'outerHTML' is missing in type 'ComponentA'.\r\n // ...\r\n // but I want a type checking...\r\n \u003cComponentA myCounter={-3}>\u003c/ComponentA>\r\n );\r\n }\r\n\r\n ...\r\n});\r\n```\r\n\r\nother information.\r\n\r\nfrom [src/compiler/checker.ts](https://github.com/Microsoft/TypeScript/blob/master/src/compiler/checker.ts)\r\n\r\n```\r\n /// e.g. \"props\" for React.d.ts,\r\n /// or 'undefined' if ElementAttributesProperty doesn't exist (which means all\r\n /// non-intrinsic elements' attributes type is 'any'),\r\n /// or '' if it has 0 properties (which means every\r\n /// non-intrinsic elements' attributes type is the element instance type)\r\n function getJsxElementPropertiesName() {\r\n```\r\n\r\nI want to change `targetAttributesType && !sawSpreadedAny` to something like... `targetAttributesType && !sawSpreadedAny && !suppressRequiredPropertyCheck`.\r\n\r\n```\r\n function checkJsxOpeningLikeElement(node: JsxOpeningLikeElement) {\r\n\r\n ...\r\n\r\n // Check that all required properties have been provided. If an 'any'\r\n // was spreaded in, though, assume that it provided all required properties\r\n if (targetAttributesType && !sawSpreadedAny) {\r\n const targetProperties = getPropertiesOfType(targetAttributesType);\r\n for (let i = 0; i \u003c targetProperties.length; i++) {\r\n if (!(targetProperties[i].flags & SymbolFlags.Optional) &&\r\n !nameTable[targetProperties[i].name]) {\r\n\r\n error(node, Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType));\r\n }\r\n }\r\n }\r\n```\r\n\r\n\r\n**Expected behavior:**\r\n\r\nWe can compile my code.\r\n\r\n**Actual behavior:** \r\n\r\ntsc raise a lot of errors.\r\n","author":{"url":"https://github.com/vvakame","@type":"Person","name":"vvakame"},"datePublished":"2016-11-03T08:21:02Z","url":"https://github.com/microsoft/TypeScript/issues/12016"}
| 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:a5774646-bcdc-98b0-03a6-822b32fb72f2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A370:2E3FEE:1C47FF:24D2F7:6B00CAA8 |
| html-safe-nonce | 737fca08c6a67b2258d000260f869fe809e49aa8be3b86ac2b7eef75ec544db4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzcwOjJFM0ZFRToxQzQ3RkY6MjREMkY3OjZCMDBDQUE4IiwidmlzaXRvcl9pZCI6Ijc4MDU0MTgwMTA2OTY1MzQ2OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c54899822c80b16164be314089c389fbf0078767b3dddf5cca7d524732dd1700 |
| hovercard-subject-tag | issue:186999102 |
| 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/12016/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f8bc927bb17e16510ccf6e3796cfcf26a86aabdc1ff383a8f9f3d8e211934ab/microsoft/TypeScript/issues/12016 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f8bc927bb17e16510ccf6e3796cfcf26a86aabdc1ff383a8f9f3d8e211934ab/microsoft/TypeScript/issues/12016 |
| og:image:alt | I want to turn off required properties check in TSX context with using skate.js http://skate.js.org/ And, I don't want to turn of type checking about properties. cc/ Bradley Ayers (@bradleyayers) d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vvakame |
| 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