@jeemyeong/dataclass
v1.1.1
Published
`dataclass` is like a data class from kotlin
Downloads
11
Readme
dataclass
dataclass
is like a data class from kotlin
Features
- Written in TypeScript.
Installation
$ npm i @jeemyeong/dataclass
Usage
class Person {
name!: string;
language: string | null = null;
public constructor(initializer: Initializer<Person>) {
Object.assign(this, initializer);
}
}
const p1 = new Person({
name: "Leo"
}); // OK
const p2 = new Person({
name: "Leo",
language: "Korean",
}); // OK
const p3 = new Person({
name: "Leo",
age: 30 // error
});