-
Notifications
You must be signed in to change notification settings - Fork 157
fix: add typings to v1 and v1beta in firestore.d.ts #1433
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1433 +/- ##
=======================================
Coverage 98.20% 98.20%
=======================================
Files 32 32
Lines 19502 19502
Branches 1363 1363
=======================================
Hits 19152 19152
Misses 346 346
Partials 4 4 Continue to review full report at Codecov.
|
28b7026
to
ed94657
Compare
dab4a57
to
b5dcb0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach LGTM. Some improvement suggestions.
I also wonder whether this should be a fix
or even a feat
since this is something that we want to create a release for,
types/firestore.d.ts
Outdated
@@ -1964,13 +1980,16 @@ declare namespace FirebaseFirestore { | |||
* Firestore v1beta1 RPCs. | |||
* @deprecated Use v1 instead. | |||
*/ | |||
export const v1beta1: any; | |||
export const v1beta1: typeof import('./v1beta1/firestore_client'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just do a regular import:
import v1beta1 from '...';
import {FirestoreClient, FirestoreAdminClient} from '...'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach LGTM. Some improvement suggestions.
I also wonder whether this should be a
fix
or even afeat
since this is something that we want to create a release for,
'fix' should cause a patch release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think top level imports in .d.ts
files are allowed (see stackoverflow). I played around with it, but it always ended in sadness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: Following our conversation, changed to use import
directly inline, rather than use typeof
.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are now two copyright headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
…e into bc/types-copy
types/firestore.d.ts
Outdated
@@ -1964,13 +1962,16 @@ declare namespace FirebaseFirestore { | |||
* Firestore v1beta1 RPCs. | |||
* @deprecated Use v1 instead. | |||
*/ | |||
export const v1beta1: any; | |||
export const v1beta1: import('./v1beta1/firestore_client').FirestoreClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit torn about using the default export here, which is really an anti-pattern and not used in the export below. I think no matter how we export this, we have a chance of breaking users, but the clean way would be to export this as { FirestoreClient: import(...).FirestoreClient }. That both works is technical debt that I would like to not carry forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Add external typings for
v1
andv1beta1
infirestore.d.ts
files by copying over the generated.d.ts
files intotypes/
.Fixes #1422.