{"record":{"id":"2c310b3c60283851","repo":"microsoft/typescript-go","slug":"publishedtypescriptaliaspackagename-package-jso-2c310b","errorCode":null,"errorMessage":"${publishedTypeScriptAliasPackageName} package.json did not contain platform optionalDependencies.","messagePattern":"(.+?) package\\.json did not contain platform optionalDependencies\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":2213,"sourceCode":"const publishedPlatformPackageLibDirs = new Map();\r\n\r\nconst getPublishedTypeScriptPackageJson = memoize(() => {\r\n    const candidates = [\r\n        path.join(extensionDir, \"node_modules\", publishedTypeScriptAliasPackageName, \"package.json\"),\r\n        path.join(__dirname, \"node_modules\", publishedTypeScriptAliasPackageName, \"package.json\"),\r\n    ];\r\n\r\n    for (const candidate of candidates) {\r\n        if (fs.existsSync(candidate)) {\r\n            const packageJson = JSON.parse(fs.readFileSync(candidate, \"utf8\"));\r\n            if (packageJson.name !== \"typescript\") {\r\n                throw new Error(`${publishedTypeScriptAliasPackageName} should alias the typescript package, but found ${packageJson.name}.`);\r\n            }\r\n            if (!packageJson.version || typeof packageJson.version !== \"string\") {\r\n                throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain a version.`);\r\n            }\r\n            if (!packageJson.optionalDependencies || typeof packageJson.optionalDependencies !== \"object\") {\r\n                throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain platform optionalDependencies.`);\r\n            }\r\n            return packageJson;\r\n        }\r\n    }\r\n\r\n    throw new Error(`Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.`);\r\n});\r\n\r\nfunction getPublishedTypeScriptVersion() {\r\n    const version = getPublishedTypeScriptPackageJson().version;\r\n    const expectedVersion = getVersion();\r\n    if (usePublishedPlatformPackagesForVsix && version !== expectedVersion) {\r\n        throw new Error(`usePublishedPlatformPackagesForVsix requires ${publishedTypeScriptAliasPackageName}'s installed version (${version}) to match release version ${expectedVersion}.`);\r\n    }\r\n    return version;\r\n}\r\n\r\nfunction checkPublishedPlatformPackagesForVsix() {\r","sourceCodeStart":2195,"sourceCodeEnd":2231,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L2195-L2231","documentation":"Third validation inside getPublishedTypeScriptPackageJson: the alias package.json must contain an `optionalDependencies` object. That object maps platform package names (e.g. @typescript/native-preview-win32-x64) to versions, and getPublishedPlatformPackageLibDir later reads it to know which platform tarballs to fetch. Stock `typescript` from npm has no such field, so this check distinguishes the native-preview alias distribution from a plain typescript install.","triggerScenarios":"The alias resolved to a package without platform optionalDependencies — typically plain upstream `typescript` instead of the native-preview distribution, or an old/custom build of the alias published before platform packages existed.","commonSituations":"Someone changed the alias spec in package.json (or the lockfile) so `@typescript/bundled-typescript` now points at the regular typescript package; installing an alias version published by an older layout of this repo.","solutions":["Restore the alias spec from the repo's package.json/package-lock.json (the version published alongside the native preview) and re-run `npm install`","Verify the reinstalled `_extension/node_modules/@typescript/bundled-typescript/package.json` now lists platform packages under optionalDependencies","If you maintain the alias package, ensure its package.json publishes the platform optionalDependencies map"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const pj = JSON.parse(fs.readFileSync(aliasPath, \"utf8\"));\nif (pj.optionalDependencies === null || typeof pj.optionalDependencies !== \"object\" || Array.isArray(pj.optionalDependencies)) {\n  throw new Error(`${aliasPath} lacks platform optionalDependencies — wrong alias target, reinstall`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the alias pointing at the native-preview distribution, not stock typescript","After install, spot-check optionalDependencies lists @typescript/* platform packages"],"tags":["npm","dependencies","packaging","vsix"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}