Skip to content

Commit

Permalink
chore: cleaup source types file
Browse files Browse the repository at this point in the history
  • Loading branch information
ashgw committed May 4, 2024
1 parent 462eced commit a5cb94b
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,6 @@ export const Final = <CST extends Newable>(cst: CST): CST => {

return F as CST;
};
/**
TODO: figure it out, maybe use the new stage 3 decorators
see [this](https://github.com/microsoft/TypeScript/pull/50820)
*/
/* eslint-disable @typescript-eslint/no-unused-vars */
const finalMethod = (
target: object,
propertyKey: MaybeUndefined<string | symbol>,
descriptor: PropertyDescriptor
): PropertyDescriptor => {
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const originalMethod = descriptor.value;

descriptor.value = function (...args: any[]) {
if (new.target !== target.constructor) {
throw new TypeError(
`Cannot override final method '${String(propertyKey)}' in class '${
target.constructor.name
}'`
);
}

/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
return originalMethod.apply(this, ...args);
};

return descriptor;
};

const _freeze = (obj: object) => {
Object.freeze(obj);
Expand Down

0 comments on commit a5cb94b

Please sign in to comment.