mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #65515 [matter-js] Fixed/Added ability to pass an array to Composite.remove by @TaylorS15
* Update index.d.ts Added ability to pass Body/Composite/Constraint/MouseConstraint array to Composite.remove. Composite.add has this ability and functions the same in the src (/matter-js/src/body/Composite.js/) Has been tested. * removed type from @param object as requested * Updated JSDoc @param object * Added test for Composite.remove() Testing ability to remove an array of objects. * Update types/matter-js/matter-js-tests.ts Co-authored-by: Steven Snoeijen <stevensnoeijen@gmail.com> * Update index.d.ts * trailing whitespace fix --------- Co-authored-by: Steven Snoeijen <stevensnoeijen@gmail.com>
This commit is contained in:
13
types/matter-js/index.d.ts
vendored
13
types/matter-js/index.d.ts
vendored
@@ -1385,11 +1385,20 @@ declare namespace Matter {
|
||||
* Triggers `beforeRemove` and `afterRemove` events on the `composite`.
|
||||
* @method remove
|
||||
* @param {Composite} composite
|
||||
* @param {any} object
|
||||
* @param {Body | Composite | Constraint | MouseConstraint | Array<Body | Composite | Constraint | MouseConstraint>} object
|
||||
* @param {boolean} [deep=false]
|
||||
* @returns {Composite} The original composite with the objects removed
|
||||
*/
|
||||
static remove(composite: Composite, object: Body | Composite | Constraint, deep?: boolean): Composite;
|
||||
static remove(
|
||||
composite: Composite,
|
||||
object:
|
||||
| Body
|
||||
| Composite
|
||||
| Constraint
|
||||
| MouseConstraint
|
||||
| Array<Body | Composite | Constraint | MouseConstraint>,
|
||||
deep?: boolean,
|
||||
): Composite;
|
||||
|
||||
/**
|
||||
* Translates all children in the composite by a given vector relative to their current positions,
|
||||
|
||||
@@ -193,6 +193,8 @@ Composite.add(composite1, constraint1);
|
||||
Composite.add(composite1, mouseConstraint);
|
||||
// $ExpectType Composite
|
||||
Composite.add(composite3, [box1, composite2, constraint1, mouseConstraint]);
|
||||
// $ExpectType Composite
|
||||
Composite.remove(composite3, [box1, composite2, constraint1, mouseConstraint]);
|
||||
|
||||
// Pairs
|
||||
// $ExpectType Pairs
|
||||
|
||||
Reference in New Issue
Block a user