qlik-oss / enigma.js

JavaScript library for consuming Qlik's Associative Engine.
MIT License
210 stars 82 forks source link

TypeScript Support Broken #989

Open jordan-erisman opened 12 months ago

jordan-erisman commented 12 months ago

Description

Types added in #983 breaks existing project using @types/enigma.js

Steps to Reproduce

const global = await enigma.create(config).open();

** Property openDoc does not exist on type  **
const app = await global.openDoc(appId);
Expected behavior

New types should match functionality available in library. Similar to @types/enigma.js

Actual behavior

Property openDoc does not exist on type

nilzona commented 11 months ago

Hello @jordan-erisman. Can you expand your example a bit more? .. specifically I want to know if you have created your own global type or augmented the types in @types/enigma.js somehow. Because as you can see here https://www.npmjs.com/package/@types/enigma.js?activeTab=code .. there is actually no type for the global api there.

PatoDeVille commented 10 months ago

i am encountering the same problem, where i am left with basically a type free module in my application (angular app with qlik integration via enigmajs) , because i cant get these types as per the documentation here https://qlik.dev/apis/json-rpc/qix/field/#%23%2Fentries%2FField

(its showing field but i mean all of it) and it all starts when you..

import enigma from 'enigma.js'

const config: enigmaJS.IConfig = {
     // ...
    };

    const session: enigmaJS.ISession = await enigma.create(config);
    const global = await session.open()

    //Property 'openDoc' does not exist on type 'IGeneratedAPI'
    global.openDoc(...)

i dont know what i might be missing, or if i have to extend any types or something, funny thing...the code works if i keep any in most of it, so from there, documents, generic objects, etc etc. all is untyped and is very challenging to code unless you know your way through the api

i am using version 2.9.0 and version 2.2.2 for @types