Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(language-core): prevent the generation of generics in JS #4836

Merged
merged 12 commits into from
Oct 24, 2024
Prev Previous commit
Next Next commit
remove isTs
  • Loading branch information
johnsoncodehk committed Oct 24, 2024
commit 901bdc3feb9728fb2f8693a44a48b44c1c9aa7ea
1 change: 0 additions & 1 deletion packages/language-core/lib/codegen/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export interface ScriptCodegenOptions {
vueCompilerOptions: VueCompilerOptions;
sfc: Sfc;
lang: string;
isTs: boolean;
scriptRanges: ScriptRanges | undefined;
scriptSetupRanges: ScriptSetupRanges | undefined;
templateCodegen: TemplateCodegenContext & { codes: Code[]; } | undefined;
Expand Down
3 changes: 2 additions & 1 deletion packages/language-core/lib/codegen/script/scriptSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ function* generateSetupFunction(
]);
}
}
if (options.isTs) {
const isTs = options.lang !== 'js' && options.lang !== 'jsx';
if (isTs) {
for (const { exp, arg } of scriptSetupRanges.cssModules) {
if (arg) {
setupCodeModifies.push([
Expand Down
4 changes: 0 additions & 4 deletions packages/language-core/lib/plugins/vue-tsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ function createTsx(
: _sfc.script && _sfc.script.lang !== 'js' ? _sfc.script.lang
: 'js';
});
const isTs = computed(() => {
return lang.get() !== 'js' && lang.get() !== 'jsx';
});
const scriptRanges = computed(() =>
_sfc.script
? parseScriptRanges(ts, _sfc.script.ast, !!_sfc.scriptSetup, false)
Expand Down Expand Up @@ -186,7 +183,6 @@ function createTsx(
fileBaseName: path.basename(fileName),
sfc: _sfc,
lang: lang.get(),
isTs: isTs.get(),
scriptRanges: scriptRanges.get(),
scriptSetupRanges: scriptSetupRanges.get(),
templateCodegen: generatedTemplate.get(),
Expand Down