microsoft / microsoft/TypeScript
Readonly type breaks Set and Map
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.4.0-dev.201xxxxx
Search Terms:
Code
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
Expected behavior:
However, Set and Map can't use with es3 and es5. We need any workaround.
export type Readonly<T> =
T extends ReadonlySet<infer V> ? ReadonlySet<V> :
T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, V> :
{ readonly [P in keyof T]: T[P]; };
Actual behavior:
type Readonly<T> = {
readonly [P in keyof T]: T[P];
};
Playground Link:
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
Non è indicato alcun file del repository né alcun test. Inizia riducendo gli snippet Readonly forniti a un esempio TypeScript riproducibile ed eseguilo con tsc; il lavoro è completo quando il comportamento previsto di Set e Map per ES3/ES5 è riprodotto chiaramente e coperto da un test del compilatore appropriato.
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
- Da chiarire
- Idoneità per principianti
- 25/100