Skip to content

Commit

Permalink
set target
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm authored Aug 20, 2024
1 parent 6dac14e commit e9a22d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/language-server/src/plugins/typescript/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ async function createLanguageService(
// NodeJS: up to 4.9, Node10: since 5.0
(ts.ModuleResolutionKind as any).NodeJs ?? ts.ModuleResolutionKind.Node10;
}

if (
!compilerOptions.module ||
[
Expand All @@ -712,6 +713,12 @@ async function createLanguageService(
compilerOptions.module = ts.ModuleKind.ESNext;
}

if (!compilerOptions.target) {
compilerOptions.target = ts.ScriptTarget.Latest;
} else if (ts.ScriptTarget.ES2015 > compilerOptions.target) {
compilerOptions.target = ts.ScriptTarget.ES2015;
}

// detect which JSX namespace to use (svelte | svelteNative) if not specified or not compatible
if (!compilerOptions.jsxFactory || !compilerOptions.jsxFactory.startsWith('svelte')) {
//override if we detect svelte-native
Expand Down

0 comments on commit e9a22d0

Please sign in to comment.