microsoft / microsoft/TypeScript
Type definitions overshadowing
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
TypeScript Version: 3.8.3
(also tried 3.9.0-dev.20200310)
Search Terms:
"Module '"immutable"' has no exported member"
Code
(not self contained)
import { hash } from "immutable";
export function test(): number {
return hash(1);
}
Actual behavior:
src/index.ts:1:10 - error TS2305: Module '"immutable"' has no exported member 'hash'.
1 import { hash } from "immutable";
~~~~
even though
grep "export function hash" node_modules/immutable/dist/immutable.d.ts
reveals
export function hash(value: any): number;
Because it uses type definitions in
node_modules/@types/draft-js/node_modules/immutable/dist/immutable.d.ts
instead of
node_modules/immutable/dist/immutable.d.ts
Demo:
sadly I did not find any way to put it in a playground, in any case:
https://gitlab.com/rawieo/issue_demo_1
Related Issues:
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
Inizia da src/index.ts e confronta le dichiarazioni in node_modules/immutable/dist/immutable.d.ts e node_modules/@types/draft-js/node_modules/immutable/dist/immutable.d.ts. Riproduci l’import con TypeScript 3.8.3 o con la versione nightly indicata, quindi traccia la risoluzione dei moduli per capire perché vengono selezionate le definizioni annidate. È completato quando l’export hash valido viene risolto senza TS2305.
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