UrielCh / proxmox-api

TypeScript Api for proxmox
56 stars 15 forks source link

Update README.md #6

Closed D-saif closed 1 year ago

D-saif commented 2 years ago

I think you should import the function itself from the package proxmox-api

UrielCh commented 2 years ago

sorry but no...

look at the index.ts:

import { proxmoxApi } from './constructor';
export { proxmoxApi } from './constructor';
///
///
///
export default proxmoxApi;

proxmoxApi is exported twice:

so the 2 syntax works, but the old one is 4 for char shorter.

the next PR may be the right one :)

import proxmoxApi from "proxmox-api"; is an alias for: import { default as proxmoxApi } from "proxmox-api";

D-saif commented 2 years ago

Because when I install the package then execute the sample in a test.js file with node I got this error:

TypeError: proxmoxApi is not a function
    at test (file:/test.js:8:20)
    at file:/test.js:29:1
    at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

while after adding the curly brackets in the import line it works fine.

Please tell me if I am missing anything since I am a newbie to JS/TS

UrielCh commented 1 year ago

yep, there was an error in the readme, thx for the notice.