You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@zepumph and I observed incorrect behavior from tsc when incremental was set to true. A similar behavior was also discussed in #42769. It seems like the tsbuildinfo is stale.
Set up the 3 files described above, note the relative paths
Run tsc. Observe that type checking passes, as expected
Change public message = 'hello'; to protected message = 'hello'; and run tsc. Observe that type checking fails, as expected. The error message is js/main.ts:5:23 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses.
Change protected message = 'hello'; back to public message = 'hello'; and run tsc. Observe that type checking fails when it should have succeeded. Same error message as in prior step.
Change "incremental": true, to "incremental": false, in the tsconfig file and run tsc. Observe that type checking succeeds as expected.
🙂 Expected behavior
In Step 4, we would have expected no type errors, since message is public. However, tsc reports a type error.
In Step 5, we would expect no change in behavior whether incremental is set to true or false.
Note that we experimented with combining main into the MessageablePerson file and could not exhibit the bug in that way
Note also that the bug appears in both ways: (a) reporting an error when there isn't one and (b) reporting that there is no error when there really is an error.
The text was updated successfully, but these errors were encountered:
…tal mode use d.ts emit text + diagnostics as signature of the file (#49543)
* Add test when declaration emit has errors and d.ts emit doesnt change which results in incorrect incremental behaviour
* Refactor
* Use declaration diagnostics in the d.ts signature for the file so it can be more accurate for detecting changes to file that could affect other files
Fixes#49527
* Renames and clarifications
* Simplify serialize declaration diagnostics for signature purpose
Do not serialize file name if error is in same file we are emitting. this should avoid having to do file path computation in most cases.
Locations are start and length instead of line and character.
Do not use any indents
* Fix baselines
Bug Report
@zepumph and I observed incorrect behavior from
tsc
whenincremental
was set to true. A similar behavior was also discussed in #42769. It seems like the tsbuildinfo is stale.🔎 Search Terms
incremental, stale, tsbuildinfo
🕗 Version & Regression Information
💻 Code
🙁 Actual behavior
tsc
. Observe that type checking passes, as expectedpublic message = 'hello';
toprotected message = 'hello';
and runtsc
. Observe that type checking fails, as expected. The error message isjs/main.ts:5:23 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses.
protected message = 'hello';
back topublic message = 'hello';
and runtsc
. Observe that type checking fails when it should have succeeded. Same error message as in prior step."incremental": true,
to"incremental": false,
in the tsconfig file and runtsc
. Observe that type checking succeeds as expected.🙂 Expected behavior
message
ispublic
. However,tsc
reports a type error.incremental
is set totrue
orfalse
.The text was updated successfully, but these errors were encountered: