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

define-properties is not a polyfill for Object.defineProperties #35

Open
ljharb opened this issue Sep 4, 2024 · 3 comments
Open

define-properties is not a polyfill for Object.defineProperties #35

ljharb opened this issue Sep 4, 2024 · 3 comments

Comments

@ljharb
Copy link

ljharb commented Sep 4, 2024

The current error message for this package is flatly incorrect:

error  "define-properties" should be replaced with native functionality. You can instead use Object.defineProperties. Read more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties  depend/ban-dependencies

It's ofc fine if you want to suggest an alternative, but Object.defineProperties isn't it by itself.

@43081j
Copy link
Contributor

43081j commented Sep 7, 2024

can you give us an example of a very common use of define-properties which shows this?

I know they're not directly equivalent but I'd like to see the main usage that shows it, to help people understand (incl me). importantly I'm not asking for the logical differences (we already know those), but the most common real world usage that shows it

it may be we just need to move it to the preferred manifest instead so we can document the usage/suggestions

@ljharb
Copy link
Author

ljharb commented Sep 7, 2024

The main usage is to take an additional mapping object with predicates, so that each property is conditionally defined.

It certainly uses an Object.defineProperty polyfill, and could be made to use the native Object.defineProperty/Object.defineProperties in a fork, but isn’t itself a polyfill.

@43081j
Copy link
Contributor

43081j commented Sep 10, 2024

We probably need to move it to the preferred manifest I think

Then we can document that if you don't need such features, you can use native functionality

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

2 participants