i have several utility functions. best way package these up, , import them?
this trying do:
import * util './util' export class myclass{ constructor() { util.dosomething("test"); } }
then in class:
export class util{ dosomething(val: string){ return val;} dosomethingelse(val: string{ return val;} }
the error message vs "property dosomething not exist on type util."
if create file utils.ts
contains
export default class utils { static dosomething(val: string) { return val; } static dosomethingelse(val: string) { return val; } }
then can simplify client code this:
import utils './utils' export class myclass { constructor() { utils.dosomething("test"); } }
Comments
Post a Comment