microsoft / microsoft/TypeScript
Bug: Incorrect module resolution for "valid" ES2015 specifiers with hashes and/or search parameters
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
TypeScript Version: 2.8.0-dev.20180315
Search Terms: moduleResolution "module path" hash
Code
import { x as x1 } from './x.m.js'; // Typed correctly on hover
import { x as x2 } from './x.m.js#esm' // Typed as "import x…" on hover
Expected behavior:
Since module specifiers are now standardized, whereby if given an absolute specifier (or a relative specifier and the absolute referrer) should always result in a validly constructed new URL(specifier, referrer) it is expected that when a specifier includes suffix aspects like hash and search, that those aspects would be excluded from the pathname that is being resolved.
The implications of hash and search in runtime is beyond the scope of TypeScript and should remain so unless somehow the environment is customized to behave different (plugins maybe). However, if at all relevant, the specs have stated that at runtime each unique "resolved" URL (including hash and search) evaluates to a single unique instance of the respective module. It is not expected that TypeScript would need to determine if and when a module is a specific unique instance. It is however expected that when suffix aspects are included in the specifier that TypeScript would still resolve it's types identically as it does for the pathname sans hash and search.
Sorry for the long text!
Actual behavior:
TypeScript does not resolve pathnames with hash or search parameters.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il problema con le due istruzioni di importazione mostrate, confrontando la risoluzione di './x.m.js' con './x.m.js#esm' e il pathname previsto senza hash o search. Inizia tracciando la gestione della risoluzione dei moduli di TypeScript per gli specificatori di importazione; il lavoro è completo quando entrambi gli specificatori vengono risolti negli stessi tipi, mantenendo al contempo qualsiasi semantica dei suffissi specifica del runtime al di fuori di TypeScript.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100