I have this function
function getAvailableProviders(tmpDir, snips, processRepo) {
const octokit = require("@octokit/rest");
octokit.repos.listForOrg(
{ org: "terraform-providers", type: "public", per_page: 100 },
(error, result) => {
result.data.forEach((element) => {
processRepo(tmpDir, element.name, snips, iterateOnDocFiles);
});
},
);
}
When I run my program, I get this error from the typescript compiler
(node:15713) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'listForOrg' of undefined
The problem is according to the octokit documentation, the repos.listForOrg
is defined.
https://octokit.github.io/rest.js/v18#repos-list-for-org
I'm just trying to learn (typescript and node), while at the same time recreate something that has been abandoned by the original devleoper. I have my require statement, according to the octokit documentation. it's not reaching out to the api. Is there something else I need to have installed in my node project to make this work correctly?