From ce149d5697d6cd51a118a8a6ea222cf9247cd828 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Wed, 21 Oct 2020 13:52:53 -0700 Subject: [PATCH] update import syntax in readmes and messages --- packages-exp/firebase-exp/compat/index.ts | 2 +- packages/firebase/README.md | 6 +++--- packages/firebase/src/index.ts | 2 +- packages/rxfire/README.md | 8 ++++---- packages/rxfire/docs/storage.md | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages-exp/firebase-exp/compat/index.ts b/packages-exp/firebase-exp/compat/index.ts index 89e4a793ebd..074d7223507 100644 --- a/packages-exp/firebase-exp/compat/index.ts +++ b/packages-exp/firebase-exp/compat/index.ts @@ -32,7 +32,7 @@ import firebase from 'firebase/app'; import 'firebase/'; Typescript: -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; import 'firebase/'; `); diff --git a/packages/firebase/README.md b/packages/firebase/README.md index 7c20ddd7321..3fb84fa4fb1 100644 --- a/packages/firebase/README.md +++ b/packages/firebase/README.md @@ -92,7 +92,7 @@ var app = firebase.initializeApp({ ... }); If you are using ES6 imports or TypeScript: ```js -import * as firebase from 'firebase'; +import firebase from 'firebase'; var app = firebase.initializeApp({ ... }); ``` @@ -147,7 +147,7 @@ services you use: ```js // This import loads the firebase namespace along with all its type information. -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; // These imports load individual services into the firebase namespace. import 'firebase/auth'; @@ -187,7 +187,7 @@ you should do: ```js // This import loads the firebase namespace. -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; // These imports load individual services into the firebase namespace. import 'firebase/auth'; diff --git a/packages/firebase/src/index.ts b/packages/firebase/src/index.ts index ffaef50690e..113eef3a9fb 100644 --- a/packages/firebase/src/index.ts +++ b/packages/firebase/src/index.ts @@ -32,7 +32,7 @@ import firebase from 'firebase/app'; import 'firebase/'; Typescript: -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; import 'firebase/'; `); diff --git a/packages/rxfire/README.md b/packages/rxfire/README.md index 9c12afdeb2e..c9e1e7010d9 100644 --- a/packages/rxfire/README.md +++ b/packages/rxfire/README.md @@ -26,7 +26,7 @@ Make sure to install Firebase and RxJS individually as they are peer dependencie ## Example use: ```ts -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; import 'firebase/firestore'; import { collectionData } from 'rxfire/firestore'; import { tap } from 'rxjs/operators'; @@ -49,7 +49,7 @@ RxJS provides multiple operators and creation methods for combining observable s The example below streams a list of "cities" from Firestore and then retrieves their image from a Cloud Storage bucket. Both tasks are asynchronous but RxJS makes it easy to combine these tasks together. ```ts -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; import 'firebase/firestore'; import 'firebase/storage'; import { collectionData } from 'rxfire/firestore'; @@ -79,7 +79,7 @@ collectionData(citiesRef, 'id') RxFire is a complementary library to Firebase. It is not meant to wrap the entire Firebase SDK. RxFire's purpose is to simplify async streams from Firebase. You need to import the Firebase SDK and initialize an app before using RxFire. ```ts -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; import 'firebase/storage'; // import only the features needed import { getDownloadURL } from 'rxfire/storage'; @@ -104,7 +104,7 @@ import { } from 'rxfire/functions'; RxFire is a set of functions. Most functions create observables and from there you can use regular RxJS operators. Some functions are custom operators. But at the end of the day, it's all just functions. This is important for **tree shaking**. Any unused functions are stripped from your final build if you use a module bundler like Webpack or Rollup. ```ts -import * as firebase from 'firebase/app'; +import firebase from 'firebase/app'; import 'firebase/storage'; import { getDownloadURL, put /* not used! */ } 'rxfire/storage'; diff --git a/packages/rxfire/docs/storage.md b/packages/rxfire/docs/storage.md index 34cbdad84c5..ecd7342f076 100644 --- a/packages/rxfire/docs/storage.md +++ b/packages/rxfire/docs/storage.md @@ -15,7 +15,7 @@ The `fromTask()` function creates an observable that emits progress changes. #### TypeScript Example ```ts import { fromTask } from 'rxfire/storage'; -import * as firebase from 'firebase'; +import firebase from 'firebase'; import 'firebase/storage'; // Set up Firebase @@ -43,7 +43,7 @@ The `percentage()` function creates an observable that emits percentage of the u #### TypeScript Example ```ts import { percentage } from 'rxfire/storage'; -import * as firebase from 'firebase'; +import firebase from 'firebase'; import 'firebase/storage'; // Set up Firebase @@ -73,7 +73,7 @@ The `getDownloadURL()` function creates an observable that emits the URL of the #### TypeScript Example ```ts import { getDownloadURL } from 'rxfire/storage'; -import * as firebase from 'firebase'; +import firebase from 'firebase'; import 'firebase/storage'; // Set up Firebase @@ -100,7 +100,7 @@ The `getMetadata()` function creates an observable that emits the URL of the fil #### TypeScript Example ```ts import { getMetadata } from 'rxfire/storage'; -import * as firebase from 'firebase'; +import firebase from 'firebase'; import 'firebase/storage'; // Set up Firebase @@ -127,7 +127,7 @@ The `put()` function creates an observable that emits the upload progress of a f #### TypeScript Example ```ts import { put } from 'rxfire/storage'; -import * as firebase from 'firebase'; +import firebase from 'firebase'; import 'firebase/storage'; // Set up Firebase @@ -157,7 +157,7 @@ The `putString()` function creates an observable that emits the upload progress #### TypeScript Example ```ts import { putString } from 'rxfire/storage'; -import * as firebase from 'firebase'; +import firebase from 'firebase'; import 'firebase/storage'; // Set up Firebase