Angular 如何将.js文件与声明一起使用.d.ts

Angular 如何将.js文件与声明一起使用.d.ts,angular,typescript,typescript-typings,Angular,Typescript,Typescript Typings,我有Angular7应用程序,我想包括一些项目外部的类型化JS常量(这些常量在AngularJS应用程序中使用,所以我需要将其保存在JS中)。我在tsconfig.json的路径中定义了新路径 { "compileOnSave": false, "compilerOptions": { "allowJs": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false,

我有Angular7应用程序,我想包括一些项目外部的类型化JS常量(这些常量在AngularJS应用程序中使用,所以我需要将其保存在JS中)。我在tsconfig.json的路径中定义了新路径

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowJs": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ],
    "baseUrl": "src",
    "paths": {
      "@app/*": ["app/*"],
      "@env/*": ["environments/*"],
      "@dep/*": ["../../web-common/*"]
    }
  }
} 
在@dep中,我有test.js和test.d.ts,其中包含以下内容

export const TEST_CONST = {
  parser: 'CSV',
  styler: 'XVE'
};

但是当我导入它并开始使用

import {TEST_CONST} from '@dep/constants/test';

它给了我

错误TS2693:“TEST_CONST”仅指类型,但在此处用作值。

我还尝试导入“@dep/constants/test.js”,但它是一样的。。。。
如何将带有打字的js文件导入Angular应用程序?据我所知,这应该是可能的。

尝试添加
declare
并删除
export

declare interface TEST_CONST {
  parser: string;
  styler: number;
}

它告诉我文件不是一个模块,如果直接导入呢<代码>从“@dep/constants/TEST.js”导入{TEST\u CONST}
console.log(TEST_CONST.styler);
declare interface TEST_CONST {
  parser: string;
  styler: number;
}