我可以在没有requireJS的情况下使用打字稿吗?

san*_*074 5 javascript typescript

我在不同的文件中有两个类:

export class ActionsCollection{
    constructor(greeting :string){
        this.greet(greeting);
    }

    public greet(greeting :string) {
        return "<h1>"+greeting+"</h1>";
    }
} 
Run Code Online (Sandbox Code Playgroud)

import {ActionsCollection} from "./actionsCollection";

class Greeter extends ActionsCollection{
    constructor(public greeting: string) {
        super(greeting); 
    }
}

alert(new Greeter("Hello, world!"));
Run Code Online (Sandbox Code Playgroud)

Greeter在这样的文件中生成,其中存在require行("./ actionsCollection")。但是我想确保所有文件(* .ts)都只在一个文件main.js中生成,不需要require。我可以那样做吗?如果是这样,怎么办?

ps同时,对于装配,您可以使用标准的WebStorm工具和Gulp。而且,除了gulp的模块之外。

Bra*_*sen 3

代替

import {ActionsCollection} from "./actionsCollection";

/// <reference path="./actionsCollection.ts" />

有关使用三斜杠导入的更多信息,请参阅三斜杠。