Error: src/algolia.ts(1,27): error TS7016: Could not find a declaration file for module 'algoliasearch'. 'xxx' implicitly has an 'any' type

I’m trying to set up CI with Github Actions and it fails on this error:
Error: src/algolia.ts(1,27): error TS7016: Could not find a declaration file for module ‘algoliasearch’. ‘xxx/algoliasearch/index.js’ implicitly has an ‘any’ type.

It suggests to add the @types/algoliasearch as a dev dependency to my package.json but this does not solve the issue. When I add the types it even gives me a warning that algolia is supposed to provide its own types and the type file is a stub.

The Firebase Cloud Function project itself works fine.

package.json

{
  "name": "functions",
  "scripts": {
    "lint": "eslint",
    "build": "tsc",
    "serve": "npm run build && firebase serve --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "12"
  },
  "main": "lib/functions/src/index.js",
  "dependencies": {
    "algoliasearch": "^4.9.2",
    "firebase-admin": "^9.9.0",
    "firebase-functions": "^3.14.1"
  },
  "devDependencies": {
    "@tsconfig/node12": "^1.0.8",
    "eslint": "^7.28.0",
    "eslint-plugin-node": "^11.1.0",
    "firebase-functions-test": "^0.2.3",
    "typescript": "^4.3.2"
  },
  "private": true
}

tsconfig.json

{
  "extends": "@tsconfig/node12/tsconfig.json",
  "compilerOptions": {
    "outDir": "lib"
  },
  "compileOnSave": false,
  "files": ["src/index.ts"],
  "include": ["**/*.ts"],
  "exclude": ["src/**/*.spec.ts"]
}

Github workflow:


name: CI

on:
  push:
  pull_request:

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  test:
    runs-on: ubuntu-latest
    
    strategy:
      matrix:
         node: [17.x]
    
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
      - run: npm i
      - run: npm run test:once
      - run: npm run e2e

The commands in the workflow come from a different package.json one level higher from the main project.

    "test:once": "ng lint && npm --prefix ./functions run build && ng test --browsers ChromeHeadless --watch=false --code-coverage",

There is a part there that checks if the “build” command of the functions still works (as they share some files).

Any suggestions are welcome.