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

Wrong import attribute typed as any, but should be typed as string #61469

Open
johann1301s opened this issue Mar 23, 2025 · 1 comment
Open
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone

Comments

@johann1301s
Copy link

johann1301s commented Mar 23, 2025

🔎 Search Terms

According to the documentation at MDN for Import attributes, the attribute value ie. dataN is of typestring.

In my VSCode setup using Typescript 5.8.2, this is typed as any in my .ts file:

Image

My tsconfig is as follows:

{
  "exclude": ["dist"],
  "compilerOptions": {
    "jsx": "react",
    "target": "ES2022",
    "module": "esnext",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "strict": true,
    "skipLibCheck": true,
    "noImplicitAny": true,
    "isolatedModules": false
  }
}

🕗 Version & Regression Information

  • This changed between versions ______ and _______
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

No response

💻 Code

// Your code here

🙁 Actual behavior

Import attribute is typed as any instead of string.

🙂 Expected behavior

Import attribute should be typed as string.

Additional information about the issue

No response

@RyanCavanaugh
Copy link
Member

It's a grammar error to write anything but a string literal there, so I'm not sure why anyone cares what the hover says

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases labels Mar 27, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Projects
None yet
Development

No branches or pull requests

2 participants