qlik-oss / enigma.js

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

Property 'openDoc' does not exist on type 'IGeneratedAPI #954

Closed LiKang6688 closed 2 years ago

LiKang6688 commented 2 years ago

Description

[Description of the issue]

Following the code snippet from https://github.com/qlik-oss/enigma.js/blob/master/docs/api.md#sessionopen

session.open().then((global) => {
  global.openDoc('my-document.qvf');
});

Property 'opendoc' does not exist on type 'IGeneratedAPI'

Environment

Developing a mashup in typescript

Screenshot 2022-06-23 at 02 34 07
Library
[ ] Node.js
[ ] Browser
Operating system
[ ] Windows
[ ] OSX
[ ] Linux
Qlik Sense
[ ] Desktop
[ ] Enterprise

Versions

wennmo commented 2 years ago

Hi @LiKang6688, not sure what ts definitions that are being consumed here, but shouldn't it be const app = session.open().then(global => global.openDoc(appId));?

LiKang6688 commented 2 years ago

Hi @wennmo, yes, my wrong spelling. It should be openDoc. So the type for global is IGeneratedAPI and the Property openDoc is missing in IGeneratedAPI.

LiKang6688 commented 2 years ago

@types/enigma.js https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/enigma.js is maintained by Konrad Mattheis outside of Qlik. So I close the issue.

T-Wizard commented 2 years ago

to solve this use case (not tested) I think you can add a dependency to @types/qlik-engineapi (in addition to @types/enigma.js) and use session.open<EngineAPI.IGlobal>().then((global) => ...); to get a useable type

LiKang6688 commented 2 years ago

@T-Wizard It works. Thanks.