microsoft / microsoft/TypeScript

Issues with Pick causes tsc (on Node12/Win10?) to hang.

Aperta
#31,943 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@RyanCavanaugh ci sta già lavorando.

Dal 17/6/2019.

Needs Investigation
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

TypeScript Version: 3.5.2

Search Terms: Pick, mapped types

Problem: Unfortunately, I've not been able to reproduce outside my project in small whittled down samples, but the problem causes tsc to hang and as a result really needs to be investigated. The idea is as follows: I have an interface StoreState which has (among other properties some of which use mapped types) a property called windows. Therefore, the type Pick<StoreState, 'windows'> should be equivalent to { windows: StoreState['windows'] }. Within the content of one of my files, I cast a variable as the latter type and it works like a charm.

const { windows } = state as { windows: StoreState['windows'] };

However if instead I try to clean the code up by using the Pick, it causes the tsc process (and VS code if it's open to that file and I attempt to hover) to hang, take up tons of memory (node/tsc were at over 2gb before I killed it) and never complete the compilation.

Stranger still is that within the same project, but in a different file, I write the following with no issue.

const { windows }: Pick<StoreState, 'windows'> = ...

Due to corporate rules I can't simply upload this project to github, however if someone directly from microsoft (i.e. @RyanCavanaugh) sends me a private message, I could send them a zip file of the source, pointing out where to find the issue. I'm well aware that no one in this forum is interested in my app (especially at this nascent phase in its buildout), but I'm not risking getting fired in order to file a bug when I have an acceptable workaround.

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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.