Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: tests from definitely typed #211

Merged
merged 5 commits into from
Oct 20, 2020

Conversation

mmkal
Copy link
Contributor

@mmkal mmkal commented Oct 20, 2020

Related: #209
Part of #195

This adds tests defined for the types in https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/slonik/slonik-tests.ts - this is the API existing typescript users are working with - so after this, the only breaking changes for typescript users will be removal of some helpers like the interceptor presets that should already have gone from the definitions.

The tests are in test/dts.ts, GitHub may collapse it on some browsers since it's fairly long, but it's (almost) a straight copy-paste.

Exports some new methods to make them pass. Some modifications made for breaking changes that weren't ported over there.

Uses expect-type for testing since definitely typed uses tslint/dtslint which is deprecated.

This also replaces most any instances in src/types.ts with generics.

After this:

  • switch from babel->tsc for building and @babel/register->ts-node for tests (I have a local branch for this on top of this one)
  • convert default exports to named exports to compensate for babel plugins/equivalents not existing in typescript (likewise, this is ready)
  • remove // @flow annotations and switch // @ts-ignores to // @ts-expect-errors (mostly just find and replace)

At that point I think everything should be read to re-enable semantic-release in .travis.yml and merge typescript into master! @gajus I should be able to do all that today.

This adds tests defined for the types in https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/slonik/slonik-tests.ts

Exports some new methods to make them pass. Some modifications made for breaking changes that weren't ported over there.

Uses expect-type for testing
@coveralls
Copy link

coveralls commented Oct 20, 2020

Coverage Status

Coverage remained the same at 82.949% when pulling afe34f9 on mmkal:ts/definitelyTypedTests into ef2e2de on gajus:typescript.

@danielrearden
Copy link
Contributor

@mmkal This looks amazing 😍

README.md Outdated Show resolved Hide resolved
@mmkal mmkal requested a review from gajus October 20, 2020 18:02
@gajus gajus merged commit 7fe5c36 into gajus:typescript Oct 20, 2020
@gajus
Copy link
Owner

gajus commented Oct 20, 2020

🥳

mmkal added a commit to mmkal/slonik that referenced this pull request Oct 21, 2020
* Add tests from definitely typed tests
* Describe token types
* Use generics for some internal types
* Make createSqlTag generic
* Give `...First` functions more intuitive typeargs
@gajus
Copy link
Owner

gajus commented Oct 21, 2020

🎉 This PR is included in version 22.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants