-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
script block next to script setup is in TSX mode by default #4106
Comments
Does this happen in other cases than the old version of casting? You should use |
I wasn't aware this syntax was old or not recommended.
And in the as section:
Doesn't sound very deprecated to me. To answer your quetion: yes there are other syntactic ambiguities, related to generics. I think there's a reason why TS has a flag to opt into the TSX syntax, and it would be good if Vue followed suit. |
Thanks for the links! So the If right now tsx works in
That one works in the SFC playground. |
I agree using
For the anecdote, generics problems happen.
Is it really? I think regular So if this is specific to |
That's true! It would be acceptable to change the behavior right now and I doubt it will affect a lot of people. I haven't tried the different combinations but keeping the behavior coherent between different usages of |
Version
3.1.4
Reproduction link
https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE+e3sgbXNnIH19PC9oMT5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQgbGFuZz1cInRzXCI+XG5cdGxldCB4ID0gPGFueT4zNDtcbjwvc2NyaXB0PlxuXG48c2NyaXB0IHNldHVwIGxhbmc9XCJ0c1wiPlxuY29uc3QgbXNnID0gJ0hlbGxvIFdvcmxkISdcbjwvc2NyaXB0PiJ9
Steps to reproduce
Use script setup with
lang="ts"
, add a regular<script lang="ts">
block next to it, containing a cast.What is expected?
Compiles fine.
What is actually happening?
Compilation error, seems like the script block is handled as TSX by default.
Regular TS and TSX are not compatible, there are ambiguities with casts and (sometimes) generic syntax.
Users should opt into TSX with
lang="tsx"
.The text was updated successfully, but these errors were encountered: