Added test suite
All checks were successful
Build / Build NPM Project (push) Successful in 1m16s
Build / Tag Version (push) Successful in 14s
Build / Publish Documentation (push) Successful in 53s

This commit is contained in:
2025-05-14 16:30:42 -04:00
parent cf122ef9e8
commit fec373ca4c
32 changed files with 1719 additions and 310 deletions

18
tests/type.spec.ts Normal file
View File

@ -0,0 +1,18 @@
import {Writable} from '../src';
describe('Type Utilities', () => {
describe('Writable', () => {
it('should create a writable version of a readonly type', () => {
type ReadonlyPerson = {
readonly name: string;
readonly age: number;
};
type WritablePerson = Writable<ReadonlyPerson>;
// Typescript: WritablePerson's properties should not be readonly
const person: WritablePerson = { name: 'Alice', age: 40 };
person.name = 'Bob'; // Should not error in TypeScript
person.age = 41; // Should not error in TypeScript
expect(person).toEqual({ name: 'Bob', age: 41 });
});
});
});