You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #2562 [Map][Translator][Turbo] Ensure TypeScript code is valid (Kocal)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
[Map][Translator][Turbo] Ensure TypeScript code is valid
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
This PR aims to fail the build (and the CI) when TypeScript code contain issues.
I also fixed existing issues in Map, Translator, and Turbo code.
Before:
```
Cleaning up the "/home/runner/work/ux/ux/src/Chartjs/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-chartjs package...
Done in 3.175 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Autocomplete/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-autocomplete package...
Done in 3.179 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Cropperjs/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-cropperjs package...
Minifying CSS...
Done in 2.377 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Dropzone/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-dropzone package...
Minifying CSS...
Done in 2.434 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/LazyImage/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-lazy-image package...
Done in 2.438 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/LiveComponent/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-live-component package...
Minifying CSS...
Done in 3.861 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Map/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-map package...
Done in 2.515 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Map/src/Bridge/Google/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-google-map package...
Done in 2.509 seconds.
[plugin typescript] src/map_controller.ts (12:35): `@rollup`/plugin-typescript TS2307: Cannot find module '`@symfony`/ux-map' or its corresponding type declarations.
[plugin typescript] src/map_controller.ts (19:8): `@rollup`/plugin-typescript TS2307: Cannot find module '`@symfony`/ux-map' or its corresponding type declarations.
[plugin typescript] src/map_controller.ts (78:21): `@rollup`/plugin-typescript TS7053: Element implicitly has an 'any' type because expression of type 'Library' can't be used to index type 'typeof maps'.
Property 'streetView' does not exist on type 'typeof maps'.
[plugin typescript] src/map_controller.ts (80:55): `@rollup`/plugin-typescript TS2698: Spread types may only be created from object types.
[plugin typescript] src/map_controller.ts (89:30): `@rollup`/plugin-typescript TS2339: Property 'hasCenterValue' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (89:53): `@rollup`/plugin-typescript TS2339: Property 'centerValue' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (90:37): `@rollup`/plugin-typescript TS2339: Property 'centerValue' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (95:30): `@rollup`/plugin-typescript TS2339: Property 'hasZoomValue' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (95:51): `@rollup`/plugin-typescript TS2339: Property 'zoomValue' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (96:35): `@rollup`/plugin-typescript TS2339: Property 'zoomValue' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (101:14): `@rollup`/plugin-typescript TS2339: Property 'dispatch' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (125:42): `@rollup`/plugin-typescript TS2339: Property 'element' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (148:18): `@rollup`/plugin-typescript TS2551: Property 'createInfoWindow' does not exist on type 'default'. Did you mean 'doCreateInfoWindow'?
[plugin typescript] src/map_controller.ts (176:18): `@rollup`/plugin-typescript TS2551: Property 'createInfoWindow' does not exist on type 'default'. Did you mean 'doCreateInfoWindow'?
[plugin typescript] src/map_controller.ts (204:18): `@rollup`/plugin-typescript TS2551: Property 'createInfoWindow' does not exist on type 'default'. Did you mean 'doCreateInfoWindow'?
[plugin typescript] src/map_controller.ts (264:18): `@rollup`/plugin-typescript TS2339: Property 'markers' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (269:14): `@rollup`/plugin-typescript TS2339: Property 'markers' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (269:31): `@rollup`/plugin-typescript TS7006: Parameter 'marker' implicitly has an 'any' type.
[plugin typescript] src/map_controller.ts (296:14): `@rollup`/plugin-typescript TS2339: Property 'infoWindows' does not exist on type 'default'.
[plugin typescript] src/map_controller.ts (296:35): `@rollup`/plugin-typescript TS7006: Parameter 'otherInfoWindow' implicitly has an 'any' type.
Cleaning up the "/home/runner/work/ux/ux/src/Map/src/Bridge/Leaflet/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-leaflet-map package...
Done in 2.459 seconds.
"leaflet/dist/leaflet.min.css" is imported by "src/map_controller.ts", but could not be resolved – treating it as an external dependency.
Cleaning up the "/home/runner/work/ux/ux/src/Notify/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-notify package...
Done in 2.381 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/React/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-react package...
Done in 2.498 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/StimulusBundle/assets/dist" directory...
Building JavaScript files from `@symfony`/stimulus-bundle package...
Done in 2.444 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Svelte/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-svelte package...
Done in 2.453 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Swup/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-swup package...
Done in 2.254 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/TogglePassword/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-toggle-password package...
Minifying CSS...
Done in 2.489 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Translator/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-translator package...
Done in 2.351 seconds.
[plugin typescript] src/formatters/intl-formatter.ts (26:5): `@rollup`/plugin-typescript TS2[32](https://github.com/symfony/ux/actions/runs/13231659169/job/36929714748#step:5:37)2: Type 'string | number | (string | number)[]' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
[plugin typescript] src/translator.ts (152:57): `@rollup`/plugin-typescript TS2[34](https://github.com/symfony/ux/actions/runs/13231659169/job/36929714748#step:5:39)5: Argument of type 'ParametersType' is not assignable to parameter of type 'Record<string, string | number>'.
Type 'Record<string, string | number | Date>' is not assignable to type 'Record<string, string | number>'.
'string' index signatures are incompatible.
Type 'string | number | Date' is not assignable to type 'string | number'.
[plugin typescript] src/translator.ts (166:49): `@rollup`/plugin-typescript TS2345: Argument of type 'ParametersType' is not assignable to parameter of type 'Record<string, string | number>'.
Type 'Record<string, string | number | Date>' is not assignable to type 'Record<string, string | number>'.
Cleaning up the "/home/runner/work/ux/ux/src/Turbo/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-turbo package...
Done in 2.2[49](https://github.com/symfony/ux/actions/runs/13231659169/job/36929714748#step:5:54) seconds.
[plugin typescript] src/turbo_stream_controller.ts (11:61): `@rollup`/plugin-typescript TS7016: Could not find a declaration file for module '`@hotwired`/turbo'. '/home/runner/work/ux/ux/node_modules/`@hotwired`/turbo/dist/turbo.es2017-umd.js' implicitly has an 'any' type.
Try `npm i --save-dev `@types`/hotwired__turbo` if it exists or add a new declaration (.d.ts) file containing `declare module '`@hotwired`/turbo';`
Cleaning up the "/home/runner/work/ux/ux/src/Typed/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-typed package...
Done in 2.228 seconds.
Cleaning up the "/home/runner/work/ux/ux/src/Vue/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-vue package...
Done in 1.970 seconds.
Done in 30s 328ms
```
After:
```
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Chartjs/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-chartjs package...
Done in 2.830 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Autocomplete/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-autocomplete package...
Done in 2.967 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Cropperjs/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-cropperjs package...
Minifying CSS...
Done in 2.[39](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:44)2 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Dropzone/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-dropzone package...
Minifying CSS...
Done in 2.[42](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:47)8 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/LazyImage/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-lazy-image package...
Done in 2.472 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/LiveComponent/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-live-component package...
Minifying CSS...
Done in 3.855 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Map/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-map package...
Done in 2.[47](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:52)1 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Notify/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-notify package...
Done in 2.392 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/React/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-react package...
Done in 2.597 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/StimulusBundle/assets/dist" directory...
Building JavaScript files from `@symfony`/stimulus-bundle package...
Done in 2.[48](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:53)4 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Svelte/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-svelte package...
Done in 2.470 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Swup/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-swup package...
Done in 2.264 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/TogglePassword/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-toggle-password package...
Minifying CSS...
Done in 2.[57](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:62)2 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Translator/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-translator package...
Done in 2.[58](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:63)1 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Turbo/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-turbo package...
Done in 2.296 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Typed/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-typed package...
Done in 2.273 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Vue/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-vue package...
Done in 2.083 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Map/src/Bridge/Google/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-google-map package...
Done in 2.579 seconds.
Cleaning up the "/home/runner/work/symfony-ux/symfony-ux/src/Map/src/Bridge/Leaflet/assets/dist" directory...
Building JavaScript files from `@symfony`/ux-leaflet-map package...
Done in 2.742 seconds.
"leaflet/dist/leaflet.min.css" is imported by "src/map_controller.ts", but could not be resolved – treating it as an external dependency.
Done in 30s [68](https://github.com/Kocal/symfony-ux/actions/runs/13252531380/job/36993303948?pr=2562#step:5:73)6ms
```
Commits
-------
ddbabd6 [Map] Fix TypeScript errors
975628b [Translator] Fix types definition, allow `Date` as parameter type
07b5078 Stop packages build when TypeScript code is invalid
795f2ad [Turbo] Install missing ``@hotwired`/turbo` definition types
863ba8c Fix ``@symfony`/ux-*-map` dev dependency, use `--topological-dev` to ensure `build` and `test` scripts respect workspaces topoligy
0 commit comments