Sunday 27 August 2023

Cannot import a TypeScript library that was installed from a GitHub fork

I'm trying to use the probot library to build a GitHub app. However, as per this issue, probot does not support ESM modules, and I need ESM modules in order to have my app function properly.

Fortunately, this fork adds ESM support to the library. However, after installing the library by running the following line:

npm i github:pixelass/probot#feat/esm-it-plz

which installs without issue, I'm unable to import the library. When I add the line:

import { Probot } from "probot"

I get the following error:

Cannot find module 'probot' or its corresponding type declarations.ts(2307)

I even made my own fork of the fork and, as suggested by How to have npm install a typescript dependency from a GitHub url?, added the following to the module's package.json:

"postinstall": "tsc --outDir ./lib"

But even when I install my own fork, I get a different error:

Module '"probot"' has no exported member 'Probot'.ts(2305)

Does anyone know how to solve this issue?



from Cannot import a TypeScript library that was installed from a GitHub fork

No comments:

Post a Comment