ui5-community / generator-ui5-project

Generator for UI5-based web-apps which use the official UI5 tooling and support multiple deployment targets such as the SAP Business Technology Platform
Apache License 2.0
33 stars 25 forks source link

Allow usage of Promises when using code assist #39

Closed lboehm closed 2 years ago

lboehm commented 2 years ago

Hi!

When generating a project with code assist, the following error is shown, when you're using promises:

any 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.ts(2585)

image

I think, it should be easily possible to use Promises, especially after IE11 support is dropped. To solve this issue the tsconfig.json has to be changed:

{
    "compilerOptions": {
        "module": "none",
        "noEmit": true,
        "checkJs": true,
        "allowJs": true,
        "types": ["@sapui5/ts-types"],
        "lib": ["es2015"]                    <<< new
    }
}

Important: The eslint.rc file should have the following config, otherwise we will receive another error:

image

{
    "env": {
        "es6": true
    },

This PR does not contain the necessary change in the eslint.rc, because this change comes with the PR #31.

So if you like you can wait with merging this one, until #31 is resolved. Or you merge this one now, because the devs will receive just a different error message than they currently do. So no big difference.

BR, Lukas

petermuessig commented 2 years ago

Fixed with #40