Skip to content
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

Passing Temporal object to with() should cause compile-time error #206

Open
ptomato opened this issue Jan 2, 2023 · 0 comments
Open

Passing Temporal object to with() should cause compile-time error #206

ptomato opened this issue Jan 2, 2023 · 0 comments

Comments

@ptomato
Copy link
Contributor

ptomato commented Jan 2, 2023

Moved from tc39/proposal-temporal#1214

e.g.

const now = Temporal.Now.plainDateTimeISO();
const time = Temporal.PlainTime.from('09:10');
now.with(time);

The above code throws a TypeError at runtime because Temporal objects should not be passed to with(). In this case, withPlainTime() should be used instead.

It would be better if the TypeScript binding disallowed this at compile-time, as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant