Title: Incorrect assumption around host being defined in base64encode/base64decode · Issue #24638 · microsoft/TypeScript · GitHub
Open Graph Title: Incorrect assumption around host being defined in base64encode/base64decode · Issue #24638 · microsoft/TypeScript
X Title: Incorrect assumption around host being defined in base64encode/base64decode · Issue #24638 · microsoft/TypeScript
Description: TypeScript Version: 2.9.1+ Code Any code under deno with TypeScript 2.9.1 or later. #22658 introduced a significant refactor of code. One of the areas defines the base64encode function which assumes that the argument host is always defin...
Open Graph Description: TypeScript Version: 2.9.1+ Code Any code under deno with TypeScript 2.9.1 or later. #22658 introduced a significant refactor of code. One of the areas defines the base64encode function which assume...
X Description: TypeScript Version: 2.9.1+ Code Any code under deno with TypeScript 2.9.1 or later. #22658 introduced a significant refactor of code. One of the areas defines the base64encode function which assume...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/24638
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect assumption around host being defined in base64encode/base64decode","articleBody":"**TypeScript Version:** 2.9.1+\r\n\r\n**Code**\r\n\r\nAny code under [deno](https://github.com/ry/deno/) with TypeScript 2.9.1 or later.\r\n\r\n#22658 introduced a significant refactor of code. One of the [areas](https://github.com/Microsoft/TypeScript/pull/22658/files#diff-942ae3cd2a8bbd85ed86a60cd7c43307R3515) defines the `base64encode` function which assumes that the argument `host` is always defined. In practice, this comes from `ts.sys` in which `ts.sys` is possibly undefined, but without the strict checking, this does not throw a compiler error, but at runtime in certain environments (like deno) an exception is thrown.\r\n\r\nA simple check of `host && host.base64encode` there (and the following function `base64decode` restores functionality).\r\n\r\n**Expected behavior:**\r\n\r\nThe code actually runs.\r\n\r\n**Actual behavior:**\r\n\r\n```\r\nTypeError: Cannot read property 'base64encode' of undefined\r\n at Object.base64encode (../node_modules/typescript/lib/typescript.js:12079:18)\r\n at Object.getSourceMappingURL (../node_modules/typescript/lib/typescript.js:73929:46)\r\n at printSourceFileOrBundle (../node_modules/typescript/lib/typescript.js:74550:48)\r\n at emitJsFileOrBundle (../node_modules/typescript/lib/typescript.js:74499:13)\r\n at emitSourceFileOrBundle (../node_modules/typescript/lib/typescript.js:74456:13)\r\n at forEachEmittedFile (../node_modules/typescript/lib/typescript.js:74365:30)\r\n at Object.emitFiles (../node_modules/typescript/lib/typescript.js:74446:9)\r\n at emitWorker (../node_modules/typescript/lib/typescript.js:78992:33)\r\n at ../node_modules/typescript/lib/typescript.js:78952:66\r\n at runWithCancellationToken (../node_modules/typescript/lib/typescript.js:79043:24)\r\n```\r\n\r\n**Related Issues:**\r\nRefs: ry/deno#117\r\n","author":{"url":"https://github.com/kitsonk","@type":"Person","name":"kitsonk"},"datePublished":"2018-06-03T20:56:28Z","url":"https://github.com/microsoft/TypeScript/issues/24638"}
| 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:df22911a-105f-1f6f-1e7c-5219835eedbc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA06:19E4BB:272549F:31EE57B:6B019BB2 |
| html-safe-nonce | 57f7ba770c6c26e69a545ef2676de9a5d51b8698f18c2f515882fb027bbb6249 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTA2OjE5RTRCQjoyNzI1NDlGOjMxRUU1N0I6NkIwMTlCQjIiLCJ2aXNpdG9yX2lkIjoiNjc1ODQyMjEzMzQ1OTc1MzkwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9a5ec98456c265fd840f3c1674a02c95c5c4ec30148084cc272395d00864142e |
| hovercard-subject-tag | issue:328861375 |
| 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/24638/issue_layout |
| twitter:image | https://opengraph.githubassets.com/774a29130d9866225149dcdfe87c7d5685b3e4928d7f6eb8967005bc5278e260/microsoft/TypeScript/issues/24638 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/774a29130d9866225149dcdfe87c7d5685b3e4928d7f6eb8967005bc5278e260/microsoft/TypeScript/issues/24638 |
| og:image:alt | TypeScript Version: 2.9.1+ Code Any code under deno with TypeScript 2.9.1 or later. #22658 introduced a significant refactor of code. One of the areas defines the base64encode function which assume... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kitsonk |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width