-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add option to force enable TypeScript option checkJs
#352
Comments
I see two possible implementations:
1 is simpler, but 2 feels more elegant. 2 requires some changes to how the virtual documents are built, but I’ve been wanting to change that anyway. Also we need to come up with a name for the configuration setting. I consider the use of |
What if users do |
That doesn’t work. It must be a line comment at the top of the file. In case of Volar at the top of the virtual JS file. This does work. {
// @ts-check
} We could make We could also make a custom setting in {
"compilerOptions": {},
"mdx": {
// We already have this
"plugins": [],
// This would be new
"check": true
}
} Regardless, I think it’s good to allow the user to control this setting in their editor configuration. It’s a preference. People might not want to commit changes just to enhance the MDX editing experience. |
This would be a great addition! {
"compilerOptions": {
"checkJs": true,
},
"include": {
"**/*.mdx"
}
} |
Volar 2.0 will recommend based on TS Plugin to improve performance, and TS Plugin cannot get IDE configs, so I recommend solving it through tsconfig option for future implementation. I think the |
Related PR: johnsoncodehk#2 It looks like it is possible to pass configuration options to TypeScript plugins from a VSCode extension (https://code.visualstudio.com/api/references/contribution-points#Plugin-configuration). |
The MDX language service now accepts the option `checkMdx`. When this is enabled, it tells TypeScript to type check the virtual JSX by inserting a `@ts-check` comment. The language server reads this as the option `mdx.checkMdx` from `tsconfig.json`. Closes #352
The MDX language service now accepts the option `checkMdx`. When this is enabled, it tells TypeScript to type check the virtual JSX by inserting a `@ts-check` comment. The language server reads this as the option `mdx.checkMdx` from `tsconfig.json`. Closes #352
Initial checklist
Problem
Under the hood MDX is transformed to JavaScript(X) for type checking. By default TypeScript only checks TypeScript(X). It provides subtle editor features, but no red squiggly lines for type errors. Some users expect the latter.
Solution
Add a configuration option to force more strict type checking inside MDX files.
Alternatives
N/A
The text was updated successfully, but these errors were encountered: