microsoft / microsoft/TypeScript

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

Offen
#31,943 5 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@RyanCavanaugh arbeitet bereits daran.

Seit 17.6.2019.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.