René's URL Explorer Experiment


Title: The inferred type of `this` is wrong · Issue #8913 · microsoft/TypeScript · GitHub

Open Graph Title: The inferred type of `this` is wrong · Issue #8913 · microsoft/TypeScript

X Title: The inferred type of `this` is wrong · Issue #8913 · microsoft/TypeScript

Description: On this file declare var require:any; var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig'); // Populate property map with ReactJS's attribute and property mappings // TODO handle/use .Properties value eg: MUST_USE_PROPE...

Open Graph Description: On this file declare var require:any; var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig'); // Populate property map with ReactJS's attribute and property mappings // TODO handle/...

X Description: On this file declare var require:any; var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig'); // Populate property map with ReactJS's attribute and property mappings // ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/8913

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The inferred type of `this` is wrong","articleBody":"On this file\n\n``` ts\ndeclare var require:any;\n\nvar HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig');\n\n// Populate property map with ReactJS's attribute and property mappings\n// TODO handle/use .Properties value eg: MUST_USE_PROPERTY is not HTML attr\nfor (var propname in HTMLDOMPropertyConfig.Properties) {\n  if (!HTMLDOMPropertyConfig.Properties.hasOwnProperty(propname)) {\n    continue;\n  }\n\n  var mapFrom = HTMLDOMPropertyConfig.DOMAttributeNames[propname] || propname.toLowerCase();\n}\n\n/**\n * Repeats a string a certain number of times.\n * Also: the future is bright and consists of native string repetition:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n *\n * @param {string} string  String to repeat\n * @param {number} times   Number of times to repeat string. Integer.\n * @see http://jsperf.com/string-repeater/2\n */\nfunction repeatString(string, times) {\n  if (times === 1) {\n    return string;\n  }\n  if (times \u003c 0) { throw new Error(); }\n  var repeated = '';\n  while (times) {\n    if (times \u0026 1) {\n      repeated += string;\n    }\n    if (times \u003e\u003e= 1) {\n      string += string;\n    }\n  }\n  return repeated;\n}\n\n/**\n * Determine if the string ends with the specified substring.\n *\n * @param {string} haystack String to search in\n * @param {string} needle   String to search for\n * @return {boolean}\n */\nfunction endsWith(haystack, needle) {\n  return haystack.slice(-needle.length) === needle;\n}\n\n/**\n * Trim the specified substring off the string. If the string does not end\n * with the specified substring, this is a no-op.\n *\n * @param {string} haystack String to search in\n * @param {string} needle   String to search for\n * @return {string}\n */\nfunction trimEnd(haystack, needle) {\n  return endsWith(haystack, needle)\n    ? haystack.slice(0, -needle.length)\n    : haystack;\n}\n\n/**\n * Convert a hyphenated string to camelCase.\n */\nfunction hyphenToCamelCase(string) {\n  return string.replace(/-(.)/g, function(match, chr) {\n    return chr.toUpperCase();\n  });\n}\n\n/**\n * Determines if the specified string consists entirely of whitespace.\n */\nfunction isEmpty(string) {\n   return !/[^\\s]/.test(string);\n}\n\n/**\n * Determines if the CSS value can be converted from a\n * 'px' suffixed string to a numeric value\n *\n * @param {string} value CSS property value\n * @return {boolean}\n */\nfunction isConvertiblePixelValue(value) {\n  return /^\\d+px$/.test(value);\n}\n\nexport class HTMLtoJSX {\n    private output: string;\n    private level: number;\n    private _inPreTag: boolean;\n\n\n  /**\n   * Handles processing of the specified text node\n   *\n   * @param {TextNode} node\n   */\n  _visitText = (node) =\u003e {\n    var parentTag = node.parentNode \u0026\u0026 node.parentNode.tagName.toLowerCase();\n    if (parentTag === 'textarea' || parentTag === 'style') {\n      // Ignore text content of textareas and styles, as it will have already been moved\n      // to a \"defaultValue\" attribute and \"dangerouslySetInnerHTML\" attribute respectively.\n      return;\n    }\n\n    var text = ''\n\n    if (this._inPreTag) {\n      // If this text is contained within a \u003cpre\u003e, we need to ensure the JSX\n      // whitespace coalescing rules don't eat the whitespace. This means\n      // wrapping newlines and sequences of two or more spaces in variables.\n      text = text\n        .replace(/\\r/g, '')\n        .replace(/( {2,}|\\n|\\t|\\{|\\})/g, function(whitespace) {\n          return '{' + JSON.stringify(whitespace) + '}';\n        });\n    } else {\n      // If there's a newline in the text, adjust the indent level\n      if (text.indexOf('\\n') \u003e -1) {\n      }\n    }\n    this.output += text;\n  }\n\n\n\n};\n\n/**\n * Handles parsing of inline styles\n */\nexport class StyleParser {\n  styles = {};\n  toJSXString = () =\u003e {\n    for (var key in this.styles) {\n      if (!this.styles.hasOwnProperty(key)) {\n      }\n    }\n  }\n}\n```\n\n\u003e which is actually a part of a larger file [here](https://github.com/alm-tools/alm/blob/master/src/app/htmlToJsx/htmlToJsx.ts)\n\nWith TypeScript nightly we get the following errors: \n\n```\nC:/repos/alm/tests/success/simple/bas.tsx:141 Property 'styles' does not exist on type 'HTMLtoJSX'.\nC:/repos/alm/tests/success/simple/bas.tsx:142 Property 'styles' does not exist on type 'HTMLtoJSX'.\n```\n\nBasically `this` in the class function isn't inferring to `StyleParser` and instead inferring to `HTMLtoJSX`\n\n``` ts\nexport class StyleParser {\n  styles = {};\n  toJSXString = () =\u003e {\n    for (var key in this.styles) {\n      if (!this.styles.hasOwnProperty(key)) {\n      }\n    }\n  }\n}\n```\n\nSorry for not being able to narrow it down, deleting portions of the file (e.g. the `HTMLtoJSX._visitText` method) makes the error go away. Note that this error only appeared in the last 10 days :rose: \n","author":{"url":"https://github.com/basarat","@type":"Person","name":"basarat"},"datePublished":"2016-06-01T06:57:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/8913/TypeScript/issues/8913"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:189088ff-9425-2275-5d1d-dbefc22c6130
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8F20:2FDF33:2C2F7C6:402704E:6A60DC9D
html-safe-nonce63cb4c853a24c3247fe7ef35307e554d481dc35d8a68487959a40d0da9e32945
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjIwOjJGREYzMzoyQzJGN0M2OjQwMjcwNEU6NkE2MERDOUQiLCJ2aXNpdG9yX2lkIjoiMTI3MDQ5MzA3OTMxODYxNzI0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac025e7e172f345e60645f0507cc9f778207d00fd482c441e55be11ffcda88f661
hovercard-subject-tagissue:157836446
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/8913/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4c03e7b2d70e49381777f680fb94f358650e179ad07fe4104d7175a5f29fa4a4/microsoft/TypeScript/issues/8913
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4c03e7b2d70e49381777f680fb94f358650e179ad07fe4104d7175a5f29fa4a4/microsoft/TypeScript/issues/8913
og:image:altOn this file declare var require:any; var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig'); // Populate property map with ReactJS's attribute and property mappings // TODO handle/...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebasarat
hostnamegithub.com
expected-hostnamegithub.com
None8302bdfafed4cf34ac9c1d3593108fafa53bc3f86b893907e38fa6bdd74361ac
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec3c2ff0c76b34772c83c9498a08cefee28f53da0
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/8913#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F8913
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F8913
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/8913
Reloadhttps://github.com/microsoft/TypeScript/issues/8913
Reloadhttps://github.com/microsoft/TypeScript/issues/8913
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/8913
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.6k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 30 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
The inferred type of this is wronghttps://github.com/microsoft/TypeScript/issues/8913#top
https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.0https://github.com/microsoft/TypeScript/milestone/1
https://github.com/basarat
basarathttps://github.com/basarat
on Jun 1, 2016https://github.com/microsoft/TypeScript/issues/8913#issue-157836446
herehttps://github.com/alm-tools/alm/blob/master/src/app/htmlToJsx/htmlToJsx.ts
ahejlsberghttps://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.0https://github.com/microsoft/TypeScript/milestone/1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.