1.0.8 • Published 3 years ago

tspartials v1.0.8

Weekly downloads
391
License
MIT
Repository
github
Last release
3 years ago

Inspired from C# partial classes for typescript, Simplified 🎀 syntax that may help divide functionality of a single class into multiple 🍬🍬🍬 class files

Install

Install dependencies with npm:

npm i partials

Import

import partial from 'partials';

Add your partial classes 🍬🍬🍬

@partial export class Employee {
    @partial work: EmployeeWork;
    @partial lunch: EmployeeLunch;
    start() {
        this.work.doWork();
        this.lunch.goToLunch();
    }
}
@partial export class EmployeeWork {
    @partial model: EmployeeModel;
    doWork() {
        console.log(`doWork()`);
    }
}
@partial export class EmployeeLunch {
  
    @partial model: EmployeeModel;
    goToLunch() {
        console.log(`goToLunch()`);
    }
}

Use your class

new Employee().start()
// Ouputs:
// goToWork()
// goToLunch()
1.0.2

3 years ago

1.0.1

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago