I found an interesting package and want to use it in my typescript application: https://github.com/dsherret/ts-nameof
But I cannot import nameof
function. It is not exported in d.ts file:
declare module "ts-nameof" {
interface Api {
...
}
var func: Api;
export = func;
}
declare function nameof<T>(func?: (obj: T) => void): string;
declare function nameof(obj: Object | null | undefined): string;
declare namespace nameof {
function full<T>(periodIndex?: number): string;
function full(obj: Object | null | undefined, periodIndex?: number): string;
}
How should I import nameof
function into my typescript module?
for import 'ts-nameof';
I have Uncaught ReferenceError: nameof is not defined
error.
Add this into tsd.d.ts
:
/// <reference path="../node_modules/ts-nameof/ts-nameof.d.ts" />
Make sure to put correct path to node_modules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With