Skip to content

Commit

Permalink
fix(server): Fall back to bundled TS version if specified TSDK is too…
Browse files Browse the repository at this point in the history
… old (#1863)

We attempt to use the version of typescript defined in the extension
options. However, this might be too old for the required version in the
bundled Angular compiler. If this happens, we now attempt to resolve the
version from the bundled one instead (and print a warning to the output).

Fixes #1855
  • Loading branch information
atscott authored Feb 21, 2023
1 parent 2e6e8c9 commit 406dac9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/src/version_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ export function resolveTsServer(probeLocations: string[]): NodeModule {
if (probeLocations.length > 0) {
// The first probe location is `typescript.tsdk` if it is specified.
const resolvedFromTsdk = resolveTsServerFromTsdk(probeLocations[0], probeLocations.slice(1));
const minVersion = new Version(MIN_TS_VERSION);
if (resolvedFromTsdk !== undefined) {
return resolvedFromTsdk;
if (resolvedFromTsdk.version.greaterThanOrEqual(minVersion)) {
return resolvedFromTsdk;
} else {
console.warn(`Ignoring TSDK version specified in the TypeScript extension options ${
resolvedFromTsdk
.version} because it is lower than the required TS version for the language service (${
MIN_TS_VERSION}).`);
}
}
}
return resolveWithMinVersion(TSSERVERLIB, MIN_TS_VERSION, probeLocations, 'typescript');
Expand Down

0 comments on commit 406dac9

Please sign in to comment.