Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 导入的函数给出一个TypeError:。。。这不是一个函数_Typescript - Fatal编程技术网

Typescript 导入的函数给出一个TypeError:。。。这不是一个函数

Typescript 导入的函数给出一个TypeError:。。。这不是一个函数,typescript,Typescript,我有一个在很多文件中使用的函数。这项工作: import moment from 'moment'; let monthAsString = (month: number): string => { return moment().locale('de').month(month - 1).format("MMMM"); } configuration2005.push( { worksheetName: monthAsString(10), } ) 在额外文件中

我有一个在很多文件中使用的函数。这项工作:

import moment from 'moment';

let monthAsString = (month: number): string => {
  return moment().locale('de').month(month - 1).format("MMMM");
}

configuration2005.push(
  {
    worksheetName: monthAsString(10),
  }
)
在额外文件中分离函数时,我得到一个类型错误:

export function monthAsString(month: number): string {
  return moment().locale('de').month(month - 1).format("MMMM");
}
错误:

TypeError: configurations_1.monthAsString is not a function
    at Object.<anonymous> (/Users/mles/project/src/configuration-2005.ts:12:22)
    ...
TypeError:configurations\u 1.monthastring不是函数
反对。(/Users/mles/project/src/configuration-2005.ts:12:22)
...
我错过了什么?VSCode未显示任何错误。

对我正常工作:对我正常工作:
TypeError: configurations_1.monthAsString is not a function
    at Object.<anonymous> (/Users/mles/project/src/configuration-2005.ts:12:22)
    ...