I want to use newman (https://www.npmjs.com/package/newman) in a typescript project to execute postmancollection, but when getting an error when I import (import { Newman } from 'newman';) the module
I tried instruction provided in https://community.getpostman.com/t/running-newman-in-typescript-node-project/7932 to import javascript module to typescript by running npm install @types/node --save
import { Newman } from 'newman';
export class PostmanCollectionExecution {
public static async onBoardLoan(_numberOfLoan: number): Promise<boolean> {
// call newman.run to pass `options` object and wait for callback
await Newman.run({
collection: require('./sample-collection.json'),
reporters: 'cli'
}, function (err) {
if (err) {
console.log(err);
return false;
}
});
return true;
}
}
Error: - Failed: Cannot read property 'run' of undefined - [ts] Module '"/Users/joe.tharayil/enerbank.multidisbursement.web/node_modules/@types/newman/index"' has no exported member 'Newman'."
Is it possible to use newman in typescrip? If so how do import the module and provide and example of usage