halvardssm / deno-nessie

A modular Deno library for PostgreSQL, MySQL, MariaDB and SQLite migrations
MIT License
527 stars 31 forks source link

[BUG] Unable to provide a client to AbstractMigration class #112

Closed willsoto closed 3 years ago

willsoto commented 3 years ago

System (please complete the following information):

deno 1.9.2 (release, x86_64-apple-darwin)
v8 9.1.269.5
typescript 4.2.2

Describe the bug A clear and concise description of what the bug is.

I cannot provide a client to the AbstractMigration class as specified in the examples and docs.

To Reproduce Steps to reproduce the behavior:

  1. Write a migration file and provide the Client to the AbstractMigration class
  2. Migration doesn't compile
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

Migration should compile when providing a Client

Screenshots or error log If applicable, add screenshots or error log to help explain your problem.

Screen Shot 2021-05-07 at 2 40 31 PM Screen Shot 2021-05-07 at 2 41 35 PM

Additional context Add any other context about the problem here.

I have tried postgres@v0.4.5 (what is in the docs) and postgres@v0.11.2 (latest) - both fail to compile.

halvardssm commented 3 years ago

Hi @willsoto ! I mentioned this in #111 as well, but I will mention it here as well for future reference in case anyone stumbles across the same. This is how you should use the generic type:

import {AbstractMigration, ClientPostgreSQL} from "https://deno.land/x/nessie@1.2.4/mod.ts";

export default class extends AbstractMigration<ClientPostgreSQL> {

By doing this, you will see the proper typehint.

Let me know if this solves it!

willsoto commented 3 years ago

That works! Thanks