Opt + Enter - new Refactoring available for TS1016: A required parameter cannot follow an optional parameter

I do not want to manually fix this error. I want my IDE to rerrange the params for me using either Opt + Enter or better, with on save.

I've checked the preferences, TS service is running which is why I get this error in the first place:

TS1016: A required parameter cannot follow an optional parameter

But for some reason (maybe it's not possible with WebStorm) when I Opt + Ent, there's no option to rearrange the params on the fly for me.

Also, I see no auto fix for TS in WebStorm preferences like you do with eslint and prettier for example.

But your IDE shows the TS error, and highlights the warning with the param in question, so ???  What are my options here?

Comment actions Permalink

Quick fixes for Typescript compiler errors are normally provided by Typescript language service, but there is no fix for this one; you can use Change Signature refactoring to re-order parameters

Comment actions Permalink

Thanks Elena, that's really bad (I don't know how that's not already part of the language service).  I will put in a request to get that added, it should really be able to do this based on that TS rule.


Please sign in to leave a comment.