Skip to content

Use Pick type to define Class prototype.#701

Merged
sindresorhus merged 5 commits intosindresorhus:mainfrom
ajvincent:class-prototype-pick
Nov 13, 2023
Merged

Use Pick type to define Class prototype.#701
sindresorhus merged 5 commits intosindresorhus:mainfrom
ajvincent:class-prototype-pick

Conversation

@ajvincent
Copy link
Copy Markdown
Contributor

Fixes #696 .

@ajvincent
Copy link
Copy Markdown
Contributor Author

@Lodin I could use a little more help. I copied your test for Class (thank you very much for that), using better names, but I couldn't immediately come up with a good abstract class test in this scenario.

@sindresorhus
Copy link
Copy Markdown
Owner

@ajvincent Maybe ChatGPT can help. Can you try out this? https://chat.openai.com/share/232f2043-f201-40c6-8b7a-1fb8b9b96c80

@ajvincent
Copy link
Copy Markdown
Contributor Author

ajvincent commented Nov 11, 2023

@ajvincent Maybe ChatGPT can help. Can you try out this? https://chat.openai.com/share/232f2043-f201-40c6-8b7a-1fb8b9b96c80

No good. The problem is their test also passes under the current AbstractClass type. The same is true for any test case I can imagine.

(Sorry for the lengthy delay. I've been exceedingly busy in the last few weeks.)

@ajvincent
Copy link
Copy Markdown
Contributor Author

@sindresorhus
Copy link
Copy Markdown
Owner

@Emiyaaaaa Any ideas? ⬆️

@Emiyaaaaa
Copy link
Copy Markdown
Collaborator

@Emiyaaaaa Any ideas? ⬆️

Looks like it's been resolved by @ajvincent 👍

@sindresorhus
Copy link
Copy Markdown
Owner

@Emiyaaaaa No. It's still missing a test, as mentioned.

The problem is their test also passes under the current AbstractClass type. The same is true for any test case I can imagine.

⬆️

@Emiyaaaaa
Copy link
Copy Markdown
Collaborator

Obligatory playground link

Resolved here @sindresorhus

@ajvincent
Copy link
Copy Markdown
Contributor Author

ajvincent commented Nov 12, 2023

No, no, no, it had not been resolved. I posted that while I was still wandering around in the weeds.

The solution came to me while I was away from my desk yesterday: only the class needs to be abstract. Not the members. Other than that, it's the same test as Class gets.

In case it's unclear, it's fixed now. :)

@ajvincent
Copy link
Copy Markdown
Contributor Author

Playground Link

If line 33 says false extends true ?, the test fails. If line 33 says true extends true, the test passes. Which is what I was aiming for.

@sindresorhus sindresorhus merged commit 7294cf0 into sindresorhus:main Nov 13, 2023
@ajvincent ajvincent deleted the class-prototype-pick branch November 13, 2023 15:54
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.

[Bug]: Class declaration is broken

3 participants