Skip to content

Commit

Permalink
chore: use experimentalExposeScriptSetupContext for vue-tsc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cexbrayat committed Dec 22, 2021
1 parent 78b8dff commit 18121bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/expose.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('expose', () => {
expect(wrapper.vm.other).toBe('other')
// can't access `msg` as it is not exposed
// and we are in a component with a setup returning a render function
expect(wrapper.vm.msg).toBeUndefined()
expect((wrapper.vm as unknown as { msg: undefined }).msg).toBeUndefined()
})

it('access vm with <script setup> and defineExpose()', async () => {
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"tests",
"src",
"types"
]
],
"vueCompilerOptions": {
"experimentalExposeScriptSetupContext": true
}
}
3 changes: 1 addition & 2 deletions tsconfig.volar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"compilerOptions": {
"lib": ["DOM", "ES2020"],
"skipLibCheck": true
},
"exclude": ["tests/expose.spec.ts"]
}
}

0 comments on commit 18121bb

Please sign in to comment.