Skip to content

WIP - adding typescript#84

Open
richgilbank wants to merge 1 commit intomasterfrom
typescript
Open

WIP - adding typescript#84
richgilbank wants to merge 1 commit intomasterfrom
typescript

Conversation

@richgilbank
Copy link
Owner

Work in progress - This is not yet complete, as the error handling seems to be a little difficult (TypeScript seems to not be throwing SyntaxErrors, or anything else, when encountering broken syntax). Anyone more familiar with TypeScript's compiler who could lend a hand?
cc @yashprit or @hi104, who's already done great work on the TypeScript Playground on Ace

Ref: #35

@aluanhaddad
Copy link

aluanhaddad commented Jul 10, 2016

@richgilbank Cool project! The reason no errors are being reported is because you have not set reportDiagnostics: true. This will cause the compiler to populate the diagnosticsproperty ofresult`.
Here is a simple example.

const source = "let x: stri ng  = 'string'";

const result = ts.transpileModule(source, {
    reportDiagnostics: true
});

result.diagnostics
    .filter(diagnostic => diagnostic.category === 1) // error
    .map(diagnostic => typeof diagnostic.messageText === 'string' 
        ? diagnostic.messageText
        : diagnostic.messageText.messageText)
    .forEach(message => console.error(message));
// '=' expected.

@aluanhaddad aluanhaddad mentioned this pull request Jul 22, 2016
@richgilbank
Copy link
Owner Author

Sorry for the incredibly slow response on this. Would like to get this up and running soon - should be able to find some time to work on it in the next little while. Thanks for the note @aluanhaddad, will take a look! Alternatively, feel free to submit a PR :)

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

Successfully merging this pull request may close these issues.

2 participants