
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ts-class-initializable
Advanced tools
TypeScript abstract class enabling instance initialization from a plain object
A small helper for TypeScript classes to enable instance properties to be initialized by passing a plain object to the constructor - without every class needing boilerplate code to handle this.
Extend one of the Initializable classes and your class constructor will accept a
plain object literal as its first argument, and assign the values to instance properties.
npm i ts-class-initializable
import { Initializable } from 'ts-class-initializable';
class Foo extends Initializable<Foo> {
public bar: string;
public baz: number;
public optional?: boolean;
}
const instance: Foo = new Foo({
bar: 'foobar',
baz: 2,
});
console.log(instance.bar); // 'foobar'
There are a few flavours:
Initializable: the constructor requires a plain object to initialize the instancePartiallyInitializable: the constructor requires a plain object to initialize the instance,
but all properties are treated as optionalOptionallyInitializable: the constructor may accept a plain object to initialize the instance,
or you can do new Foo() without initializationOptionallyPartiallyInitializable: the constructor may accept a plain object to initialize the instance,
and all properties are treated as optionalFAQs
TypeScript abstract class enabling instance initialization from a plain object
The npm package ts-class-initializable receives a total of 7,620 weekly downloads. As such, ts-class-initializable popularity was classified as popular.
We found that ts-class-initializable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.