Angularjs 在另一个带有Typescript的文件中使用.config函数?

Angularjs 在另一个带有Typescript的文件中使用.config函数?,angularjs,typescript,Angularjs,Typescript,我在一个名为config.ts的文件中有这段代码 app.config(['abc', function (abc) { // some code here }]) app.config(myFunc) 有人能告诉我如何将函数移动到另一个文件并使用Typescript吗?特别是,我希望确保在模拟代码时不会出现问题。以下是我的想法,但我不确定这是否正确: 文件myFunc.ts myFunc => (['abc', function (abc) { // some c

我在一个名为config.ts的文件中有这段代码

app.config(['abc', function (abc) {
    // some code here
}])
 app.config(myFunc)
有人能告诉我如何将函数移动到另一个文件并使用Typescript吗?特别是,我希望确保在模拟代码时不会出现问题。以下是我的想法,但我不确定这是否正确:

文件myFunc.ts

 myFunc => (['abc', function (abc) {
    // some code here
}])
文件config.ts

app.config(['abc', function (abc) {
    // some code here
}])
 app.config(myFunc)

希望有人能帮助我朝着正确的方向前进。特别是我不确定的是如何使用typescript将参数注入函数中。如果函数是一个类,那么我知道怎么做,但是.config不接受类作为其参数。

使用外部模块,然后与加载程序绑定

文件
myFunc.ts

export const myFunc = () => (['abc', function (abc) {
    // some code here
}])
import {myFunc} from "./myFunc";
app.config(myFunc)
文件
config.ts

export const myFunc = () => (['abc', function (abc) {
    // some code here
}])
import {myFunc} from "./myFunc";
app.config(myFunc)
更多

非常感谢您的回复。我想使用外部模块,但在这个时候,这将意味着我的代码有相当多的变化。如果你不介意,你也可以给我一个答案,如何做到这一点,而不使用外部模块,只是把一个文件的功能。只是文件将包含myFunc=()=>(['abc',函数(abc){//some code here}])谢谢您需要使用
--out
,out是坏的!