wesdoyle / base-chat

A simple chat application built using Angular and Firebase
53 stars 52 forks source link

'query' does not exist in type 'QueryFn' #1

Closed Hillel-Nagid closed 6 years ago

Hillel-Nagid commented 6 years ago

'query' does not exist in type 'QueryFn'


    return this.db.list('messages', {
      query: {
        limitToLast: 25,
        orderByKey: true
      }
    });
  }```
how can I fix that
rijomonr commented 6 years ago

I'm getting the same issue Argument of type '{ query: { limitTolast: number; orderByKey: boolean; }; }' is not assignable to parameter of type 'QueryFn'. Object literal may only specify known properties, and 'query' does not exist in type 'QueryFn'.

3669 commented 6 years ago

hii. i have this problem also. Maybe you found what need to do yet?

3669 commented 6 years ago

firstly it's need to be together //import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database-deprecated';

secondly it's my funcshion

getMessages(): FirebaseListObservable<ChatMessage[]> { // query to create our message feed binding return this.db.list('message', { query: { limitToLast: 20 } }); }

and it's work now.

Hillel-Nagid commented 6 years ago

Thanks 3669

jdevsan commented 6 years ago

ERROR in src/app/services/chat.service.ts(55,39): error TS2345: Argument of type '{ query: { limitToLast: number; }; }' is not assignable to parameter of type 'FirebaseListFactoryOpts'. Types of property 'query' are incompatible. Type '{ limitToLast: number; }' is not assignable to type 'Query'. Property 'endAt' is missing in type '{ limitToLast: number; }'. whats happening??


chat.services.ts

getMessages(): FirebaseListObservable<ChatMessage[]> { // query to create our message feed binding return this.db.list('messages', { query: { limitToLast: 20,

    }
  });
}
pranjul29 commented 5 years ago

ERROR in src/app/services/chat.service.ts(48,7): error TS2345: Argument of type '{ query: { limitToLast: number; orderByKey: boolean; }; }' is not assignable to parameter of type 'QueryFn'. Object literal may only specify known properties, and 'query' does not exist in type 'QueryFn'. ../../node_modules/rxjs-compat/Observable.d.ts(1,28): error TS2307: Cannot find module 'rxjs'. ../../node_modules/rxjs-compat/Observable.d.ts(2,70): error TS2307: Cannot find module 'rxjs'.

ramzan-ali-suzan commented 3 years ago

For AngularFire version 5 and up use,

db.list('/items', ref => ref.orderByChild('size').equalTo('large'));

for details please refer here