-
Notifications
You must be signed in to change notification settings - Fork 54
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
Reinstate glint-expect-error (and other directives) for tsc and TS Plugin using Vue's approach #799
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support for
@glint-expect-error
was previously provided by monkeypatching thetypescript-semantic
Language Service plugin provided by Volar, but unfortunately:runTsc
which our glint type-checking binary uses.The solution is to move more of the expect-error (and other directive) logic into our mapping code so that when we call
toVolarMappings
, we can make use of theshouldReport
callback to keep track of diagnostics raised within theglint-expect-error
directive's area of effect. It is complicated and possibly brittle but at least it's in line with Vue, and any upstream breaking changes should be much easier to follow.TODO
Closes #796
Caveat: Expected Future Work
I might be actually impossible to restore exact semantics from Glint v1 directives (expect-error / ignore) do the Volar's constraints, specifically surrounding the requirement that expect-error logic be expressed as closely/statically within the transformed TS as possible. The Vue tooling maintainer acknowledges that this is much harder to pull off in Volar 2 but is necessary ultimately in order to get things working within the TS Plugin, which is the future of Volar and the only way that our classic two file (e.g. .ts + .hbs) components can/will be supported in the future.
I need to move on to other things; in the mean time, users are encouraged to try out the Alpha let me/us know whether the changes in directive behavior/semantics are too numerous to be adjusted within the codebases (or perhaps the new implementation is just plain buggy). Ultimately there will probably be some breaking changes but it's impossible for me to get a sense of scale right now.