我可以使用没有requireJS的打字稿吗? [英] Can I use the typescript without requireJS?

查看:54
本文介绍了我可以使用没有requireJS的打字稿吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have two classes in different files:

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

    public greet(greeting :string) {
        return "<h1>"+greeting+"</h1>";
    }
} 

import {ActionsCollection} from "./actionsCollection";

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

alert(new Greeter("Hello, world!"));

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

Greeter is generated in such a file in which there is require line ("./ actionsCollection"). But I want to make sure that all the files (*.ts) generates in only one file main.js, it does not need require. Can I do that? And if so, how?

p.s。同时,对于程序集,您可以使用标准的WebStorm工具和Gulp。除了gulp模块之外,还有更多。

p.s. At the same time, for the assembly, you can use a standard WebStorm tools and Gulp. And Nothing more, besides modules for gulp.

推荐答案

替换

从./actionsCollection导入{ActionsCollection};

with

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

有关使用三联的详细信息,请参阅三次斜线斜线进口。

See Triple Slashes for more info on using the triple slash imports.

这篇关于我可以使用没有requireJS的打字稿吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆