-
Notifications
You must be signed in to change notification settings - Fork 12.8k
BigInt constructor should not accept any type #38995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Why is Wouldn't be better allowing only |
@DanielRosenwasser Any opinion? |
This thing is just a conversion function from another type, so it should be somewhat permissive. The only thing that doesn't work is @typescript-bot test this |
Heya @DanielRosenwasser, I've started to run the parallelized Definitely Typed test suite on this PR at 759fff5. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the parallelized community code test suite on this PR at 759fff5. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the extended test suite on this PR at 759fff5. You can monitor the build here. |
Yeah, but other "primitive boxes" when called as a function does give a valid value of the primitive type: Number({}) // -> NaN, a number
Boolean({}) // -> true, a boolean
String({}) // -> '[object Object]', an string
Symbol({}) // -> a new symbol
BigInt({}) // throws :( Those maybe are just a side effect of the convertion to primitive and could or not be useful, but the type declaration doesn't lie. With BTW I think |
In consideration of below code also makes a TS error, maybe what InExtremaRes said is right? const keyObj = {
[Symbol.toPrimitive] () :'key' { return 'key'; },
toString () :'key' { return 'key'; },
valueOf () :'key' { return 'key'; },
};
( { 'key': 'value' } )[keyObj]; |
@LongTengDao sorry for letting this get stale. The next step is to see how much (if any) of Definitely Typed packages and our user tests break with this change. I don't see PRs from the last run so I'm going to re-run: @typescript-bot user test this Once they've run, report back on any failures. |
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
@sandersn what's the status on this? We have bugs go into production because null and undefined are not rejected. As for accepted values, |
@fubar One check fails after the commit which removed the
|
@LongTengDao your fork is well behind upstream, the file exists in upstream but not in your fork. Try pulling latest. |
@sandersn can we get another look at this? Do those tests need to run again? The previous test runs don't have their output anymore, looks like they're too old. Thanks! |
@typescript-bot user test this |
@typescript-bot run dt |
DT doesn't have any new errors (although I need to go and clean up the existing errors). The user tests were also clean back in September so I doubt anything has changed. |
This is now merged in #43204 |
Thank you @sandersn and @LongTengDao |
Fixes #38980