Closed javier-godoy closed 1 year ago
So what has changed as the options are still the same? Is it because of upgrading Typescript from 4.7 to 4.9?
Is it because of upgrading Typescript from 4.7 to 4.9?
It seems so, although I cannot fully parse the TypeScript release notes.
Spelling out the details for one of the example cases I mentiones above:
flow-15485
from FlowingCode/FontAwesomeIronIconset (pom has vaadin 23.2.10)git clone -b flow-15485 git@github.com:FlowingCode/FontAwesomeIronIconset.git
Run the demo application mvn jetty:run
, open http://127.0.0.1:8080/ --> the application starts, no errors ๐
mvn vaadin:dance
Edit pom and set 23.3.0
Delete tsconfig.json so that it's recreated with defaults.
mvn jetty:run
, open http://127.0.0.1:8080/ --> the application starts, there are some errors ๐
Property has no initializer and is not definitely assigned in the constructor.
Variable implicitly has type 'any[]' in some locations where its type cannot be determined.
Variable implicitly has an 'any[]' type.
Object is possibly 'null'.
rm -rf frontend/generated
Edit tsconfig.json and set "noImplicitAny": false
and "strictPropertyInitialization": false
mvn jetty:run
, open http://127.0.0.1:8080/ --> the application starts, there are less errors ๐คจ
Type 'string[]' is not assignable to type 'never[]'. Type 'string' is not assignable to type 'never'.
Object is possibly 'null'.
Edit tsconfig.json and set "strictNullChecks": false
(https://stackoverflow.com/a/57563877/1297272)
Run the demo application mvn jetty:run
, open http://127.0.0.1:8080/ --> the application starts, no errors ๐
It just hit me what the change is: the files from addons are validated as part of the build as they are placed inside frontend/generated/jar-resources. That folder should be excluded as you cannot change the code in the addons
I am facing the same issue in a multi module project I am working on.
During the build I get a lot of Parameter implicitly has an 'any' type.
errors.
The files with the errors always come from "frontend/generated/jar-resources/src".
The errors are actually true but they are not shown on the real files ("META-INF/resources/frontend/src") neither in VS Code nor during the build.
When I (accidentally) open one of the generated files in VS Code, the error is shown there too, so it seems like a different tsconfig.json is used for the "real" files and the generated files.
@probert94 Try adding
"exclude": [
"frontend/generated/jar-resources/**"
]
to your tsconfig.json. This is also what is done in #15700 for future versions
It seems like "exclude"
only works if you do not reference the files from any code... which kind of is not what ever happens
Now I am confused because #15700 does seem to work..
Just noting that I applied the workaround in a couple of projects and addons, and it works fine.
This ticket/PR has been released with Vaadin 24.0.0.alpha10 and is also targeting the upcoming stable 24.0.0 version.
This ticket/PR has been released with Vaadin 23.3.6.
Description of the bug
Vaadin 23.3.0 seems to introduce stricter TS checks by default.
I had to configure the following in
tsconfig.json
in order to run applications that were working fine with Vaadin 23.2:(
noImplicitAny
andnoImplicitThis
were alreadytrue
with Vaadin 23.2, but now they flag additional errors.)See some sample error logs in https://github.com/FlowingCode/FontAwesomeIronIconset/issues/56
The new stricter defaults are problematic, since they also affect third-party components (addons), which may rely on loose checks.
Expected behavior
Since it's not documented as a breaking change, I would expect no additional TS errors when upgrading from Vaadin 23.2 to Vaadin 23.3.0.
Minimal reproducible example
See https://github.com/FlowingCode/FontAwesomeIronIconset/tree/font-awesome-iron-iconset-4.2.0 (fixed in https://github.com/FlowingCode/FontAwesomeIronIconset/pull/58) and https://github.com/FlowingCode/XTermConsoleAddon/commits/xterm-console-2.1.0 (fixed in https://github.com/FlowingCode/XTermConsoleAddon/pull/66)
The application runs with no issues up to vaadin 23.2 (
mvn jetty:run
), but it fails with TS errors with vaadin 23.3 and 24.Versions