I would like to create a "Utility Module": tnt.module.ts:
import {NgModule} from '@angular/core';
import {toUpperCase} from "./tnt.utils";
@NgModule({
declarations: [
toUpperCase
],
exports: [
toUpperCase
]
})
export default class TntModule {}
Here is one util function example: tnt.utils.ts
export const toUpperCase= function (str:String) {
return str.toUpperCase()
}
I am getting an Error:
ERROR in [default] /data/2016/le-tube/src/app/shared/tnt/tnt.module.ts:5:10
Argument of type '{ imports: undefined[]; declarations: ((str: String) => string)[]; exports: ((str: String) => str...' is not assignable to parameter of type 'NgModule'.
Types of property 'declarations' are incompatible.
Type '((str: String) => string)[]' is not assignable to type '(any[] | Type<any>)[]'.
Type '(str: String) => string' is not assignable to type 'any[] | Type<any>'.
Type '(str: String) => string' is not assignable to type 'Type<any>'.
Type '(str: String) => string' provides no match for the signature 'new (...args: any[]): any'
What am I missing ? Why can't I create a module with simple functions ? I suppose I am just missing a simple detail but I can't figure it out...