Skip to content

Commit

Permalink
fix: avoid language server crash on TS 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed May 28, 2022
1 parent 2ded70f commit ef19daa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vue-typescript/src/utils/ts.ts
Expand Up @@ -9,6 +9,12 @@ export function injectCacheLogicToLanguageServiceHost(
service: ts.LanguageService,
) {

const versionNums = ts.version.split('.').map(s => Number(s));
if (versionNums[0] > 4 || (versionNums[0] === 4 && versionNums[1] >= 7)) {
console.log('Please update to v0.35.0 or higher to support TypeScript version:', ts.version);
return;
}

const _createCacheableExportInfoMap = (ts as any).createCacheableExportInfoMap;
const _combinePaths = (ts as any).combinePaths;
const _forEachAncestorDirectory = (ts as any).forEachAncestorDirectory;
Expand Down

0 comments on commit ef19daa

Please sign in to comment.