You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exported type merged with 'export * as namespace...' only exports type meaning. #36792
Namespaces are not really the way to go any more, babel doesn't support them, they probably aren't tree-shakeable etc. But I was hoping that the export * as ns syntax could be > used as a replacement, like this:
exporttypeFoobar=import('./Foobar').Foobar// Or:// export type { Foobar } from './Foobar'export*asFoobarfrom'./Foobar'
This seems to pass the nightly compiler, but the compiler only knows that Foobar is re-exported as a type, not a value. It would be great if the compiler could merge them into a combined value & type like with namespaces.
changed the title [-]exported type merged with 'export * as namespace...' only exports type meaning.[/-][+]Exported type merged with 'export * as namespace...' only exports type meaning.[/+]on Feb 13, 2020
This is fixed by #50853, which resolves aliases before checking their type/value meaning.
With a top-level doStuff export in ./Foobar, the export type Foobar = import('./Foobar').Foobar and export * as Foobar from './Foobar' pattern produced TS2693 ('Foobar' only refers to a type, but is being used as a value here.) in 4.9.0-dev.20220929. It compiles without that diagnostic in the adjacent 4.9.0-dev.20220930 package and in current native TypeScript.
Activity
[-]exported type merged with 'export * as namespace...' only exports type meaning.[/-][+]Exported type merged with 'export * as namespace...' only exports type meaning.[/+]jasonkuhrt commentedon Sep 1, 2021
We have certain projects/modules making heavy use of this pattern. The writing is on the wall though that we're in need of change:
I guess I don't have much to add to this issue, its well described, and our use-case is similar. I just wish I could +1000 it :)
nexsodev commentedon Oct 12, 2021
Same here, my case:
In a:
Only the options:
RequestContextandResponsePayloadare showed, none of the types is present, but it works in runtime.types/index.jsis:RyanCavanaugh commentedon Sep 3, 2026
This is fixed by #50853, which resolves aliases before checking their type/value meaning.
With a top-level
doStuffexport in./Foobar, theexport type Foobar = import('./Foobar').Foobarandexport * as Foobar from './Foobar'pattern produced TS2693 ('Foobar' only refers to a type, but is being used as a value here.) in4.9.0-dev.20220929. It compiles without that diagnostic in the adjacent4.9.0-dev.20220930package and in current native TypeScript.