typescript-plugin-css-modules icon indicating copy to clipboard operation
typescript-plugin-css-modules copied to clipboard

Readonly classes

Open hakubo opened this issue 2 years ago • 3 comments

I saw that sometime ago you added https://github.com/mrmckeb/typescript-plugin-css-modules/pull/103 readonly classes, but it got never merged.

Any chance that you'd accept a PR for this? With added 'readonly' option, so users can configure it?

hakubo avatar Mar 29 '23 08:03 hakubo

hi @hakubo, I'll be honest, I can't remember why we didn't go ahead with that PR now. It's unfortunate that I didn't make a note at the time - sorry about that. I know we hit some issues with const/let at the time (See: https://github.com/mrmckeb/typescript-plugin-css-modules/issues/97), so it's possible that it was related to that, or it could be that I just ran short of time.

I'm more than happy for you to add it. It might be easier to use the Readonly<Type> utility.

I'm not sure that it needs to be an option. I was playing around then and I can't think of any risks - but very open to feedback/thoughts on that.

mrmckeb avatar Apr 10 '23 08:04 mrmckeb

Hi! First off, love the project. Awesome work! Second, having all the properties be readonly makes a lot of sense and would love to try my hand at adding it

OlaoluwaM avatar Sep 19 '23 12:09 OlaoluwaM

@OlaoluwaM, that would be a welcome addition - thanks. Obviously it wouldn't apply to named imports and only style objects, but I definitely think those should be readonly.

mrmckeb avatar Sep 22 '23 05:09 mrmckeb