microsoft / microsoft/TypeScript
Wrong import attribute typed as any, but should be typed as string
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 132
Description
### 🔎 Search Terms
According to the [documentation at MDN for Import attributes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with), the attribute value ie. [dataN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with#datan) is of type`string`.
In my VSCode setup using Typescript 5.8.2, this is typed as `any` in my .ts file:
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
```ts
// 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_
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Aucun fichier source, test ou playground n'est nommé. Reproduisez le comportement avec TypeScript 5.8.2 en utilisant un import attribute et examinez le chemin de typage du compilateur pour la valeur de l'attribut. C'est terminé lorsque la valeur est inférée comme string plutôt que any, avec une couverture de régression pour le cas signalé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- compilers
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100