- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
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 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.
A simple check of host && host.base64encode there (and the following function base64decode restores functionality).
Expected behavior:
The code actually runs.
Actual behavior:
TypeError: Cannot read property 'base64encode' of undefined
    at Object.base64encode (../node_modules/typescript/lib/typescript.js:12079:18)
    at Object.getSourceMappingURL (../node_modules/typescript/lib/typescript.js:73929:46)
    at printSourceFileOrBundle (../node_modules/typescript/lib/typescript.js:74550:48)
    at emitJsFileOrBundle (../node_modules/typescript/lib/typescript.js:74499:13)
    at emitSourceFileOrBundle (../node_modules/typescript/lib/typescript.js:74456:13)
    at forEachEmittedFile (../node_modules/typescript/lib/typescript.js:74365:30)
    at Object.emitFiles (../node_modules/typescript/lib/typescript.js:74446:9)
    at emitWorker (../node_modules/typescript/lib/typescript.js:78992:33)
    at ../node_modules/typescript/lib/typescript.js:78952:66
    at runWithCancellationToken (../node_modules/typescript/lib/typescript.js:79043:24)
Related Issues:
Refs: ry/deno#117
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue