Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix .AddObject type definition #34

Merged
merged 11 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions janitor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Unreleased Changes

### 1.17.0-ts.1
- Fix `.AddObject` type definition

### 1.17.0-ts.0

- Updated to upstream [`1.17.0`](https://github.com/howmanysmall/Janitor/releases/tag/v1.17.0) Janitor source
Expand Down
12 changes: 6 additions & 6 deletions janitor/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Constructable<T, Args extends Array<unknown>> = new (...args: Args) => T;
type Constructable<T> = new (...args: Parameters<T>) => T;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* A class to manage the connections in your game
Expand Down Expand Up @@ -67,11 +67,11 @@ export class Janitor<U extends object | void = void> {
* @returns The new constructed object from the passed `object` class.
*/
public AddObject<
O extends Constructable<unknown, Array<unknown>>,
M extends undefined | ((this: O) => void) | ((_: O) => void) | ExtractKeys<O, () => void> | true,
I extends keyof U | undefined = undefined,
Args extends Array<unknown> = [],
>(object: Constructable<O, Args>, methodName?: M, index?: I, ...args: Args): O;
O extends Constructable<unknown>,
T extends InstanceType<O>,
M extends undefined | ExtractKeys<T, () => void> | true,
I extends keyof U | undefined = undefined,
>(object: O, methodName?: M, index?: I, ...args: ConstructorParameters<O>): T;

/**
* Cleans up whatever `object` was set to this namespace by the 3rd parameter of `.Add()`.
Expand Down
16 changes: 9 additions & 7 deletions janitor/package-lock.json

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

5 changes: 1 addition & 4 deletions janitor/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"name": "@rbxts/janitor",
"version": "1.17.0-ts.0",
"version": "1.17.0-ts.1",
"description": "A port of howmanysmall's janitor module.",
"main": "src/init.lua",
"types": "index.d.ts",
"files": [
"index.d.ts",
"src/"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/OverHash/Roblox-TS-Libraries/tree/master/janitor"
Expand Down