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
Produces no compile error, and generates a code that throws a runtime error:
TypeError: Cannot read properties of undefined (reading 'toUpperCase')
π Expected behavior
Produces a compile error similar to "Property 'a' is used before its initialization."
Additional information about the issue
I'm not sure whether this may be a issue that can be fixed or just keep it as is "by design". I haven't found any other issues similar to this one here, at least with the search terms I tried.
As you know, we can easily modify the example case like below to avoid the error:
π Search Terms
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&ts=5.5.0-dev.20240328#code/MYGwhgzhAECiAeYC2AHEBTaBvAUNaYAXNBAC4BOAlgHYDmA3HtAEbQC80pAFpRAHQBXCOgCCACgCUjfMAD21MuQHBSs8mKIkKNWhOxN83XnzDsC06AF8cTIaMnFFO-fnzl0pAeWqce-MHyqAKooKOjkAMKQ6JIW1tY4cgqyGHwgsrRi1OgA7nCIqBhiAOToBWjoxRJ8zFJAA
π» Code
tsconfig.json:
example.ts:
π Actual behavior
Produces no compile error, and generates a code that throws a runtime error:
π Expected behavior
Produces a compile error similar to "Property 'a' is used before its initialization."
Additional information about the issue
I'm not sure whether this may be a issue that can be fixed or just keep it as is "by design". I haven't found any other issues similar to this one here, at least with the search terms I tried.
As you know, we can easily modify the example case like below to avoid the error:
But we can't adopt this workaround when the property is a hard-private one:
Actually I found this problem when using a hard-private variable.
The text was updated successfully, but these errors were encountered: