Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/vuejs/language-tools into…
Browse files Browse the repository at this point in the history
… fix/resolve-components
  • Loading branch information
KazariEX committed Dec 20, 2024
2 parents 1dc739e + 44f1c28 commit 6d45fb3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
23 changes: 12 additions & 11 deletions packages/language-core/lib/codegen/script/scriptSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,18 @@ function* generateSetupFunction(
]);
}
}
for (const { callExp } of scriptSetupRanges.useAttrs) {
setupCodeModifies.push([
[`(`],
callExp.start,
callExp.start
], [
[` as __VLS_TemplateResult['attrs'] & Record<string, unknown>)`],
callExp.end,
callExp.end
]);
}
// TODO: circular reference
// for (const { callExp } of scriptSetupRanges.useAttrs) {
// setupCodeModifies.push([
// [`(`],
// callExp.start,
// callExp.start
// ], [
// [` as __VLS_TemplateResult['attrs'] & Record<string, unknown>)`],
// callExp.end,
// callExp.end
// ]);
// }
for (const { callExp, exp, arg } of scriptSetupRanges.useCssModule) {
setupCodeModifies.push([
[`(`],
Expand Down
3 changes: 2 additions & 1 deletion packages/language-core/lib/codegen/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export function* generateTemplate(options: TemplateCodegenOptions): Generator<Co
if (options.propsAssignName) {
ctx.addLocalVariable(options.propsAssignName);
}
ctx.addLocalVariable('$attrs');
// TODO: circular reference
// ctx.addLocalVariable('$attrs');
ctx.addLocalVariable(getSlotsPropertyName(options.vueCompilerOptions.target));
ctx.addLocalVariable('$refs');
ctx.addLocalVariable('$el');
Expand Down
12 changes: 6 additions & 6 deletions packages/tsc/tests/typecheck.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ describe(`vue-tsc`, () => {

test(`TypeScript - Stable`, () => {
expect(
getTscOutput('stable')
getTscOutput('stable').sort()
).toMatchInlineSnapshot(`
[
"test-workspace/tsc/failureFixtures/#3632/both.vue(3,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#3632/both.vue(7,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#3632/script.vue(3,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#3632/scriptSetup.vue(3,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#5071/withoutScript.vue(2,26): error TS1005: ';' expected.",
"test-workspace/tsc/failureFixtures/#5071/withScript.vue(1,19): error TS1005: ';' expected.",
"test-workspace/tsc/failureFixtures/#5071/withoutScript.vue(2,26): error TS1005: ';' expected.",
"test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.",
"test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<ToResolvedProps<{}, {}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 18 more ..., {}>'.",
"test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<ToResolvedProps<{}, {}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 18 more ..., {}>'.",
"test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.",
]
`);
});
Expand All @@ -27,18 +27,18 @@ describe(`vue-tsc`, () => {

test.skipIf(!isUpdateEvent && isGithubActions)(`TypeScript - Next`, () => {
expect(
getTscOutput('next')
getTscOutput('next').sort()
).toMatchInlineSnapshot(`
[
"test-workspace/tsc/failureFixtures/#3632/both.vue(3,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#3632/both.vue(7,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#3632/script.vue(3,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#3632/scriptSetup.vue(3,1): error TS1109: Expression expected.",
"test-workspace/tsc/failureFixtures/#5071/withoutScript.vue(2,26): error TS1005: ';' expected.",
"test-workspace/tsc/failureFixtures/#5071/withScript.vue(1,19): error TS1005: ';' expected.",
"test-workspace/tsc/failureFixtures/#5071/withoutScript.vue(2,26): error TS1005: ';' expected.",
"test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.",
"test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<ToResolvedProps<{}, {}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 18 more ..., {}>'.",
"test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<ToResolvedProps<{}, {}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 18 more ..., {}>'.",
"test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.",
]
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
"strictTemplates": true,
},
"include": [ "**/*" ],
"exclude": [ "useAttrs/main.vue" ],
}

0 comments on commit 6d45fb3

Please sign in to comment.