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 #1790 #2248

Merged
merged 2 commits into from
Sep 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion server/src/services/typescriptService/serviceHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ export function getServiceHost(
const jsHost = createLanguageServiceHost(compilerOptions);
const templateHost = createLanguageServiceHost({
...compilerOptions,
noImplicitAny: false,
noUnusedLocals: false,
noUnusedParameters: false,
allowJs: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,27 @@ export function createTemplateDiagnosticFilter(tsModule: T_TypeScript) {
return true;
};

return mergeFilter([ignorePrivateProtectedViolation]);
const ignoreNoImplicitAnyViolationInNativeEvent: DiagnosticFilter = diag => {
const noImplicitAnyViolation = 7006;

if (diag.code !== noImplicitAnyViolation) {
return true;
}

const source = diag.file;
if (!source) {
return true;
}

const target = findNodeFromDiagnostic(diag, source);
if (target && tsModule.isParameter(target.parent)) {
return false;
}

return true;
};

return mergeFilter([ignorePrivateProtectedViolation, ignoreNoImplicitAnyViolationInNativeEvent]);
}

/**
Expand Down
9 changes: 8 additions & 1 deletion test/interpolation/features/diagnostics/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,14 @@ describe('Should find template-diagnostics in <template> region', () => {
});
});

const noErrorTests: string[] = ['class.vue', 'style.vue', 'hyphen-attrs.vue', 'template-literal.vue'];
const noErrorTests: string[] = [
'class.vue',
'style.vue',
'hyphen-attrs.vue',
'template-literal.vue',
'no-implicit-any-parameters.vue',
'no-implicit-any-v-for-array.vue'
];

noErrorTests.forEach(t => {
it(`Shows no template diagnostics error for ${t}`, async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div @click="(event) => onClick(event)">
<div @click="(event) => onClick(event)">
<div :allow="(event) => onClick(event)" />
</div>
</div>
</template>

<script>
export default {
methods: {
onClick (e) {
console.log(e)
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<div>
<div
v-for="num in list"
:key="num.q"
>
Test {{num.q.toString()}}
</div>
</div>
</template>

<script lang="ts">
import Vue from 'vue'

export default Vue.extend({
computed: {
list () {
const result = []
for (let i = 1; i < 10; i++) {
if (i % 2 === 0)
result.push({ c: i, q: i })
}
return result
}
}
})
</script>