If I want to export all the exported members of a module (including code), I can use
export * from 'module'
If I want to export the type of a class without code I can do
export type {typeName} from 'module'
Now I have a need to export all the types from a module, without code. I would be tempted to do
export type * from 'module'
as that's the intuitive thing, but typescript type exports must be named exports (ts 1383).
So how I can I export everything from a module in such a way that its members cannot be used at runtime?
Workarounds I can think of:
Get over it and use
export *. This is an option. But for our use case I don't want users of our library to use these classes, only to use them to annotate their typesAsk pretty-please that everyone who uses our library please use
import type {typeName} from 'myLibrary'. I guess this is an option too, but how do I convince users to do this?
tl;dr: How can I emulate global type exports in Typescript?
export type {*} from 'accesscontrol'export * from './types'something like this we have done here