halvardssm / deno-nessie

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

[BUG] TS2790 [ERROR]: The operand of a 'delete' operator must be optional #77

Closed giggio closed 4 years ago

giggio commented 4 years ago

System (please complete the following information):

Describe the bug When running on 1.3.3 it gives the error.

To Reproduce Steps to reproduce the behavior:

  1. Setup a migration
  2. Run: deno run --allow-net --allow-read --allow-write https://deno.land/x/nessie@v1.0.4/cli.ts migrate
  3. See error

Expected behavior Migrations run.

Screenshots or error log

❯ deno run --allow-net --allow-read --allow-write https://deno.land/x/nessie@v1.0.4/cli.ts migrate
Check https://deno.land/x/nessie@v1.0.4/cli.ts
error: TS2790 [ERROR]: The operand of a 'delete' operator must be optional.
    delete this.conn;
           ~~~~~~~~~
    at https://deno.land/x/postgres@v0.4.3/connection.ts:612:12

TS2790 [ERROR]: The operand of a 'delete' operator must be optional.
    delete this.bufReader;
           ~~~~~~~~~~~~~~
    at https://deno.land/x/postgres@v0.4.3/connection.ts:613:12

TS2790 [ERROR]: The operand of a 'delete' operator must be optional.
    delete this.bufWriter;
           ~~~~~~~~~~~~~~
    at https://deno.land/x/postgres@v0.4.3/connection.ts:614:12

TS2790 [ERROR]: The operand of a 'delete' operator must be optional.
    delete this.packetWriter;
           ~~~~~~~~~~~~~~~~~
    at https://deno.land/x/postgres@v0.4.3/connection.ts:615:12

Found 4 errors.

Additional context

I believe this is happening because of TypeScript 4.0, which has just been introduced in Deno, it wasn't failing in the previous version.

This is the project and commit that I'm using, if you want to repro: https://github.com/giggio-samples/deno-api-starter-oak/tree/a66ba95ea8aaa0f0dc0ce4812b15d17a8171f8fc