Page MenuHomePhabricator

Make types exact
ClosedPublic

Authored by marcin on Feb 21 2023, 10:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 7, 6:28 PM
Unknown Object (File)
Fri, Nov 22, 1:22 AM
Unknown Object (File)
Fri, Nov 22, 1:22 AM
Unknown Object (File)
Fri, Nov 22, 1:22 AM
Unknown Object (File)
Fri, Nov 22, 1:22 AM
Unknown Object (File)
Fri, Nov 22, 1:20 AM
Unknown Object (File)
Fri, Nov 22, 1:14 AM
Unknown Object (File)
Nov 15 2024, 7:49 AM
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
Branch
marcin/eng-3030
Lint
No Lint Coverage
Unit
No Test Coverage

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.