Page MenuHomePhabricator

Make types exact
ClosedPublic

Authored by marcin on Feb 21 2023, 10:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 22, 12:30 PM
Unknown Object (File)
Tue, Oct 22, 12:30 PM
Unknown Object (File)
Tue, Oct 22, 12:30 PM
Unknown Object (File)
Tue, Oct 22, 12:30 PM
Unknown Object (File)
Tue, Oct 22, 3:06 AM
Unknown Object (File)
Mon, Oct 21, 3:58 PM
Unknown Object (File)
Fri, Oct 18, 5:37 PM
Unknown Object (File)
Fri, Oct 18, 5:37 PM
Subscribers

Details

Summary

Native notifications modules JS types can be exact since we established there are no fields in those objects that are not covered by types.

Test Plan

Run flow in native directory. Using console.log ensure types are covering every fields present in those objects.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat requested changes to this revision.Feb 21 2023, 12:06 PM

Aren't we missing "FETCH_RESULT_NO_DATA", "FETCH_RESULT_NEW_DATA", "FETCH_RESULT_FAILED"? Source here

This revision now requires changes to proceed.Feb 21 2023, 12:06 PM

Add constants to object types.

Okay, just make sure you did this part of the Test Plan so that all constants are included:

Using console.log ensure types are covering every fields present in those objects.

This revision is now accepted and ready to land.Feb 23 2023, 8:18 AM

Okay, just make sure you did this part of the Test Plan so that all constants are included:

Using console.log ensure types are covering every fields present in those objects.

Yes, I used console.log and Object.keys on Android as well and the types comprehensive.

Besides it is quite surprising to me that constants exported via getConstants method are also automatically added to JS object, so they can be accessed directly without getConstants method being called in JS. This makes getConstants in JS redundant, doesn't it? Just curious about this.

It might be for backwards compatibility, or maybe just for convenience of accessing. The idea of getConstants() is that it's called once by the module at initialization, so actually I think calling it directly might also have some nuanced differences if there is some stateful code there

This revision was automatically updated to reflect the committed changes.