microsoft / microsoft/TypeScript

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

Abierto
#31,943 5 comentarios 0 reacciones 1 asignado Ver en GitHub

@RyanCavanaugh ya está trabajando en esto.

Desde el 17/6/2019.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.