Skip to content

Commit 9e3097b

Browse files
committed
feature #380 [Turbo] Fix TypeScript compilation issue... again (7-zete-7)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Turbo] Fix TypeScript compilation issue... again | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | License | MIT _webpack.config.js_: ```js Encore ... .enableTypeScriptLoader() .enableForkedTypeScriptTypesChecking() ``` Error message on `yarn encore production`: ``` Failed to compile with 1 errors error in vendor/symfony/ux-turbo/Resources/assets/src/turbo_controller.ts:14:8 11:22:22 TS2339: Property 'Turbo' does not exist on type 'Window & typeof globalThis'. 12 | 13 | // Expose Turbo to the rest of the app to allow for dynamic Turbo calls > 14 | window.Turbo = Turbo; | ^^^^^ 15 | 16 | /** 17 | * Empty Stimulus controller only used for Symfony Flex wiring. ``` Previously, #331 proposed a different solution, but it was rejected due to the changes already being prepared in hotwired/turbo#280. At the moment, the changes in the second package have been made, as a result of which it is possible to change lines that cause a compilation error. Commits ------- 25482a7 [Turbo] Fix TypeScript compilation issue... again
2 parents e84a31b + 25482a7 commit 9e3097b

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/Turbo/Resources/assets/dist/turbo_controller.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Controller } from '@hotwired/stimulus';
2-
import * as Turbo from '@hotwired/turbo';
2+
import '@hotwired/turbo';
33

4-
window.Turbo = Turbo;
54
class turbo_controller extends Controller {
65
}
76

src/Turbo/Resources/assets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@hotwired/stimulus": "^3.0.0"
2020
},
2121
"devDependencies": {
22-
"@hotwired/turbo": "^7.0.1",
22+
"@hotwired/turbo": "^7.1.0",
2323
"@hotwired/stimulus": "^3.0.0"
2424
}
2525
}

src/Turbo/Resources/assets/src/turbo_controller.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
*/
99

1010
import { Controller } from '@hotwired/stimulus';
11-
import * as Turbo from '@hotwired/turbo';
12-
13-
// Expose Turbo to the rest of the app to allow for dynamic Turbo calls
14-
window.Turbo = Turbo;
11+
import '@hotwired/turbo';
1512

1613
/**
1714
* Empty Stimulus controller only used for Symfony Flex wiring.

0 commit comments

Comments
 (0)