Skip to content

Conversation

@runjak
Copy link

@runjak runjak commented May 27, 2025

Hi 👋

I hope this is an ok suggestion to make - I know it's several things at once. Let me attempt to explain:

I started out coming from tajo/ladle#616 , where I observed impractical behaviour regarding instanceof in a copy of code from this project.

This led me to attempt bringing the changed Symbol.hasInstance method here, too.

It seems that the line MockDate.prototype = RealDate.prototype; does not work in current node and that it wasn't included in the copy of it that ladle has.

A possible alternative that I'd suggest would be this method:

static [Symbol.hasInstance](instance: unknown): boolean {
  return instance instanceof RealDate;
 }

Next thing I noted was that for Symbol to be present it's required to update to ES6 - so I'm suggesting that, too.

I then noticed that several dependencies were rather old. So I'm suggesting to update them, too.
In particular - since node has it's own test runner and can execute typescript these days I'm suggesting to directly test with node here and ditch several dependencies alongside.

I'm also suggesting to switch to a newer version of the rollup typescript plugin because the previous one hasn't been updated in quite some time.

Afterwards I noted some variations in formatting, and so was under the impression that it could be helpful to introduce some preconfigured linting - that's what the later commits do.

Would love to hear your input on this.

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

Successfully merging this pull request may close these issues.

1 participant