Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: Add type null to Item properties #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danielrentz
Copy link

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.

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.
@rubenv
Copy link
Owner

rubenv commented Feb 24, 2023

Shouldn't the question mark be dropped when you explicitly add | undefined?

@danielrentz
Copy link
Author

danielrentz commented Feb 24, 2023

I followed other projects here that explicitly added the "undefined" type to optional props withregards to compiler option "exactOptionalPropertyTypes", e.g. DefinitelyTyped/DefinitelyTyped#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.

@danielrentz
Copy link
Author

Anybody around here in this project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants