better-object-constructor
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

BetterObjectConstructor

npm GitHub closed pull requests npm (tag) npm bundle size GitHub


How to use?

import type { BetterObjectConstructor } from 'better-object-constructor';

declare const Object: BetterObjectConstructor;

What will change?

For example:

const hoge: { a: string } = {
  a: 'fugafuga'
};

const hoge2 = Object.fromEntries(Object.entries(hoge));

Placed in this code, hoge and hoge2 should truly have the same type.

But let's look at it in the editor. (Below is a sample in VSCode…)

image

Oh! We lost the type!
But don't worry, if you add the code shown in the "How to use?" section...?


image

Welcome back, my lovely type definition.
...That's the kind of package.


Author

Follow @_AsPulse_


License

BetterObjectConstructor is licensed under MIT.
Please see LICENSE for more info.

Readme

Keywords

Package Sidebar

Install

npm i better-object-constructor

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

3.42 kB

Total Files

4

Last publish

Collaborators

  • aspulse