knex-tiny-logger icon indicating copy to clipboard operation
knex-tiny-logger copied to clipboard

Typescript typings broken with Knex > 0.95

Open lucaspiller opened this issue 4 years ago • 4 comments
trafficstars

Related to #9, the Typescript typings are broken when using this package with the latest version of Knex:

node_modules/knex-tiny-logger/typings/index.d.ts:10:46 - error TS2709: Cannot use namespace 'Knex' as a type.

    export default function knexTinyLogger(knex: Knex, options?: KnexTinyLoggerOptions): Knex
                                                ~~~~

node_modules/knex-tiny-logger/typings/index.d.ts:10:86 - error TS2709: Cannot use namespace 'Knex' as a type.

    export default function knexTinyLogger(knex: Knex, options?: KnexTinyLoggerOptions): Knex

In my code I had to change:

import Knex from 'knex'

to:

import { Knex } from 'knex'

So it's probably something similar here.

  • knex-tiny-logger 2.1.0
  • knex 0.95.4
  • typescript 4.2.4

lucaspiller avatar Apr 14 '21 06:04 lucaspiller

I'm seeing the same issue. I can't upgrade from Knex v0.21.19 unless I remove this package.

samalexander avatar Apr 28 '21 09:04 samalexander

Same here..

$ tsc && node dist/main.js
node_modules/knex-tiny-logger/typings/index.d.ts:10:46 - error TS2709: Cannot use namespace 'Knex' as a type.

10 export default function knexTinyLogger(knex: Knex, options?: KnexTinyLoggerOptions): Knex
                                                ~~~~

node_modules/knex-tiny-logger/typings/index.d.ts:10:86 - error TS2709: Cannot use namespace 'Knex' as a type.

10 export default function knexTinyLogger(knex: Knex, options?: KnexTinyLoggerOptions): Knex
                                                                                        ~~~~

JigneshWorld avatar Apr 28 '21 14:04 JigneshWorld

I submitted a PR here https://github.com/khmm12/knex-tiny-logger/pull/15

klauszhang avatar May 18 '21 00:05 klauszhang

Hi,

I've create knex-little-logger, which is a drop-in replacement of knex-tiny-logger for Knex 0.95.

https://github.com/acro5piano/knex-little-logger

Key difference:

  • supports only Knex >= 0.95
  • bindings works

Knex changed a lot since 0.95 and some implementation of knex-tiny-logger no longer works. knex-little-logger does not depend on Knex's internal API.

acro5piano avatar Jul 28 '21 06:07 acro5piano