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.transpileModule does not return diagnostics #17514

Closed
alex-kinokon opened this issue Jul 30, 2017 · 2 comments
Closed

ts.transpileModule does not return diagnostics #17514

alex-kinokon opened this issue Jul 30, 2017 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@alex-kinokon
Copy link

TypeScript Version: 2.4.2

Code

import * as ts from 'typescript';

const module = ts.transpileModule('const a: string = 2; a = 0;', {
  reportDiagnostics: true,
});
console.log(module.diagnostics);

Expected behavior:
Reports [ts] Type '2' is not assignable to type 'string'.

Actual behavior:
Diagnostics is an empty array [].

@aluanhaddad
Copy link
Contributor

aluanhaddad commented Jul 30, 2017

From what I understand, that is precisely the point of the transpile module API. It exposes TypeScript's ability to transform ESNext code intro various targets while removing TypeScript specific syntax without typechecking. This is useful for many tool chains that wish to perform typechecking and transpilation separately.

@kitsonk
Copy link
Contributor

kitsonk commented Jul 30, 2017

Duplicate of #4864

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jul 31, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants