UI5 / UI5/typescript

Error creating Singleton instance of sap.ushell.Container in SAPUI5 1.120.12 with TypeScript

Open
#465 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
213
Forks
35
Avg merge
37m
Merged PRs (30d)
1

Description

Hello Experts,

I am encountering an issue with SAPUI5 version 1.120.12 when trying to create a Singleton instance of sap.ushell.Container to get a Navigation Service for navigating to another SAPUI5 application using a semantic object and action.

Problem

The intended method call, as per the API documentation, should be:

sap.ushell.Container.getServiceAsync("Navigation")

However, the linter reports an error, and even the API documentation's recommended approach does not work in TypeScript.

Code Snippet:
sap.ushell.Container.getServiceAsync("Navigation").then(function (navigation) {
    navigation.toExternal({
        target: {
            semanticObject: "SemanticObject",
            action: "action"
        }
    });
});
Linter Error

image

Additional Information

The issue might be related to an incorrect type definition file, as the method call provided in the API documentation also fails in TypeScript.

How should this method be correctly invoked in TypeScript to avoid the linting error? Could the type definition file for this version be incorrect?

Thank you for your assistance.

Best regards,

Dominik Kastenmeier

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TypeScript type definition for sap.ushell.Container and compare getServiceAsync("Navigation") with the SAPUI5 API documentation. Reproduce the linter error using the reported call and verify that the corrected invocation supports navigation.toExternal; the issue is done when the documented TypeScript usage passes linting.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.