async function transpile_ts(tsconfig, filename, source) {
	const ts = await try_load_ts();
	const options = load_tsconfig(tsconfig, filename, ts);
	// transpileModule treats NodeNext as CommonJS because it doesn't read the package.json. Therefore we need to override it.
	// Also see https://github.com/microsoft/TypeScript/issues/53022 (the filename workaround doesn't work).
	return ts.transpileModule(source, {
		compilerOptions: {
			...options,
			module: ts.ModuleKind.ESNext,
			moduleResolution: ts.ModuleResolutionKind.NodeNext
		},
		fileName: filename
	}).outputText;
}
TS -> JS

@param {string | undefined} tsconfig
@param {string} filename
@param {string} source