Skip to content

Commit 00e3349

Browse files
🤖 Merge PR DefinitelyTyped#72512 feat(is-equal-shallow): add type support for is-equal-shallow package by @akeldamas
Co-authored-by: Jake Bailey <[email protected]>
1 parent a92820f commit 00e3349

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!**/*.d.ts
3+
!**/*.d.cts
4+
!**/*.d.mts
5+
!**/*.d.*.ts
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Performs a shallow comparison between two objects.
3+
*
4+
* @param a - The first object to compare
5+
* @param b - The second object to compare
6+
* @returns `true` if the objects have identical top-level property values, otherwise `false`
7+
*/
8+
declare function isEqual(a: object, b: object): boolean;
9+
10+
export = isEqual;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import isEqual from "is-equal-shallow";
2+
3+
// $ExpectType boolean
4+
isEqual({ a: 1 }, { a: 1 });
5+
6+
// $ExpectType boolean
7+
isEqual({ a: 1 }, { a: 2 });
8+
9+
// @ts-expect-error
10+
isEqual(1, 1);
11+
12+
// @ts-expect-error
13+
isEqual("test", "test");
14+
15+
// Nested objects (shallow comparison only checks top level)
16+
const obj1 = { a: { b: 1 } };
17+
const obj2 = { a: { b: 1 } };
18+
19+
// $ExpectType boolean
20+
isEqual(obj1, obj2);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"private": true,
3+
"name": "@types/is-equal-shallow",
4+
"version": "0.1.9999",
5+
"projects": [
6+
"https://github.com/jonschlinkert/is-equal-shallow"
7+
],
8+
"devDependencies": {
9+
"@types/is-equal-shallow": "workspace:."
10+
},
11+
"owners": [
12+
{
13+
"name": "Laurens Tobias",
14+
"githubUsername": "akeldamas"
15+
}
16+
]
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"module": "node16",
4+
"lib": [
5+
"es6"
6+
],
7+
"noImplicitAny": true,
8+
"noImplicitThis": true,
9+
"strictFunctionTypes": true,
10+
"strictNullChecks": true,
11+
"types": [],
12+
"noEmit": true,
13+
"forceConsistentCasingInFileNames": true
14+
},
15+
"files": [
16+
"index.d.ts",
17+
"is-equal-shallow-tests.ts"
18+
]
19+
}

0 commit comments

Comments
 (0)