Export ServiceImplementationExtended
rrichardson opened this issue · 3 comments
I have created some wrappers around the protocat interface to work with our library/plugin system, however, in order to define the type of the handlers in my API, I need to have access to the ServiceImplementationExtended
type, which is not currently exported from index.ts.
Adding that additional export seems to not break anything and it enables my wrappers to compile.
I don't consider all internal parts of the types final. Exporting them from the index would strongly suggest that it is officially a part of the public API.
If you wish to use the type, you can import it now like so:
import { ServiceImplementationExtended } from 'protocat/dist/lib/server/call'
@grissius ServiceImplementationExtended is a type of a parameter of an exported function (Protocat.addService
).
According to typescript best practices, exposed API functions shouldn't use private types.
The workaround should work for now, though.
According to typescript best practices
Citation needed
Exposed API functions shouldn't use private types
Fair enough. I don't mean to prevent people from using them, that's why they are not part of the public API, which is actually what I wrote. Making it exported from index would indicate that the types is not likely a subject to be changed and that does not only apply to the type but also the name. You can get the type from the public API without direct export with simple inference. Exporting it would also finalize the name of the type as well and I do not think that ServiceImplementationExtended
is a good type to export solely because it is confusing for regular users. If it is not confusing to you, since you know the project, you are more than capable of using the workaround.
Thanks for the proposal though and your time in the discussion.