error TS2612 Property will overwrite base property not raised if "strictNullCheck" is true #48667
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Bug Report
If you enable useDefineForClassFields then a new error is possible TS26126
If you have code that trigger TS2612 Property 'xxx' will overwrite the base propert in 'yyy'. It this is intentional, add an initializer. Othertwise, add a "declare" modifier or remove the redundant declaration.
The error do not appear if you enable strictNullCheck.
Without strictNullCheck you'll see this error.
If you put strict=true or strictNullCheck=true the error is not reported anymore
🔎 Search Terms
TS2612
strictNullCheck
🕗 Version & Regression Information
Noticed this on typescript 4.6.3
Tested on typescript@nightly 4.7.0-dev.20220408 and it behave the same (no error on strict mode)
Tested on 4.3.5 and it behave the same (no error on strict mode)
TS2612 was introduced in 4.3 so previous version do not make sense
⏯ Playground Link
This link contain a minimal code to show the problem but you need to enable/disable strictNullCheck and useDefineForClassFields to see it in action
Playground link with relevant code
💻 Code
🙁 Actual behavior
When compiled with:
the code does not raise any error
🙂 Expected behavior
It should raise the TS2612 error
The text was updated successfully, but these errors were encountered: