-
Notifications
You must be signed in to change notification settings - Fork 264
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
chore: use experimentalExposeScriptSetupContext for vue-tsc #1170
chore: use experimentalExposeScriptSetupContext for vue-tsc #1170
Conversation
@johnsoncodehk I gave a try to the option, as we have a test file Using the option, 2 errors went away 👍 We still have one unexpected error, for a component defined with
It also raises an error that was not existing before in
We can workaround all this, but maybe that should be fixed in vue-tsc? |
@@ -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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be ts-ignoring these or is there more work to come (maybe in Volar) before merging this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is expected to not compile without as
, as the test is just to check it is not exposed 😉 So I think it's fine to explicitly cast it to make TS happy.
@johnsoncodehk mentioned on Discord that the first part of the issue is an upstream one vuejs/core#4397 (comment) I think I'll rewrite the test to get rid of the second one, and maybe ts-ignore the first error while we wait for the issue resolution in vue-next |
18121bb
to
e69e76b
Compare
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
e69e76b
to
eeff860
Compare
Done. At the price of one |
This new option allows a better typechecking of components that expose variables.
See vuejs/language-tools#805
Refs #972 as this partially fixes it