microsoft / microsoft/TypeScript

TS:1379 An import alias cannot reference a declaration that was exported using 'export type'

Abierto
#54,855 12 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Bug Domain: ES Modules Help Wanted
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Bug Report

🔎 Search Terms

TS1379
An import alias cannot reference a declaration that was exported using 'export type'

🕗 Version & Regression Information

This has always been the behavior as far as I can tell (edit: tested on all versions listed in playground back to >3.7.5 (changed to export type {...} statement when needed))

⏯ Playground Link

Multi file: repro but I will show in playground.

Below are pictures that might be easier to parse

💻 Code

When annotated with type it errors
Screen Shot 2023-07-01 at 10 29 21 AM

Screen Shot 2023-07-01 at 10 30 29 AM

When not annotated with type it doesn't error:
Screen Shot 2023-07-01 at 10 31 27 AM

Screen Shot 2023-07-01 at 10 31 41 AM
🙁 Actual behavior

Exports of types annotated with type error while those not annotated as types do not error even though TS understand it is still a type.

🙂 Expected behavior

Honestly I don't know which of these behaviors is correct - this behavior could be completely intentional as well - intuitively I think these should match and I prefer the behavior with no errors but it is unclear to me if this is an emit issue? I'm sorry if this behavior is on purpose and I have wasted your time. Really appreciate the work!

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.

Línea de trabajo

Comienza con la reproducción enlazada de TypeScript Playground en varios archivos y compara los casos de import-alias anotados y no anotados que producen TS1379. Determina primero si los diagnósticos diferentes son intencionados o si se deben a un defecto de emit/type-checking; se considera terminado cuando el comportamiento esperado está establecido y cubierto por una prueba de regresión adecuada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
compilers
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.