You cannot export an interface. You can export only:
- Other modules
- Components
- Directives
- Pipes
NgModule
is an angular concept and should not be confused with typescript module. To make a third-party user who uses your module that can use your interface, you must create a .d.ts
definition .d.ts
with your module.
If you want to use the interface inside another NgModule, you should simply use:
import {InterfaceName} from 'path/to/ngmodule/to/interface';
Also, do not put the interface in the declaration array, this is used only for pipes / components / directives.
If you want your interface to be used outside the library, you must add it to the export of your index.ts
:
export {InterfaceName} from 'path/to/ngmodule/to/interface';
source share