Microsoft/TypeScript

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

Open

#54.855 geöffnet am 1. Juli 2023

Auf GitHub ansehen
 (12 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: ES ModulesHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

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

When not annotated with type it doesn't error:

🙁 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!

Contributor Guide