vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
622 stars 166 forks source link

TypeScript compiler ignores TSConfig excludes. #16237

Closed oliveryasuna closed 1 year ago

oliveryasuna commented 1 year ago

Description of the bug

I added "strict": true to the generated tsconfig.json, but despite excluding frontend/generated/jar-resources/**, the TypeScript compiler still includes sources in that directory.

For example:

2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :  ERROR(TypeScript)  Object is possibly 'undefined'.
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :  FILE  /Users/oliveryasuna/projects/app/frontend/generated/jar-resources/vaadin-dev-tools/License.ts:80:3
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     78 |   const tagName = cvdlElement.tagName.toLowerCase();
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     79 |   productTagNames[cvdlName] = productTagNames[cvdlName] ?? [];
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   > 80 |   productTagNames[cvdlName].push(tagName);
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :        |   ^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     81 |
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     82 |   const failedLicenseCheck = productMissingLicense[key(product)];
2023-03-12 03:37:09.008  INFO 151 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     83 |   if (failedLicenseCheck) {

This occurs for other properties, such as noImplicitOverride.

Expected behavior

Standard behavior for TypeScript, i.e., follows excludes.

Minimal reproducible example

Starter app demonstrates this.

Versions

Artur- commented 1 year ago

Not sure how to reproduce this. The starter app has no tsconfig.json so it does not demonstrate this, and if you enable frontend hotdeploy for it, the generated tsconfig.json already contains strict: true and there are no errors

oliveryasuna commented 1 year ago

@Artur- You are right; however, this is reproducible with noImplicitOverride.

  1. Download blank starter.
  2. Add vaadin.frontend.hotdeploy = true to application.properties.
  3. Run the application and wait for everything to initialize/download.
  4. Add "noImplicitOverride": true to tsconfig.json.
  5. See errors in server console output and Vite overlay.
Artur- commented 1 year ago

Yeah, then I see it but it is just tsc behavior that you also see by running node_modules/.bin/tsc

oliveryasuna commented 1 year ago

That makes sense then, since TSC includes imports from included files even if those imports are excluded.