Closed tommy-mitchell closed 1 year ago
Perhaps users could set additional diagnostic codes in their tsd
config, to let their tests still pass if that code isn't in our list.
Added ts2542
to fix #143.
or at the very least in the expectError message:
👍
or at the very least in the expectError message:
Do you plan to work on this? No pressure, but I need to know whether or not to release a new version after merging this.
I did start attempting to add the updated error message, but it‘s a little more involved because the diagnostic
object at that location doesn’t have access to the error code.
Should we just update the error message and add the code there, or report the code on all diagnostics?
It would be too noisy to have the code on all diagnostics.
Fixes #170. Fixes #143.
Adds missing diagnostic codes:
ts2375
,ts2379
, andts2412
, which occur whenexactOptionalPropertyTypes
is set totrue
intsconfig.json
.ts2542
, which occurs when attempting to modify a readonly key in an object.Related, I think it's worth improving the error reporting when
expectError
fails. Currently, it reportseven if another error is reported for the same invocation (i.e.,
tsd
doesn't support that diagnostic code). We could change it to:I used the following snippet in
compiler.ts
to confirm whichDiagnosticCode
to add[^1]:I think it would be worthwhile to either report the codes of all diagnostics (potentionally in a
--verbose
mode?), or at the very least in theexpectError
message:[^1]: Full list here.