[typescript] fix: escaped multiline comments; implementation option 3

Merge conflicts
JO
2y ago
+49-14

alternative implementation for #19528 and #19553, via https://github.com/OpenAPITools/openapi-generator/pull/19528#issuecomment-2337016513:

if it's not a lot of work, can you please file another PR to add null guards for the typescript generator(s)?

This implementation moves the null guard in the super classes. It leaves the individual implementations of escapeUnsafeCharacters of all generators as-is, thus reducing the diff in this pull request.

This implementation is a mixture of #19528 and #19553. It doesn't introduce a new odd ...NullGuard method and it also doesn't touch all generators.

closes https://github.com/OpenAPITools/openapi-generator/pull/19528 https://github.com/OpenAPITools/openapi-generator/pull/19553