Partage
  • Partager sur Facebook
  • Partager sur Twitter

problème typescript avec firebase

cours angular

    28 octobre 2021 à 15:47:36

    Bonjour, 

    je suis actuellement le cours sur angular, et en utilisant firebase j'ai cette erreur typescript :

    ERROR in node_modules/@firebase/firestore/dist/index.d.ts:26:28 - error TS1005: ']' expected.
    
    26     [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
                                  ~~
    node_modules/@firebase/firestore/dist/index.d.ts:26:47 - error TS1005: ';' expected.
    
    26     [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
                                                     ~
    node_modules/@firebase/firestore/dist/index.d.ts:26:49 - error TS1109: Expression expected.
    
    26     [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
                                                       ~
    node_modules/@firebase/firestore/dist/index.d.ts:26:50 - error TS1109: Expression expected.
    
    26     [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
                                                        ~
    node_modules/@firebase/firestore/dist/index.d.ts:27:1 - error TS1128: Declaration or statement expected.
    
    27 };

    ci-dessous mon fichier package.json

    {
      "name": "bookshelves",
      "version": "0.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "~9.1.1",
        "@angular/common": "~9.1.1",
        "@angular/compiler": "~9.1.1",
        "@angular/core": "~9.1.1",
        "@angular/forms": "~9.1.1",
        "@angular/platform-browser": "~9.1.1",
        "@angular/platform-browser-dynamic": "~9.1.1",
        "@angular/router": "~9.1.1",
        "bootstrap": "^3.3.7",
        "firebase": "^9.1.3",
        "rxjs": "~6.5.4",
        "rxjs-compat": "^6.6.7",
        "tslib": "^1.10.0",
        "zone.js": "~0.10.2"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.901.1",
        "@angular/cli": "~9.1.1",
        "@angular/compiler-cli": "~9.1.1",
        "@angular/language-service": "~9.1.1",
        "@types/jasmine": "~3.5.0",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "^12.11.1",
        "codelyzer": "^5.1.2",
        "jasmine-core": "~3.5.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~4.4.1",
        "karma-chrome-launcher": "~3.1.0",
        "karma-coverage-istanbul-reporter": "~2.1.0",
        "karma-jasmine": "~3.0.1",
        "karma-jasmine-html-reporter": "^1.4.2",
        "protractor": "~5.4.3",
        "ts-node": "~8.3.0",
        "tslint": "~6.1.0",
        "typescript": "^3.8.3"
      }
    }
    

    merci de votre aide.




    -
    Edité par Manu Dev 28 octobre 2021 à 15:55:01

    • Partager sur Facebook
    • Partager sur Twitter
      28 octobre 2021 à 17:42:03

      Bonjour,

      Le mot clef 'as' sert pour forcer le type d'une variable.

      https://www.typescriptlang.org/docs/handbook/advanced-types.html 

      -
      Edité par piero5673 28 octobre 2021 à 17:43:16

      • Partager sur Facebook
      • Partager sur Twitter

      problème typescript avec firebase

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown