Skip to content
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

For/takepepe #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
"@types/highlight.js": "^9.12.3",
"@types/marked": "^0.4.2",
"element-ui": "^2.4.8",
"firebase": "^5.5.6",
"firebase": "^5.6.0",
"firebase-admin": "^6.3.0",
"highlight.js": "^9.13.1",
"inversify": "^5.0.1",
"marked": "^0.5.1",
"pring": "^0.21.4",
"pring": "^0.25.0",
"reflect-metadata": "^0.1.12",
"vue": "^2.5.17",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vue-router": "^3.0.1",
"vue-router-layout": "^0.1.2",
"vuetify": "^1.3.3",
"vuetify": "^1.3.12",
"vuex": "^3.0.1"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/firebase/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import firebase from 'firebase'
import * as admin from 'firebase-admin'
import * as Pring from 'pring'


Expand All @@ -21,7 +22,7 @@ const auth = firebase.auth
const storage = firebase.storage
const firestoreHelper = firebase.firestore

Pring.initialize(app.firestore(), firestoreHelper.FieldValue.serverTimestamp())
Pring.initialize(admin.initializeApp(config).firestore())

export {
auth,
Expand Down
4 changes: 4 additions & 0 deletions src/types/shims-pring.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module 'pring' {
Copy link

@takefumi-yoshii takefumi-yoshii Dec 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ファイル先頭に import * as Pring from 'pring' を追加すれば、既存定義を壊さず重複していないメソッドを生やすことは出来ますね。ただ、initialize がオーバーロード出来ずで、ぐぐっても解決策なさそうで積みました

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

へーーーーーーーーー!
d.tdはモジュールテンプレートファイル?っていうんですかね!
モジュールテンプレートファイルの先頭でimportすると拡張って感じですかね!

type appFirestore = import ('firebase').firestore.Firestore | import ('firebase-admin').firestore.Firestore
export const initialize: (appFirestore: appFirestore) => void
}
Loading