Typescript error, unexpected ',' when fetching Geopoint
I get a "Typescript error, unexpected ','" when i try to update location collection of a user field.
this is my code
import * as firebase from 'firebase';
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude); //this is where the error points at
});
}
Please what am i doing wrong?
EDIT: My issue with firebase not defined was i was importing it wrongly. Corrected it.
javascript angular typescript firebase ionic-framework
|
show 1 more comment
I get a "Typescript error, unexpected ','" when i try to update location collection of a user field.
this is my code
import * as firebase from 'firebase';
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude); //this is where the error points at
});
}
Please what am i doing wrong?
EDIT: My issue with firebase not defined was i was importing it wrongly. Corrected it.
javascript angular typescript firebase ionic-framework
you forgot the keywordfunction
infunction updateDriverLocation
– Get Off My Lawn
Nov 10 at 20:25
Remove the semicolon, that line is part of a object not a statement
– dotconnor
Nov 10 at 20:25
@dotconnor omg am such a moron. Silly mistake! Thanks
– Patrick Obafemi
Nov 10 at 20:28
@dotconnor now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:31
how are you importing firebase?
– dotconnor
Nov 10 at 20:33
|
show 1 more comment
I get a "Typescript error, unexpected ','" when i try to update location collection of a user field.
this is my code
import * as firebase from 'firebase';
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude); //this is where the error points at
});
}
Please what am i doing wrong?
EDIT: My issue with firebase not defined was i was importing it wrongly. Corrected it.
javascript angular typescript firebase ionic-framework
I get a "Typescript error, unexpected ','" when i try to update location collection of a user field.
this is my code
import * as firebase from 'firebase';
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude); //this is where the error points at
});
}
Please what am i doing wrong?
EDIT: My issue with firebase not defined was i was importing it wrongly. Corrected it.
javascript angular typescript firebase ionic-framework
javascript angular typescript firebase ionic-framework
edited Nov 10 at 20:38
asked Nov 10 at 20:24
Patrick Obafemi
112113
112113
you forgot the keywordfunction
infunction updateDriverLocation
– Get Off My Lawn
Nov 10 at 20:25
Remove the semicolon, that line is part of a object not a statement
– dotconnor
Nov 10 at 20:25
@dotconnor omg am such a moron. Silly mistake! Thanks
– Patrick Obafemi
Nov 10 at 20:28
@dotconnor now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:31
how are you importing firebase?
– dotconnor
Nov 10 at 20:33
|
show 1 more comment
you forgot the keywordfunction
infunction updateDriverLocation
– Get Off My Lawn
Nov 10 at 20:25
Remove the semicolon, that line is part of a object not a statement
– dotconnor
Nov 10 at 20:25
@dotconnor omg am such a moron. Silly mistake! Thanks
– Patrick Obafemi
Nov 10 at 20:28
@dotconnor now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:31
how are you importing firebase?
– dotconnor
Nov 10 at 20:33
you forgot the keyword
function
in function updateDriverLocation
– Get Off My Lawn
Nov 10 at 20:25
you forgot the keyword
function
in function updateDriverLocation
– Get Off My Lawn
Nov 10 at 20:25
Remove the semicolon, that line is part of a object not a statement
– dotconnor
Nov 10 at 20:25
Remove the semicolon, that line is part of a object not a statement
– dotconnor
Nov 10 at 20:25
@dotconnor omg am such a moron. Silly mistake! Thanks
– Patrick Obafemi
Nov 10 at 20:28
@dotconnor omg am such a moron. Silly mistake! Thanks
– Patrick Obafemi
Nov 10 at 20:28
@dotconnor now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:31
@dotconnor now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:31
how are you importing firebase?
– dotconnor
Nov 10 at 20:33
how are you importing firebase?
– dotconnor
Nov 10 at 20:33
|
show 1 more comment
2 Answers
2
active
oldest
votes
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude);
});
}
Here you're sending in an object to the update function:
{
location: new firebase.firestore.GeoPoint(latitude, longitude);
}
An object property can't end with ;
Instead the code should be:
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
1
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
add a comment |
This is the correct code:
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
1
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
2
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
1
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
1
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243092%2ftypescript-error-unexpected-when-fetching-geopoint%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude);
});
}
Here you're sending in an object to the update function:
{
location: new firebase.firestore.GeoPoint(latitude, longitude);
}
An object property can't end with ;
Instead the code should be:
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
1
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
add a comment |
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude);
});
}
Here you're sending in an object to the update function:
{
location: new firebase.firestore.GeoPoint(latitude, longitude);
}
An object property can't end with ;
Instead the code should be:
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
1
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
add a comment |
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude);
});
}
Here you're sending in an object to the update function:
{
location: new firebase.firestore.GeoPoint(latitude, longitude);
}
An object property can't end with ;
Instead the code should be:
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude);
});
}
Here you're sending in an object to the update function:
{
location: new firebase.firestore.GeoPoint(latitude, longitude);
}
An object property can't end with ;
Instead the code should be:
updateDriverLocation(latitude, longitude, id: string) {
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
answered Nov 10 at 20:26
E. Sundin
2,7871024
2,7871024
1
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
add a comment |
1
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
1
1
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
OMG silly mistake. Such a moron. Thanks
– Patrick Obafemi
Nov 10 at 20:28
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
Now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:30
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
@PatrickObafemi Then I assume you have forgotten to include firebase. I'm not sure where you should be importing it. In an html file perhaps?
– E. Sundin
Nov 10 at 20:32
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
Imported it wrongly. Already corrected it in my question. Thanks
– Patrick Obafemi
Nov 10 at 20:39
add a comment |
This is the correct code:
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
1
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
2
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
1
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
1
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
add a comment |
This is the correct code:
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
1
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
2
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
1
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
1
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
add a comment |
This is the correct code:
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
This is the correct code:
updateDriverLocation(latitude, longitude, id:string)
{
return this.DriverCollection.doc(id).update({
location: new firebase.firestore.GeoPoint(latitude, longitude)
});
}
answered Nov 10 at 20:27
Gabitu
1414
1414
1
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
2
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
1
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
1
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
add a comment |
1
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
2
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
1
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
1
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
1
1
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
OMG silly mistake. Such a moron. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:29
2
2
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
You should explain why it is correct. Don't just say it is correct.
– Get Off My Lawn
Nov 10 at 20:29
1
1
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
@GetOffMyLawn it is correct cos you do not add a semi colon after an object property.
– Patrick Obafemi
Nov 10 at 20:30
1
1
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@PatrickObafemi I know it is correct, but on SO, you should explain your reasoning. That is the whole point of SO, as it is basically a Wiki. If you looked up Thomas Edison on Wikipedia, and all it said was he was an inventor, Wikipedia wouldn't be very helpful now would it?
– Get Off My Lawn
Nov 10 at 20:35
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
@GetOffMyLawn my bad. I already explained why it is correct though. Thanks a lot
– Patrick Obafemi
Nov 10 at 20:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243092%2ftypescript-error-unexpected-when-fetching-geopoint%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you forgot the keyword
function
infunction updateDriverLocation
– Get Off My Lawn
Nov 10 at 20:25
Remove the semicolon, that line is part of a object not a statement
– dotconnor
Nov 10 at 20:25
@dotconnor omg am such a moron. Silly mistake! Thanks
– Patrick Obafemi
Nov 10 at 20:28
@dotconnor now i get a firebase not defined error. Any help?
– Patrick Obafemi
Nov 10 at 20:31
how are you importing firebase?
– dotconnor
Nov 10 at 20:33