This might be a change in how the released version of Stimulus 2.0 handles implicit properties, but I was getting the same error on line 6. Just removing the line with the property declaration caused the code to work.
// app/javascripts/controllers/day_toggle_controller.ts
import { Controller } from "stimulus"
export default class DayToggleController extends Controller {
static targets = ["thingToHide"]
// This was the offending line. Was expecting a different error when commented out, but it worked
// thingToHideTarget: HTMLElement
toggle() {
console.log('Click! Click! Boom!')
this.thingToHideTarget.classList.toggle("is-hidden")
}
}
I’m only on page 37 and don’t know Typescript or Stimulus, so I don’t know if this will cause problems later on.