pofile
pofile copied to clipboard
TypeScript: Add type `null` to `Item` properties
As can be verified in source code, the properties Item#msgctxt and Item#msgid_plural will be initialized to null instead of undefined (https://github.com/rubenv/pofile/blob/master/lib/po.js#L279-L281). However, type undefined should remain to not break any existing code.
Shouldn't the question mark be dropped when you explicitly add | undefined?
I followed other projects here that explicitly added the "undefined" type to optional props withregards to compiler option "exactOptionalPropertyTypes", e.g. https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54256
The question mark is needed if class Item should support property deletion. I think this is unusual and may be dropped, but thinking strictly it would be a breaking change.
So I would be happy to adapt the PR to remove the question marks if you like.