#Is there any hope for me?

29 messages · Page 1 of 1 (latest)

solemn yew
bronze igloo
#

the error is quite obvious

#

spent more time looking for the lib on npm than finding what's wrong

#

@solemn yew

#

the default export for package apache-age-client is a class

#

which you need to create an instance of yourself

#

age.connect is wrong

#

and should be

import { ApacheAgeClient } from "apache-age-client";

this.connectionPromise = new ApacheAgeClient().connect({});
solemn yew
#

nah; it does not work

#
Property 'connect' does not exist on type 'ApacheAgeClient'. Did you mean to access the static member 'ApacheAgeClient.connect' instead?
cyan oriole
bronze igloo
solemn yew
#

@cyan oriole @bronze igloo is it possible that there is some tsconfig option, that blocks the usage of class method without initialization of class?

bronze igloo
#

no

#

but I had a look at the compile library, and it looks quite complicated for a few commonjs exports

#

what if you try to switch to ESM, to run the ESM version of the lib
you'd need to

  • add "type": "module"
  • change your tsconfig options to "module": "ESNext"
#

not sure how the auth of the lib published their library, but it's possible the library is built incorrectly

solemn yew
#

Already did that

#

I do not know if he build it incorrectly, but i tried using pg instead ang I have got yet another error

#
import { Client } from "pg";
         ^

SyntaxError: The requested module 'pg' does not provide an export named 'Client'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12)
#

even though I have @types/pg installed

#

maybe there is some issue with my config

cyan oriole
solemn yew
cyan oriole
#

it's not really about ts

#

it's about cjs/esm interop

solemn yew
#

Ok