-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
declares globals and exports in .d.ts file not recognized #1172
Comments
I think the documentation needs to be improved.
|
isn't globals just for declaring global variables one by one, or from enviroment sets? rather, i would need quick lint to recognize all the global types declared in app.d.ts and accept them as global |
quick-lint-js currently does not have a mechanism to take global variables declared in one file (app.d.ts in your case) and make them visible in another file. Some possible solutions:
@KraXen72 Which solutions sound good to you? |
while 1 is a good short term solution, i think 5 would be the best - scanning, relevant .d.ts files in the project (as far as i understand it, quicklint already does scanning and parsing in these files, since i get quicklint warnings in them), and parsing declare global blocks or other ways to declare global types, so quicklint recognizes global types and supresses the unknown type warning. until this is implemented, a stopgap solution could be adding the option to disable the 'unknown type' warning, and leave known/unknown logic to the typescript LSP. I think many people use quicklint alongside the ts lsp, and not instead of it. while importing and exporting types is likely a better way to manage types than globals, for a lot of projects i either don't have that many types (they fit in 1 file), or i don't want to put in the extra effort of import/export management for types too. yes, autoimport extensions exist and they do help, but i found they often make mistakes when modifying existing imports, or just refuse to create 'import type {}' imports. |
quick-lint-js only reports diagnostics for files you open in your editor. quick-lint-js does not scan all files in your project automatically. I did want to implement project-wide analysis, but only by following
In the next few months, I don't plan on implementing a proper fix for this issue. If you want to avoid the warnings but continue using quick-lint-js, you can configure quick-lint-js. |
for now, i'm using oxc linter, but i like quick-lint more - i'll try configuring it in a bit. thanks! |
sveltekit projects have a
app.d.ts
file. i use it like this:However, the global types are not recognized and show:
tsconfig:
the "./.svelte-kit/tsconfig.json" is auto-generated / changes a lot, better to check a bare sveltekit starter project.
The text was updated successfully, but these errors were encountered: