Commit 4625961
refactor(remote-config)!: migrate to TypeScript (#8972)
* refactor(remote-config): add typescript package scaffolding
* refactor(remote-config): split modular and namespaced entrypoints
* refactor(remote-config): split types for namespaced and modular
* refactor(remote-config): type namespaced runtime and local helpers
* refactor(remote-config): type modular wrapper adapters
* test(remote-config): cover root type exports and drop source dts includes
* chore(remote-config): initial compare script work
* refactor(remote-config): switch compare-types to emitted dist declarations
* fix(remote-config): align public config update instance typings
* refactor(remote-config): remove source declaration shims
* refactor(remote-config): remove legacy modular index wrapper
* refacto(remote-config): convert web to TS
* refactor(remote-config): reduce compare-types drift from firebase-js-sdk
* refactor: remove legacy modular helpers that are not part of firebase-js-sdk
* chore: rm unneeded typing
* fix: modular deprecation warnings firing because we have instances that still have methods (such as StorageReference) and fire console warning incorrectly
* fix: some remote config need to proxy setters as well (on RC instance)
* fix: RC modular settings behaves same way as namespaced
* test: update response from loglevel which matches firebase-js-sdk
* fix: race condition due to using sync getters on remote config instance to match firebase-js-sdk
* fix: revert back to previous implementation now we resolved race condition
* fix: stop clobbering over non-default values in this._values
* fix: ignore stale fetchTimeout & minimumFetchInterval before they have a chance to update
* refactor:! remove deprecated api on RemoteConfigValue. value and source getters
* refactor:align remote-config checks with modular-only exports
* test: ios resolves to "undefined" as per previous TS declaration typings
* refactor: align return types for fetch, reset, ensureInitialized and setCustomSignals
* fix: remove path to non-existent remote-config TS declaration file
* fix: update remote-config typedoc.json
BREAKING CHANGE: remote-config types now match firebase-js-sdk as closely as possible
Please see https://rnfirebase.io/migrating-to-v25 for help migrating if needed
react-native-firebase has a goal to be a drop-in replacement for firebase-js-sdk, with native extensions and performance. It has always worked that way at the javascript level but the typescript types have been divergent
We are fixing that as we refactor to typescript. Please bear with us as we get closer to our goal of react-native-firebase matching firebase-js-sdk both in functionality where possible, but also in exact typescript typing.
Specifics for Remote Config:
the primary modular remote-config types now use Firebase JS SDK names: LogLevel, FetchStatus, Value, and RemoteConfigSettings
RemoteConfig.settings is now typed as RemoteConfigSettings, which uses fetchTimeoutMillis rather than the older RNFB-style fetchTimeMillis on the modular surface
modular getAll() and getValue() now return SDK-aligned types: Record<string, Value> and Value
modular setLogLevel() now matches the Firebase JS SDK signature and returns void
the legacy modular helper exports fetchTimeMillis(), settings(), and lastFetchStatus() have been removed from @react-native-firebase/remote-config. Modular callers should read remoteConfig.fetchTimeMillis, remoteConfig.settings, and remoteConfig.lastFetchStatus from the RemoteConfig instance instead
modular fetch() has been removed. Modular callers should use fetchConfig(remoteConfig) instead; the RNFB-only modular expirationDurationSeconds helper is no longer part of the public modular API
modular setConfigSettings() and setDefaults() have been removed. Modular callers should use remoteConfig.settings = ... and remoteConfig.defaultConfig = ... on the RemoteConfig instance instead
modular onConfigUpdated() has been removed. Modular callers should use onConfigUpdate(remoteConfig, observer) instead
deprecated RemoteConfigValue.value and .source getters have been removed. Callers should use asString() and getSource() instead
Remove LastFetchStatus, ValueSource, ConfigSettings, ConfigDefaults, ConfigValue, ConfigValues, LastFetchStatusType, and RemoteConfigLogLevel from modular exports
---------
Co-authored-by: Mike Hardy <github@mikehardy.net>1 parent 71e8eb5 commit 4625961
37 files changed
Lines changed: 1952 additions & 2583 deletions
File tree
- .github/scripts/compare-types
- packages/remote-config
- src
- packages
- app/lib/common
- remote-config
- __tests__
- android/src/reactnative/java/io/invertase/firebase/config
- e2e
- ios/RNFBConfig
- lib
- modular
- types
- web
- tests/ios
Lines changed: 27 additions & 110 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 19 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 20 | | |
42 | | - | |
| 21 | + | |
43 | 22 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 23 | + | |
| 24 | + | |
47 | 25 | | |
48 | 26 | | |
49 | | - | |
| 27 | + | |
50 | 28 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 29 | + | |
| 30 | + | |
54 | 31 | | |
55 | 32 | | |
56 | | - | |
| 33 | + | |
57 | 34 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 35 | + | |
| 36 | + | |
61 | 37 | | |
62 | 38 | | |
63 | | - | |
| 39 | + | |
64 | 40 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 41 | + | |
| 42 | + | |
69 | 43 | | |
70 | 44 | | |
71 | | - | |
| 45 | + | |
72 | 46 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 47 | + | |
| 48 | + | |
103 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
104 | 55 | | |
105 | 56 | | |
106 | 57 | | |
107 | 58 | | |
108 | 59 | | |
109 | 60 | | |
110 | 61 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 62 | | |
127 | 63 | | |
128 | 64 | | |
| |||
131 | 67 | | |
132 | 68 | | |
133 | 69 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | 70 | | |
139 | 71 | | |
140 | 72 | | |
| |||
144 | 76 | | |
145 | 77 | | |
146 | 78 | | |
147 | | - | |
| 79 | + | |
148 | 80 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
152 | 84 | | |
153 | 85 | | |
154 | 86 | | |
155 | 87 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
174 | 91 | | |
175 | 92 | | |
176 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 50 | + | |
57 | 51 | | |
58 | 52 | | |
59 | 53 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 54 | | |
77 | 55 | | |
78 | 56 | | |
| |||
93 | 71 | | |
94 | 72 | | |
95 | 73 | | |
96 | | - | |
| 74 | + | |
97 | 75 | | |
98 | | - | |
| 76 | + | |
99 | 77 | | |
100 | 78 | | |
101 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
102 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
103 | 92 | | |
104 | 93 | | |
105 | 94 | | |
| |||
148 | 137 | | |
149 | 138 | | |
150 | 139 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 140 | + | |
157 | 141 | | |
158 | 142 | | |
159 | 143 | | |
| |||
190 | 174 | | |
191 | 175 | | |
192 | 176 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 177 | + | |
202 | 178 | | |
| 179 | + | |
203 | 180 | | |
204 | 181 | | |
205 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
649 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
650 | 654 | | |
651 | 655 | | |
652 | 656 | | |
| |||
664 | 668 | | |
665 | 669 | | |
666 | 670 | | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
667 | 675 | | |
668 | 676 | | |
669 | 677 | | |
| |||
672 | 680 | | |
673 | 681 | | |
674 | 682 | | |
675 | | - | |
| 683 | + | |
676 | 684 | | |
677 | 685 | | |
678 | 686 | | |
| |||
781 | 789 | | |
782 | 790 | | |
783 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
784 | 812 | | |
785 | 813 | | |
786 | 814 | | |
| |||
0 commit comments