Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@sapui5/ts-types-esm - opaQunit should be an overload & async option should be optional #308

Open
DetachHead opened this issue Nov 25, 2021 · 4 comments
Labels
types ES modules types (recommended)

Comments

@DetachHead
Copy link

DetachHead commented Nov 25, 2021

declare module "sap/ui/test/opaQunit" {
  export default function opaQunit(
    /**
     * name of the QUnit test.
     */
    testName: string,
    /**
     * integer value only supported in QUnit v1.x: denotes how many assertions are expected to be made in the
     * test. If a function is passed instead, it is considered to be the callback parameter
     */
    expected: int | Function,
    /**
     * the test function. Expects 3 arguments, in order: {@link sap.ui.test.Opa.config}.arrangements, {@link
     * sap.ui.test.Opa.config}.actions, {@link sap.ui.test.Opa.config}.assertions. These arguments will be prefilled
     * by OPA
     */
    callback: Function,
    /**
     * available only in QUnit v1.x. Indicates whether the test is asynchronous. False by default.
     */
    async: boolean
  ): void;
}

if that documentation is correct, the definition should instead be something like:

declare module 'sap/ui/test/opaQunit' {
    export default function opaQunit(
        testName: string,
        expected: int,
        callback: Function,
        async?: boolean,
    ): void
    export default function opaQunit(testName: string, callback: Function, async?: boolean): void
}

(assuming async becomes the third argument if a callback is provided as the second, i'm not sure how the impl handles it)

@DetachHead
Copy link
Author

the Given, When and Then in the callback should also be typed (so that this example works), it probably needs to use a generic but i'm not familiar enough with Opa5 and opaQunit to provide a solution

@petermuessig petermuessig added the legacy ts-types (with globals) Related to legacy Global types (deprecated) label Nov 28, 2021
@petermuessig
Copy link
Contributor

Same like #306 - testing related code wasn't in focus of TS API support so far.

@DetachHead DetachHead changed the title @sapui5/ts-types - opaQunit should be an overload & async option should be optional @sapui5/ts-types-esm - opaQunit should be an overload & async option should be optional Nov 29, 2021
@petermuessig petermuessig added types ES modules types (recommended) and removed legacy ts-types (with globals) Related to legacy Global types (deprecated) labels Nov 29, 2021
@akudev
Copy link
Contributor

akudev commented Jan 26, 2022

Actually, this is the same issue that I more generically reported as #327: permutations are missing for a few UI5 API objects, which are no proper classes, interfaces or namespaces.
We understand where in the code they are accidentally not handled, but have not done a fix yet.

@akudev
Copy link
Contributor

akudev commented Jan 28, 2022

Issue is understood and fixed in the internal generator repo.
Which type definitions version has the fix depends on when the fixed version is used in the internal build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types ES modules types (recommended)
Projects
None yet
Development

No branches or pull requests

3 participants