Skip to content

Commit

Permalink
args types fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wentout committed Nov 10, 2023
1 parent 466c67f commit a677835
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type IDEF<T> = {
new (...args: unknown[]): T;
new (): T;
} | {
(this: T, ...args: unknown[]): void;
(this: T, ...args: any[]): void;
};
export interface ConstructorFunction<ConstructorInstance extends object> {
new (...args: unknown[]): ConstructorInstance;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mnemonica",
"version": "0.9.974",
"version": "0.9.975",
"description": "abstract technique that aids information retention : instance inheritance system",
"type": "commonjs",
"main": "./build/index.js",
Expand Down
4 changes: 3 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

// type RN = Record<string|symbol, unknown>

// type narrowable = string | number | boolean | symbol | object | undefined | void | null | [];
// export type IDEF<T extends RN> = { new(): T } | { (this: T): void };
export type IDEF<T> = { new(...args: unknown[]): T } | { (this: T, ...args: unknown[]): void };
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type IDEF<T> = { new(): T } | { (this: T, ...args: any[]): void };

export interface ConstructorFunction<ConstructorInstance extends object> {
new( ...args: unknown[] ): ConstructorInstance;
Expand Down
6 changes: 3 additions & 3 deletions test-ts/test-no-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { define, apply, bind, call } from '..';

const SomeType = define( 'SomeType', function (this: {
one: string,
check: 321,
check: number,
q: number
}, gather: string ) {
}, gather: string, check: number ) {
this.one = gather;
this.check = 321;
this.check = check;
this.q = 123;
}, {
l : 12345
Expand Down

0 comments on commit a677835

Please sign in to comment.