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

ts-node doesn't work with latest typescript 2.5 #360

Closed
cevek opened this issue Jun 18, 2017 · 8 comments
Closed

ts-node doesn't work with latest typescript 2.5 #360

cevek opened this issue Jun 18, 2017 · 8 comments
Labels

Comments

@cevek
Copy link
Contributor

cevek commented Jun 18, 2017

ts-node 1.tsx

TSError: ⨯ Unable to compile TypeScript
Cannot find type definition file for 'react'. (2688)
1.tsx (1,24): Cannot find module 'react'. (2307)

tsc works without problems

@blakeembrey
Copy link
Member

Can you give some example code that will replicate this? Can you verify your TypeScript versions aren't out of sync (e.g. you installed something locally but you're using the local version)?

@cevek
Copy link
Contributor Author

cevek commented Jun 18, 2017

create file 1.tsx

import * as React from 'react';
<div className="foo"></div>

create file tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "jsx": "react"
  }
}
npm i -g ts-node
npm i -g typescript@next
npm init -y
npm i @types/react 
ts-node 1.tsx

And result is

/usr/local/lib/node_modules/ts-node/src/index.ts:300
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
Cannot find type definition file for 'react'. (2688)
1.tsx (1,24): Cannot find module 'react'. (2307)
    at getOutput (/usr/local/lib/node_modules/ts-node/src/index.ts:300:15)

@cevek
Copy link
Contributor Author

cevek commented Jun 18, 2017

with [email protected] works correctly

@cevek
Copy link
Contributor Author

cevek commented Jun 18, 2017

I think its related to this merge microsoft/TypeScript#12336

@blakeembrey
Copy link
Member

Thanks for this! I'll have to look next week, but until then feel free to investigate yourself and/or submit a PR.

@cevek
Copy link
Contributor Author

cevek commented Jun 19, 2017

Bug on the typescript side microsoft/TypeScript#16616

@cevek
Copy link
Contributor Author

cevek commented Jun 20, 2017

PR #366

@blakeembrey
Copy link
Member

Closed with #366, cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants