Skip to content
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

Error use of undeclared type on types defined in .d.ts files #1214

Closed
lifeisfakenews opened this issue Mar 30, 2024 · 1 comment
Closed

Error use of undeclared type on types defined in .d.ts files #1214

lifeisfakenews opened this issue Mar 30, 2024 · 1 comment

Comments

@lifeisfakenews
Copy link

I am getting the error use of undeclared type on Tournament for the following code:

const tournament = query.data() as Tournament;
tournament.id = query.id;

even though, in vsc i can ctrl click on Tournament and it takes me to the definition in my types.d.ts file.

i can even hover it and it will show me the type information
image

@strager
Copy link
Collaborator

strager commented Apr 27, 2024

Yeah, this looks to be the same issue as #1172. Currently quick-lint-js does not respect declare global in .d.ts files like this. I wrote some possible solutions in this comment: #1172 (comment)

Some possible solutions:

  1. Rewrite your code to use import instead of globals.
  2. Manually replicate app.d.ts to your quick-lint-js.config.
  3. Use a tool which replicates app.d.ts's globals to your quick-lint-js.config. (This tool does not yet exist.)
  4. Use a "globals-files" feature in quick-lint-js.config to specify source files. You would list "globals-files": ["src/app.d.ts"]. (This feature does not yet exist.)
  5. Have quick-lint-js auto-scan for .ts and .d.ts files which declare globals, similar to what TypeScript's compiler does. (This feature does not yet exist.)

I'm closing this as a duplicate.

@strager strager closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants