jsayol / FireSQL

Query Firestore using SQL syntax
https://devlibrary.withgoogle.com/products/firebase/repos/jsayol-FireSQL
MIT License
350 stars 32 forks source link

Unable to compile using TypeScript #18

Open agordeev opened 5 years ago

agordeev commented 5 years ago

I'm trying to use FireSQL with code from README, but getting errors below:

> tsc

node_modules/firebase/index.d.ts:6297:36 - error TS2304: Cannot find name 'ServiceWorkerRegistration'.

6297     useServiceWorker(registration: ServiceWorkerRegistration): void;
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/firebase/index.d.ts:6414:13 - error TS2304: Cannot find name 'Blob'.

6414       data: Blob | Uint8Array | ArrayBuffer,
                 ~~~~

node_modules/firesql/utils.d.ts:1:45 - error TS7016: Could not find a declaration file for module './sql-parser'. '/Users/andrey/Documents/MyProjects/FreelanceJobs/FreelanceJobs-server/functions/node_modules/firesql/sql-parser/index.js' implicitly has an 'any' type.

1 import { SQL_Value, SQL_AggrFunction } from './sql-parser';
                                              ~~~~~~~~~~~~~~

src/repositories/upwork/upworkJobRepository.ts:4:1 - error TS6133: 'firebase' is declared but its value is never read.

4 import firebase from 'firebase/app'
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 4 errors.

The code is:

import 'firebase/firestore'
import firebase from 'firebase/app'
import { FireSQL } from 'firesql'

    const fireSQL = new FireSQL(this.getCollectionRef().firestore)
    const promise = fireSQL.query(`
  SELECT *
  FROM upworkjobs
  WHERE budget >= 500 AND budget <= 10000 AND subcategory = 'Game Development'
  ORDER BY datePosted DESC
  LIMIT 5
`)

How to fix them? I use TypeScript.

cyiboy commented 4 years ago

having same isuss need guide asap import { SQL_Value, SQL_AggrFunction } from './sql-parser';

agordeev commented 4 years ago

@cyiboy unfortunately this repo seems dead :(

ezequielpablo commented 4 years ago

Hello @cyiboy @agordeev ! I've tried, and it works for me, edit the line in the utils.d.ts file to: import { SQL_Value, SQL_AggrFunction } from './types/sql-parser'; I know this isn't the right way but I needed to compile :D