Title: Generic type arguments are sometimes also valid JavaScript comparison expressions · Issue #33639 · microsoft/TypeScript · GitHub
Open Graph Title: Generic type arguments are sometimes also valid JavaScript comparison expressions · Issue #33639 · microsoft/TypeScript
X Title: Generic type arguments are sometimes also valid JavaScript comparison expressions · Issue #33639 · microsoft/TypeScript
Description: TypeScript Version: 3.4.0-dev.201xxxxx Search Terms: superset, syntactic, semantic, heuristic, parsing Code function f(x = {}) { document.body.innerText = `I'm ${ arguments[1] === false ? "java" : "type" }script`; } let h = () => ""; f(h...
Open Graph Description: TypeScript Version: 3.4.0-dev.201xxxxx Search Terms: superset, syntactic, semantic, heuristic, parsing Code function f(x = {}) { document.body.innerText = `I'm ${ arguments[1] === false ? "java" : ...
X Description: TypeScript Version: 3.4.0-dev.201xxxxx Search Terms: superset, syntactic, semantic, heuristic, parsing Code function f(x = {}) { document.body.innerText = `I'm ${ arguments[1] === false ? "...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/33639
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic type arguments are sometimes also valid JavaScript comparison expressions","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.4.0-dev.201xxxxx\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\nsuperset, syntactic, semantic, heuristic, parsing\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction f(x = {}) {\r\n document.body.innerText =\r\n `I'm ${\r\n arguments[1] === false ?\r\n \"java\" :\r\n \"type\"\r\n }script`;\r\n}\r\nlet h = () => \"\";\r\nf(h.apply\u003cString, Object>(\"type\"));\r\n```\r\n\r\n**Expected behavior:**\r\nWhen run as JS (since it's valid JS) it should output the same as when run as TS.\r\n\r\n**Actual behavior:**\r\nThe behavior is different in JavaScript and TypeScript\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\nhttps://www.typescriptlang.org/play/#code/GYVwdgxgLglg9mABMAFAD0QXkQbwL4CUuAsAFCKIAmcEIAtgKZhQB0ARnJQJ4sxhgMATgBUGaKFjIUKAAwCSAcjqIAJDinSKAQ0EBzekygBnANoBGALpZM2YFoA2RhogD8GzQCIAVloBuWj0QALndpDyguAAcGDw08IwhBGEioGQBuMjwyewYJAAssRBQiTAA+RA8PDNJUPJYtSMj7LgAeAGUoJLBdABpEAHk2LwZoUpRwqJiCAmqgA\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n\r\nhttps://github.com/microsoft/TypeScript/issues/26179\r\n\r\n**Note**\r\n\r\nI wrote about this at some length https://medium.com/@jasvir/monoglots-when-a-subset-is-not-1604e3a51d9 because I thought it was just cute but not serious. I was inspired to file it here by a comment @erights made in a bug filed against TC39 (https://github.com/tc39/ecma262/issues/1681) on JS failing to be a superset of JSON that resulted in a security bug.\r\n","author":{"url":"https://github.com/jasvir","@type":"Person","name":"jasvir"},"datePublished":"2019-09-27T21:07:18Z","url":"https://github.com/microsoft/TypeScript/issues/33639"}
| 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:0003b414-dd19-0d2e-75b0-7526a4e62d97 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A00:CC1A4:6D3045:8CD278:6B00E196 |
| html-safe-nonce | c2045be723160b861d8900a2109aefcc1f8d4be8feb01d808923203ae5d55e4e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTAwOkNDMUE0OjZEMzA0NTo4Q0QyNzg6NkIwMEUxOTYiLCJ2aXNpdG9yX2lkIjoiMTQwODQ5ODQxNDQzMzM5NTA5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d9ac95794c1d836cea086ab0ad4e0e7d8aa4b2d9e2588d2c1b1db2ce48c8481d |
| hovercard-subject-tag | issue:499651128 |
| 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/33639/issue_layout |
| twitter:image | https://opengraph.githubassets.com/43a9dad0d8809be7a28b1bff77acfbbb8baa10ee1205516b26261a7dde9e70de/microsoft/TypeScript/issues/33639 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/43a9dad0d8809be7a28b1bff77acfbbb8baa10ee1205516b26261a7dde9e70de/microsoft/TypeScript/issues/33639 |
| og:image:alt | TypeScript Version: 3.4.0-dev.201xxxxx Search Terms: superset, syntactic, semantic, heuristic, parsing Code function f(x = {}) { document.body.innerText = `I'm ${ arguments[1] === false ? "java" : ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jasvir |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width