Skip to content

Commit 67bd6fc

Browse files
committed
Merge branch 'master' into fix/template-ref-required
2 parents 43f06a4 + cd7c2fd commit 67bd6fc

40 files changed

+508
-515
lines changed

packages/language-core/lib/codegen/template/element.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ function* generateReferencesForElements(
549549
) {
550550
const [content, startOffset] = normalizeAttributeValue(prop.value);
551551

552-
yield `// @ts-ignore${newLine}`;
552+
yield `// @ts-ignore navigation for \`const ${content} = ref()\`${newLine}`;
553553
yield `__VLS_ctx`;
554554
yield* generatePropertyAccess(
555555
options,

packages/language-server/tests/completions.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ describe('Completions', async () => {
188188
"slot",
189189
"template",
190190
"fixture",
191+
"BaseTransition",
191192
]
192193
`);
193194
});
@@ -341,7 +342,7 @@ describe('Completions', async () => {
341342
"(",
342343
],
343344
"detail": "Add import from "./ComponentForAutoImport.vue"
344-
(property) default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<{}>>, {}, {}>",
345+
(property) default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<...>, ... 7 more ..., {}>",
345346
"documentation": {
346347
"kind": "markdown",
347348
"value": "",

packages/language-server/tests/renaming.spec.ts

+51-3
Original file line numberDiff line numberDiff line change
@@ -871,16 +871,16 @@ describe('Renaming', async () => {
871871
`);
872872
});
873873

874-
it('Template Ref', async () => {
874+
it('Ref', async () => {
875875
expect(
876876
await requestRename('tsconfigProject/fixture.vue', 'vue', `
877877
<template>
878878
<a ref="foo"></a>
879879
</template>
880880
881881
<script lang="ts" setup>
882-
import { useTemplateRef } from 'vue';
883-
const el = useTemplateRef('foo|');
882+
import { ref } from 'vue';
883+
const foo| = ref();
884884
</script>
885885
`, 'bar')
886886
).toMatchInlineSnapshot(`
@@ -900,6 +900,41 @@ describe('Renaming', async () => {
900900
},
901901
},
902902
},
903+
{
904+
"newText": "bar",
905+
"range": {
906+
"end": {
907+
"character": 13,
908+
"line": 7,
909+
},
910+
"start": {
911+
"character": 10,
912+
"line": 7,
913+
},
914+
},
915+
},
916+
],
917+
},
918+
}
919+
`);
920+
});
921+
922+
it('Template Ref', async () => {
923+
expect(
924+
await requestRename('tsconfigProject/fixture.vue', 'vue', `
925+
<template>
926+
<a ref="foo"></a>
927+
</template>
928+
929+
<script lang="ts" setup>
930+
import { useTemplateRef } from 'vue';
931+
const el = useTemplateRef('foo|');
932+
</script>
933+
`, 'bar')
934+
).toMatchInlineSnapshot(`
935+
{
936+
"changes": {
937+
"file://\${testWorkspacePath}/tsconfigProject/fixture.vue": [
903938
{
904939
"newText": "bar",
905940
"range": {
@@ -913,6 +948,19 @@ describe('Renaming', async () => {
913948
},
914949
},
915950
},
951+
{
952+
"newText": "bar",
953+
"range": {
954+
"end": {
955+
"character": 16,
956+
"line": 2,
957+
},
958+
"start": {
959+
"character": 13,
960+
"line": 2,
961+
},
962+
},
963+
},
916964
],
917965
},
918966
}

packages/tsc/tests/__snapshots__/dts.spec.ts.snap

+45-45
Large diffs are not rendered by default.

packages/tsc/tests/typecheck.spec.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@ describe(`vue-tsc`, () => {
99
getTscOutput('stable')
1010
).toMatchInlineSnapshot(`
1111
[
12-
"test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 12 more ..., {}>'.",
13-
"test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 12 more ..., {}>'.",
12+
"test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 17 more ..., {}>'.",
13+
"test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 17 more ..., {}>'.",
1414
"test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.",
1515
]
1616
`);
1717
});
1818

19-
test.skipIf(!process.env.GITHUB_ACTIONS)(`TypeScript - Next`, () => {
19+
const isUpdateEvent = process.env.npm_lifecycle_event === 'test:update';
20+
const isGithubActions = !!process.env.GITHUB_ACTIONS;
21+
22+
test.skipIf(!isUpdateEvent && isGithubActions)(`TypeScript - Next`, () => {
2023
expect(
2124
getTscOutput('next')
2225
).toMatchInlineSnapshot(`
2326
[
24-
"test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 12 more ..., {}>'.",
25-
"test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 12 more ..., {}>'.",
27+
"test-workspace/tsc/failureFixtures/directives/main.vue(4,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 17 more ..., {}>'.",
28+
"test-workspace/tsc/failureFixtures/directives/main.vue(9,6): error TS2339: Property 'notExist' does not exist on type 'CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, { exist: typeof exist; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ... 17 more ..., {}>'.",
2629
"test-workspace/tsc/failureFixtures/directives/main.vue(12,2): error TS2578: Unused '@ts-expect-error' directive.",
2730
"test-workspace/tsc/passedFixtures/#3373/tsconfig.json(4,3): error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
2831
Use 'verbatimModuleSyntax' instead.",

0 commit comments

Comments
 (0)