Closed t3hmrman closed 3 years ago
I could also add a basic r2g
-based test to this PR and hook that into the project testing, but figured I'd at least get the regular PR up first.
[EDIT] - Quick & dirty local testing procedures:
First, Create a new small test project (npm init
), with this index.ts
:
import { createPool } from "generic-pool";
const pool = createPool({
create: () => Promise.resolve(1),
destroy: () => Promise.resolve(1),
});
pool
.drain()
// Expect Typescript to complain on the line below since PromiseLike has no .catch()
.catch((err: Error) => {});
After creating the new project I did two things:
Confirming old (broken) functionality
npm install generic-pool
npm install @types/generic-pool
(you may have to re-link the local generic-pool
)tsc index.ts --watch
.catch
not being on PromiseLike
Checking the new index.d.ts
r2g
's Z stage to create a local published artifact @ $HOME/.r2g/temp/project
(generic-pool
will be in node_modules
under that folder) -- roughly npm install -D r2g && ./node_modules/.bin/r2g --skip=t,s
, it will fail but ignore it because the package does get packed)npm link ~/.r2g/temp/project/node_modules/generic-pool
inside the test projectnpm remove @types/generic-pool
(you may have to re-link the local generic-pool
)tsc index.ts
) and you should not see the same errorAgain, this can be made more easily automatable with r2g
(this is what it's for, you just need to add a folder called .r2g
in the project and add tests in it. But the method above was doable for quick & dirty testing.
I've done the bare minimum:
@types
repositoryPromiseLike
withPromise
I would love some help checking the published artifact however -- locally I'm using
r2g
and the build package looks fine (includesindex.d.ts
in the package root).Resolves #259