Skip to content

Commit

Permalink
...args typings
Browse files Browse the repository at this point in the history
  • Loading branch information
wentout committed Nov 10, 2023
1 parent 8ee0751 commit 0d72cf1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type hook = {
type Proto<P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
type SN = Record<string, new () => unknown>;
interface IDefinitorInstance<N extends object, S> {
new (): {
new (...arg: unknown[]): {
[key in keyof S]: S[key];
};
define: IDefinitor<N, string>;
Expand Down
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 (): T;
new (...args: unknown[]): T;
} | {
(this: T): void;
(this: T, ...args: unknown[]): 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.973",
"version": "0.9.974",
"description": "abstract technique that aids information retention : instance inheritance system",
"type": "commonjs",
"main": "./build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Proto <P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
type SN = Record<string, new() => unknown>

interface IDefinitorInstance<N extends object, S> {
new(): {
new(...arg: unknown[]): {
[key in keyof S]: S[key]
}
define: IDefinitor<N, string>
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// type RN = Record<string|symbol, unknown>

// export type IDEF<T extends RN> = { new(): T } | { (this: T): void };
export type IDEF<T> = { new(): T } | { (this: T): void };
export type IDEF<T> = { new(...args: unknown[]): T } | { (this: T, ...args: unknown[]): 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 @@ -6,8 +6,8 @@ const SomeType = define( 'SomeType', function (this: {
one: string,
check: 321,
q: number
}) {
this.one = 'SomeType';
}, gather: string ) {
this.one = gather;
this.check = 321;
this.q = 123;
}, {
Expand All @@ -28,7 +28,7 @@ const SomeSubType = SomeType.define( 'SomeSubType', function ( this: {
k : 123
});

const first = new SomeType();
const first = new SomeType('SomeArg');
SomeSubType.registerHook('preCreation', () => { console.log('SomeSubType'); });

const x = first.one;
Expand Down

0 comments on commit 0d72cf1

Please sign in to comment.