Skip to content

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

@HerringtonDarkholme

Description

@HerringtonDarkholme

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions