Tag: typescript browserify qunit

找不到从Typescript构build的JavaScript类

情况 我正在打字的webapp的前面,我编译成JS。 我想对生成的js运行qunittesting。 我的打字稿是合并在一个文件中使用browserify我想对我的js对象运行testing。 我使用war包在tomcat web服务器上运行没有节点的js。 问题 我找不到我生成的类js(访问问题或隐藏对象….)? 当我尝试在js脚本中使用animal.js时,动物类是不可访问的!? 如何在js中访问这个类? 我想运行没有错误,animal.test.html。 animal.ts export class Animal { name:string; constructor(name:string) { this.name=name; } public run(){ console.log('${this.name}:Animal runs.'); } public eat(){ console.log('${this.name}:Animal eats.'); } public sleep(){ console.log('${this.name}:Animal sleeps.'); } } animal.js (来自animal.ts) (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return […]