Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] error if test file import other typescript #16

Closed
HerringtonDarkholme opened this issue Apr 19, 2016 · 5 comments
Closed

[bug] error if test file import other typescript #16

HerringtonDarkholme opened this issue Apr 19, 2016 · 5 comments

Comments

@HerringtonDarkholme
Copy link

I think this is a problem related to typescirpt-simple.

Reproduction:
package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha test.ts --compilers ts:espower-typescript/guess"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "espower-typescript": "^5.0.1",
    "mocha": "^2.4.5"
  }
}

dep.ts

export function test() {
  console.log('from ts')
}

test.ts

import {test} from './dep'

test()

Error stack

TypeError: Cannot read property 'text' of undefined
    at TypeScriptSimple.toJavaScript (/node_modules/typescript-simple/index.js:162:28)
    at TypeScriptSimple.compile (/node_modules/typescript-simple/index.js:71:25)
    at Object.loadTypeScript (/node_modules/espower-typescript/index.js:19:22)
    …略

Works fine with espower-typescript 4.1.0.

@muraken720
Copy link

I have encounter the same issue.

@muraken720
Copy link

I closed my issue.
In my case, the cause is "noEmitOnError: true".

I changed my tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": true,
        "inlineSources": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "noEmitOnError": false,    // true ---> false
        "preserveConstEnums": true,
        "removeComments": true,
        "declaration": true
    },
    "exclude": [
        "node_modules",
        "typings/browser",
        "typings/browser.d.ts"
    ]
}

joe-re added a commit to joe-re/cafe-pitch that referenced this issue Jul 5, 2016
to resolve espower-typescript's complite error on travis
ref: power-assert-js/espower-typescript#16
@minodisk
Copy link

minodisk commented Aug 23, 2016

In my case, this bug is fixed with replacing typescript-simple package manually to https://github.com/uncovertruth/typescript-simple/tree/fix/file-text .

npm install -D git://github.com/uncovertruth/typescript-simple.git#fix/file-text

@teppeis
Copy link
Contributor

teppeis commented Oct 24, 2016

@HerringtonDarkholme @muraken720 @minodisk
This would be fixed by teppeis/typescript-simple#47 fixes in Mac and Linux, but still remains in Windows.

@teppeis
Copy link
Contributor

teppeis commented Feb 23, 2017

Fixed in teppeis/typescript-simple#66

@teppeis teppeis closed this as completed Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants