hilla icon indicating copy to clipboard operation
hilla copied to clipboard

flow-client should not cause TS errors depending tsconfig.json of user project

Open Haprog opened this issue 4 years ago • 1 comments

Description of the bug

Frontend compilation fails because it's trying to build node_modules/@vaadin/form/*.ts as part of the generated project which has a tsconfig.json configuration that's not compatible with those sources.

In the context of user projects it should not matter what TS configuration we choose to use in flow-client. Even if the flow internal tsconfig.json file is updated later, it should not break existing projects which might have conflicting TS configuration for the projects purposes.

Minimal reproducible example

  1. Download app from https://start.vaadin.com/?preset=try-ts
  2. Edit pom.xml to use V17 and Flow 3.2-SNAPSHOT:
    <properties>
        ...
        <vaadin.version>17.0.0.alpha5</vaadin.version>
        <flow.version>3.2-SNAPSHOT</flow.version>
    </properties>
    ...
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-bom</artifactId>
                <version>${flow.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            ...
        </dependencies>
    </dependencyManagement>
    
  3. Try to run the project with mvn

Expected behavior

Frontend compilation should not fail

Actual behavior

You see:

ERROR in [at-loader] ./node_modules/@vaadin/form/BinderNode.ts:115:9 
    TS2339: Property 'flat' does not exist on type '(readonly ValueError<any>[])[]'.
...
------------------ Frontend compilation failed. ------------------

Versions:

  • Vaadin / Flow version: Vaadin 17 alpha, Flow 3.2-SNAPSHOT

Workaround

Can be workarounded in the generated project by editing tsconfig.json to be compatible with the tsconfig used in flow-client. In this case it is enough to add "lib": ["DOM", "ES2019.Array"], to the "compilerOptions" section.

Haprog avatar Jun 30 '20 12:06 Haprog

Updated severity and impact labels since this issue doesn't affect our users anymore after the PR https://github.com/vaadin/flow/pull/8674 gets merged which avoids the issue for now.

Keeping this issue open as we still want to fix this later so we can start using less conservative tsconfig options again in flow-client in the future (without breaking/affecting user projects).

For future reproduction, you can keep reproducing the issue if you install Flow 3.2-SNAPSHOT version locally from commit 69542bee (which is current master version without the above workaround that avoids the issue)

Haprog avatar Jul 01 '20 12:07 Haprog