Skip to content

Can't create controllers with TypeScript extension? #59

@jmsche

Description

@jmsche

Hi,

So I started upgrading apps to Stimulus 3 & Symfony Stimulus Bridge 3.

Controllers work file if using the .js extension, but as long as I only rename the controller with .ts extension (so not even using TypeScript) I get the following error in Chrome console (only when the controller is called):

episode-status_controller.ts:11 Uncaught (in promise) TypeError: Class constructor Controller cannot be invoked without 'new'
    at new default_1 (episode-status_controller.ts:11)
    at new extended (stimulus.js:1210)
    at new Context (stimulus.js:1051)
    at Module.fetchContextForScope (stimulus.js:1272)
    at Module.connectContextForScope (stimulus.js:1258)
    at Router.scopeConnected (stimulus.js:1575)
    at ScopeObserver.elementMatchedValue (stimulus.js:1495)
    at ValueListObserver.tokenMatched (stimulus.js:793)
    at TokenListObserver.tokenMatched (stimulus.js:726)
    at stimulus.js:720

Not sure why this happens though?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions