ts
object has no properties when loading typescript.js in a browser with v5.5-rc
#58893
Closed
1 task done
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Acknowledgement
Comment
This came up after sending the initial Google v5.5-beta feedback in #58685 since I was just looking at build failures for that feedback.
Apologies if this isn't an officially supported way of using the TypeScript compiler or not - most of the docs I can find are specific to running the compiler via Node.
Google has some internal web apps that load the bundled TSC from https://github.com/microsoft/TypeScript/blob/v5.5-rc/lib/typescript.js file in a browser. One example use case is a tool similar to https://www.typescriptlang.org/play/.
In TS 5.5 these apps break at runtime because they call methods on the global
ts
object likets.createLanguageService
, butts
is now just an empty object with no properties. I narrowed this down to the bundling changes in #57133. Here's typescript.js before & after:v5.4.2:
v5.5-rc:
I'd assume that in v5.5-rc,
ts
was intended to be instantiated via passing{exports : ts }
as themodule
argument to this IIFE, causing the exported functions that are put onmodule.exports
to also be defined as properties onts
. Instead themodule.exports = __toCommonJS(typescript_exports);
assignment just overwritests
in{exports: ts}
andts
is just an empty object.The text was updated successfully, but these errors were encountered: