-
Notifications
You must be signed in to change notification settings - Fork 87
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
Show Typescript compiler errors in console #1
Comments
Could you maybe post an example of some typescript code that should throw an error / warning? |
This for example should not pass type checking :-) interface Foo {
bar: string
}
const n: number = false
const foo:Foo = {bar: n}
console.log(foo) |
The simplest error might be to contradict an annotation, which should always be an error regardless of compiler settings:
Here are some other examples that show errors with different compiler settings. (You can flip them on and off with the Options menu.) |
I've been looking closer at getting error output, but unfortunately it's not as straight forward as I had hoped. I currently use This speaks for having an API in Flems to do type checking or linting etc, instead of trying to plug it in to the compilation phase. The example from the typescript playground uses the monaco editor, and I tried to dig into the source of that, but it's heavily tied up inside and felt like finding a needle in a haystack. I've found this documentation and this to be the best place to start for now. It requires creating a Either digging in to that or participating in this issue to get the option in |
Ah, it's too bad it's not a trivial undertaking. If I had the time I'd love to look into it but I really don't right now. There may be other TS users who would though, if you advertise it a bit. Just being able to run TS code is a pretty nice feature already. |
Hmm.. couldn't help myself.. I managed to get a bit further.. This definitely needs to be put in a worker, cause it seems quite heavy, but I think that might be possible to tweak by removing checks for errors not needed.. |
That's awesome! The |
The Edit:
Yeah, doubling down on that :-) |
Thanks for the pointers :) I'll play around with it a bit more next week.. Also looked a bit into fetching type declarations with @spacejack on gitter, so I'll just leave this flems here because someone didn't implement saving flemses yet... |
I think this might be solved better by using the monaco editor and use the typescript checker it includes. I haven't found anything for CodeMirror unfortunately, there's only the js linter, but nothing typescript specific. What do you think @spacejack & @pygy ? |
I'm afraid I don't have any useful feedback... |
fix: add allow-presentation to iframe sandbox;
Would make the Typescript language support a lot nicer.
The text was updated successfully, but these errors were encountered: