When I asked a coding agent to convert a Typescript interface and associated functions to a proper class to enforce some invariants, it had no trouble doing that. So I think you can get this if...
When I asked a coding agent to convert a Typescript interface and associated functions to a proper class to enforce some invariants, it had no trouble doing that. So I think you can get this if you want, but you have to ask for it?
It was a while ago and part of a larger refactoring so it's not very general-purpose, but here's what the coding agent tells me:
It was a while ago and part of a larger refactoring so it's not very general-purpose, but here's what the coding agent tells me:
Your initial prompt was:
"In richtext.ts, the only usage of DomParser is in fromHtml. If we change fromHtml to take a Dom node instead, it seems like it could all be moved to dom-richtext.ts and we wouldn't have the richtext library split in two anymore?"
That kicked off the refactoring that merged the richtext.ts interface/functions with dom-richtext.ts into a single RichText class with proper encapsulation — removing fromHtml, adding fromElement, eliminating casts, unexporting internals, etc.
@skybrian isn't going to get a notification because you didn't reply to their comment directly, fwiw. Doing so would increase your chances of getting an answer (though LLMs are non-deterministic,...
@skybrian isn't going to get a notification because you didn't reply to their comment directly, fwiw. Doing so would increase your chances of getting an answer (though LLMs are non-deterministic, so just sharing the prompt alone might not solve your problem).
When I asked a coding agent to convert a Typescript interface and associated functions to a proper class to enforce some invariants, it had no trouble doing that. So I think you can get this if you want, but you have to ask for it?
Show the prompt? Can you show the code?
It was a while ago and part of a larger refactoring so it's not very general-purpose, but here's what the coding agent tells me:
@skybrian isn't going to get a notification because you didn't reply to their comment directly, fwiw. Doing so would increase your chances of getting an answer (though LLMs are non-deterministic, so just sharing the prompt alone might not solve your problem).