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

suppress compile error #1

Merged
merged 1 commit into from
Aug 9, 2016
Merged
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
13 changes: 5 additions & 8 deletions auth/src/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@

// This sample is TypeScript ported version of https://github.com/firebase/quickstart-js.

/// <reference path="../../../node_modules/firebase/app.d.ts" />
/// <reference path="../../../node_modules/firebase/firebase.d.ts" />

import * as firebase from 'firebase';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this lines is not required.
tsc can lookup these definition files. see cat node_modules/firebase/package.json | grep types.

http://qiita.com/vvakame/items/72d22e33632178f7db24

const config = {
apiKey: "<apiKey>",
authDomain: "<domain>",
databaseURL: "<database URL>",
storageBucket: "<storage bucket>"
storageBucket: "<storage bucket>",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

as you like.

};

firebase.initializeApp(config);
Expand All @@ -34,10 +31,10 @@ function toggleSignIn() {
if (firebase.auth().currentUser) {
firebase.auth().signOut();
} else {
const email = (<HTMLInputElement>document.getElementById('email')).value;
const email = (document.getElementById('email') as HTMLInputElement).value;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

const password = (<HTMLInputElement>document.getElementById('password')).value;
firebase.auth().createUserWithEmailAndPassword(email, password)
.catch((e) => {
.catch((e: firebase.FirebaseError) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You should make up type annotation manually.

const code = e.code;
const message = e.message;

Expand Down Expand Up @@ -67,7 +64,7 @@ function handleSignUp() {
return;
}
firebase.auth().createUserWithEmailAndPassword(email, password)
.catch((e) => {
.catch((e: firebase.FirebaseError) => {
const code = e.code;
const message = e.message;
switch (code) {
Expand All @@ -82,4 +79,4 @@ function handleSignUp() {
})
};

// port initApp()
// port initApp()