Skip to content

Commit

Permalink
fix(vue-component-meta): cannot create checker with TS 4.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Aug 28, 2022
1 parent d4fd1ba commit 18eb403
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 226 deletions.
7 changes: 2 additions & 5 deletions packages/vue-component-meta/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function createComponentMetaChecker(tsconfigPath: string, checkerOptions:
function createComponentMetaCheckerBase(tsconfigPath: string, parsedCommandLine: vue.ParsedCommandLine, checkerOptions: MetaCheckerOptions) {

const scriptSnapshot: Record<string, ts.IScriptSnapshot> = {};
const globalComponentName = tsconfigPath.replace(/\\/g, '/') + '.global.ts';
const globalComponentName = tsconfigPath.replace(/\\/g, '/') + '.global.vue';
const host: vue.LanguageServiceHost = {
...ts.sys,
getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), // should use ts.getDefaultLibFilePath not ts.getDefaultLibFileName
Expand All @@ -83,10 +83,7 @@ function createComponentMetaCheckerBase(tsconfigPath: string, parsedCommandLine:
fileText = getMetaScriptContent(fileName);
}
else if (fileName === globalComponentName) {
fileText = `
import { defineComponent } from 'vue';
export default defineComponent({});
`;
fileText = `<script setup lang="ts"></script>`;
}
else {
fileText = ts.sys.readFile(fileName);
Expand Down
Loading

0 comments on commit 18eb403

Please sign in to comment.