Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Modify some type definitions of Object in TypeScript.

License

Notifications You must be signed in to change notification settings

AsPulse/BetterObjectConstructor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

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.

About

Modify some type definitions of Object in TypeScript.

Resources

License

Stars

Watchers

Forks

Sponsor this project

AltStyle によって変換されたページ (->オリジナル) /