打字稿只能找到类CI

问题描述

我有一个 Angular 项目,当我在本地运行“ ng test”时,一切正常,但是在bitbucket管道中却出现此错误

src / app / services / user-store / user.service.ts中的

ERROR:7:22-错误 TS2307:找不到模块“ ../../models/user”或其对应的模块 类型声明。 7从'../../models/user'导入{User};

我的tsconfig.base

{
  "compileOnSave": false,"compilerOptions": {
    "baseUrl": "./","outDir": "./dist/out-tsc","sourceMap": true,"declaration": false,"downlevelIteration": true,"experimentalDecorators": true,"moduleResolution": "node","importHelpers": true,"target": "es2015","module": "ES2020","lib": [
      "es2018","dom"
    ]
  }
}

我的tsconfig.spec.json

{
  "extends": "./tsconfig.base.json","compilerOptions": {
    "outDir": "./out-tsc/spec","types": [
      "jasmine"
    ]
  },"files": [
    "src/test.ts","src/polyfills.ts"
  ],"include": [
    "src/**/*.spec.ts","src/**/*.d.ts"
  ]
}

我认为与tsconfig.base中的“目标”有关,但我不确定,也许我的Yaml中缺少某些内容

bitbucket-pipelines.yml

pipelines:
 default:
   - step:
       name: Build,Lint and Test
       image: rastasheep/alpine-node-chromium:12-alpine
       caches:
         - node
       deployment: test
       script:
         - npm install 
         - npm run test:ci
         - npm run e2e:ci
         - npm run build:prod
         - pipe: atlassian/firebase-deploy:0.3.0
           variables:
             FIREBASE_TOKEN: '$FIREBASE_TOKEN_CI'

User.ts

import * as firebase from 'firebase';

export interface User{
    uid: string;
    name: string;
    email: string;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)