Skip to content

Commit

Permalink
fix: pug template reporting TS2339 with strictTemplates
Browse files Browse the repository at this point in the history
close #2431
  • Loading branch information
johnsoncodehk committed Feb 20, 2023
1 parent 4ea8a5a commit e961f14
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
4 changes: 1 addition & 3 deletions packages/vue-language-plugin-pug/src/index.ts
Expand Up @@ -38,9 +38,7 @@ const plugin: VueLanguagePlugin = ({ modules }) => {
if (prop === 'offset') {
const htmlOffset = target.offset;
for (const mapped of map.toSourceOffsets(htmlOffset)) {
if (mapped[1].data !== pug.MappingKind.EmptyTagCompletion) {
return mapped[0];
}
return mapped[0];
}
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-language-service/src/index.ts
@@ -1,4 +1,4 @@
export * from './languageService';
export { ConfigurationHost, LanguageServicePlugin as EmbeddedLanguageServicePlugin, SemanticToken } from '@volar/language-service';
export * from '@volar/language-service';
export * from './ideFeatures/nameCasing';
export * from './languageService';
export * from './types';
1 change: 1 addition & 0 deletions packages/vue-language-service/src/types.ts
Expand Up @@ -9,4 +9,5 @@ export enum AttrNameCasing {
}

// only export types of depend packages
export * from '@volar/language-service/out/types';
export * from '@volar/vue-language-core/out/types';
2 changes: 1 addition & 1 deletion packages/vue-test-workspace/vue-tsc/#2225/main.vue
Expand Up @@ -14,7 +14,7 @@ const searchFunction2 = () => {
</script>

<template>
<TestComp
<component
@reset="
() => {
resetFunction()
Expand Down
6 changes: 4 additions & 2 deletions packages/vue-test-workspace/vue-tsc/#2236/main.vue
@@ -1,6 +1,8 @@
<template>
<Comp>
<component>
<template #actions></template>
</component>
<component>
<template v-slot:actions></template>
</Comp>
</component>
</template>
3 changes: 3 additions & 0 deletions packages/vue-test-workspace/vue-tsc/#2431/main.vue
@@ -0,0 +1,3 @@
<template lang="pug">
div Test
</template>
4 changes: 4 additions & 0 deletions packages/vue-test-workspace/vue-tsc/tsconfig.json
Expand Up @@ -3,6 +3,10 @@
"compilerOptions": {
"noPropertyAccessFromIndexSignature": true,
},
"vueCompilerOptions": {
"strictTemplates": true,
"plugins": ["../../vue-language-plugin-pug"]
},
"include": [
"**/*.vue",
"**/*.html",
Expand Down

0 comments on commit e961f14

Please sign in to comment.