vytant / stimulus-decorators

TypeScript decorators for the Stimulus framework
https://npm.im/@vytant/stimulus-decorators
MIT License
12 stars 2 forks source link

Setting default `Value`s doesn't work as expected #2

Open hangsu opened 2 years ago

hangsu commented 2 years ago

The documented way of setting a default value doesn't work:

@Value(String) methodValue: string = 'GET';

this.methodValue is always 'GET' regardless of what gets passed in through data-controller-method-value

Our current workaround is:

@Value({ type: String, default: 'GET' }) methodValue!: string;
vytant commented 1 year ago

This library used to work with Stimulus 3.0.* versions. From Stimulus 3.1.0 the framework itself provides basic support for TypeScript, which ruins the compatibility with this library.

Anyway, I'll check what I can do here and update the library if it won't require a big change.