No errors on apparent type of bigint or symbol, even for recent targets#49104
No errors on apparent type of bigint or symbol, even for recent targets#49104
Conversation
`BigInt` isn't resolved whenever `lib < es2020`, but it's not an error when `target < es2020`. I have a few ideas for improving this situation but for the RC I'm going to remove `bigint` from Object.freeze's signature.
|
In discussion by the team, we decided that the checker should never error when a primitive like |
DanielRosenwasser
left a comment
There was a problem hiding this comment.
The original comment is out of date, but given your last comment
In discussion by the team, we decided that the checker should never error when a primitive like
bigintorsymbolcan't resolve its associated apparent type. I removed the error message and restoredbigintto Object.freeze in es5.d.ts.
I think this is the right call. Referencing BigInt directly probably shouldn't work; however, trying to resolve the apparent type to BigInt for bigint (or to any new wrapper type of any new primitive) is something that should have a reasonable fallback behavior; nobody should get an error for that. Furthermore, the apparent type should be {} so that it is effectively opaque (other than the fact that it's "not null/undefined).
That seems to be the behavior of this PR, so 👍🏻
|
@typescript-bot cherry-pick this to release-4.7 |
|
Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into |
|
Hey @DanielRosenwasser, I've opened #49135 for you. |
Component commits: 4c6e802 Remove bigint from Object.freeze in es5.d.ts `BigInt` isn't resolved whenever `lib < es2020`, but it's not an error when `target < es2020`. I have a few ideas for improving this situation but for the RC I'm going to remove `bigint` from Object.freeze's signature. 6d5bf6a Update other baselines e1958f7 No errors for missing apparent type of bigint,symbol for any target 86fc8db Update test text
Component commits: 4c6e802 Remove bigint from Object.freeze in es5.d.ts `BigInt` isn't resolved whenever `lib < es2020`, but it's not an error when `target < es2020`. I have a few ideas for improving this situation but for the RC I'm going to remove `bigint` from Object.freeze's signature. 6d5bf6a Update other baselines e1958f7 No errors for missing apparent type of bigint,symbol for any target 86fc8db Update test text Co-authored-by: Nathan Shively-Sanders <[email protected]>
BigIntisn't resolved wheneverlib < es2020, but it's not an error whentarget < es2020. I have a few ideas for improving this situation but for the RC I'm going to removebigintfrom Object.freeze's signature.Update: In discussion by the team, we decided that the checker should never error when a primitive like bigint or symbol can't resolve its associated apparent type. I removed the error message and restored bigint to Object.freeze in es5.d.ts.
Fixes #49101