paralleldrive / riteway

Simple, readable, helpful unit tests.
MIT License
1.15k stars 35 forks source link

Fix types #304

Closed tmueller closed 3 years ago

tmueller commented 3 years ago

According to this PR in DefinitelyTyped the types for cheerio have changed. To be precise, CheerioStatic was renamed to Root in namespace cheerio.

This PR changes the return type of render and adds an additional type check for index.d.ts.

When working on the package, I saw you use npx -p typescript tsc. Since you declared typescript a dev dependency, wouldn't it be possible to call tsc directly?

Thanks for creating such a wonderful package.

tmillr commented 3 years ago

@tmueller I keep getting errors for this as well.

Also would be helpful if this line were changed: https://github.com/tmueller/riteway/blob/a9482c1679a964d6e63ee18a27f8ea21d9f0fed1/index.d.ts#L6

to this

  export function Try<U extends any[], V>(fn: (...args: U) => V, ...args: U): V extends Promise<any> ? Promise<any> : any

so that Try() reports back whether it returns a Promise (and subsequently whether we need to await it's execution when, say, inlining it into the value of the "actual" property).

tmueller commented 3 years ago

Hi @ericelliott ,

could you be so kind to check this PR?

ericelliott commented 3 years ago

Approved - @ me here if I forget to merge and deploy.

tmueller commented 3 years ago

Hi @ericelliott ,

here's your reminder to merge and deploy :)