Skip to content

Commit 18121bb

Browse files
committed
chore: use experimentalExposeScriptSetupContext for vue-tsc
This new option allows a better typechecking of components that expose variables. See vuejs/language-tools#805 Refs vuejs#972 as this partially fixes it
1 parent 78b8dff commit 18121bb

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

tests/expose.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('expose', () => {
2828
expect(wrapper.vm.other).toBe('other')
2929
// can't access `msg` as it is not exposed
3030
// and we are in a component with a setup returning a render function
31-
expect(wrapper.vm.msg).toBeUndefined()
31+
expect((wrapper.vm as unknown as { msg: undefined }).msg).toBeUndefined()
3232
})
3333

3434
it('access vm with <script setup> and defineExpose()', async () => {

tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@
2222
"tests",
2323
"src",
2424
"types"
25-
]
25+
],
26+
"vueCompilerOptions": {
27+
"experimentalExposeScriptSetupContext": true
28+
}
2629
}

tsconfig.volar.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
"compilerOptions": {
44
"lib": ["DOM", "ES2020"],
55
"skipLibCheck": true
6-
},
7-
"exclude": ["tests/expose.spec.ts"]
6+
}
87
}

0 commit comments

Comments
 (0)