kossnocorp / typesaurus

🦕 Type-safe TypeScript-first ODM for Firestore
https://typesaurus.com
412 stars 34 forks source link

Error on build (Property 'on' in type 'SubscriptionPromise<Request, Result, SubscriptionMeta>' is not assignable) #129

Closed Ichenn92 closed 5 months ago

Ichenn92 commented 5 months ago

Hi there,

I've encountered an issue while building my new project with typesaurus. here's the error:

Executing task: npm run build 
> build
> tsc && tsc-alias
node_modules/typesaurus/sp/index.d.ts:17:5 - error TS2416: Property 'on' in type 'SubscriptionPromise<Request, Result, SubscriptionMeta>' is not assignable to the same property in base type 'SubscriptionPromise<Request, Result, undefined>'.
  Property 'request' is missing in type '(callback: SubscriptionPromiseCallback<Result, SubscriptionMeta>) => OffSubscriptionWithCatch' but required in type 'SubscriptionPromiseOn<Request, Result, undefined>'.

17     on(callback: TypesaurusCore.SubscriptionPromiseCallback<Result, SubscriptionMeta>): TypesaurusCore.OffSubscriptionWithCatch;
       ~~
  node_modules/typesaurus/types/core.d.ts:589:9
    589         request: Request;
                ~~~~~~~
    'request' is declared here.
Found 1 error in node_modules/typesaurus/sp/index.d.ts:17

I don't know how useful it is but here are my

package.json

{
  "name": "functions",
  "scripts": {
    "lint": "eslint 'src/**/*.ts'",
    "lint:fix": "eslint 'src/**/*.ts' --fix",
    "build": "tsc && tsc-alias",
    "build:watch": "tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log",
    "clean": "rimraf lib/"
  },
  "engines": {
    "node": "18"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@types/rimraf": "^4.0.5",
    "axios": "^1.6.8",
    "better-firebase-functions": "^6.0.0",
    "express": "^4.19.1",
    "firebase": "^10.10.0",
    "firebase-admin": "^11.11.1",
    "firebase-functions": "^4.8.2",
    "rimraf": "^5.0.5",
    "typesaurus": "^10.3.0"
  },
  "devDependencies": {
    "@types/express": "^4.17.21",
    "@types/glob": "^8.1.0",
    "@typescript-eslint/eslint-plugin": "^5.62.0",
    "@typescript-eslint/parser": "^5.62.0",
    "concurrently": "^8.2.2",
    "eslint": "^8.57.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.25.4",
    "firebase-functions-test": "^3.1.0",
    "glob": "^10.3.10",
    "tsc-alias": "^1.8.8",
    "typescript": "^4.9.0"
  },
  "private": true
}

tsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "@/*": [
        "*"
      ]
    },
    "module": "commonJS",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "ES2020",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    // "skipLibCheck": true
  },
  "compileOnSave": true,
  "include": [
    "src"
  ],
  "exclude": [
    "node_modules",
    "lib"
  ]
}

I could build when activating "skipLibCheck"

kossnocorp commented 5 months ago

I appreciate the report. Can you please try building it with the latest TypeScript? I'm not sure which version is minimal, but I'm on 5.4 right now.

Ichenn92 commented 5 months ago

Oh thanks, silly me... I haven't updated typescript

problem solved ! thank you, appreciate your quick reponse

klyse commented 3 months ago

I have the same issue with typescript 5.4.5 and typesaurus 10.7.0. Setting skipLibCheck to true solves the issue also for me. Anything else I can try?

BenjaminCB commented 1 month ago

Any updates on this? I have the same problems using typescript 5.5.2 and typesaurus 10.7.0.