microsoft / microsoft/TypeScript

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

Aperta
#61,469 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Domain: ES Modules Help Wanted Possible Improvement
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

🔎 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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non viene indicato alcun file sorgente, test o playground. Riproduci il comportamento con TypeScript 5.8.2 usando un import attribute e ispeziona il percorso di tipizzazione del compilatore per il valore dell'attributo. È completato quando il valore viene inferito come string invece di any, con una copertura di regressione per il caso segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.