Closed nostrorom closed 4 months ago
What are you trying to do? Are you trying to render all errors, or ignores all errors?
You can add // @noErrors
or // @noErrorVaildation
deps on your need:
https://github.com/twoslashes/twoslash/blob/0a18156a9f71b05d84b55b53ef63dca125aab071/packages/twoslash/src/types/handbook-options.ts#L4-L44
Hi @antfu
Thanks for your quick answer; reading it has made me understand I had the wrong expectations.
What I was trying to do was have this kind of error line:
<div class="twoslash-meta-line twoslash-error-line">Type 'string' is not assignable to type 'number'.</div><div class="twoslash-meta-line twoslash-error-line">Type 'number' is not assignable to type 'string'.</div>
Which I can reproduce from the example in the docs; my mistake was expecting similar error line divs also for JS
errors.
I know realise this is not the scope of twoslash
, only TS
errors.
Though if there is a way to also generate something like this for the error in my OP, I'd be happy to kown 😄
<div class="twoslash-meta-line twoslash-error-line">
Property 'loog' does not exist on type 'Console'. Did you mean 'log'?"
</div>
Otherwise the issue is closed for me
Idk, maybe try adding // @ts-check
to your js file?
Did no seem to work. I'm still fiddling with things to see if I can probably describe the cases where I find there is expected/unexpected behaviour, and then provide reproductible examples. Is there a discussion page where I can take this conversation to instead of issues? I'll close this for now.
Anyway thank you guys for yout work on this project, it's an awesome tool 👍
Hello,
When trying
twoslah
withshiki
, compiler errors are treated as real errors instead of being rendered to htmlCode without errors
index.js
then
node ./index.js
correctly renders
Code without errors
index.js
then
node ./index.js
throws an error instead of rendering:
Using error tags to suppress errors
Following the expected tag leads to other errors, also suppressing them
index.js
then
node ./index.js
this renders the HTML, but the errors are also suppressed here, defeating the purpose
What am I missing here ?