在打字稿中使用 apache thrift [英] Using apache thrift with typescript

查看:51
本文介绍了在打字稿中使用 apache thrift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 apache thrift 编译器生成了 .js 和 .d.ts 文件.如何在我现有的 Angular2/Typescript-Project 中使用这个文件?我尝试使用

I generated .js and .d.ts files with the apache thrift compiler. How can I use this files in my existing Angular2/Typescript-Project? I tried to use

///<reference path="./thrift.d.ts"/>
///<reference path="./Service.d.ts"/>

import Thrift = require("./thrift");
import Service = require("./Service")

如果我使用这四行,打字稿编译器不会抱怨,但是当我想使用它时没有定义节俭".thrift.js、Service.js 和 .d.ts 文件都存在于文件夹中.

If i use this four lines, the typescript compiler is not complaining, but "Thrift" is not defined when i want to use it. thrift.js, Service.js and both .d.ts files are existing in the folder.

非常感谢!

推荐答案

你需要在index.html中手动引用你的thrift.js

You need to manually reference your thrift.js in the index.html

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

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